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

Rewrite with support for zk-AluVM #128

Merged
merged 13 commits into from
Dec 23, 2024
Merged

Rewrite with support for zk-AluVM #128

merged 13 commits into from
Dec 23, 2024

Conversation

dr-orlovsky
Copy link
Member

@dr-orlovsky dr-orlovsky commented Oct 20, 2024

This re-writes the entire codebase of AluVM with two main goals:

  • Remove sheer complexity of the code and ensure all pieces of business logic are as small and compact as possible, easy to unit-test, audit and document; reduce instruction set to the initial minimum possible.
  • Create zk-STARK-compatible zk-AluVM version of the VM, activated with just a feature flag.

zk-AluVM design

  1. ALU128 base ISA which contains just:
    • only A8-A128 registers;
    • control flow instructions;
    • EQ instruction (and no LE/LT/GE/GT);
    • data instructions: put a value into a register, clear value, test value, copy move and swap values between registers; all these ops are compatible with values being field elements;
    • no bit logic instructions.
  2. GFA ISA extension:
    • adds fp read-only register contanining the used field order;
    • adds field_order to the CoreConfig with which AluVM core is initialized;
    • treats all A8-A128 registers as field elements;
    • adds arithmetic ops over finite field; if a register has a value which doesn't fit it the operation sould fail.
  3. zk-aluvm feature flag which allows only zk-STARK-compatible ISA and ISA extension: ALU128 and GFA.

The new ISA architecture is described in https://docs.google.com/spreadsheets/d/1YgCYEzikUHI5cgm6XUhYdQDM1Q3-faf9NvF4y5XY0Uo/edit?gid=0#gid=0

zk-AluVM subset is highlighed on the first page in green colors (rows 2-24 and 106-110).

@dr-orlovsky dr-orlovsky added this to the v0.12.0 milestone Oct 20, 2024
@dr-orlovsky dr-orlovsky self-assigned this Oct 20, 2024
@dr-orlovsky dr-orlovsky changed the title Complete rewrite Rewrite with support for zk-AluVM Oct 22, 2024
@dr-orlovsky dr-orlovsky added *security* Issues affecting safety/security (include undefined behaviours) *consensus* Issues affecting distributed concensus refactoring Refactoring of the existing code test Test implementation or failures breaking Breaking API changes labels Oct 22, 2024
@dr-orlovsky dr-orlovsky changed the base branch from develop to master October 31, 2024 12:28
@dr-orlovsky dr-orlovsky merged commit 60cbdab into master Dec 23, 2024
1 of 29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Breaking API changes *consensus* Issues affecting distributed concensus refactoring Refactoring of the existing code *security* Issues affecting safety/security (include undefined behaviours) test Test implementation or failures
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant