Commit 2a63c34b authored by Andreas Bigger's avatar Andreas Bigger

fix: compute local output root with op-node exported function

parent 95793fc7
...@@ -19,6 +19,7 @@ import ( ...@@ -19,6 +19,7 @@ import (
"github.com/ethereum-optimism/optimism/op-chain-ops/crossdomain" "github.com/ethereum-optimism/optimism/op-chain-ops/crossdomain"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis" "github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/util" "github.com/ethereum-optimism/optimism/op-chain-ops/util"
"github.com/ethereum-optimism/optimism/op-node/rollup"
"github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
...@@ -933,14 +934,12 @@ func createOutput( ...@@ -933,14 +934,12 @@ func createOutput(
LatestBlockhash: header.Hash(), LatestBlockhash: header.Hash(),
} }
// TODO(mark): import the function from `op-node` to compute the hash // Compute the output root locally
// instead of doing this. Will update when testing against mainnet. l2OutputRoot, err := rollup.ComputeL2OutputRoot(&outputRootProof)
localOutputRootHash := crypto.Keccak256Hash( localOutputRootHash := common.Hash(l2OutputRoot)
outputRootProof.Version[:], if err != nil {
outputRootProof.StateRoot[:], return nil, bindings.TypesOutputRootProof{}, nil, err
outputRootProof.MessagePasserStorageRoot[:], }
outputRootProof.LatestBlockhash[:],
)
// ensure that the locally computed hash matches // ensure that the locally computed hash matches
if l2Output.OutputRoot != localOutputRootHash { if l2Output.OutputRoot != localOutputRootHash {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment