diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a944f08f40..dcb3b9f422 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -169,6 +169,17 @@ jobs: run: | echo "Running redis tests" >> full.log TEST_REDIS=redis://localhost:6379/0 gotestsum --format short-verbose -- -p 1 -run TestRedis ./arbnode/... ./system_tests/... -coverprofile=coverage-redis.txt -covermode=atomic -coverpkg=./... + + - name: create block input json file + if: matrix.test-mode == 'defaults' + run: | + BLOCK_INPUT_JSON_PATH="${{ github.workspace }}/target/block_input.json" gotestsum --format short-verbose -- -run TestProgramStorage$ ./system_tests/... --count 1 + + - name: run arbitrator prover on block input json + if: matrix.test-mode == 'defaults' + run: | + make build-prover-bin + target/bin/prover target/machines/latest/machine.wavm.br -b --json-inputs="${{ github.workspace }}/target/block_input.json" - name: run challenge tests if: matrix.test-mode == 'challenge' diff --git a/arbnode/api.go b/arbnode/api.go index 2dabd41bff..8afb78770b 100644 --- a/arbnode/api.go +++ b/arbnode/api.go @@ -59,5 +59,5 @@ func (a *BlockValidatorDebugAPI) ValidateMessageNumber( func (a *BlockValidatorDebugAPI) ValidationInputsAt(ctx context.Context, msgNum hexutil.Uint64, target ethdb.WasmTarget, ) (server_api.InputJSON, error) { - return a.val.ValidationInputsAt(ctx, arbutil.MessageIndex(msgNum), target) + return a.val.ValidationInputsAt(ctx, arbutil.MessageIndex(msgNum), []ethdb.WasmTarget{target}) } diff --git a/staker/stateless_block_validator.go b/staker/stateless_block_validator.go index 9257c5582a..786cf3aa94 100644 --- a/staker/stateless_block_validator.go +++ b/staker/stateless_block_validator.go @@ -511,12 +511,12 @@ func (v *StatelessBlockValidator) ValidateResult( return true, &entry.End, nil } -func (v *StatelessBlockValidator) ValidationInputsAt(ctx context.Context, pos arbutil.MessageIndex, target ethdb.WasmTarget) (server_api.InputJSON, error) { +func (v *StatelessBlockValidator) ValidationInputsAt(ctx context.Context, pos arbutil.MessageIndex, targets []ethdb.WasmTarget) (server_api.InputJSON, error) { entry, err := v.CreateReadyValidationEntry(ctx, pos) if err != nil { return server_api.InputJSON{}, err } - input, err := entry.ToInput([]ethdb.WasmTarget{target}) + input, err := entry.ToInput(targets) if err != nil { return server_api.InputJSON{}, err } diff --git a/system_tests/common_test.go b/system_tests/common_test.go index 2560b7b73f..287882655f 100644 --- a/system_tests/common_test.go +++ b/system_tests/common_test.go @@ -36,7 +36,6 @@ import ( "github.com/offchainlabs/nitro/util/headerreader" "github.com/offchainlabs/nitro/util/redisutil" "github.com/offchainlabs/nitro/util/signature" - "github.com/offchainlabs/nitro/validator/inputs" "github.com/offchainlabs/nitro/validator/server_api" "github.com/offchainlabs/nitro/validator/server_common" "github.com/offchainlabs/nitro/validator/valnode" @@ -1718,8 +1717,8 @@ func logParser[T any](t *testing.T, source string, name string) func(*types.Log) // recordBlock writes a json file with all of the data needed to validate a block. // -// This can be used as an input to the arbitrator's prover (target=rawdb.TargetWavm) and jit (target=rawdb.LocalTarget()) binaries to validate a block. -func recordBlock(t *testing.T, block uint64, builder *NodeBuilder, target ethdb.WasmTarget) { +// This can be used as an input to the arbitrator prover to validate a block. +func recordBlock(t *testing.T, block uint64, builder *NodeBuilder, targets []ethdb.WasmTarget, blockInputJSONPath string) { t.Helper() ctx := builder.ctx inboxPos := arbutil.MessageIndex(block) @@ -1733,15 +1732,14 @@ func recordBlock(t *testing.T, block uint64, builder *NodeBuilder, target ethdb. break } } - validationInputsWriter, err := inputs.NewWriter(inputs.WithSlug(t.Name())) - Require(t, err) - inputJson, err := builder.L2.ConsensusNode.StatelessBlockValidator.ValidationInputsAt(ctx, inboxPos, target) + inputJson, err := builder.L2.ConsensusNode.StatelessBlockValidator.ValidationInputsAt(ctx, inboxPos, targets) if err != nil { Fatal(t, "failed to get validation inputs", block, err) } - if err := validationInputsWriter.Write(&inputJson); err != nil { - Fatal(t, "failed to write validation inputs", block, err) - } + contents, err := json.Marshal(inputJson) + Require(t, err) + err = os.WriteFile(blockInputJSONPath, contents, 0600) + Require(t, err) } func populateMachineDir(t *testing.T, cr *github.ConsensusRelease) string { diff --git a/system_tests/program_test.go b/system_tests/program_test.go index 6c478735fa..92aeddaf53 100644 --- a/system_tests/program_test.go +++ b/system_tests/program_test.go @@ -424,8 +424,11 @@ func storageTest(t *testing.T, jit bool) { validateBlocks(t, 2, jit, builder) // Captures a block_input_.json file for the block that included the - // storage write transaction. - recordBlock(t, receipt.BlockNumber.Uint64(), builder, rawdb.TargetWavm) + // storage write transaction. Include wasm targets necessary for arbitrator prover and jit binaries + blockInputJSONPath := os.Getenv("BLOCK_INPUT_JSON_PATH") + if blockInputJSONPath != "" { + recordBlock(t, receipt.BlockNumber.Uint64(), builder, []ethdb.WasmTarget{rawdb.TargetWavm, rawdb.LocalTarget()}, blockInputJSONPath) + } } func TestProgramTransientStorage(t *testing.T) { @@ -492,12 +495,6 @@ func transientStorageTest(t *testing.T, jit bool) { } validateBlocks(t, 7, jit, builder) - - // Captures a block_input_.json file for the block that included the storage - // related transaction. Has userwasms for WasmTarget recognized by jit binary - receipt, err := EnsureTxSucceeded(ctx, l2client, tx) - Require(t, err) - recordBlock(t, receipt.BlockNumber.Uint64(), builder, rawdb.LocalTarget()) } func TestProgramMath(t *testing.T) {