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

refactor!: nuke top level await #10128

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from

Conversation

olehmisar
Copy link
Contributor

@olehmisar olehmisar commented Nov 21, 2024

Closes #9959

May be postponed if #9987 makes performance acceptable.

Removed top-level await. BarretenbergSync.getSingleton and all functions and methods that depend on it are now marked as async.

Changes

  • FunctionSelector.equals cannot accept string and { name: string; parameters: ABIParameter[] } anymore. Otherwise it has to be async as well
  • EntrypointPayload, AppEntrypointPayload, and FeeEntrypointPayload are worth taking closer look at as they were changed more than other classes
  • Carefully review orchestrator.ts in prover-client because i have no idea what that code is
  • await wallet.setPublicAuthWit({ caller, action }, true).send().wait() is now await (await wallet.setPublicAuthWit({ caller, action }, true).send()).wait()
  • contract.methods.xxx.selector now returns a Promise<FunctionSelector>

There may be bugs introduced

  • if functions that previously returned boolean were changed to return Promise and now they always return truthy values (because Promise is truthy)
  • if functions that previously thrown an error synchronously were changed to async and now they throw asynchronously, so it breaks the flow

@olehmisar
Copy link
Contributor Author

still countless errors to fix

@ludamad
Copy link
Collaborator

ludamad commented Nov 22, 2024

@charlielye any comments on the approach of mass-asyncifying bb?

@olehmisar
Copy link
Contributor Author

everything except end-to-end typechecks. Waiting whether this PR is even gonna be merged before continuing. Also, see the PR description for substantial changes and potential bugs introduced.

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.

Remove top-level await from aztec.js
2 participants