-
Notifications
You must be signed in to change notification settings - Fork 206
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
chore: refactor foreign call executors #6659
Conversation
assert!(ForeignCall::lookup(&mock_oracle_name).is_none()); | ||
let id = self.last_mock_id; | ||
self.mocked_responses.push(MockedCall::new(id, mock_oracle_name)); | ||
self.last_mock_id += 1; |
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.
It's not obvious to me why the mocks aren't stored in a BTreeMap
indexed by ID. I looks like we won't have repeated IDs; I thought there might be multiple single-use responses lined up for the same ID, but not sure that's a use case.
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.
Our testing of mocked oracle calls is woefully incomplete atm so this may not be the ideal implementation. Let's handle this in a followup.
|
||
#[derive(Debug)] | ||
pub(super) struct RPCForeignCallExecutor { | ||
/// A randomly generated id for this `DefaultForeignCallExecutor`. |
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.
Should be RPCForeignCallExecutor
/// A randomly generated id for this `DefaultForeignCallExecutor`. | ||
/// | ||
/// This is used so that a single `external_resolver` can distinguish between requests from multiple | ||
/// instantiations of `DefaultForeignCallExecutor`. |
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.
And this
…compiler * master: chore: update noir-bench-report version (#6675) fix: Prevent hoisting binary instructions which can overflow (#6672) feat(ssa): Hoisting of array get using known induction variable maximum (#6639) feat: better error message when trying to invoke struct function field (#6661) feat: add memory report into the CI (#6630) feat: allow ignoring test failures from foreign calls (#6660) chore: refactor foreign call executors (#6659) fix: correct signed integer handling in `noirc_abi` (#6638) fix: allow multiple `_` parameters, and disallow `_` as an expression you can read from (#6657) feat: allow filtering which SSA passes are printed (#6636) fix: use correct type for attribute arguments (#6640) fix: always return an array of `u8`s when simplifying `Intrinsic::ToRadix` calls (#6663) feat(ssa): Option to set the maximum acceptable Brillig bytecode increase in unrolling (#6641)
Description
Problem*
Resolves
Summary*
This is a refactor to make it easier to implement #6643. We're probably going to want to have a new foreign call handler which we use for testing so I'd like to break these up a bit.
See #6643 (comment)
As a bonus it becomes way easier to add a bunch of tests for how we deal with mocked foreign calls and external resolvers, etc.
Additional Context
Documentation*
Check one:
PR Checklist*
cargo fmt
on default settings.