@@ -73,39 +73,49 @@ func (i *Interop) verifyInteropMessages(ts uint64, blocksAtTimestamp blockPerCha
7373 }
7474
7575 for chainID , expectedBlock := range blocksAtTimestamp {
76- db , ok := i .logsDBs [chainID ]
77- if ! ok {
78- // Skip chains that we don't have a logsDB for
79- // This can happen if blocksAtTimestamp includes chains not registered with the interop activity
80- continue
81- }
76+ var (
77+ blockRef eth.BlockRef
78+ execMsgs map [uint32 ]* types.ExecutingMessage
79+ err error
80+ )
81+ if frontierBlock , ok := i .frontierView .block (chainID ); ok {
82+ blockRef = frontierBlock .ref
83+ execMsgs = frontierBlock .execMsgs
84+ } else {
85+ db , ok := i .logsDBs [chainID ]
86+ if ! ok {
87+ // Skip chains that we don't have a logsDB for
88+ // This can happen if blocksAtTimestamp includes chains not registered with the interop activity
89+ continue
90+ }
8291
83- // Get the block from the logsDB
84- blockRef , _ , execMsgs , err := db .OpenBlock (expectedBlock .Number )
85- if err != nil {
86- // OpenBlock fails for the first block in the DB because it tries to find the parent.
87- // Handle this by checking if this is the first sealed block and using FirstSealedBlock instead.
88- if errors .Is (err , types .ErrSkipped ) {
89- firstBlock , firstErr := db .FirstSealedBlock ()
90- if firstErr != nil {
91- return Result {}, fmt .Errorf ("chain %s: failed to open block %d and failed to get first block: %w" , chainID , expectedBlock .Number , err )
92- }
93- if firstBlock .Number == expectedBlock .Number {
94- // This is the first block in the logsDB. Use FirstSealedBlock info.
95- // The first block has no executing messages (since we can't verify them without prior data).
96- if firstBlock .Hash != expectedBlock .Hash {
97- i .log .Warn ("first block hash mismatch" ,
98- "chain" , chainID ,
99- "expected" , expectedBlock .Hash ,
100- "got" , firstBlock .Hash ,
101- )
102- result .InvalidHeads [chainID ] = expectedBlock
92+ // Get the block from the logsDB
93+ blockRef , _ , execMsgs , err = db .OpenBlock (expectedBlock .Number )
94+ if err != nil {
95+ // OpenBlock fails for the first block in the DB because it tries to find the parent.
96+ // Handle this by checking if this is the first sealed block and using FirstSealedBlock instead.
97+ if errors .Is (err , types .ErrSkipped ) {
98+ firstBlock , firstErr := db .FirstSealedBlock ()
99+ if firstErr != nil {
100+ return Result {}, fmt .Errorf ("chain %s: failed to open block %d and failed to get first block: %w" , chainID , expectedBlock .Number , err )
101+ }
102+ if firstBlock .Number == expectedBlock .Number {
103+ // This is the first block in the logsDB. Use FirstSealedBlock info.
104+ // The first block has no executing messages (since we can't verify them without prior data).
105+ if firstBlock .Hash != expectedBlock .Hash {
106+ i .log .Warn ("first block hash mismatch" ,
107+ "chain" , chainID ,
108+ "expected" , expectedBlock .Hash ,
109+ "got" , firstBlock .Hash ,
110+ )
111+ result .InvalidHeads [chainID ] = expectedBlock
112+ }
113+ result .L2Heads [chainID ] = expectedBlock
114+ continue
103115 }
104- result .L2Heads [chainID ] = expectedBlock
105- continue
106116 }
117+ return Result {}, fmt .Errorf ("chain %s: failed to open block %d: %w" , chainID , expectedBlock .Number , err )
107118 }
108- return Result {}, fmt .Errorf ("chain %s: failed to open block %d: %w" , chainID , expectedBlock .Number , err )
109119 }
110120
111121 // Verify the block hash matches what we expect
@@ -177,6 +187,14 @@ func (i *Interop) verifyExecutingMessage(executingChain eth.ChainID, executingTi
177187 Checksum : execMsg .Checksum ,
178188 }
179189
190+ // Same-timestamp dependencies may live in the current frontier view rather
191+ // than accepted-history logsDB.
192+ if execMsg .Timestamp == executingTimestamp {
193+ if _ , ok := i .frontierView .contains (execMsg .ChainID , query ); ok {
194+ return nil
195+ }
196+ }
197+
180198 // Check if the initiating message exists in the source chain's logsDB
181199 _ , err := sourceDB .Contains (query )
182200 return err
0 commit comments