-
Notifications
You must be signed in to change notification settings - Fork 248
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
feat(cli): Log and replay oracle transcript #7417
base: master
Are you sure you want to change the base?
Conversation
… 7381-use-artifact-fs
…xec-oracle-transcript
…tracts, but just need to recompile
I'm about to start reviewing this PR, but why does it only make sense with a single test? I know oracle calls from multiple tests might lead to different results, but I was wondering if we could key them under the test name. |
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.
Looks good! I guess, if it's possible, we could support running multiple tests in a future PR (is it an error right now if you run it with multiple tests?)
Only because I didn't spend any effort to delineate them:
|
I didn't want to change the signature of |
Description
Problem*
Resolves #7379 and #7382
Summary*
NARGO_TEST_FOREIGN_CALL_LOG
tonargo test
which can be used to log the foreign calls made by a test either tostdout
or a file. It only makes sense with a single test. The format of the log is JSON Line with acall
andresponse
as it appears in the JSON-RPC.LoggingForeignCallExecutor
that prints foreign calls to a transcript log.ReplayForeignCallExecutor
that deserialises the transcript, and implements the handler by popping off the next call, comparing the logged function name and inputs, rejecting any unexpected call to avoid confusion, then returns the logged response.--oracle-file
tonoir-execute
andnargo execute
to be able to point at the transcriptnoir-execute
to use theReplayForeignCallExecutor
as the final layer in the foreign call executor stack, if the file is present.examples/oracle_transcript
based ontest_programs/noir_test_success/mock_oracle
, which callsnargo test
to capture a transcript and verify the expected input/output, thennargo execute
with the transcript file to verify the expectedreturn
value inProver.toml
. The oracle file is checked in for reference.noir-execute
to demonstrate how it's used.noir-execute
artifact on CI to be able to use it in the test script.Additional Context
Here's a link to show the new example passing on CI: https://github.com/noir-lang/noir/actions/runs/13394747019/job/37411091682
The format in this PR, or something similar, will be the one used in AztecProtocol/aztec-packages#11855
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.