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

Implementation of non-lowering for dstore and dstorebytes instructions in Venom compiler for zkSync support #4326

Open
harkal opened this issue Oct 24, 2024 · 0 comments
Assignees
Labels
Feature VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting

Comments

@harkal
Copy link
Collaborator

harkal commented Oct 24, 2024

Summary

The current implementation of the Venom compiler needs an update to handle specific instructions used by zkSync for immutables without lowering them to standard EVM instructions. While zkSync is used as an example here, the principle applies to other architectures also.

Specification

The current implementation of the Venom compiler needs an update to handle specific instructions used by zkSync for immutables without lowering them to standard EVM instructions. Here are the details:

  • Instructions: dstore and dstorebytes

  • Issue: These instructions are currently being lowered to simpler instructions that fit within the EVM framework. However, for zkSync, these instructions should remain intact as they are directly interpreted by zkSync*, not by the standard EVM.

  • Requirement:

    • Implement a feature in the Venom compiler that allows dstore and dstorebytes to pass through compilation without being converted into EVM-compatible bytecode.
    • This approach will ensure that zkSync can directly read and utilize these instructions from the Venom output.
  • Objective:

    • To ensure that zkSync can efficiently implement immutables by preserving the dstore and dstorebytes instructions during compilation.
    • Introduce an architecture selection parameter or treat zkSync as a special EVM version to handle these instructions appropriately.
    • Future enhancements could include a more dynamic opcode management system based on the target architecture's capabilities.
  • Acceptance Criteria:

    • The compiler should accept parameters that dictate when to compile for zkSync vs. standard EVM.
    • dstore and dstorebytes should remain in the bytecode output when compiling for zkSync.
    • No functionality break when merging these changes with existing systems where Venom support is not yet implemented.

Backwards Compatibility

This ticket assumes Venom does not yet support zkSync, ensuring that this implementation will not break current functionality.

References

PR: feat[venom]: remove dloadbytes and sha3_64 venom instructions #4325

Copyright

Copyright and related rights waived via CC0

@harkal harkal added Feature VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting labels Oct 24, 2024
@harkal harkal self-assigned this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature VIP: Discussion Used to denote VIPs and more complex issues that are waiting discussion in a meeting
Projects
None yet
Development

No branches or pull requests

2 participants
@harkal and others