-
Notifications
You must be signed in to change notification settings - Fork 275
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(nargo): Mock oracle resolver #6070
Conversation
Adds a `--mock-oracle-resolver` option to nargo, that responds to all oracle requests with a single zero-value field. Useful for allowing noop oracle calls, such as debug-log, when running circuits in aztec-packages, without breaking tests run via `nargo test`. Co-authored-by: Nicolás Venturo <nicolas.venturo@gmail.com>
ca3fb2f
to
c34f073
Compare
Benchmark resultsNo metrics with a significant change found. Detailed resultsAll benchmarks are run on txs on the This benchmark source data is available in JSON format on S3 here. L2 block published to L1Each column represents the number of txs on an L2 block published to L1.
L2 chain processingEach column represents the number of blocks on the L2 chain where each block has 16 txs.
Circuits statsStats on running time and I/O sizes collected for every circuit run across all benchmarks.
Tree insertion statsThe duration to insert a fixed batch of leaves into each tree type.
MiscellaneousTransaction sizes based on how many contract classes are registered in the tx.
Transaction size based on fee payment method
Transaction processing duration by data writes.
|
Feel free to document the feature as a part of / following the PR on the Oracles doc page. A nice-to-have if it's useful for Aztec devs; not strictly necessary (as Oracles is considered an experimental feature that without complete documentation for general Noir devs). |
@Savio-Sou done here |
} | ||
} | ||
|
||
pub fn none() -> Self { |
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.
can you move this to a Default
impl
?
impl JsonRpcExternalResolver { | ||
fn new(resolver_url: &str) -> Self { | ||
let mut transport_builder = | ||
Builder::new().url(resolver_url).expect("Invalid oracle resolver URL"); |
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.
can this be a CliError
?
@@ -29,3 +29,5 @@ unconstrained fn get_number_sequence(_size: Field) -> [Field] {} | |||
``` | |||
|
|||
The timeout for when using an external RPC oracle resolver can be set with the `NARGO_FOREIGN_CALL_TIMEOUT` environment variable. This timeout is in units of milliseconds. | |||
|
|||
Alternatively, a Noir program can be run with a mock oracle set up, which will default to answering every oracle call with a single zero-value `Field`. Note that this will work only for oracle calls that expect a return value of a single field element. |
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.
which will default to answering every oracle call
-> which answers every oracle call
single field element
-> single Field element
perhaps note that the specific argument can be found by running nargo --help
?
let encoded_params: Vec<_> = call.inputs.iter().map(build_json_rpc_arg).collect(); | ||
let request = self.client.build_request(call.function.as_str(), &encoded_params); | ||
let response = self.client.send_request(request).expect("Failed to send request"); | ||
response.result().expect("Failed to parse response") |
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.
can you change these expect
's back to the errors with ?
/Try
's?
the error type will probably need to be added to ExternalResolver
Spoke on this topic in slack. Conclusion is that:
|
Superseded by noir-lang/noir#4959 |
Adds a
--mock-oracle-resolver
option to nargo, that responds to all oracle requests with a single zero-value field. Useful for allowing noop oracle calls, such as debug-log, when running circuits in aztec-packages, without breaking tests run vianargo test
.