Skip to content

Commit

Permalink
Addressed small PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanIliev545 committed May 20, 2024
1 parent f1a9c31 commit 11f65ca
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
12 changes: 6 additions & 6 deletions go/common/crosschain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand Down
8 changes: 4 additions & 4 deletions go/enclave/nodetype/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion go/host/enclave/guardian.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
5 changes: 2 additions & 3 deletions go/host/l1/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand All @@ -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)
Expand Down

0 comments on commit 11f65ca

Please sign in to comment.