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

Conversation

ganeshvanahalli
Copy link
Contributor

@ganeshvanahalli ganeshvanahalli commented Oct 4, 2024

This PR adds CI steps to generate a InputJSON file corresponding to a block generated in a system test - TestProgramStorage and run arbitrator prover binary on this json file.

Recording of the block inputs' InputJSON file is now customizable via the flag options when running the test.

Flag | Default | Description
--recordBlockInputs.enable | true | "Whether to record block inputs as a json file"
--recordBlockInputs.WithSlug | "$TestName" | "Slug directory for validationInputsWriter"
--recordBlockInputs.WithBaseDir | "~/.arbitrum/validation-inputs/" | "Base directory for validationInputsWriter"
--recordBlockInputs.WithTimestampDirEnabled | true | "Whether to add timestamp directory while recording block inputs"
--recordBlockInputs.WithBlockIdInFileNameEnabled | true | "Whether to record block inputs using test specific block_id"

To test locally do this


$> go test github.com/offchainlabs/nitro/system_tests --run TestProgramStorage$ --count=1 --recordBlockInputs.WithBaseDir="some_valid_path" --recordBlockInputs.WithTimestampDirEnabled=false --recordBlockInputs.WithBlockIdInFileNameEnabled=false
ok  	github.com/offchainlabs/nitro/system_tests	3.268s

$> make build-prover-bin
<... snip lots of output ...>

$> target/bin/prover target/machines/latest/machine.wavm.br -b --json-inputs="some_valid_path/TestProgramStorage/block_input.json"
<... snip lots of output ...>

Resolves NIT-2820

@cla-bot cla-bot bot added the s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA. label Oct 4, 2024
tsahee
tsahee previously requested changes Oct 9, 2024
Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very interesting approach. Took some good thinking..
However, I still prefer my original idea: make a system test that stores block to a path chosen by environment variable (or doesn't, if variable not set), have a ci step that runs this test to create a file, and then a ci step that launches prover with it and makes sure it passes.
The advantages of this approach is we see not only that format passed, but that we succeed in launching a machine from that info. For example, if we change "wavm" target name to something else.
Also, the test in the different approach could easily also test your other pr running a jit machine.
LMK if you disagree.

@ganeshvanahalli
Copy link
Contributor Author

That's a very interesting approach. Took some good thinking.. However, I still prefer my original idea: make a system test that stores block to a path chosen by environment variable (or doesn't, if variable not set), have a ci step that runs this test to create a file, and then a ci step that launches prover with it and makes sure it passes. The advantages of this approach is we see not only that format passed, but that we succeed in launching a machine from that info. For example, if we change "wavm" target name to something else. Also, the test in the different approach could easily also test your other pr running a jit machine. LMK if you disagree.

Makes sense, I agree with your approach, as it guarantees we cover all cases and not just the parsing.

@ganeshvanahalli ganeshvanahalli force-pushed the testcompatibility-goinputjson-rustfiledata branch from 3c23148 to f0d14fb Compare October 10, 2024 08:12
.github/workflows/ci.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@tsahee tsahee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems good, but waiting for @eljobe to approve

system_tests/program_test.go Outdated Show resolved Hide resolved
Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sticking with this. Almost there.

system_tests/program_test.go Outdated Show resolved Hide resolved
system_tests/program_test.go Outdated Show resolved Hide resolved
system_tests/common_test.go Outdated Show resolved Hide resolved
validator/inputs/writer.go Outdated Show resolved Hide resolved
eljobe
eljobe previously approved these changes Oct 15, 2024
Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. One final nit-pick, but thanks for this.

system_tests/program_test.go Outdated Show resolved Hide resolved
eljobe
eljobe previously approved these changes Oct 15, 2024
Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…ibility

Jit prover should accept InputJSON format and execute a full block
Copy link
Member

@eljobe eljobe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eljobe eljobe merged commit 5c1904d into master Oct 16, 2024
16 checks passed
@eljobe eljobe deleted the testcompatibility-goinputjson-rustfiledata branch October 16, 2024 09:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-approved s Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants