Skip to content

Commit 7efc270

Browse files
curryxbocoreycoderabbitai[bot]
authored
support derive commitBatchWithProof event (#880)
Co-authored-by: corey <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
1 parent dcd0112 commit 7efc270

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

node/derivation/derivation.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,29 @@ func (d *Derivation) UnPackData(data []byte) (geth.RPCRollupBatch, error) {
523523
PostStateRoot: common.BytesToHash(rollupBatchData.PostStateRoot[:]),
524524
WithdrawRoot: common.BytesToHash(rollupBatchData.WithdrawalRoot[:]),
525525
}
526+
} else if bytes.Equal(d.rollupABI.Methods["commitBatchWithProof"].ID, data[:4]) {
527+
args, err := d.rollupABI.Methods["commitBatchWithProof"].Inputs.Unpack(data[4:])
528+
if err != nil {
529+
return batch, fmt.Errorf("commitBatchWithProof Unpack error:%v", err)
530+
}
531+
rollupBatchData := args[0].(struct {
532+
Version uint8 "json:\"version\""
533+
ParentBatchHeader []uint8 "json:\"parentBatchHeader\""
534+
LastBlockNumber uint64 "json:\"lastBlockNumber\""
535+
NumL1Messages uint16 "json:\"numL1Messages\""
536+
PrevStateRoot [32]uint8 "json:\"prevStateRoot\""
537+
PostStateRoot [32]uint8 "json:\"postStateRoot\""
538+
WithdrawalRoot [32]uint8 "json:\"withdrawalRoot\""
539+
})
540+
batch = geth.RPCRollupBatch{
541+
Version: uint(rollupBatchData.Version),
542+
ParentBatchHeader: rollupBatchData.ParentBatchHeader,
543+
LastBlockNumber: rollupBatchData.LastBlockNumber,
544+
NumL1Messages: rollupBatchData.NumL1Messages,
545+
PrevStateRoot: common.BytesToHash(rollupBatchData.PrevStateRoot[:]),
546+
PostStateRoot: common.BytesToHash(rollupBatchData.PostStateRoot[:]),
547+
WithdrawRoot: common.BytesToHash(rollupBatchData.WithdrawalRoot[:]),
548+
}
526549
} else {
527550
return batch, types.ErrNotCommitBatchTx
528551
}

0 commit comments

Comments
 (0)