-
Notifications
You must be signed in to change notification settings - Fork 696
-
Notifications
You must be signed in to change notification settings - Fork 696
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
Issues with upgrading the Ethereum VM with wasm. #508
Comments
Although it's not in the MVP, dynamic linking is a high-priority post-v.1 feature that we've thought and discussed a fair amount already in various GH issues (though it seems like DynamicLinking.md still needs updating). The basic idea is there would be, among other things, some |
@lukewagner thanks for your reply! If there was a But I'm not sure for
The result of $eth_call need to loaded into memory. Also $eth_call needs to read from memory the arguments for the targeted contract. |
Ah, so this is a source of confusion that need to be more clearly expressed in docs: wasm imports are quite distinct from dynamic linking (load-time or run-time). The best way to think of wasm imports is as syscalls which implies that you are leaving your address space. With the dynamic linking future-feature, there would be a different way to specific dynamic linking (both load-time and run-time), distinct from |
I think I see. I think the tricky part is still this is opposed from |
@wanderer JS support for accessing the linear memory is expected so if $eth_call is implement in JS then it is expected to be able to read and write operands to the linear memory. |
@JSStats that's a very convincing route to go. It would also be nice to have a similar feature in the JITLibrary. We have C++, Go and JS implementations. C++ and Go would have to use the jit library |
To expand on what @JSStats said: you wouldn't use dynamic linking, but rather separate module instances (separate linear memories) which both allowed JS to alias the heap via ArrayBuffer so that JS could do the manual copying in/out of args/results. If we add the post-MVP feature of allowing wasm to import other instances' linear memory, then you could do this copying from within wasm without the thunk through JS. Alternatively, if you trust the VM implementation on both sides, you could use dynamic linking and a single instance (1 linear memory) and implement the sandboxing yourself within the VM so that no copy was necessary. |
Thank you @lukewagner and @JSStats for helping! I'm fairly confident both of the above methods can work for us. |
I wrote a proposal today for upgrading the Ethereum VM with wasm. You can see it here ethereum/EIPs#48
One of the harder parts of fitting wasm to Ethereum is the current Ethereum opcodes CALL and CALLCODE. CALL makes a call to another Ethereum contract (module) and the result is placed in memory at a specified location. CALLCODE is kinda like dlopen. It injects code from a given contract into the current running code. Currently I don't know of anyway to support this kind of behavior with wasm semantics. So if we adopt the proposal we will have to modify a wasm VM.
Would there be a better way of doing this that fits close to wasm semantics and does not involve as heavy modification to a wasm implementation? And Ideally what kind of semantics could wasm have to support this?
The text was updated successfully, but these errors were encountered: