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

ROADMAP #171

Open
rodrigo-pino opened this issue Nov 21, 2023 · 0 comments
Open

ROADMAP #171

rodrigo-pino opened this issue Nov 21, 2023 · 0 comments

Comments

@rodrigo-pino
Copy link
Contributor

rodrigo-pino commented Nov 21, 2023

Roadmap

The Virtual Machine is half way there in terms of features, but there is still a long way to go to achieve production quality.

Stage I: MVP (Completed)

The first stage we do the minimal features required by a VM to work with basic programs:

  1. Implement a Basic Instruction Loop (assert equal, jump, ap+= call and ret)
  2. Implement the Write Once Memory System.
  3. Write a basic Cairo Zero Runner, enough to run a basic program.
  4. Implement Proof Mode and compare traces with another production tested VM (using the Python VM currently, but we can switch)

Stage II: Cairo Zero (In Progress)

During this stage we aim to give full compatibility to Cairo Zero. Our VM targets latest version of the compiler but because it Cairo Zero and CASM are very similar is easier to test the former (no intermediate language during compilation).

This is probably the bigger Stage of them all due to the sheer amount of Hints to implement as well as a several Builtins. Part of the Hints and all of the Builtins implemented are going to be used in the following stages.

To mark this stage as completed the following list should be implemented with unit tests and integration tests. Adding benchmarks here will be a very nice to have because it would give us a nice baseline on how the implementation is performing.

  1. Prepare the VM to for the easy addition of hints and builtins:
    • Update the VM to receive a hintrunner and execute hints accordingly
    • Make segments to perform differently depending if they are a builtin segment or not.
  2. Implement all Cairo Zero Hints Add Cairo Zero Hints #164
  3. Implement all Builtins required by Cairo Zero. Implement Cairo Zero Builtins #126
  4. Make a full featured Cairo Zero runner (hints and builtin detection)
  5. Add unit and integration tests for all of this features.
  6. Add benchmarks (strongly suggested, but optional)

When completed we can make a v0.1 release.

Stage III: Cairo (In Progress)

This stage can only be completed once Stage II is complete. The main blocker on this part of development is that at the moment of writing there is no support for the current Cairo compiler for tools outside of Rust.

Most of the tools that make use of the Compiler or Scarb are written in Rust using those tools internal APIs. It doesn't exist a good way of representing a Cairo Program or Sierra Program in a json format. Note here that I am referring to Cairo files and not Starknet contracts since this issue doesn't exist there.

After discussing with Starkware, it was decided that this was going to be implemented at Scarb, there is already an issue created for this here.

To mark this stage as completed:

  1. Implement all Cairo hints that haven't being implemented already. Add Core Hints to the VM #36
  2. Implement any Builtin required by Cairo 1. Implement Starknet Builtins #168
  3. Complete the PR to Scarb.
  4. Make a full fledged Cairo 1 Runner (point 3 should be completed first)

As usual, this stage should include thorough unit testing and integration tests. When completed it could be a v0.2 release.

Stage IV: Starknet

This is the final stage that will include features for the VM. Here we will implement Starknet only hints and builtins. This stage is too long in to the future to have an accurate description but it should be the same as the previous ones.

The only thing that need to be investigated is how system calls like deploy, storage write and read etc. will interact with the VM and if current structure should be modified. Perhaps is better to this investigation sooner rather than later.

To mark this task as completed:

  1. Implement Starknet Hints.
  2. Implement any possible Starknet only Builtin. Implement Starknet Builtins #168
  3. Full Fledged Starknet Runner

This can be the v0.3 release of the VM.

Stage V: Optimization & Maintenance

The final stage of development. Here we will keep the VM up to date fixing any possible bugs and using the Benchmark tests written in the previous stages (if not, they should be written here) to optimize execution. Also, make the required updates as the tooling improves/changes over time.

Optimization Ideas

Separate sub section to write possible optimizations to add to the VM:

  • Execute Hints Asynchronously: An instruction in Cairo can have a Hint appended to it or not. If it has, then:
    1. The hint is executed
    2. The instruction is decoded
    3. The instruction is executed
      There is a possibility for steps (i) and (ii) to be performed at the same time using Go channels. This can improve performance or not but it is an idea worth checking.
@rodrigo-pino rodrigo-pino pinned this issue Nov 21, 2023
@TAdev0 TAdev0 mentioned this issue Jun 25, 2024
8 tasks
@MaksymMalicki MaksymMalicki unpinned this issue Jul 3, 2024
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

1 participant