From 928c04a71eb29a46c8c6815f77143be75eb48450 Mon Sep 17 00:00:00 2001 From: Ganesh Vanahalli Date: Fri, 15 Mar 2024 16:13:56 -0500 Subject: [PATCH 1/2] Add test to verify if arbBlockHash on pending block returns latest --- contracts | 2 +- go-ethereum | 2 +- system_tests/pendingblock_test.go | 54 +++++++++++++++++++++++++++++++ system_tests/rpc_test.go | 22 ------------- 4 files changed, 56 insertions(+), 24 deletions(-) create mode 100644 system_tests/pendingblock_test.go diff --git a/contracts b/contracts index 7c46876077..11e643e5c5 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 7c46876077c6353c7ebdf9cd364710d357fa3914 +Subproject commit 11e643e5c52cfb91a6e330894bed48e5e10b272c diff --git a/go-ethereum b/go-ethereum index 09ec05c142..8f491a030a 160000 --- a/go-ethereum +++ b/go-ethereum @@ -1 +1 @@ -Subproject commit 09ec05c142b0430fa7b0d270f80ef423f1bb8a93 +Subproject commit 8f491a030ac7a5bac886a050037d7a893ccff865 diff --git a/system_tests/pendingblock_test.go b/system_tests/pendingblock_test.go new file mode 100644 index 0000000000..e328ca1112 --- /dev/null +++ b/system_tests/pendingblock_test.go @@ -0,0 +1,54 @@ +// Copyright 2021-2022, Offchain Labs, Inc. +// For license information, see https://github.com/nitro/blob/master/LICENSE + +package arbtest + +import ( + "context" + "testing" + "time" + + "github.com/offchainlabs/nitro/solgen/go/mocksgen" +) + +func TestPendingBlockTimeAndNumberAdvance(t *testing.T) { + t.Parallel() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + builder := NewNodeBuilder(ctx).DefaultConfig(t, true) + cleanup := builder.Build(t) + defer cleanup() + + auth := builder.L2Info.GetDefaultTransactOpts("Faucet", ctx) + + _, _, testTimeAndNr, err := mocksgen.DeployPendingBlkTimeAndNrAdvanceCheck(&auth, builder.L2.Client) + Require(t, err) + + time.Sleep(1 * time.Second) + + _, err = testTimeAndNr.IsAdvancing(&auth) + Require(t, err) +} + +func TestPendingBlockArbBlockHashReturnsLatest(t *testing.T) { + t.Parallel() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + builder := NewNodeBuilder(ctx).DefaultConfig(t, true) + cleanup := builder.Build(t) + defer cleanup() + + auth := builder.L2Info.GetDefaultTransactOpts("Faucet", ctx) + + _, _, pendingBlk, err := mocksgen.DeployPendingBlkTimeAndNrAdvanceCheck(&auth, builder.L2.Client) + Require(t, err) + + header, err := builder.L2.Client.HeaderByNumber(ctx, nil) + Require(t, err) + + _, err = pendingBlk.CheckArbBlockHashReturnsLatest(&auth, header.Hash()) + Require(t, err) + +} diff --git a/system_tests/rpc_test.go b/system_tests/rpc_test.go index 357cb8e4c1..511a608e67 100644 --- a/system_tests/rpc_test.go +++ b/system_tests/rpc_test.go @@ -7,10 +7,8 @@ import ( "context" "path/filepath" "testing" - "time" "github.com/ethereum/go-ethereum/ethclient" - "github.com/offchainlabs/nitro/solgen/go/mocksgen" ) func TestIpcRpc(t *testing.T) { @@ -27,23 +25,3 @@ func TestIpcRpc(t *testing.T) { _, err := ethclient.Dial(ipcPath) Require(t, err) } - -func TestPendingBlockTimeAndNumberAdvance(t *testing.T) { - t.Parallel() - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - builder := NewNodeBuilder(ctx).DefaultConfig(t, true) - cleanup := builder.Build(t) - defer cleanup() - - auth := builder.L2Info.GetDefaultTransactOpts("Faucet", ctx) - - _, _, testTimeAndNr, err := mocksgen.DeployPendingBlkTimeAndNrAdvanceCheck(&auth, builder.L2.Client) - Require(t, err) - - time.Sleep(1 * time.Second) - - _, err = testTimeAndNr.IsAdvancing(&auth) - Require(t, err) -} From f965fb83ea2729fe376d41288a9d93ae09998c1e Mon Sep 17 00:00:00 2001 From: Ganesh Vanahalli Date: Mon, 18 Mar 2024 10:46:31 -0500 Subject: [PATCH 2/2] update contracts pin --- contracts | 2 +- system_tests/pendingblock_test.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/contracts b/contracts index 11e643e5c5..1cab72ff3d 160000 --- a/contracts +++ b/contracts @@ -1 +1 @@ -Subproject commit 11e643e5c52cfb91a6e330894bed48e5e10b272c +Subproject commit 1cab72ff3dfcfe06ceed371a9db7a54a527e3bfb diff --git a/system_tests/pendingblock_test.go b/system_tests/pendingblock_test.go index e328ca1112..dc21bca525 100644 --- a/system_tests/pendingblock_test.go +++ b/system_tests/pendingblock_test.go @@ -50,5 +50,4 @@ func TestPendingBlockArbBlockHashReturnsLatest(t *testing.T) { _, err = pendingBlk.CheckArbBlockHashReturnsLatest(&auth, header.Hash()) Require(t, err) - }