refactor!: nuke top level await#10128
refactor!: nuke top level await#10128olehmisar wants to merge 15 commits intoAztecProtocol:masterfrom
Conversation
|
still countless errors to fix |
|
@charlielye any comments on the approach of mass-asyncifying bb? |
|
everything except |
|
Why not to simply remove |
|
@Groxan it can be done as a temporary workaround. But this PR should be the end solution |
|
@olehmisar Why do you think that couldn't be an end solution? Allowing users to initialize the "environment" manually and, in particular, allowing them to choose the best moment for it is actually a better practice. At least, that's how it currently works for node devs. |
|
@Groxan UI apps don’t have a top-to-bottom flow like cli apps. Imagine your app crashing randomly here and there because some wasm code was not initialised. |
|
@olehmisar Nothing will crash if you initialize it in advance |
|
Initialization on-demand, as you propose, is fine when the initialization itself takes <100ms. But when the initialization takes several seconds, the UX will leave much to be desired. |
how do you initialize in advance in a multipage app that has
I don't understand what you wanted to say with this sentence. You have to initialise wasm in any case. The UX will be better if you can do other things while waiting for wasm to be initialised, unlike how it currently halts the whole UI. |
|
It doesn't matter what type of app you have, there is always an entry point. But actually, "in advance" doesn't necessarily mean "at the entry point". "In advance" means "at ANY time before" calling aztec's components, requiring bb to be initialized. So, I'm just saying that as a developer I'd like to have a choice - how, when and where to initialize bb, because in different use cases different approaches may be needed to give better UX. |
|
This discussion leads to nowhere so I am not gonna entertain it anymore. Nuking top level await in favour of async initialisation does not take any control from the user. Requiring the user to initialize bb manually is a half measure that is gonna lead to a lot of headaches (look at Aleo) |
|
Sorry, this is my fault for letting this thread be followed as far as it did, but I think the consensus is we prefer to just drop the top level await, there is already an async API that can be used it preferred. Apologies again |
|
Just want to say that I didn't intend my previous message to be offensive. Not the best choice of words, so I want to apologize to anyone that may be offended by it. |
|
fwiw, I think there are some great alternate fixes and PRs for these issues coming down the line! |
|
superseded by #11491 |
Closes #9959
May be postponed if #9987 makes performance acceptable.
Removed top-level await.
BarretenbergSync.getSingletonand all functions and methods that depend on it are now marked asasync.Changes
{ name: string; parameters: ABIParameter[] }anymore. Otherwise it has to be async as wellawait wallet.setPublicAuthWit({ caller, action }, true).send().wait()is nowawait (await wallet.setPublicAuthWit({ caller, action }, true).send()).wait()contract.methods.xxx.selectornow returns aPromise<FunctionSelector>There may be bugs introduced