From 11f65ca11be9ba772881600fb807cc902b16cfe2 Mon Sep 17 00:00:00 2001 From: StefanIliev545 Date: Mon, 20 May 2024 09:52:12 +0300 Subject: [PATCH] Addressed small PR comments. --- go/common/crosschain.go | 12 ++++++------ go/enclave/nodetype/sequencer.go | 8 ++++---- go/host/enclave/guardian.go | 2 +- go/host/l1/publisher.go | 5 ++--- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/go/common/crosschain.go b/go/common/crosschain.go index 49c31acb64..3c39f078d0 100644 --- a/go/common/crosschain.go +++ b/go/common/crosschain.go @@ -10,11 +10,11 @@ import ( ) type ExtCrossChainBundle struct { - LastBatchHash gethcommon.Hash - Signature []byte - L1BlockHash gethcommon.Hash // The block hash that's expected to be canonical on signature submission - L1BlockNum *big.Int // The number of the block that has the block hash. This is used to verify the block hash. - CrossChainHashes [][]byte // + LastBatchHash gethcommon.Hash + Signature []byte + L1BlockHash gethcommon.Hash // The block hash that's expected to be canonical on signature submission + L1BlockNum *big.Int // The number of the block that has the block hash. This is used to verify the block hash. + CrossChainRootHashes [][]byte // The CrossChainRoots of the batches that are being submitted } func (bundle ExtCrossChainBundle) HashPacked() common.Hash { @@ -37,7 +37,7 @@ func (bundle ExtCrossChainBundle) HashPacked() common.Hash { }, } - bytes, err := args.Pack(bundle.LastBatchHash, bundle.L1BlockHash, bundle.L1BlockNum, bundle.CrossChainHashes) + bytes, err := args.Pack(bundle.LastBatchHash, bundle.L1BlockHash, bundle.L1BlockNum, bundle.CrossChainRootHashes) if err != nil { panic(err) } diff --git a/go/enclave/nodetype/sequencer.go b/go/enclave/nodetype/sequencer.go index dc2cc8420c..1ce0f4a5d4 100644 --- a/go/enclave/nodetype/sequencer.go +++ b/go/enclave/nodetype/sequencer.go @@ -503,10 +503,10 @@ func (s *sequencer) ExportCrossChainData(ctx context.Context, fromSeqNo uint64, } bundle := &common.ExtCrossChainBundle{ - LastBatchHash: batchHash, // unused for now. - L1BlockHash: block.Hash(), - L1BlockNum: big.NewInt(0).Set(block.Header().Number), - CrossChainHashes: crossChainHashes, + LastBatchHash: batchHash, // unused for now. + L1BlockHash: block.Hash(), + L1BlockNum: big.NewInt(0).Set(block.Header().Number), + CrossChainRootHashes: crossChainHashes, } //todo: check fromSeqNo err = s.signCrossChainBundle(bundle) diff --git a/go/host/enclave/guardian.go b/go/host/enclave/guardian.go index e1f169af1c..ed7851c9e5 100644 --- a/go/host/enclave/guardian.go +++ b/go/host/enclave/guardian.go @@ -650,7 +650,7 @@ func (g *Guardian) periodicBundleSubmission() { continue } - if len(bundle.CrossChainHashes) == 0 { + if len(bundle.CrossChainRootHashes) == 0 { g.logger.Debug("No cross chain data to submit. Skipping.") continue } diff --git a/go/host/l1/publisher.go b/go/host/l1/publisher.go index 9d94e833b9..2d853f66d6 100644 --- a/go/host/l1/publisher.go +++ b/go/host/l1/publisher.go @@ -286,7 +286,7 @@ func (p *Publisher) PublishCrossChainBundle(bundle *common.ExtCrossChainBundle) return nil } - if len(bundle.CrossChainHashes) == 0 { + if len(bundle.CrossChainRootHashes) == 0 { return fmt.Errorf("nothing to publish in cross chain bundle") } @@ -308,10 +308,9 @@ func (p *Publisher) PublishCrossChainBundle(bundle *common.ExtCrossChainBundle) return fmt.Errorf("unable to get nonce for management contract. Cause: %w", err) } - // transactor.GasLimit = 200_000 transactor.Nonce = big.NewInt(0).SetUint64(nonce) - tx, err := managementCtr.AddCrossChainMessagesRoot(transactor, [32]byte(bundle.LastBatchHash.Bytes()), bundle.L1BlockHash, bundle.L1BlockNum, bundle.CrossChainHashes, bundle.Signature) + tx, err := managementCtr.AddCrossChainMessagesRoot(transactor, [32]byte(bundle.LastBatchHash.Bytes()), bundle.L1BlockHash, bundle.L1BlockNum, bundle.CrossChainRootHashes, bundle.Signature) if err != nil { if !errors.Is(err, errutil.ErrCrossChainBundleRepublished) { p.logger.Error("Error with submitting cross chain bundle transaction.", log.ErrKey, err, log.BundleHashKey, bundle.LastBatchHash)