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

chore: refactor foreign call executors #6659

Merged
merged 2 commits into from
Dec 2, 2024

Conversation

TomAFrench
Copy link
Member

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:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist*

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@TomAFrench TomAFrench added this pull request to the merge queue Dec 2, 2024
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;
Copy link
Contributor

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.

Copy link
Member Author

@TomAFrench TomAFrench Dec 2, 2024

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.

Merged via the queue into master with commit f0c5fe9 Dec 2, 2024
49 checks passed
@TomAFrench TomAFrench deleted the tf/refactor-foreign-call-executors branch December 2, 2024 15:29

#[derive(Debug)]
pub(super) struct RPCForeignCallExecutor {
/// A randomly generated id for this `DefaultForeignCallExecutor`.
Copy link
Contributor

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`.
Copy link
Contributor

Choose a reason for hiding this comment

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

And this

TomAFrench added a commit that referenced this pull request Dec 2, 2024
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants