-
Notifications
You must be signed in to change notification settings - Fork 790
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
VM, Blockchain, Client: fix storing unsettled promises (develop) #1811
Conversation
When making the blockchain or vm constructor
|
Codecov Report
Flags with carried forward coverage won't be shown. Click here to find out more. |
I made the blockchain constructor and it seemed to work fine. Ran the VM api tests and everything passed without incident. |
Hmm, I am not sure yet if I am a fan of making even the VM constructor Also from a UX perspective I have some doubts, then e.g. Can we let this sink in a bit more? Maybe we leave the |
(I also find our internal usage with selected |
We already had a vm
Node allows top level await now https://v8.dev/features/top-level-await
Yes the constructor is depercated so it should give substantive warnings to at least IDE users. And normal users wouldn't be able to use it without casting, so they should understand that they are doing something against convention.
We only use it in a couple of constructors, out of hundreds of other uses throughout the repo and tests. |
e2e7a55
to
563a4a0
Compare
Ok, going along with all. |
4bf5a01
to
20134d6
Compare
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.
LGTM, this look great, also thanks a lot for all these clean-ups in the PR, this always gives me re-newed confidence that we do not end up with some pile of chaotic code spaghetti at some point with all the work we are doing! 😍 🙏
So, for a last confirmation: we do not want to make Block, Tx constructors protected, since the constructors are only aliases to the fromData()
static constructors, is this decided? Or is this still in the ring?`
I think that's a separate topic, this PR was more focused on providing safe methods for async init. I think it's okay to leave those constructors public since people may use them in more direct ways, and I think that's okay with us, as long as they are strictly following the types there should be no issues (the |
* blockchain: remove storing unsettled promise * vm: remove storing unsettled promises. make copy() async * client: update to new async changes * block: doc nit * nits * fix vm benchmarks, add _init to mockchain * Make blockchain and vm constructors protected * lint * vm: update new tests to await Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
* blockchain: remove storing unsettled promise * vm: remove storing unsettled promises. make copy() async * client: update to new async changes * block: doc nit * nits * fix vm benchmarks, add _init to mockchain * Make blockchain and vm constructors protected * lint * vm: update new tests to await Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
* blockchain: remove storing unsettled promise * vm: remove storing unsettled promises. make copy() async * client: update to new async changes * block: doc nit * nits * fix vm benchmarks, add _init to mockchain * Make blockchain and vm constructors protected * lint * vm: update new tests to await Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
* blockchain: remove storing unsettled promise * vm: remove storing unsettled promises. make copy() async * client: update to new async changes * block: doc nit * nits * fix vm benchmarks, add _init to mockchain * Make blockchain and vm constructors protected * lint * vm: update new tests to await Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
* blockchain: remove storing unsettled promise * vm: remove storing unsettled promises. make copy() async * client: update to new async changes * block: doc nit * nits * fix vm benchmarks, add _init to mockchain * Make blockchain and vm constructors protected * lint * vm: update new tests to await Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
* blockchain: remove storing unsettled promise * vm: remove storing unsettled promises. make copy() async * client: update to new async changes * block: doc nit * nits * fix vm benchmarks, add _init to mockchain * Make blockchain and vm constructors protected * lint * vm: update new tests to await Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
* blockchain: remove storing unsettled promise * vm: remove storing unsettled promises. make copy() async * client: update to new async changes * block: doc nit * nits * fix vm benchmarks, add _init to mockchain * Make blockchain and vm constructors protected * lint * vm: update new tests to await Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
* blockchain: remove storing unsettled promise * vm: remove storing unsettled promises. make copy() async * client: update to new async changes * block: doc nit * nits * fix vm benchmarks, add _init to mockchain * Make blockchain and vm constructors protected * lint * vm: update new tests to await Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
* blockchain: remove storing unsettled promise * vm: remove storing unsettled promises. make copy() async * client: update to new async changes * block: doc nit * nits * fix vm benchmarks, add _init to mockchain * Make blockchain and vm constructors protected * lint * vm: update new tests to await Co-authored-by: acolytec3 <17355484+acolytec3@users.noreply.github.com>
This PR continues #1201 retargeted towards develop.
VM.init()
and has no stored promise.VM.create()
rather thannew VM
Blockchain.create()
and has no stored promise.Both classes have boolean
_isInitialized
and check internally to make sure they do not init more than once.Sometimes in the client a Blockchain or VM is set up in a constructor. In this case, the init is added to the classes' open method.