Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
7e0873f
support eip4844 format batch
FletcherMan Jan 25, 2024
f2faa2b
Merge remote-tracking branch 'origin/main' into eip4844
FletcherMan Jan 29, 2024
b31691a
Merge remote-tracking branch 'origin/main' into eip4844
FletcherMan Jan 29, 2024
457a55c
refactor L1Message validation (#12)
FletcherMan Jan 29, 2024
0dead6e
fix compile error
FletcherMan Jan 29, 2024
8dd6146
update l2 genesis gen
Kukoomomo Jan 29, 2024
c3910cd
refactor chunk format for storing tx payload (#16)
FletcherMan Feb 2, 2024
4534c07
devnet-l1 move on
MarvelFisher Feb 1, 2024
145f1ca
wait proxy deployed
Kukoomomo Feb 2, 2024
b14be41
support eip4844 (#17)
chengwenxi Feb 2, 2024
a86768b
make L2-genesis work
MarvelFisher Feb 3, 2024
3acdb80
add L2-genesis to go.work
MarvelFisher Feb 3, 2024
c01df4d
make build work for node and geth
MarvelFisher Feb 4, 2024
7592edb
add gasOracle
anylots Feb 4, 2024
3e9c1d5
make other components work
MarvelFisher Feb 4, 2024
f02c620
add gateways deploy
Kukoomomo Feb 5, 2024
ae03b45
add predeploy address in bindings
Kukoomomo Feb 5, 2024
ba858f0
Ops marvel (#19)
MarvelFisher Feb 5, 2024
b4f6d6d
Eip4844 prover (#20)
anylots Feb 6, 2024
ba72be7
make repo tidy (#21)
FletcherMan Feb 6, 2024
e1ad8a9
tidy contracts
FletcherMan Feb 6, 2024
b992687
update l2 genesis gen
Kukoomomo Feb 6, 2024
61bc2a2
Merge branch 'ops' of github.com:morph-l2/morph into ops
Kukoomomo Feb 6, 2024
ea85b71
go work update
Kukoomomo Feb 6, 2024
38be01f
using replace go-ethereum
FletcherMan Feb 6, 2024
c8cb5f5
refact ops code
MarvelFisher Feb 6, 2024
5ec1dcf
Merge branch 'ops' of github.com:morph-l2/morph into ops
MarvelFisher Feb 6, 2024
0d7c317
rm no use var in py
MarvelFisher Feb 6, 2024
db71f35
Merge remote-tracking branch 'origin/ops' into eip4844
FletcherMan Feb 6, 2024
2e4f3aa
upgrade go-ethereum
FletcherMan Feb 6, 2024
7f20beb
allow all virtual host to access l1 8545
FletcherMan Feb 6, 2024
81c5134
Merge remote-tracking branch 'origin/ops' into eip4844
FletcherMan Feb 6, 2024
73e6b57
fix
FletcherMan Feb 6, 2024
18856b8
Merge remote-tracking branch 'origin/ops' into eip4844
FletcherMan Feb 6, 2024
a329b31
EIP4844 prover (#22)
chengwenxi Feb 7, 2024
7d055b5
Update from morph/prover (#18)
anylots Feb 5, 2024
fe6bcfa
WIP : Morph OPS (#13)
Kukoomomo Feb 7, 2024
427b9f5
Merge remote-tracking branch 'origin/main' into eip4844
FletcherMan Feb 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/prover.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Run build
run: build-prover
run: make build-prover
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "go-ethereum"]
path = go-ethereum
url = https://github.com/morph-l2/go-ethereum.git
branch = change_root_slot
branch = eip4844
4 changes: 2 additions & 2 deletions bindings/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ require (
github.com/tklauser/go-sysconf v0.3.13 // indirect
github.com/tklauser/numcpus v0.7.0 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/sys v0.15.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
)
Expand Down
4 changes: 2 additions & 2 deletions bindings/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a h1:1ur3QoCqvE5f
github.com/tklauser/go-sysconf v0.3.13 h1:GBUpcahXSpR2xN01jhkNAbTLRk2Yzgggk8IM08lq3r4=
github.com/tklauser/numcpus v0.7.0 h1:yjuerZP127QG9m5Zh/mSO4wqurYil27tHrqwRoRjpr4=
github.com/yusufpapurcu/wmi v1.2.3 h1:E1ctvB7uKFMOJw3fdOW32DwGE9I7t++CRUEMKvFoFiw=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/net v0.18.0 h1:mIYleuAkSbHh0tCv7RvjL3F6ZVbLjq4+R7zbOn3Kokg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce h1:+JknDZhAj8YMt7GC73Ei8pv4MzjDUNPHgQWJdtMAaDU=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
2 changes: 1 addition & 1 deletion contracts/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ require (

require (
github.com/stretchr/testify v1.8.4 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/sys v0.15.0 // indirect
)
5 changes: 1 addition & 4 deletions contracts/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
github.com/scroll-tech/go-ethereum v1.10.14-0.20231130005111-38a3a9c9198c h1:MnAdt80steCDli4SAD0J0spBGNY+gQvbdptNjWztHcw=
github.com/scroll-tech/go-ethereum v1.10.14-0.20231130005111-38a3a9c9198c/go.mod h1:4HrFcoStbViFVy/9l/rvKl1XmizVAaPdgqI8v0U8hOc=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
golang.org/x/crypto v0.16.0 h1:mMMrFzRSCF0GvB7Ne27XVtVAaXLrPmgPC7/v0tkwHaY=
golang.org/x/crypto v0.16.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
5 changes: 4 additions & 1 deletion go.work
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
go 1.20

replace github.com/scroll-tech/go-ethereum => github.com/morph-l2/go-ethereum v1.10.14-0.20240206055104-957a5e9ef045
replace (
github.com/scroll-tech/go-ethereum => github.com/morph-l2/go-ethereum v1.10.14-0.20240206173246-45487e1b941a
github.com/tendermint/tendermint => github.com/morph-l2/tendermint v0.1.0-beta.0.20240125053652-c7ba1597b86f
)

use (
./bindings
Expand Down
935 changes: 353 additions & 582 deletions go.work.sum

Large diffs are not rendered by default.

125 changes: 70 additions & 55 deletions node/core/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

type BatchingCache struct {
parentBatchHeader types.BatchHeader
parentBatchHeader *types.BatchHeaderWithBlobHashes
prevStateRoot common.Hash

// accumulated batch data
Expand All @@ -30,7 +30,8 @@ type BatchingCache struct {
withdrawRoot common.Hash
lastPackedBlockHeight uint64
// caches sealedBatchHeader according to the above accumulated batch data
sealedBatchHeader *types.BatchHeader
sealedBatchHeader *types.BatchHeaderWithBlobHashes
sealedSidecar *eth.BlobTxSidecar

currentBlockContext []byte
currentTxsPayload []byte
Expand Down Expand Up @@ -72,31 +73,34 @@ func (bc *BatchingCache) ClearCurrent() {
bc.currentTxsHash = nil
}

// CalculateCapWithProposalBlock calculate the batch size and chunks count with the proposed block.
// It helps query the blocks from the last batch point, which are used to seal a new batch by SealBatch.
// It stores the proposed block as the currentBlockContext, which is used by PackCurrentBlock to pack it to batch.
// CalculateCapWithProposalBlock calculate the transaction payload size and chunks count with the proposed block.
// It queries the blocks from the last batch point to now, in order to seal a new batch by SealBatch with these blocks.
// It stores the proposed block as the `currentBlockContext`, which is used by PackCurrentBlock to pack it to batch.
// It can be called by multiple times during the same height consensus process.
func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, currentTxs tmtypes.Txs, get l2node.GetFromBatchStartFunc) (int64, int64, error) {
e.logger.Info("CalculateBatchSizeWithProposalBlock request", "block size", len(currentBlockBytes), "txs size", len(currentTxs))
func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, currentTxs tmtypes.Txs, get l2node.GetFromBatchStartFunc) (bool, int64, error) {
e.logger.Info("CalculateCapWithProposalBlock request", "block size", len(currentBlockBytes), "txs size", len(currentTxs))
if e.batchingCache.IsEmpty() {
parentBatchHeaderBytes, blocks, transactions, err := get()
if err != nil {
return 0, 0, err
return false, 0, err
}

var parentBatchHeader types.BatchHeader
parentBatchHeader := new(types.BatchHeaderWithBlobHashes)
if len(parentBatchHeaderBytes) == 0 {
genesisHeader, err := e.l2Client.HeaderByNumber(context.Background(), big.NewInt(0))
if err != nil {
return 0, 0, err
return false, 0, err
}
parentBatchHeader, err = GenesisBatchHeader(genesisHeader)
genesisBatchHeader, err := GenesisBatchHeader(genesisHeader)
if err != nil {
return 0, 0, err
return false, 0, err
}
parentBatchHeader = &types.BatchHeaderWithBlobHashes{
BatchHeader: genesisBatchHeader,
}
} else {
if parentBatchHeader, err = types.DecodeBatchHeader(parentBatchHeaderBytes); err != nil {
return 0, 0, err
if err = parentBatchHeader.UnmarshalBinary(parentBatchHeaderBytes); err != nil {
return false, 0, err
}
}

Expand All @@ -111,7 +115,7 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre
for i, blockBz := range blocks {
wBlock := new(types.WrappedBlock)
if err = wBlock.UnmarshalBinary(blockBz); err != nil {
return 0, 0, err
return false, 0, err
}

if i == 0 {
Expand All @@ -121,7 +125,7 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre
totalL1MessagePoppedBefore := totalL1MessagePopped
txsPayload, txHashes, totalL1MessagePopped, skippedBitmap, l2TxNum, err = ParsingTxs(transactions[i], parentBatchHeader.TotalL1MessagePopped, totalL1MessagePoppedBefore, skippedBitmap)
if err != nil {
return 0, 0, err
return false, 0, err
}
l1TxNum := int(totalL1MessagePopped - totalL1MessagePoppedBefore) // include skipped L1 messages
e.logger.Info("fetched block", "block height", wBlock.Number, "involved transaction count", len(transactions[i]), "l2 tx num", l2TxNum, "l1 tx num", l1TxNum)
Expand All @@ -134,27 +138,27 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre
// make sure passed block is the next block of the last packed block
curHeight, err := heightFromBCBytes(currentBlockBytes)
if err != nil {
return 0, 0, err
return false, 0, err
}
if curHeight != e.batchingCache.lastPackedBlockHeight+1 {
return 0, 0, fmt.Errorf("wrong propose height passed. lastPackedBlockHeight: %d, passed height: %d", e.batchingCache.lastPackedBlockHeight, curHeight)
return false, 0, fmt.Errorf("wrong propose height passed. lastPackedBlockHeight: %d, passed height: %d", e.batchingCache.lastPackedBlockHeight, curHeight)
}

e.batchingCache.parentBatchHeader = parentBatchHeader
e.batchingCache.skippedBitmap = skippedBitmap
header, err := e.l2Client.HeaderByNumber(context.Background(), big.NewInt(int64(lastHeightBeforeCurrentBatch)))
if err != nil {
return 0, 0, err
return false, 0, err
}
e.batchingCache.prevStateRoot = header.Root
}

height, err := heightFromBCBytes(currentBlockBytes)
if err != nil {
return 0, 0, err
return false, 0, err
}
if height <= e.batchingCache.lastPackedBlockHeight {
return 0, 0, fmt.Errorf("wrong propose height passed. lastPackedBlockHeight: %d, passed height: %d", e.batchingCache.lastPackedBlockHeight, height)
return false, 0, 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
e.batchingCache = NewBatchingCache() // clean the cache, recall the function
e.logger.Info("the proposed block height is discontinuous from the block height in the cache, start to clean the cache and recall the function",
Expand All @@ -164,29 +168,27 @@ func (e *Executor) CalculateCapWithProposalBlock(currentBlockBytes []byte, curre
}

if err := e.setCurrentBlock(currentBlockBytes, currentTxs); err != nil {
return 0, 0, err
}

/**
* commit batch which includes the fields:
* version: 1 byte
* parentBatchHeader
* chunks
* skippedL1MessageBitmap
* prevStateRoot: 32 byte
* postStateRoot: 32 byte
* withdrawRoot: 32 byte
*/
chunksSizeWithCurBlock := e.batchingCache.chunks.Size() + len(e.batchingCache.currentTxsPayload) + len(e.batchingCache.currentBlockContext)
return false, 0, err
}

chunkNum := e.batchingCache.chunks.ChunkNum()
// current block will be filled in a new chunk
if e.batchingCache.chunks.IsChunksAppendedWithNewBlock(e.batchingCache.currentRowConsumption) {
chunksSizeWithCurBlock += 1
var exceeded bool
var extraSize int
// if current block will be filled in a new chunk
chunkAppended, zeroNum := e.batchingCache.chunks.IsChunksAppendedWithNewBlock(e.batchingCache.currentRowConsumption)
if chunkAppended {
chunkNum += 1
// if current block takes up a new chunk,
// then both the added zero bytes and the first 4bytes within this chunk are all need to be counted.
extraSize += zeroNum + 4
}
batchSize := 97 + len(e.batchingCache.skippedBitmapAfterCurBlock)*32 + len(e.batchingCache.parentBatchHeader.Encode()) + chunksSizeWithCurBlock
e.logger.Info("CalculateBatchSizeWithProposalBlock response", "batchSize", batchSize)
return int64(batchSize), int64(chunkNum), nil
blobSizeWithCurBlock := e.batchingCache.chunks.CurrentPayloadForBlobSize() +
len(e.batchingCache.currentTxsPayload) + extraSize
if blobSizeWithCurBlock > types.MaxBlobTxPayloadSize {
exceeded = true
}
e.logger.Info("CalculateCapWithProposalBlock response", "blobSizeWithCurBlock", blobSizeWithCurBlock, "exceeded", exceeded)
return exceeded, int64(chunkNum), nil
}

// SealBatch seals the accumulated blocks into a batch
Expand All @@ -210,11 +212,21 @@ func (e *Executor) SealBatch() ([]byte, []byte, error) {
L1MessagePopped: e.batchingCache.totalL1MessagePopped - e.batchingCache.parentBatchHeader.TotalL1MessagePopped,
TotalL1MessagePopped: e.batchingCache.totalL1MessagePopped,
DataHash: e.batchingCache.chunks.DataHash(),
ParentBatchHash: e.batchingCache.parentBatchHeader.Hash(),
ParentBatchHash: e.batchingCache.parentBatchHeader.BatchHash(),
SkippedL1MessageBitmap: skippedL1MessageBitmapBytes,
}
e.batchingCache.sealedBatchHeader = &batchHeader
batchHash := batchHeader.Hash()
txPayload := e.batchingCache.chunks.SealTxPayloadForBlob()
sidecar, err := types.MakeBlobTxSidecarWithTxPayload(txPayload)
if err != nil {
return nil, nil, err
}
var blobHashes []common.Hash
if sidecar != nil && len(sidecar.Blobs) > 0 {
blobHashes = sidecar.BlobHashes()
}
e.batchingCache.sealedBatchHeader = types.NewBatchHeaderWithBlobHashes(batchHeader, blobHashes)
e.batchingCache.sealedSidecar = sidecar
batchHash := e.batchingCache.sealedBatchHeader.BatchHash()
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===ParentBatchHash: %x \n===SkippedL1MessageBitmap: %x \n",
batchHeader.BatchIndex,
Expand All @@ -228,7 +240,8 @@ func (e *Executor) SealBatch() ([]byte, []byte, error) {
for i, chunk := range chunksBytes {
e.logger.Info(fmt.Sprintf("===chunk%d: %x \n", i, chunk))
}
return batchHash[:], batchHeader.Encode(), nil
e.logger.Info(fmt.Sprintf("===txs: %x \n", txPayload))
return batchHash[:], e.batchingCache.sealedBatchHeader.MarshalBinary(), nil
}

// CommitBatch commit the sealed batch. It does nothing if no batch header is sealed.
Expand Down Expand Up @@ -269,21 +282,23 @@ func (e *Executor) CommitBatch(currentBlockBytes []byte, currentTxs tmtypes.Txs,
if err = e.l2Client.CommitBatch(context.Background(), &eth.RollupBatch{
Version: 0,
Index: e.batchingCache.parentBatchHeader.BatchIndex + 1,
Hash: e.batchingCache.sealedBatchHeader.Hash(),
Hash: e.batchingCache.sealedBatchHeader.BatchHash(),
ParentBatchHeader: e.batchingCache.parentBatchHeader.Encode(),
Chunks: chunksBytes,
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
}

// commit sealed batch header; move current block into the next batch
e.batchingCache.parentBatchHeader = *e.batchingCache.sealedBatchHeader
e.batchingCache.parentBatchHeader = e.batchingCache.sealedBatchHeader
e.batchingCache.prevStateRoot = e.batchingCache.postStateRoot
e.batchingCache.sealedBatchHeader = nil
e.batchingCache.sealedSidecar = nil

_, _, totalL1MessagePopped, skippedBitmap, _, err := ParsingTxs(e.batchingCache.currentTxs, e.batchingCache.totalL1MessagePopped, e.batchingCache.totalL1MessagePopped, nil)
if err != nil {
Expand Down Expand Up @@ -352,6 +367,14 @@ func (e *Executor) PackCurrentBlock(currentBlockBytes []byte, currentTxs tmtypes
return nil
}

func (e *Executor) BatchHash(batchHeaderBytes []byte) ([]byte, error) {
batchHeaderWithBlobHashes := new(types.BatchHeaderWithBlobHashes)
if err := batchHeaderWithBlobHashes.UnmarshalBinary(batchHeaderBytes); err != nil {
return nil, err
}
return batchHeaderWithBlobHashes.BatchHash().Bytes(), nil
}

func (e *Executor) setCurrentBlock(currentBlockBytes []byte, currentTxs tmtypes.Txs) error {
currentTxsPayload, currentTxsHashes, totalL1MessagePopped, skippedBitmap, l2TxNum, err := ParsingTxs(currentTxs, e.batchingCache.parentBatchHeader.TotalL1MessagePopped, e.batchingCache.totalL1MessagePopped, e.batchingCache.skippedBitmap)
if err != nil {
Expand All @@ -377,14 +400,6 @@ func (e *Executor) setCurrentBlock(currentBlockBytes []byte, currentTxs tmtypes.
return nil
}

func (e *Executor) BatchHash(batchHeaderBytes []byte) ([]byte, error) {
batchHeader, err := types.DecodeBatchHeader(batchHeaderBytes)
if err != nil {
return nil, err
}
return batchHeader.Hash().Bytes(), nil
}

func ParsingTxs(transactions tmtypes.Txs, totalL1MessagePoppedBeforeTheBatch, totalL1MessagePoppedBefore uint64, skippedBitmapBefore []*big.Int) (txsPayload []byte, txHashes []common.Hash, totalL1MessagePopped uint64, skippedBitmap []*big.Int, l2TxNum int, err error) {
// the first queue index that belongs to this batch
baseIndex := totalL1MessagePoppedBeforeTheBatch
Expand Down
13 changes: 9 additions & 4 deletions node/core/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func (e *Executor) RequestBlockData(height int64) (txs [][]byte, blockMeta []byt
l1Messages := e.l1MsgReader.ReadL1MessagesInRange(fromIndex, fromIndex+e.maxL1MsgNumPerBlock-1)
transactions := make(eth.Transactions, len(l1Messages))

var collectedL1TxHashes []common.Hash
if len(l1Messages) > 0 {
queueIndex := fromIndex
for i, l1Message := range l1Messages {
Expand All @@ -169,6 +170,7 @@ func (e *Executor) RequestBlockData(height int64) (txs [][]byte, blockMeta []byt
err = types.ErrInvalidL1MessageOrder
return
}
collectedL1TxHashes = append(collectedL1TxHashes, l1Message.L1TxHash)
queueIndex++
}
collectedL1Msgs = true
Expand Down Expand Up @@ -196,7 +198,8 @@ func (e *Executor) RequestBlockData(height int64) (txs [][]byte, blockMeta []byt
RowConsumption: l2Block.RowUsages,
NextL1MessageIndex: l2Block.NextL1MessageIndex,
Hash: l2Block.Hash,
CollectedL1Messages: l1Messages,
CollectedL1TxHashes: collectedL1TxHashes,
SkippedL1Txs: l2Block.SkippedTxs,
}
blockMeta, err = wb.MarshalBinary()
txs = l2Block.Transactions
Expand Down Expand Up @@ -242,18 +245,19 @@ func (e *Executor) CheckBlockData(txs [][]byte, metaData []byte) (valid bool, er
RowUsages: wrappedBlock.RowConsumption,
NextL1MessageIndex: wrappedBlock.NextL1MessageIndex,
Hash: wrappedBlock.Hash,
SkippedTxs: wrappedBlock.SkippedL1Txs,

Transactions: txs,
}
if err := e.validateL1Messages(l2Block, wrappedBlock.CollectedL1Messages); err != nil {
if err = e.validateL1Messages(l2Block, wrappedBlock.CollectedL1TxHashes); err != nil {
if err != types.ErrQueryL1Message { // only do not return error if it is not ErrQueryL1Message error
err = nil
}
return false, err
}
l2Block.WithdrawTrieRoot = wrappedBlock.WithdrawTrieRoot

validated, err := e.l2Client.ValidateL2Block(context.Background(), l2Block, L1MessagesToTxs(wrappedBlock.CollectedL1Messages))
validated, err := e.l2Client.ValidateL2Block(context.Background(), l2Block)
e.logger.Info("CheckBlockData response", "validated", validated, "error", err)
return validated, err
}
Expand Down Expand Up @@ -309,6 +313,7 @@ func (e *Executor) DeliverBlock(txs [][]byte, metaData []byte, consensusData l2n
WithdrawTrieRoot: wrappedBlock.WithdrawTrieRoot,
RowUsages: wrappedBlock.RowConsumption,
NextL1MessageIndex: wrappedBlock.NextL1MessageIndex,
SkippedTxs: wrappedBlock.SkippedL1Txs,
Hash: wrappedBlock.Hash,

Transactions: txs,
Expand All @@ -318,7 +323,7 @@ func (e *Executor) DeliverBlock(txs [][]byte, metaData []byte, consensusData l2n
batchHash = new(common.Hash)
copy(batchHash[:], consensusData.BatchHash)
}
err = e.l2Client.NewL2Block(context.Background(), l2Block, batchHash, L1MessagesToTxs(wrappedBlock.CollectedL1Messages))
err = e.l2Client.NewL2Block(context.Background(), l2Block, batchHash)
if err != nil {
e.logger.Error("failed to NewL2Block", "error", err)
return nil, nil, err
Expand Down
Loading