Skip to content

Commit 2d943af

Browse files
Fix syncMonitor's BlockMetadataByNumber response for arb classic block numbers
1 parent c7fc9d4 commit 2d943af

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

execution/gethexec/sync_monitor.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/ethereum/go-ethereum/common"
1010
"github.com/ethereum/go-ethereum/log"
1111

12+
"github.com/offchainlabs/nitro/arbutil"
1213
"github.com/offchainlabs/nitro/execution"
1314
)
1415

@@ -127,12 +128,13 @@ func (s *SyncMonitor) SetConsensusInfo(consensus execution.ConsensusInfo) {
127128
}
128129

129130
func (s *SyncMonitor) BlockMetadataByNumber(blockNum uint64) (common.BlockMetadata, error) {
130-
count, err := s.exec.BlockNumberToMessageIndex(blockNum)
131-
if err != nil {
132-
return nil, err
131+
genesis := s.exec.GetGenesisBlockNumber()
132+
if blockNum < genesis { // Arbitrum classic block
133+
return nil, nil
133134
}
135+
pos := arbutil.MessageIndex(blockNum - genesis)
134136
if s.consensus != nil {
135-
return s.consensus.BlockMetadataAtCount(count + 1)
137+
return s.consensus.BlockMetadataAtCount(pos + 1)
136138
}
137139
log.Debug("FullConsensusClient is not accessible to execution, BlockMetadataByNumber will return nil")
138140
return nil, nil

0 commit comments

Comments
 (0)