-
Notifications
You must be signed in to change notification settings - Fork 224
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
Support Wasm sign extension and bulk memory extension #4367
Comments
Developing smart contracts on Casper is currently far from being developer-friendly. I am delighted we are facing this issue, as it presents a great opportunity to make some improvements. Manual WASM PostprocessingI created minimal-casper-code to demonstrate that minimal WASM is ~916 KB 😨, which is really close to the deployment limit of 1 MB. In practice, all Casper developers are forced to manually strip the binary. This is somewhat mitigated by the provided contract template, which includes Additionally, the documentation describes stripping code as a tip, even though it is an essential step that should not be overlooked. Along with identifying issues, I am eager to offer my assistance and solutions! I also encountered a sign-extension problem that resulted in:
Opcode 192 ( Replacing Opcode 192An easy mitigation is described in near/nearcore#8358 (comment):
I applied this to my binary, and the change was minor: < i32.extend8_s
---
> i32.const 24
> i32.shl
> i32.const 24
> i32.shr_s Fortunately, that was sufficient to allow my code - compiled with rustc 1.75.0 - to execute successfully on the Casper blockchain 😀. Additionally, I got smaller binary size than with My RecommendationI recommend three action items:
As an additional point, I propose considering the integration of WASM postprocessing directly within the node, although I recognize this may be a complex task. |
Hi @mpapierski , can we close this? |
Sign extensions are addressed by #4894, we'd still need another ticket for supporting bulk memory operations if we decide it's worth it. |
Take a look into casper-wasmi/casper-wasm and asses possibility to support sign extension and bulk memory extension without dealing with wasmi upgrade. If it’s possible by enabling flags, we should do it, otherwise we’d have to wait and upgrade wasmi first (ticket above). Modern compilers i.e. rust, and golang are emitting these extensions by default, so if we want to support these compilers we should also support these extensions.
The text was updated successfully, but these errors were encountered: