diff --git a/Makefile b/Makefile index 92026b225..4f6558b2d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ################## update dependencies #################### -ETHEREUM_TARGET_VERSION := v1.10.14-0.20241105040223-5c7f1bb7073e +ETHEREUM_TARGET_VERSION := v1.10.14-0.20241127093812-67d4a670e1a1 TENDERMINT_TARGET_VERSION := v0.3.1 ETHEREUM_MODULE_NAME := github.com/morph-l2/go-ethereum diff --git a/bindings/go.mod b/bindings/go.mod index 27f5875bd..c6f752e19 100644 --- a/bindings/go.mod +++ b/bindings/go.mod @@ -4,7 +4,7 @@ go 1.22 replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.1 -require github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e +require github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 require ( github.com/VictoriaMetrics/fastcache v1.12.2 // indirect diff --git a/bindings/go.sum b/bindings/go.sum index 6c525f26a..12655cc81 100644 --- a/bindings/go.sum +++ b/bindings/go.sum @@ -109,8 +109,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e h1:pV7z8mnNQr+JJO2CGUzwAlzjrPnZ0YlO92izBaq00Zs= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 h1:2NHhXzEO2TQ9Rq0XRNxb+VnJpkQwHED9VNilOqWcV5M= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= diff --git a/contracts/go.mod b/contracts/go.mod index 783504b76..9be128102 100644 --- a/contracts/go.mod +++ b/contracts/go.mod @@ -6,7 +6,7 @@ replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3. require ( github.com/iden3/go-iden3-crypto v0.0.16 - github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e + github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 github.com/stretchr/testify v1.9.0 ) diff --git a/contracts/go.sum b/contracts/go.sum index 71bfe5ece..0d00468a9 100644 --- a/contracts/go.sum +++ b/contracts/go.sum @@ -25,8 +25,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e h1:pV7z8mnNQr+JJO2CGUzwAlzjrPnZ0YlO92izBaq00Zs= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 h1:2NHhXzEO2TQ9Rq0XRNxb+VnJpkQwHED9VNilOqWcV5M= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= diff --git a/node/core/batch.go b/node/core/batch.go index 2ecb561ba..ce169d4e8 100644 --- a/node/core/batch.go +++ b/node/core/batch.go @@ -3,13 +3,11 @@ package node import ( "bytes" "context" - "errors" "fmt" "math/big" "morph-l2/node/types" - "github.com/morph-l2/go-ethereum/accounts/abi/bind" "github.com/morph-l2/go-ethereum/common" eth "github.com/morph-l2/go-ethereum/core/types" "github.com/morph-l2/go-ethereum/crypto" @@ -128,7 +126,7 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre if err != nil { return false, err } - l1TxNum := int(totalL1MessagePopped - totalL1MessagePoppedBefore) // include skipped L1 messages + l1TxNum := int(totalL1MessagePopped - totalL1MessagePoppedBefore) e.logger.Info("fetched block", "block height", wBlock.Number, "involved transaction count", len(transactions[i]), "l2 tx num", l2TxNum, "l1 tx num", l1TxNum) blockContext := wBlock.BlockContextBytes(l2TxNum+l1TxNum, l1TxNum) e.batchingCache.batchData.Append(blockContext, txsPayload, l1TxHashes) @@ -137,7 +135,7 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre } // make sure passed block is the next block of the last packed block - curHeight, err := heightFromBCBytes(currentBlockBytes) + curHeight, err := types.HeightFromBCBytes(currentBlockBytes) if err != nil { return false, err } @@ -158,10 +156,11 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre e.metrics.BatchIndex.Set(float64(e.batchingCache.parentBatchHeader.BatchIndex)) } - height, err := heightFromBCBytes(currentBlockBytes) + block, err := types.WrappedBlockFromBytes(currentBlockBytes) if err != nil { return false, err } + height := block.Number if height <= e.batchingCache.lastPackedBlockHeight { return false, fmt.Errorf("wrong propose height passed. lastPackedBlockHeight: %d, passed height: %d", e.batchingCache.lastPackedBlockHeight, height) } else if height > e.batchingCache.lastPackedBlockHeight+1 { // skipped some blocks, cache is dirty. need rebuild the cache @@ -176,163 +175,13 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre return false, err } - exceeded, err := e.batchingCache.batchData.EstimateCompressedSizeWithNewPayload(e.batchingCache.currentTxsPayload) - - return exceeded, err -} - -// SealBatch seals the accumulated blocks into a batch -// It should be called after CalculateBatchSizeWithProposalBlock which ensure the accumulated blocks is correct. -func (e *Executor) SealBatch() ([]byte, []byte, error) { - if e.batchingCache.IsEmpty() { - return nil, nil, errors.New("failed to seal batch. No data found in batch cache") - } - - sidecar, err := types.EncodeTxsPayloadToBlob(e.batchingCache.batchData.TxsPayload()) - if err != nil { - return nil, nil, err - } - blobHashes := []common.Hash{types.EmptyVersionedHash} - if sidecar != nil && len(sidecar.Blobs) > 0 { - blobHashes = sidecar.BlobHashes() - } - - sequencerSetVerifyHash, err := e.sequencerCaller.SequencerSetVerifyHash(nil) - if err != nil { - return nil, nil, fmt.Errorf("failed to get sequencerSetVerifyHash, err: %w", err) - } - - block, err := wrappedBlockFromBytes(e.batchingCache.currentBlockBytes) - if err != nil { - return nil, nil, err - } - l1MessagePopped := e.batchingCache.totalL1MessagePopped - e.batchingCache.parentBatchHeader.TotalL1MessagePopped - var skippedL1MessageBitmap []byte - if block.Timestamp < e.UpgradeBatchTime { - e.logger.Info("waiting upgrade batch time", "upgradeBatchTime", e.UpgradeBatchTime, "current block time", block.Timestamp, "remaining seconds", e.UpgradeBatchTime-block.Timestamp) - if l1MessagePopped > 0 { // 32 zero bytes when before upgrading and has L1 message in batch - skippedL1MessageBitmap = make([]byte, 32) - } - } - - batchHeader := types.BatchHeader{ - Version: 0, - BatchIndex: e.batchingCache.parentBatchHeader.BatchIndex + 1, - L1MessagePopped: l1MessagePopped, - TotalL1MessagePopped: e.batchingCache.totalL1MessagePopped, - DataHash: e.batchingCache.batchData.DataHash(), - BlobVersionedHash: blobHashes[0], // currently we only have one blob - PrevStateRoot: e.batchingCache.prevStateRoot, - PostStateRoot: e.batchingCache.postStateRoot, - WithdrawalRoot: e.batchingCache.withdrawRoot, - SequencerSetVerifyHash: sequencerSetVerifyHash, - ParentBatchHash: e.batchingCache.parentBatchHeader.Hash(), - SkippedL1MessageBitmap: skippedL1MessageBitmap, + var exceeded bool + if e.isBatchUpgraded(block.Timestamp) { + exceeded, err = e.batchingCache.batchData.WillExceedCompressedSizeLimit(e.batchingCache.currentBlockContext, e.batchingCache.currentTxsPayload) + } else { + exceeded, err = e.batchingCache.batchData.EstimateCompressedSizeWithNewPayload(e.batchingCache.currentTxsPayload) } - e.batchingCache.sealedBatchHeader = &batchHeader - e.batchingCache.sealedSidecar = sidecar - batchHash := e.batchingCache.sealedBatchHeader.Hash() - e.logger.Info("Sealed batch header", "batchHash", batchHash.Hex()) - e.logger.Info(fmt.Sprintf("===batchIndex: %d \n===L1MessagePopped: %d \n===TotalL1MessagePopped: %d \n===dataHash: %x \n===blockNum: %d \n===SkippedL1MessageBitmap: %s \n===ParentBatchHash: %x \n", - batchHeader.BatchIndex, - batchHeader.L1MessagePopped, - batchHeader.TotalL1MessagePopped, - batchHeader.DataHash, - e.batchingCache.batchData.BlockNum(), - batchHeader.SkippedL1MessageBitmap, - batchHeader.ParentBatchHash)) - blockContexts, _ := e.batchingCache.batchData.Encode() - e.logger.Info(fmt.Sprintf("===blockContexts: %x \n", blockContexts)) - - return batchHash[:], e.batchingCache.sealedBatchHeader.Encode(), nil -} - -// CommitBatch commit the sealed batch. It does nothing if no batch header is sealed. -// It is supposed to be called when the current block is confirmed. -func (e *Executor) CommitBatch(currentBlockBytes []byte, currentTxs tmtypes.Txs, blsDatas []l2node.BlsData) error { - if e.batchingCache.IsEmpty() || e.batchingCache.sealedBatchHeader == nil { // nothing to commit - return nil - } - - // reconstruct current block context - // it is possible that the confirmed current block is different from the existing cached current block context - if !bytes.Equal(currentBlockBytes, e.batchingCache.currentBlockBytes) || - !bytes.Equal(currentTxs.Hash(), e.batchingCache.currentTxsHash) { - e.logger.Info("current block is changed, reconstructing current context...") - if err := e.setCurrentBlock(currentBlockBytes, currentTxs); err != nil { - return err - } - } - - blockContexts, err := e.batchingCache.batchData.Encode() - if err != nil { - return err - } - - curHeight, err := heightFromBCBytes(e.batchingCache.currentBlockBytes) - if err != nil { - return err - } - - var batchSigs []eth.BatchSignature - if !e.devSequencer { - batchSigs, err = e.ConvertBlsDatas(blsDatas) - if err != nil { - return err - } - } - - currentIndex := e.batchingCache.parentBatchHeader.BatchIndex + 1 - - // The batch needs the sequencer set info at the end height of the batch, which is equal to current height - 1. - callOpts := &bind.CallOpts{ - BlockNumber: big.NewInt(int64(curHeight - 1)), - } - sequencerSetBytes, err := e.sequencerCaller.GetSequencerSetBytes(callOpts) - if err != nil { - e.logger.Error("failed to GetSequencerSetBytes", "query at height of", curHeight-1, "error", err) - return err - } - - if err = e.l2Client.CommitBatch(context.Background(), ð.RollupBatch{ - Version: 0, - Index: currentIndex, - Hash: e.batchingCache.sealedBatchHeader.Hash(), - ParentBatchHeader: e.batchingCache.parentBatchHeader.Encode(), - CurrentSequencerSetBytes: sequencerSetBytes, - BlockContexts: blockContexts, - SkippedL1MessageBitmap: e.batchingCache.sealedBatchHeader.SkippedL1MessageBitmap, - PrevStateRoot: e.batchingCache.prevStateRoot, - PostStateRoot: e.batchingCache.postStateRoot, - WithdrawRoot: e.batchingCache.withdrawRoot, - Sidecar: e.batchingCache.sealedSidecar, - }, batchSigs); err != nil { - return err - } - - // update newest batch index - e.metrics.BatchIndex.Set(float64(currentIndex)) - - // commit sealed batch header; move current block into the next batch - e.batchingCache.parentBatchHeader = e.batchingCache.sealedBatchHeader - e.batchingCache.prevStateRoot = e.batchingCache.postStateRoot - e.batchingCache.sealedBatchHeader = nil - e.batchingCache.sealedSidecar = nil - - _, _, totalL1MessagePopped, _, err := ParsingTxs(e.batchingCache.currentTxs, e.batchingCache.totalL1MessagePopped) - if err != nil { - return err - } - e.batchingCache.totalL1MessagePopped = totalL1MessagePopped - e.batchingCache.postStateRoot = e.batchingCache.currentStateRoot - e.batchingCache.withdrawRoot = e.batchingCache.currentWithdrawRoot - e.batchingCache.lastPackedBlockHeight = curHeight - e.batchingCache.batchData = types.NewBatchData() - e.batchingCache.batchData.Append(e.batchingCache.currentBlockContext, e.batchingCache.currentTxsPayload, e.batchingCache.currentL1TxsHashes) - e.batchingCache.ClearCurrent() - - e.logger.Info("Committed batch", "batchIndex", currentIndex) - return nil + return exceeded, err } func (e *Executor) AppendBlsData(height int64, batchHash []byte, data l2node.BlsData) error { @@ -366,7 +215,7 @@ func (e *Executor) PackCurrentBlock(currentBlockBytes []byte, currentTxs tmtypes } } - curHeight, err := heightFromBCBytes(currentBlockBytes) + curHeight, err := types.HeightFromBCBytes(currentBlockBytes) if err != nil { return err } @@ -495,18 +344,6 @@ func (e *Executor) ConvertBlsData(blsData l2node.BlsData) (*eth.BatchSignature, return &bs, nil } -func wrappedBlockFromBytes(blockBytes []byte) (*types.WrappedBlock, error) { - var curBlock = new(types.WrappedBlock) - if err := curBlock.UnmarshalBinary(blockBytes); err != nil { - return nil, err - } - return curBlock, nil -} - -func heightFromBCBytes(blockBytes []byte) (uint64, error) { - curBlock, err := wrappedBlockFromBytes(blockBytes) - if err != nil { - return 0, err - } - return curBlock.Number, nil +func (e *Executor) isBatchUpgraded(blockTime uint64) bool { + return blockTime >= e.UpgradeBatchTime } diff --git a/node/core/batch_commit.go b/node/core/batch_commit.go new file mode 100644 index 000000000..34fcad866 --- /dev/null +++ b/node/core/batch_commit.go @@ -0,0 +1,105 @@ +package node + +import ( + "bytes" + "context" + "fmt" + "math/big" + "morph-l2/node/types" + + "github.com/morph-l2/go-ethereum/accounts/abi/bind" + eth "github.com/morph-l2/go-ethereum/core/types" + "github.com/tendermint/tendermint/l2node" + tmtypes "github.com/tendermint/tendermint/types" +) + +// CommitBatch commits the sealed batch. It does nothing if no batch header is sealed. +// It should be called when the current block is confirmed. +func (e *Executor) CommitBatch(currentBlockBytes []byte, currentTxs tmtypes.Txs, blsDatas []l2node.BlsData) error { + // If no batch data is available, do nothing + if e.batchingCache.IsEmpty() || e.batchingCache.sealedBatchHeader == nil { + return nil + } + + // Reconstruct current block context if needed + if !bytes.Equal(currentBlockBytes, e.batchingCache.currentBlockBytes) || !bytes.Equal(currentTxs.Hash(), e.batchingCache.currentTxsHash) { + e.logger.Info("Current block has changed. Reconstructing current context...") + if err := e.setCurrentBlock(currentBlockBytes, currentTxs); err != nil { + return fmt.Errorf("failed to set current block: %w", err) + } + } + + // Get current block height + curHeight, err := types.HeightFromBCBytes(e.batchingCache.currentBlockBytes) + if err != nil { + return fmt.Errorf("failed to parse current block height: %w", err) + } + + // Convert BlsData to batch signatures (if applicable) + var batchSigs []eth.BatchSignature + if !e.devSequencer { + batchSigs, err = e.ConvertBlsDatas(blsDatas) + if err != nil { + return fmt.Errorf("failed to convert BLS data: %w", err) + } + } + + // Get the sequencer set at current height - 1 + callOpts := &bind.CallOpts{BlockNumber: big.NewInt(int64(curHeight - 1))} + sequencerSetBytes, err := e.sequencerCaller.GetSequencerSetBytes(callOpts) + if err != nil { + e.logger.Error("Failed to GetSequencerSetBytes", "blockHeight", curHeight-1, "error", err) + return fmt.Errorf("failed to get sequencer set bytes: %w", err) + } + + // Encode batch data and commit batch to L2 client + blockContexts, err := e.batchingCache.batchData.Encode() + if err != nil { + return fmt.Errorf("failed to encode block contexts: %w", err) + } + + // Construct the batch and commit it + if err = e.l2Client.CommitBatch(context.Background(), ð.RollupBatch{ + Version: 0, + Index: e.batchingCache.parentBatchHeader.BatchIndex + 1, + Hash: e.batchingCache.sealedBatchHeader.Hash(), + ParentBatchHeader: e.batchingCache.parentBatchHeader.Encode(), + CurrentSequencerSetBytes: sequencerSetBytes, + BlockContexts: blockContexts, + PrevStateRoot: e.batchingCache.prevStateRoot, + PostStateRoot: e.batchingCache.postStateRoot, + WithdrawRoot: e.batchingCache.withdrawRoot, + Sidecar: e.batchingCache.sealedSidecar, + LastBlockNumber: e.batchingCache.lastPackedBlockHeight, + NumL1Messages: uint16(e.batchingCache.sealedBatchHeader.L1MessagePopped), + }, batchSigs); err != nil { + return fmt.Errorf("failed to commit batch to L2 client: %w", err) + } + + // Update batch index metric + e.metrics.BatchIndex.Set(float64(e.batchingCache.parentBatchHeader.BatchIndex + 1)) + + // Commit the batch and reset the cache for the next batch + e.commitSealedBatch(curHeight) + + e.logger.Info("Committed batch", "batchIndex", e.batchingCache.parentBatchHeader.BatchIndex+1) + return nil +} + +// commitSealedBatch commits the sealed batch and resets cache for the next batch. +func (e *Executor) commitSealedBatch(curHeight uint64) { + e.batchingCache.parentBatchHeader = e.batchingCache.sealedBatchHeader + e.batchingCache.prevStateRoot = e.batchingCache.postStateRoot + e.batchingCache.sealedBatchHeader = nil + e.batchingCache.sealedSidecar = nil + + e.batchingCache.totalL1MessagePopped = e.batchingCache.totalL1MessagePoppedAfterCurBlock + e.batchingCache.postStateRoot = e.batchingCache.currentStateRoot + e.batchingCache.withdrawRoot = e.batchingCache.currentWithdrawRoot + e.batchingCache.lastPackedBlockHeight = curHeight + + // Reset batch data and current context + e.batchingCache.batchData = types.NewBatchData() + e.batchingCache.batchData.Append(e.batchingCache.currentBlockContext, e.batchingCache.currentTxsPayload, e.batchingCache.currentL1TxsHashes) + e.batchingCache.ClearCurrent() +} diff --git a/node/core/batch_seal.go b/node/core/batch_seal.go new file mode 100644 index 000000000..39234100b --- /dev/null +++ b/node/core/batch_seal.go @@ -0,0 +1,132 @@ +package node + +import ( + "errors" + "fmt" + + "morph-l2/node/types" + + "github.com/morph-l2/go-ethereum/common" + eth "github.com/morph-l2/go-ethereum/core/types" +) + +// SealBatch seals the accumulated blocks into a batch. +// It ensures proper compression and data preparation based on the batch version. +// It should be called after CalculateBatchSizeWithProposalBlock which ensure the accumulated blocks is correct. +func (e *Executor) SealBatch() ([]byte, []byte, error) { + // Ensure the batching cache is not empty + if e.batchingCache.IsEmpty() { + return nil, nil, errors.New("failed to seal batch: batch cache is empty") + } + + // Parse the current block from the cache + block, err := types.WrappedBlockFromBytes(e.batchingCache.currentBlockBytes) + if err != nil { + return nil, nil, fmt.Errorf("failed to parse current block: %w", err) + } + + // Compress and get data hash based on batch version + compressedPayload, batchDataHash, err := e.handleBatchSealing(block.Timestamp) + if err != nil { + return nil, nil, err + } + + // Generate sidecar for blob data + sidecar, err := types.MakeBlobTxSidecar(compressedPayload) + if err != nil { + return nil, nil, fmt.Errorf("failed to create blob sidecar: %w", err) + } + + // Retrieve sequencer verification hash + sequencerSetVerifyHash, err := e.sequencerCaller.SequencerSetVerifyHash(nil) + if err != nil { + return nil, nil, fmt.Errorf("failed to get sequencer set verification hash: %w", err) + } + + // Create batch header + batchHeader := e.createBatchHeader(batchDataHash, sidecar, sequencerSetVerifyHash) + + // Cache the sealed header and sidecar + e.batchingCache.sealedBatchHeader = &batchHeader + e.batchingCache.sealedSidecar = sidecar + + // Log information about the sealed batch + e.logSealedBatch(batchHeader) + + batchHash := batchHeader.Hash() + // Return the batch hash and encoded batch header + return batchHash[:], batchHeader.Encode(), nil +} + +// handleBatchSealing determines which version to use for compression and calculates the data hash. +func (e *Executor) handleBatchSealing(blockTimestamp uint64) ([]byte, common.Hash, error) { + var ( + compressedPayload []byte + batchDataHash common.Hash + err error + ) + + // Check if the batch should use the upgraded version + if e.isBatchUpgraded(blockTimestamp) { + compressedPayload, err = types.CompressBatchBytes(e.batchingCache.batchData.TxsPayloadV2()) + if err != nil { + return nil, common.Hash{}, fmt.Errorf("failed to compress upgraded payload: %w", err) + } + + if len(compressedPayload) <= types.MaxBlobBytesSize { + batchDataHash, err = e.batchingCache.batchData.DataHashV2() + if err != nil { + return nil, common.Hash{}, fmt.Errorf("failed to calculate upgraded data hash: %w", err) + } + return compressedPayload, batchDataHash, nil + } + } + + // Fallback to old version if upgraded is not used + compressedPayload, err = types.CompressBatchBytes(e.batchingCache.batchData.TxsPayload()) + if err != nil { + return nil, common.Hash{}, fmt.Errorf("failed to compress payload: %w", err) + } + batchDataHash = e.batchingCache.batchData.DataHash() + + return compressedPayload, batchDataHash, nil +} + +// createBatchHeader creates a BatchHeader from the given parameters. +func (e *Executor) createBatchHeader(dataHash common.Hash, sidecar *eth.BlobTxSidecar, sequencerSetVerifyHash common.Hash) types.BatchHeader { + blobHashes := []common.Hash{types.EmptyVersionedHash} + if sidecar != nil && len(sidecar.Blobs) > 0 { + blobHashes = sidecar.BlobHashes() + } + + l1MessagePopped := e.batchingCache.totalL1MessagePopped - e.batchingCache.parentBatchHeader.TotalL1MessagePopped + + return types.BatchHeader{ + Version: 0, + BatchIndex: e.batchingCache.parentBatchHeader.BatchIndex + 1, + L1MessagePopped: l1MessagePopped, + TotalL1MessagePopped: e.batchingCache.totalL1MessagePopped, + DataHash: dataHash, + BlobVersionedHash: blobHashes[0], + PrevStateRoot: e.batchingCache.prevStateRoot, + PostStateRoot: e.batchingCache.postStateRoot, + WithdrawalRoot: e.batchingCache.withdrawRoot, + SequencerSetVerifyHash: sequencerSetVerifyHash, + ParentBatchHash: e.batchingCache.parentBatchHeader.Hash(), + } +} + +// logSealedBatch logs the details of the sealed batch for debugging purposes. +func (e *Executor) logSealedBatch(batchHeader types.BatchHeader) { + e.logger.Info("Sealed batch header", "batchHash", batchHeader.Hash().Hex()) + e.logger.Info(fmt.Sprintf("===batchIndex: %d \n===L1MessagePopped: %d \n===TotalL1MessagePopped: %d \n===dataHash: %x \n===blockNum: %d \n===ParentBatchHash: %x \n", + batchHeader.BatchIndex, + batchHeader.L1MessagePopped, + batchHeader.TotalL1MessagePopped, + batchHeader.DataHash, + e.batchingCache.batchData.BlockNum(), + batchHeader.ParentBatchHash)) + + blockContexts, _ := e.batchingCache.batchData.Encode() + e.logger.Info(fmt.Sprintf("===blockContexts: %x \n", blockContexts)) +} diff --git a/node/derivation/batch_info.go b/node/derivation/batch_info.go index 17d4fe88a..2c4decaea 100644 --- a/node/derivation/batch_info.go +++ b/node/derivation/batch_info.go @@ -78,10 +78,7 @@ func (bi *BatchInfo) TxNum() uint64 { func (bi *BatchInfo) ParseBatch(batch geth.RPCRollupBatch) error { bi.root = batch.PostStateRoot bi.withdrawalRoot = batch.WithdrawRoot - // If skipMap is zero value, there are no msgs that can be skipped - if len(batch.SkippedL1MessageBitmap[:]) != 0 { - bi.skippedL1MessageBitmap = new(big.Int).SetBytes(batch.SkippedL1MessageBitmap[:]) - } + bi.version = uint64(batch.Version) tq := newTxQueue() for _, blob := range batch.Sidecar.Blobs { diff --git a/node/derivation/derivation.go b/node/derivation/derivation.go index 6db69e881..b93a7274d 100644 --- a/node/derivation/derivation.go +++ b/node/derivation/derivation.go @@ -356,13 +356,12 @@ func (d *Derivation) UnPackData(data []byte) (geth.RPCRollupBatch, error) { WithdrawalRoot [32]uint8 "json:\"withdrawalRoot\"" }) batch = geth.RPCRollupBatch{ - Version: uint(rollupBatchData.Version), - ParentBatchHeader: rollupBatchData.ParentBatchHeader, - BlockContexts: rollupBatchData.BlockContexts, - SkippedL1MessageBitmap: rollupBatchData.SkippedL1MessageBitmap, - PrevStateRoot: common.BytesToHash(rollupBatchData.PrevStateRoot[:]), - PostStateRoot: common.BytesToHash(rollupBatchData.PostStateRoot[:]), - WithdrawRoot: common.BytesToHash(rollupBatchData.WithdrawalRoot[:]), + Version: uint(rollupBatchData.Version), + ParentBatchHeader: rollupBatchData.ParentBatchHeader, + BlockContexts: rollupBatchData.BlockContexts, + PrevStateRoot: common.BytesToHash(rollupBatchData.PrevStateRoot[:]), + PostStateRoot: common.BytesToHash(rollupBatchData.PostStateRoot[:]), + WithdrawRoot: common.BytesToHash(rollupBatchData.WithdrawalRoot[:]), } } else { return batch, types.ErrNotCommitBatchTx diff --git a/node/go.mod b/node/go.mod index dae5dc141..8c9b6ab8f 100644 --- a/node/go.mod +++ b/node/go.mod @@ -10,7 +10,7 @@ require ( github.com/hashicorp/go-multierror v1.1.1 github.com/hashicorp/golang-lru v1.0.2 github.com/klauspost/compress v1.17.9 - github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e + github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 github.com/prometheus/client_golang v1.17.0 github.com/spf13/viper v1.13.0 github.com/stretchr/testify v1.9.0 diff --git a/node/go.sum b/node/go.sum index 2a6ffdcda..0800bd613 100644 --- a/node/go.sum +++ b/node/go.sum @@ -360,8 +360,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e h1:pV7z8mnNQr+JJO2CGUzwAlzjrPnZ0YlO92izBaq00Zs= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 h1:2NHhXzEO2TQ9Rq0XRNxb+VnJpkQwHED9VNilOqWcV5M= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= github.com/morph-l2/tendermint v0.3.1 h1:yqyM3/p9sCNmFSsIFeIxS5RBgXHWqbtyNHx16I9cIZ0= github.com/morph-l2/tendermint v0.3.1/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= diff --git a/node/types/batch.go b/node/types/batch.go index 12b95cd96..a07a64683 100644 --- a/node/types/batch.go +++ b/node/types/batch.go @@ -32,7 +32,6 @@ type BatchHeader struct { WithdrawalRoot common.Hash SequencerSetVerifyHash common.Hash ParentBatchHash common.Hash - SkippedL1MessageBitmap hexutil.Bytes //cache EncodedBytes hexutil.Bytes @@ -43,7 +42,7 @@ func (b *BatchHeader) Encode() []byte { if len(b.EncodedBytes) > 0 { return b.EncodedBytes } - batchBytes := make([]byte, 249+len(b.SkippedL1MessageBitmap)) + batchBytes := make([]byte, 249) batchBytes[0] = b.Version binary.BigEndian.PutUint64(batchBytes[1:], b.BatchIndex) binary.BigEndian.PutUint64(batchBytes[9:], b.L1MessagePopped) @@ -55,7 +54,6 @@ func (b *BatchHeader) Encode() []byte { copy(batchBytes[153:], b.WithdrawalRoot[:]) copy(batchBytes[185:], b.SequencerSetVerifyHash[:]) copy(batchBytes[217:], b.ParentBatchHash[:]) - copy(batchBytes[249:], b.SkippedL1MessageBitmap[:]) b.EncodedBytes = batchBytes return batchBytes } @@ -87,7 +85,6 @@ func DecodeBatchHeader(data []byte) (BatchHeader, error) { WithdrawalRoot: common.BytesToHash(data[153:185]), SequencerSetVerifyHash: common.BytesToHash(data[185:217]), ParentBatchHash: common.BytesToHash(data[217:249]), - SkippedL1MessageBitmap: data[249:], EncodedBytes: data, } @@ -97,6 +94,7 @@ func DecodeBatchHeader(data []byte) (BatchHeader, error) { type BatchData struct { blockContexts []byte l1TxHashes []byte + l1TxNum uint16 blockNum uint16 txsPayload []byte @@ -121,6 +119,7 @@ func (cks *BatchData) Append(blockContext, txsPayload []byte, l1TxHashes []commo for _, txHash := range l1TxHashes { cks.l1TxHashes = append(cks.l1TxHashes, txHash.Bytes()...) } + cks.l1TxNum += uint16(len(l1TxHashes)) } // Encode encodes the data into bytes @@ -160,10 +159,47 @@ func (cks *BatchData) DataHash() common.Hash { return crypto.Keccak256Hash(bz) } +// DataHashV2 computes the Keccak-256 hash of the batch data, incorporating +// the last block height, L1 transaction count, and L1 transaction hashes. +func (cks *BatchData) DataHashV2() (common.Hash, error) { + // Validate blockContexts length + if len(cks.blockContexts) < 60 { + return common.Hash{}, fmt.Errorf("blockContexts too short, length: %d", len(cks.blockContexts)) + } + + // Extract the last 60 bytes + lastBlockContext := cks.blockContexts[len(cks.blockContexts)-60:] + + // Parse block height + height, err := HeightFromBCBytes(lastBlockContext) + if err != nil { + return common.Hash{}, fmt.Errorf("failed to parse blockContext: context length=%d, lastBlockContext=%x, err=%w", + len(cks.blockContexts), lastBlockContext, err) + } + + // Compute the hash + return cks.calculateHash(height), nil +} + +func (cks *BatchData) calculateHash(height uint64) common.Hash { + // Preallocate memory for efficiency + hashData := make([]byte, 8+2+len(cks.l1TxHashes)) // 8 bytes for height, 2 bytes for l1TxNum + copy(hashData[:8], Uint64ToBigEndianBytes(height)) + copy(hashData[8:10], Uint16ToBigEndianBytes(cks.l1TxNum)) + copy(hashData[10:], cks.l1TxHashes) + + return crypto.Keccak256Hash(hashData) +} + func (cks *BatchData) TxsPayload() []byte { return cks.txsPayload } +// TxsPayloadV2 returns the bytes combining the block contexts with the tx payload +func (cks *BatchData) TxsPayloadV2() []byte { + return append(cks.blockContexts, cks.txsPayload...) +} + func (cks *BatchData) BlockNum() uint16 { return cks.blockNum } func (cks *BatchData) EstimateCompressedSizeWithNewPayload(txPayload []byte) (bool, error) { @@ -177,3 +213,28 @@ func (cks *BatchData) EstimateCompressedSizeWithNewPayload(txPayload []byte) (bo } return len(compressed) > MaxBlobBytesSize, nil } + +func (cks *BatchData) combinePayloads(newBlockContext, newTxPayload []byte) []byte { + totalLength := len(cks.blockContexts) + len(newBlockContext) + len(cks.txsPayload) + len(newTxPayload) + combined := make([]byte, totalLength) + copy(combined, cks.blockContexts) + copy(combined[len(cks.blockContexts):], newBlockContext) + copy(combined[len(cks.blockContexts)+len(newBlockContext):], cks.txsPayload) + copy(combined[len(cks.blockContexts)+len(newBlockContext)+len(cks.txsPayload):], newTxPayload) + return combined +} + +// WillExceedCompressedSizeLimit checks if the size of the combined block contexts +// and transaction payloads (after compression) exceeds the maximum allowed size. +func (cks *BatchData) WillExceedCompressedSizeLimit(newBlockContext, newTxPayload []byte) (bool, error) { + // Combine the existing and new block contexts and transaction payloads + combinedBytes := cks.combinePayloads(newBlockContext, newTxPayload) + if len(combinedBytes) <= MaxBlobBytesSize { + return false, nil + } + compressed, err := zstd.CompressBatchBytes(combinedBytes) + if err != nil { + return false, fmt.Errorf("compression failed: %w", err) + } + return len(compressed) > MaxBlobBytesSize, nil +} diff --git a/node/types/batch_test.go b/node/types/batch_test.go index 25dc43e36..2bc11cf36 100644 --- a/node/types/batch_test.go +++ b/node/types/batch_test.go @@ -6,7 +6,6 @@ import ( "github.com/morph-l2/go-ethereum/common" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/rand" ) func TestBatchHeader(t *testing.T) { @@ -22,7 +21,6 @@ func TestBatchHeader(t *testing.T) { WithdrawalRoot: common.BigToHash(big.NewInt(103)), SequencerSetVerifyHash: common.BigToHash(big.NewInt(104)), ParentBatchHash: common.BigToHash(big.NewInt(200)), - SkippedL1MessageBitmap: rand.Bytes(10), } bytes := expectedBatchHeader.Encode() @@ -39,5 +37,4 @@ func TestBatchHeader(t *testing.T) { require.EqualValues(t, expectedBatchHeader.WithdrawalRoot, decoded.WithdrawalRoot) require.EqualValues(t, expectedBatchHeader.SequencerSetVerifyHash, decoded.SequencerSetVerifyHash) require.EqualValues(t, expectedBatchHeader.ParentBatchHash, decoded.ParentBatchHash) - require.EqualValues(t, expectedBatchHeader.SkippedL1MessageBitmap, decoded.SkippedL1MessageBitmap) } diff --git a/node/types/blob.go b/node/types/blob.go index a6b86e26a..8da3da37f 100644 --- a/node/types/blob.go +++ b/node/types/blob.go @@ -110,6 +110,17 @@ func MakeBlobTxSidecar(blobBytes []byte) (*eth.BlobTxSidecar, error) { }, nil } +func CompressBatchBytes(batchBytes []byte) ([]byte, error) { + if len(batchBytes) == 0 { + return nil, nil + } + compressedBatchBytes, err := zstd.CompressBatchBytes(batchBytes) + if err != nil { + return nil, fmt.Errorf("failed to compress batch bytes, err: %w", err) + } + return compressedBatchBytes, nil +} + func EncodeTxsPayloadToBlob(batchBytes []byte) (*eth.BlobTxSidecar, error) { if len(batchBytes) == 0 { return MakeBlobTxSidecar(batchBytes) diff --git a/node/types/consensus_message.go b/node/types/consensus_message.go index 29a25df1d..60e187c7b 100644 --- a/node/types/consensus_message.go +++ b/node/types/consensus_message.go @@ -145,3 +145,19 @@ func (wb *WrappedBlock) DecodeBlockContext(bc []byte) (uint16, uint16, error) { } return txsNum, l1MsgNum, nil } + +func WrappedBlockFromBytes(blockBytes []byte) (*WrappedBlock, error) { + var curBlock = new(WrappedBlock) + if err := curBlock.UnmarshalBinary(blockBytes); err != nil { + return nil, err + } + return curBlock, nil +} + +func HeightFromBCBytes(blockBytes []byte) (uint64, error) { + curBlock, err := WrappedBlockFromBytes(blockBytes) + if err != nil { + return 0, err + } + return curBlock.Number, nil +} diff --git a/ops/l2-genesis/go.mod b/ops/l2-genesis/go.mod index 277d2c777..fdc9795ff 100644 --- a/ops/l2-genesis/go.mod +++ b/ops/l2-genesis/go.mod @@ -6,7 +6,7 @@ replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3. require ( github.com/holiman/uint256 v1.2.4 - github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e + github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 github.com/stretchr/testify v1.9.0 github.com/urfave/cli v1.22.14 ) diff --git a/ops/l2-genesis/go.sum b/ops/l2-genesis/go.sum index e073c4429..837471f96 100644 --- a/ops/l2-genesis/go.sum +++ b/ops/l2-genesis/go.sum @@ -143,8 +143,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e h1:pV7z8mnNQr+JJO2CGUzwAlzjrPnZ0YlO92izBaq00Zs= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 h1:2NHhXzEO2TQ9Rq0XRNxb+VnJpkQwHED9VNilOqWcV5M= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= diff --git a/ops/tools/go.mod b/ops/tools/go.mod index 865fcdb43..4e4a5db2f 100644 --- a/ops/tools/go.mod +++ b/ops/tools/go.mod @@ -5,7 +5,7 @@ go 1.22 replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3.1 require ( - github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e + github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 github.com/tendermint/tendermint v0.35.9 ) diff --git a/ops/tools/go.sum b/ops/tools/go.sum index a45f366e7..490bff9a7 100644 --- a/ops/tools/go.sum +++ b/ops/tools/go.sum @@ -163,8 +163,8 @@ github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqky github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e h1:pV7z8mnNQr+JJO2CGUzwAlzjrPnZ0YlO92izBaq00Zs= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 h1:2NHhXzEO2TQ9Rq0XRNxb+VnJpkQwHED9VNilOqWcV5M= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= github.com/morph-l2/tendermint v0.3.1 h1:yqyM3/p9sCNmFSsIFeIxS5RBgXHWqbtyNHx16I9cIZ0= github.com/morph-l2/tendermint v0.3.1/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= diff --git a/oracle/go.mod b/oracle/go.mod index 074df471e..940f6a765 100644 --- a/oracle/go.mod +++ b/oracle/go.mod @@ -7,7 +7,7 @@ replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3. require ( github.com/go-kit/kit v0.12.0 github.com/morph-l2/externalsign v0.3.1 - github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e + github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 github.com/prometheus/client_golang v1.17.0 github.com/stretchr/testify v1.9.0 github.com/tendermint/tendermint v0.35.9 diff --git a/oracle/go.sum b/oracle/go.sum index a08b1aef8..abc9f0cb2 100644 --- a/oracle/go.sum +++ b/oracle/go.sum @@ -175,8 +175,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/morph-l2/externalsign v0.3.1 h1:UYFDZFB0L85A4rDvuwLNBiGEi0kSmg9AZ2v8Q5O4dQo= github.com/morph-l2/externalsign v0.3.1/go.mod h1:b6NJ4GUiiG/gcSJsp3p8ExsIs4ZdphlrVALASnVoGJE= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e h1:pV7z8mnNQr+JJO2CGUzwAlzjrPnZ0YlO92izBaq00Zs= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 h1:2NHhXzEO2TQ9Rq0XRNxb+VnJpkQwHED9VNilOqWcV5M= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= github.com/morph-l2/tendermint v0.3.1 h1:yqyM3/p9sCNmFSsIFeIxS5RBgXHWqbtyNHx16I9cIZ0= github.com/morph-l2/tendermint v0.3.1/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= diff --git a/oracle/oracle/batch.go b/oracle/oracle/batch.go index 7f29d2023..b5970a049 100644 --- a/oracle/oracle/batch.go +++ b/oracle/oracle/batch.go @@ -126,13 +126,13 @@ func (o *Oracle) GetBatchSubmission(ctx context.Context, startBlock, nextBatchSu }) batch := eth.RPCRollupBatch{ - Version: uint(rollupBatchData.Version), - ParentBatchHeader: rollupBatchData.ParentBatchHeader, - BlockContexts: rollupBatchData.BlockContexts, - SkippedL1MessageBitmap: rollupBatchData.SkippedL1MessageBitmap, - PrevStateRoot: common.BytesToHash(rollupBatchData.PrevStateRoot[:]), - PostStateRoot: common.BytesToHash(rollupBatchData.PostStateRoot[:]), - WithdrawRoot: common.BytesToHash(rollupBatchData.WithdrawalRoot[:]), + Version: uint(rollupBatchData.Version), + ParentBatchHeader: rollupBatchData.ParentBatchHeader, + BlockContexts: rollupBatchData.BlockContexts, + //SkippedL1MessageBitmap: rollupBatchData.SkippedL1MessageBitmap, + PrevStateRoot: common.BytesToHash(rollupBatchData.PrevStateRoot[:]), + PostStateRoot: common.BytesToHash(rollupBatchData.PostStateRoot[:]), + WithdrawRoot: common.BytesToHash(rollupBatchData.WithdrawalRoot[:]), } var batchData derivation.BatchInfo if err = batchData.ParseBatch(batch); err != nil { diff --git a/tx-submitter/go.mod b/tx-submitter/go.mod index 1fada601d..49ded5ae4 100644 --- a/tx-submitter/go.mod +++ b/tx-submitter/go.mod @@ -7,7 +7,7 @@ replace github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.3. require ( github.com/holiman/uint256 v1.2.4 github.com/morph-l2/externalsign v0.3.1 - github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e + github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 github.com/prometheus/client_golang v1.17.0 github.com/stretchr/testify v1.9.0 github.com/tendermint/tendermint v0.35.9 diff --git a/tx-submitter/go.sum b/tx-submitter/go.sum index c6d21f1ad..e190e1f64 100644 --- a/tx-submitter/go.sum +++ b/tx-submitter/go.sum @@ -164,8 +164,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/morph-l2/externalsign v0.3.1 h1:UYFDZFB0L85A4rDvuwLNBiGEi0kSmg9AZ2v8Q5O4dQo= github.com/morph-l2/externalsign v0.3.1/go.mod h1:b6NJ4GUiiG/gcSJsp3p8ExsIs4ZdphlrVALASnVoGJE= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e h1:pV7z8mnNQr+JJO2CGUzwAlzjrPnZ0YlO92izBaq00Zs= -github.com/morph-l2/go-ethereum v1.10.14-0.20241105040223-5c7f1bb7073e/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1 h1:2NHhXzEO2TQ9Rq0XRNxb+VnJpkQwHED9VNilOqWcV5M= +github.com/morph-l2/go-ethereum v1.10.14-0.20241127093812-67d4a670e1a1/go.mod h1:sMJCfHOBzVRDkM2yF/Hy+oUk2rgC0CQZHTLs0cyzhhk= github.com/morph-l2/tendermint v0.3.1 h1:yqyM3/p9sCNmFSsIFeIxS5RBgXHWqbtyNHx16I9cIZ0= github.com/morph-l2/tendermint v0.3.1/go.mod h1:TtCzp9l6Z6yDUiwv3TbqKqw8Q8RKp3fSz5+adO1/Y8w= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=