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

Support WASM instruction set for Stage 1 #22

Closed
10 tasks done
aborg-dev opened this issue Sep 18, 2023 · 4 comments
Closed
10 tasks done

Support WASM instruction set for Stage 1 #22

aborg-dev opened this issue Sep 18, 2023 · 4 comments
Assignees

Comments

@aborg-dev
Copy link

aborg-dev commented Sep 18, 2023

This is a tracking issue for all WASM instructions that we need to support to complete Stage 1.

The goal is roughly to support WASM MVP opcodes, but we might delay some that are tricky to support with current ZK processor till Stage 2.

Tasks

  1. MCJOHN974
@aborg-dev aborg-dev added this to the ZK WASM: Stage 1 milestone Sep 18, 2023
@aborg-dev aborg-dev transferred this issue from near/nearcore Sep 26, 2023
@nagisa
Copy link
Collaborator

nagisa commented Oct 2, 2023

So one thing that has been floating in my mind is that we're definitely not going to (nor it makes sense to) have support for all and every single one of the WASM/clif-ir instructions in our MVP for stage1. For instance, anything involving floats is an immediate out at the time being (it wouldn’t be too onerous to implement, but it would be a soft float affair and I don’t believe it is a good way to spend our limited time at the moment.)

With that in mind, I think we should have a representative contract that we would use as our MVP test target. This should be something like with integer operations and non-trivial control flow (loops, blocks, function calls etc.) similar to the ft-transfer contract that we had in our benchmarking efforts. I would potentially go with ft-transfer, but unfortunately it doesn’t really have that much integer or control flow in it and would be disproportionally a test of the host function calls rather than regular execution performance.

@nagisa
Copy link
Collaborator

nagisa commented Oct 2, 2023

memory.size and memory.grow from the list above in particular are instructions I think we can punt on right now, as those don't really have much use in the NEAR ecosystem. They pose interesting challenges for zkasm in particular, but I don't think those challenges need to be solved for Stage 1.

@aborg-dev
Copy link
Author

memory.size and memory.grow from the list above in particular are instructions I think we can punt on right now, as those don't really have much use in the NEAR ecosystem. They pose interesting challenges for zkasm in particular, but I don't think those challenges need to be solved for Stage 1.

I'm fine with that, as long as these instructions are not necessary for a few representative performance benchmarks #90. I'll investigate which instructions are used there and report back here with requirements.

@aborg-dev
Copy link
Author

We have all the features listed above implemented. For SHA256, we are still missing Global Data Segments and loads from a frame pointer that are tracked in #143.

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