From e67d447200368bb3aad82b9844b7648d19b432bb Mon Sep 17 00:00:00 2001 From: Olexandr88 Date: Thu, 8 Jan 2026 16:01:03 +0200 Subject: [PATCH 1/2] cleanup: remove unused ParseBusinessInfo helper --- tx-submitter/utils/utils.go | 36 ------------------------------------ 1 file changed, 36 deletions(-) diff --git a/tx-submitter/utils/utils.go b/tx-submitter/utils/utils.go index 06de87e6e..6f106196c 100644 --- a/tx-submitter/utils/utils.go +++ b/tx-submitter/utils/utils.go @@ -12,13 +12,11 @@ import ( "time" "morph-l2/bindings/bindings" - ntype "morph-l2/node/types" "github.com/morph-l2/go-ethereum/accounts/abi" "github.com/morph-l2/go-ethereum/common" "github.com/morph-l2/go-ethereum/common/hexutil" "github.com/morph-l2/go-ethereum/core/types" - "github.com/morph-l2/go-ethereum/log" "github.com/morph-l2/go-ethereum/rpc" ) @@ -164,40 +162,6 @@ func ParseMempoolLatestBatchIndex(id []byte, txs []*types.Transaction) uint64 { } -func ParseBusinessInfo(tx *types.Transaction, a *abi.ABI) []interface{} { - // var method string - // var batchIndex uint64 - // var finalizedIndex uint64 - var res []interface{} - if len(tx.Data()) > 0 { - id := tx.Data()[:4] - if bytes.Equal(id, a.Methods["commitBatch"].ID) { - method := "commitBatch" - batchIndex := ParseParentBatchIndex(tx.Data()) + 1 - res = append(res, - "method", method, - "batchIndex", batchIndex, - ) - } else if bytes.Equal(id, a.Methods["finalizeBatch"].ID) { - method := "finalizeBatch" - parms, err := a.Methods["finalizeBatch"].Inputs.Unpack(tx.Data()[4:]) - if err != nil { - log.Error("unpack finalizeBatch error", "err", err) - } - batchIndex, _ := ntype.BatchHeaderBytes(parms[0].([]byte)).BatchIndex() - res = append(res, - "method", method, - "finalizedIndex", batchIndex, - ) - - } - - } else { - return []interface{}{} - } - return res -} - func ParseMethod(tx *types.Transaction, a *abi.ABI) string { if tx.Data() == nil || len(tx.Data()) < 4 { return "" From 4c86f7d2a279348b94a323ae1deca03e33e48e39 Mon Sep 17 00:00:00 2001 From: Olexandr88 Date: Tue, 25 Aug 2026 14:36:12 +0000 Subject: [PATCH 2/2] fix: add missing common import and guard short calldata in ParseMempoolLatestBatchIndex --- tx-submitter/utils/utils.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tx-submitter/utils/utils.go b/tx-submitter/utils/utils.go index faccc218f..5e31828ba 100644 --- a/tx-submitter/utils/utils.go +++ b/tx-submitter/utils/utils.go @@ -13,6 +13,7 @@ import ( "morph-l2/bindings/bindings" "github.com/morph-l2/go-ethereum/accounts/abi" + "github.com/morph-l2/go-ethereum/common" "github.com/morph-l2/go-ethereum/common/hexutil" "github.com/morph-l2/go-ethereum/core/types" "github.com/morph-l2/go-ethereum/rpc" @@ -178,6 +179,9 @@ func ParseMempoolLatestBatchIndex(id []byte, txs []*types.Transaction) uint64 { var res uint64 for _, tx := range txs { + if len(tx.Data()) < 4 { + continue + } if bytes.Equal(tx.Data()[:4], id) { pindex := ParseParentBatchIndex(tx.Data()) if pindex > res {