-
Notifications
You must be signed in to change notification settings - Fork 435
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
Validation Inputs wiring #2604
Open
eljobe
wants to merge
34
commits into
master
Choose a base branch
from
inputs-wiring
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Validation Inputs wiring #2604
+783
−469
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
There are several changes in this commit. 1. Move the `parse_inputs.rs` and `prepare.rs` files from the benchbin package to the prover. This enables the prover to ingest most of the information it needs from the `block_inputs_<id>.json` file. 2. Add a `--json-inputs` flag to the `prover` bin which obviates several competing flags preferring to read the data from the json. 3. Write the json file to disk in the working directory before the arbitrator spawner writes the `run_prover.sh` file which is attempting to make a similar validaiton easy to reproduce. 4. Introduce a new `recordBlock` method to the tests suite which can be called once a block has been recorded to L1. 5. Wire the call to `recordBlock` into the `TestProgramStorage` to be sure to capture a block that actually uses a Stylus contract so that the prover can be shown to work with that block as well. 6. Enhance the `parse_inputs.rs` to know how to handle the `UserWasms` deserialization. To reproduce the failure state at this commit: 1. make clean && make all 2. go test -timeout 10m -tags challengetest -run ^TestProgramStorage$ github.com/offchainlabs/nitro/system_tests 3. Observe, there are now two new files in `ls system_tests/block_inputs_{2,5}.json` 4. target/bin/prover target/machines/latest/machine.wavm.br -b --json-inputs system_tests/block_inputs_5.json 5. The error is: ``` thread 'main' panicked at prover/src/machine.rs:690:58: unknown dictionary: TryFromPrimitiveError { number: 10 } ``` If you make changes to the rust code, you can quickly rebuild and install with: ``` cargo build --manifest-path arbitrator/Cargo.toml --release --bin prover && install arbitrator/target/release/prover target/bin/prover ```
This change also: 1. Documents the `parse_inputs.rs` file in an attempt to give context to why the deserialization is special. 2. Hardcodes the architecture to `wasm` when recording ValidationInputs for use with the prover. Previously, the `jit` validator would use the go system architecture, and the `arbitrator` validator would use `wavm`. 3. Switches the `TestStorageProgram` test back to the `jit` validator. Note: As of this commit, there is still a small problem that when running the validator using the json inputs, it does not come up with the same end has as `entry.End.Hash`.
This makes it easier to visually confirm the expected outcome if a human is looking at the output of the prover and knows what the expected end global state should be.
The thrid one is left around as an example of how to use the new method.
1. Remove the part of the writeToFile method on ArbitratorSpawner which was writing the bash scripts. (TODO: Write the block_inputs_<id>.json files somewhere better.) 2. Drop the expOut from the WriteToFile signature since none of the implementations need it any more. 3. Rename some unused function arguments to "_".
At this point the location of the output file is hardcoded to be in the `$HOME/.arbitrum` directory. Hopefully, this will be okay.
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
Aug 22, 2024
Reviewers, please tell me the "right" way to ensure that the transaction is visible in the L1. I don't like the idea of adding sleeps in tests to ensure that some event has occurred. Is there some RPC I can call or event I can subscribe to that I can then wait for before proceeding?
eljobe
commented
Aug 23, 2024
tsahee
reviewed
Aug 29, 2024
If the inbox is lagging behind the message, the node won't be able to create a validation entry for it.
Meant to do this in the previous commit.
This change attempts to make the location for writing the json file more flexibly configurable by the clients without making it difficult to put the data in a resonable spot by default.
tsahee
requested changes
Sep 17, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
initial
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
s
Automatically added by the CLA bot if the creator of a PR is registered as having signed the CLA.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces the
validation_writeToFile
rpc call with anarbdebug_validationInputsAt
rpc call.Rather than actually writing the file directly, the rpc call returns a JSON representation of the validation inputs, and leaves it to the caller to write the JSON to disk.
This change also calls the new ValidationInputsAt method from a test using a new
recordBlock
function in common_test.go and writes the JSON file directly when the BlockValidator fails to validate a block.The arbitrator prover is also updated to be able to parse the JSON inputs instead of getting all of the options from the command-line.
Here's an example of how to use the feature:
Fixes: https://linear.app/offchain-labs/issue/NIT-2519/create-a-simple-way-to-record-system-tests-and-specific-blocks-into