Skip to content

Commit

Permalink
use VerifyStorageRoot on OutputV0AtBlock query instead
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo committed Nov 29, 2024
1 parent 160a287 commit e810b25
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions op-service/sources/l2_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,14 +182,14 @@ func (s *L2Client) OutputV0AtBlock(ctx context.Context, blockHash common.Hash) (

proof, err := s.GetProof(ctx, predeploys.L2ToL1MessagePasserAddr, []common.Hash{}, blockHash.String())
if err != nil {
return nil, fmt.Errorf("failed to get contract proof at block %s: %w", blockHash, err)
return nil, fmt.Errorf("failed to get contract proof at address %s block %s: %w ", predeploys.L2ToL1MessagePasserAddr, blockHash, err)
}
if proof == nil {
return nil, fmt.Errorf("proof %w", ethereum.NotFound)
}
// make sure that the proof (including storage hash) that we retrieved is correct by verifying it against the state-root
if err := proof.Verify(head.Root()); err != nil {
return nil, fmt.Errorf("invalid withdrawal root hash, state root was %s: %w", head.Root(), err)
if err := proof.VerifyStorageRoot(); err != nil {
return nil, fmt.Errorf("invalid withdrawal storage proof, root was %s: %w", proof.StorageHash, err)
}
stateRoot := head.Root()
return &eth.OutputV0{
Expand Down

0 comments on commit e810b25

Please sign in to comment.