Commit c2c69cbd authored by refcell.eth's avatar refcell.eth Committed by GitHub

Merge pull request #8394 from ethereum-optimism/refcell/absolute-prestate-validation

feat(op-challenger): Output Bisection Game Genesis Output Root Fetching
parents 2858533a 74a4849e
......@@ -14,6 +14,7 @@ import (
var (
methodGenesisBlockNumber = "GENESIS_BLOCK_NUMBER"
methodGenesisOutputRoot = "GENESIS_OUTPUT_ROOT"
methodSplitDepth = "SPLIT_DEPTH"
methodL2BlockNumber = "l2BlockNumber"
)
......@@ -55,6 +56,14 @@ func (c *OutputBisectionGameContract) GetBlockRange(ctx context.Context) (presta
return
}
func (c *OutputBisectionGameContract) GetGenesisOutputRoot(ctx context.Context) (common.Hash, error) {
genesisOutputRoot, err := c.multiCaller.SingleCall(ctx, batching.BlockLatest, c.contract.Call(methodGenesisOutputRoot))
if err != nil {
return common.Hash{}, fmt.Errorf("failed to retrieve genesis output root: %w", err)
}
return genesisOutputRoot.GetHash(0), nil
}
func (c *OutputBisectionGameContract) GetSplitDepth(ctx context.Context) (uint64, error) {
splitDepth, err := c.multiCaller.SingleCall(ctx, batching.BlockLatest, c.contract.Call(methodSplitDepth))
if err != nil {
......
......@@ -41,6 +41,15 @@ func TestGetSplitDepth(t *testing.T) {
require.Equal(t, expectedSplitDepth, splitDepth)
}
func TestGetGenesisOutputRoot(t *testing.T) {
stubRpc, contract := setupOutputBisectionGameTest(t)
expectedOutputRoot := common.HexToHash("0x1234")
stubRpc.SetResponse(fdgAddr, methodGenesisOutputRoot, batching.BlockLatest, nil, []interface{}{expectedOutputRoot})
genesisOutputRoot, err := contract.GetGenesisOutputRoot(context.Background())
require.NoError(t, err)
require.Equal(t, expectedOutputRoot, genesisOutputRoot)
}
func TestOutputBisectionGame_UpdateOracleTx(t *testing.T) {
t.Run("Local", func(t *testing.T) {
stubRpc, game := setupOutputBisectionGameTest(t)
......
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