Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests to keep server_api json.go in sync with parse_inputs.rs #2723

Merged
merged 29 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
798d717
Add a test to keep server_api json.go in sync with parse_inputs.rs
ganeshvanahalli Oct 4, 2024
115afdc
Jit prover should accept InputJSON format and execute a full block
ganeshvanahalli Oct 9, 2024
3a6e868
fix clippy error
ganeshvanahalli Oct 9, 2024
c4bb3e0
Merge branch 'master' into testcompatibility-goinputjson-rustfiledata
ganeshvanahalli Oct 10, 2024
16f981f
Merge branch 'master' into jitprover-inputjson-compatibility
ganeshvanahalli Oct 10, 2024
be58669
change implimentation and add CI step to execute arbitrator prover us…
ganeshvanahalli Oct 10, 2024
f0d14fb
fix ci step and comment other steps in test(defaults) to speedup veri…
ganeshvanahalli Oct 10, 2024
d50926e
fix gotestsum invocation
ganeshvanahalli Oct 10, 2024
a1cb06d
uncomment CI steps
ganeshvanahalli Oct 10, 2024
94cd9b4
change base branch and address PR comments
ganeshvanahalli Oct 10, 2024
70c5b3f
add ci step to run jit binary on the block input json file
ganeshvanahalli Oct 10, 2024
62d76d0
check if theres a local target mismatch on go and rust side
ganeshvanahalli Oct 10, 2024
93fca3d
add more debug info
ganeshvanahalli Oct 10, 2024
5e355bc
check if jit proving succeeds in CI
ganeshvanahalli Oct 10, 2024
7259ae1
remove debug statements and comments
ganeshvanahalli Oct 10, 2024
bb5e8b7
address PR comments
ganeshvanahalli Oct 10, 2024
034a504
Merge branch 'master' into testcompatibility-goinputjson-rustfiledata
ganeshvanahalli Oct 11, 2024
f83a10f
use inputs.Writer to generate the json file
ganeshvanahalli Oct 11, 2024
05be76e
use inputs.Writer to generate the json file
ganeshvanahalli Oct 11, 2024
37551f3
resolve conflicts
ganeshvanahalli Oct 11, 2024
ceb785e
typo fix
ganeshvanahalli Oct 11, 2024
5aa0230
Merge branch 'testcompatibility-goinputjson-rustfiledata' into jitpro…
ganeshvanahalli Oct 11, 2024
4a7ff01
Merge branch 'master' into testcompatibility-goinputjson-rustfiledata
ganeshvanahalli Oct 15, 2024
eb2c5be
address PR comments
ganeshvanahalli Oct 15, 2024
2b1d7a2
prioritize test flag over the test's decision to record a block
ganeshvanahalli Oct 15, 2024
80872b4
Merge branch 'master' into testcompatibility-goinputjson-rustfiledata
ganeshvanahalli Oct 15, 2024
2f0eefb
merge upstream and resolve conflicts
ganeshvanahalli Oct 15, 2024
c5087d9
Merge pull request #2730 from OffchainLabs/jitprover-inputjson-compat…
eljobe Oct 15, 2024
92bf520
Merge branch 'master' into testcompatibility-goinputjson-rustfiledata
ganeshvanahalli Oct 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
ganeshvanahalli marked this conversation as resolved.
Show resolved Hide resolved

- 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'
Expand Down
12 changes: 5 additions & 7 deletions system_tests/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -1719,7 +1718,7 @@ 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 prover to validate a block.
func recordBlock(t *testing.T, block uint64, builder *NodeBuilder) {
func recordBlock(t *testing.T, block uint64, builder *NodeBuilder, blockInputJSONPath string) {
t.Helper()
ctx := builder.ctx
inboxPos := arbutil.MessageIndex(block)
Expand All @@ -1733,15 +1732,14 @@ func recordBlock(t *testing.T, block uint64, builder *NodeBuilder) {
break
}
}
validationInputsWriter, err := inputs.NewWriter(inputs.WithSlug(t.Name()))
Require(t, err)
inputJson, err := builder.L2.ConsensusNode.StatelessBlockValidator.ValidationInputsAt(ctx, inboxPos, rawdb.TargetWavm)
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 {
Expand Down
5 changes: 4 additions & 1 deletion system_tests/program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,10 @@ func storageTest(t *testing.T, jit bool) {

// Captures a block_input_<id>.json file for the block that included the
// storage write transaction.
recordBlock(t, receipt.BlockNumber.Uint64(), builder)
blockInputJSONPath := os.Getenv("BLOCK_INPUT_JSON_PATH")
if blockInputJSONPath != "" {
recordBlock(t, receipt.BlockNumber.Uint64(), builder, blockInputJSONPath)
}
}

func TestProgramTransientStorage(t *testing.T) {
Expand Down
Loading