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

[Tracker] EVM Engineering: automate interface generation #12412

Open
3 tasks
smartcontracts opened this issue Oct 10, 2024 · 0 comments
Open
3 tasks

[Tracker] EVM Engineering: automate interface generation #12412

smartcontracts opened this issue Oct 10, 2024 · 0 comments
Assignees

Comments

@smartcontracts
Copy link
Contributor

smartcontracts commented Oct 10, 2024

Context

In our ongoing efforts to enhance the OP Stack smart contract development process, we recently introduced interfaces to the OP Stack. This addition serves two primary purposes: it simplifies integration for external developers and significantly reduces compile time. As we've seen positive results from this change, interfaces are likely to remain a core part of our development strategy moving forward.

To ensure consistency and best practices, we've created a comprehensive guide detailing our approach to using interfaces.

Problem Statement

While the introduction of interfaces has brought substantial benefits, we've identified a key pain point in our current workflow. The process of adding and maintaining these interfaces manually has become a time-consuming and error-prone task for develoeprs. This manual overhead contradicts the goal of streamlining the development process.

Moreover, we want to create an environment where our developers can focus on writing high-quality contract logic without getting bogged down in the intricacies of interface management. The current situation requires developers to constantly think about how to properly use and update interfaces, which diverts attention from core development tasks.

We've explored existing tools like cast interface and forge inspect as potential solutions. While these tools are useful, they fall short in generating fully correct interfaces due to some limitations in handling complex types:

  1. They often generate incorrect types for more complex constructs like enums.
  2. Instead of properly importing and reusing library types, they generate inline libraries, leading to code duplication and potential inconsistencies.

These limitations mean that even when using these tools, developers still need to manually review and correct the generated interfaces, which doesn't fully solve the efficiency problem.

Goals

To address these challenges, we propose the development of a custom, automated interface generation tool. Our goals for this tool are as follows:

  1. Automatic Generation: Develop a tool that can automatically generate accurate and complete interfaces for our smart contracts.

  2. Seamless Integration: The tool should function similarly to our existing snapshot generation process, integrating smoothly into our current development workflow.

  3. Intelligent Type Handling: Implement a coherent and consistent strategy for managing types within the generated interfaces. This strategy should address two key questions:

    • Under what circumstances should types be redefined within the interface?
    • When is it more appropriate to import types from existing libraries?

By achieving these goals, we aim to significantly reduce the manual effort required in interface management, minimize the potential for errors, and allow our developers to focus more on core contract logic and less on interface maintenance.

Tasks

@smartcontracts smartcontracts changed the title EVM Engineering: automate interface generation [Tracker] EVM Engineering: automate interface generation Oct 10, 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

2 participants