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 for Vyper verification with the current implementation of CheckedContract #1673

Open
Tracked by #1364
marcocastignoli opened this issue Sep 30, 2024 · 2 comments
Assignees

Comments

@marcocastignoli
Copy link
Member

We can support Vyper in the current implementation of CheckedContract without needing to rewrite the entire class, as long as we are willing to sacrifice some code structure elegance in CheckedContract. For more details, refer to issue #1628.

Given that we'll have to rewrite CheckedContract soon, I think that making the code a bit more messy in order to support Vyper is not a big deal.

@marcocastignoli marcocastignoli changed the title Plan support for Vyper verification with the current implementation of CheckedContract Plan support for Vyper verification with the current implementation of CheckedContract Sep 30, 2024
@marcocastignoli
Copy link
Member Author

Proposal 1: making CheckedContract an abstract class and implementing SolidityCheckedContract + VyperCheckedContract

CheckedContract is actually used by the server in APIs handlers (not important for Vyper because we'll create a custom API), VerificationService.verifyDeployed (used to verify a contract) and StorageService.storeMatch (used to write the contract in active storage services).

I would create an abstract class for CheckedContract starting from all the mandatory properties/methods needed by verifyDeployed and storeMatch, then we can implement SolidityCheckedContract extends CheckedContract and VyperCheckedContract extends CheckedContract. Passing these new classes, verifyDeployed and storeMatch will check if SolidityCheckedContract functions are available before using them (e.g. tryToFindPerfectMetadata or accessing .metadata).

Each CheckedContract implementation will implement its own constructor, recompile and createJsonInputFromMetadata function.

@marcocastignoli marcocastignoli moved this from Triage to Sprint - Up Next in Sourcify Public Sep 30, 2024
@marcocastignoli marcocastignoli self-assigned this Sep 30, 2024
@marcocastignoli
Copy link
Member Author

Let's implement Vyper support following the proposal above. Regarding the StorageServices:

  • SourcifyDatabaseService and AllianceDatabaseService already supports Vyper. We can store it taking inspiration from the already existing Vyper verified_contracts stored by Blockscout: select * from compiled_contracts cc where cc."language" = 'vyper';
  • We can generate a metadata.json for RepositoryV1Service and RepositoryV2Service so that existing tools will not have to change how they interact with the repositories for Vyper contracts.

Let's keep track of the implementation in this issue.

@marcocastignoli marcocastignoli changed the title Plan support for Vyper verification with the current implementation of CheckedContract Support for Vyper verification with the current implementation of CheckedContract Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Sprint - In Progress
Development

No branches or pull requests

1 participant