From 050949ad7fe4782c867f1a42cf75f40450514e88 Mon Sep 17 00:00:00 2001 From: Max Revitt Date: Thu, 7 Nov 2024 15:33:49 +0000 Subject: [PATCH] tweak(zkevm_api): allow 0x00 accinputhash (#1421) --- turbo/jsonrpc/zkevm_api.go | 3 +++ turbo/jsonrpc/zkevm_api_test.go | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/turbo/jsonrpc/zkevm_api.go b/turbo/jsonrpc/zkevm_api.go index dada5250041..f72ae85d9a0 100644 --- a/turbo/jsonrpc/zkevm_api.go +++ b/turbo/jsonrpc/zkevm_api.go @@ -748,6 +748,9 @@ func (api *ZkEvmAPIImpl) getAccInputHash(ctx context.Context, db SequenceReader, } accInputHash = &prevSequenceAccinputHash + if prevSequenceBatch == 0 { + return + } // calculate acc input hash for i := 0; i < int(batchNum-prevSequenceBatch); i++ { accInputHash = accInputHashCalcFn(prevSequenceAccinputHash, i) diff --git a/turbo/jsonrpc/zkevm_api_test.go b/turbo/jsonrpc/zkevm_api_test.go index 4b5736c0cf6..98d48ab2e24 100644 --- a/turbo/jsonrpc/zkevm_api_test.go +++ b/turbo/jsonrpc/zkevm_api_test.go @@ -480,7 +480,7 @@ func TestGetBatchByNumber(t *testing.T) { assert.Equal(gers[len(gers)-1], batch.GlobalExitRoot) assert.Equal(mainnetExitRoots[len(mainnetExitRoots)-1], batch.MainnetExitRoot) assert.Equal(rollupExitRoots[len(rollupExitRoots)-1], batch.RollupExitRoot) - assert.Equal(common.HexToHash("0x97d1524156ccb46723e5c3c87951da9a390499ba288161d879df1dbc03d49afc"), batch.AccInputHash) + assert.Equal(common.HexToHash(common.Hash{}.String()), batch.AccInputHash) assert.Equal(common.HexToHash("0x22ddb9a356815c3fac1026b6dec5df3124afbadb485c9ba5a3e3398a04b7ba97"), *batch.SendSequencesTxHash) assert.Equal(rpctypes.ArgUint64(1714427009), batch.Timestamp) assert.Equal(true, batch.Closed)