Skip to content

Commit

Permalink
revert op-program change
Browse files Browse the repository at this point in the history
will move to a separate PR
  • Loading branch information
Vinod Damle committed Nov 13, 2024
1 parent c87f4ca commit c6b60f8
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions op-program/client/l2/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,15 @@ func (o *OracleEngine) L2OutputRoot(l2ClaimBlockNum uint64) (eth.Bytes32, error)
if outBlock == nil {
return eth.Bytes32{}, fmt.Errorf("failed to get L2 block at %d", l2ClaimBlockNum)
}
var storageRoot [32]byte
// if Isthmus is active, we don't need to compute the storage root, we can use the header
// withdrawalRoot which is the storage root for the L2ToL1MessagePasser contract
if o.rollupCfg.IsIsthmus(outBlock.Time) {
storageRoot = *outBlock.WithdrawalsHash
} else {
stateDB, err := o.backend.StateAt(outBlock.Root)
if err != nil {
return eth.Bytes32{}, fmt.Errorf("failed to open L2 state db at block %s: %w", outBlock.Hash(), err)
}
withdrawalsTrie, err := stateDB.OpenStorageTrie(predeploys.L2ToL1MessagePasserAddr)
if err != nil {
return eth.Bytes32{}, fmt.Errorf("withdrawals trie unavailable at block %v: %w", outBlock.Hash(), err)
}
storageRoot = withdrawalsTrie.Hash()
}
return rollup.ComputeL2OutputRootV0(eth.HeaderBlockInfo(outBlock), storageRoot)
stateDB, err := o.backend.StateAt(outBlock.Root)
if err != nil {
return eth.Bytes32{}, fmt.Errorf("failed to open L2 state db at block %s: %w", outBlock.Hash(), err)
}
withdrawalsTrie, err := stateDB.OpenStorageTrie(predeploys.L2ToL1MessagePasserAddr)
if err != nil {
return eth.Bytes32{}, fmt.Errorf("withdrawals trie unavailable at block %v: %w", outBlock.Hash(), err)
}
return rollup.ComputeL2OutputRootV0(eth.HeaderBlockInfo(outBlock), withdrawalsTrie.Hash())
}

func (o *OracleEngine) GetPayload(ctx context.Context, payloadInfo eth.PayloadInfo) (*eth.ExecutionPayloadEnvelope, error) {
Expand Down

0 comments on commit c6b60f8

Please sign in to comment.