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

Async vs sync interface #186

Open
s1na opened this issue Mar 28, 2019 · 2 comments
Open

Async vs sync interface #186

s1na opened this issue Mar 28, 2019 · 2 comments

Comments

@s1na
Copy link

s1na commented Mar 28, 2019

Sorry to be raising an old question again: I was wondering what are the biggest challenges in having an async-by-default interface? reading here it says:

After evaluating the trade-offs between the sync and async ewasm interfaces, we've decided to adopt the synchronous version. First, the synchronous interface better matches the EVM execution model, which synchronously executes contract calls. Secondly, although implementing the synchronous interface in Javascript requires inconvenient workarounds, in other programming languages (C++, Go, Rust, etc.) it is simpler than the async version. Lastly, adapting existing EVM higher-level languages such as Solidity to the async ewasm version would be much more complicated.

The main argument seems to center around the sync model resembling eth1 more closely. Considering that eth2 (as it currently seems like) would require asynchronous primitives anyway (e.g. for cross-shard communication, or yanking, even same-shard async calls as mentioned by Casey) , what would be the downsides of making some other methods, e.g. CALLs (except library or pure functions), CREATEs and the methods accessing the state, also async?

Of course, one could alternatively ask what would be the benefits of making them async, to which I have no good answer, but would be interested to investigate.

@poemm
Copy link
Contributor

poemm commented Mar 28, 2019

More generally, a model of concurrency may allow race conditions or deadlocks which could break consensus. For example, Primea uses an event-loop async model of concurrency with additional restrictions involving ownership of resources based on who requested them at a lower gas use. Eth2 async cross-shard calls are still be open to design.

I could mention other efforts which advertise concurrency, but you asked specifically about async models of concurrency.

@lrettig
Copy link
Member

lrettig commented Apr 15, 2019

One thought is that you can build synchronicity on top of asynchronicity (e.g., await/async pattern), but not the other way around, so it may be nice to have some async at the base layer for maximum optionality.

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

No branches or pull requests

3 participants