cove-backend icon indicating copy to clipboard operation
cove-backend copied to clipboard

Feature request: Huff Contracts verification

Open PraneshASP opened this issue 2 years ago • 4 comments

Currently there's no way to verify Huff contracts, as Etherscan and other explorers doesn't support Huff language yet. It would be very useful for the Huff community if Cove provides this functionality.

I'm happy to jump in and try to implement it, if its desirable to have this feature.

PraneshASP avatar Aug 31 '23 05:08 PraneshASP

A PR for this would be awesome! Definitely down to support more frameworks, and it would be cool to support huff as I don't think it's supported anywhere else.

I'm happy to provide any guidance if you need any help. The scope of work here is roughly:

  • [x] Split up frameworks.rs into a frameworks folder so each framework can live in it's own file, e.g. foundry.rs. This is a good initial PR.
  • [ ] Then the next PR would be to add the huff.rs implementation with any unit + integration tests.
    • I don't think huff has a metadata hash (or even a version hash), so in the Framework trait we probably should change get_artifact_metadata_settings to return an option too, e.g. Result<Option<SettingsMetadata>, Box<dyn Error>>. In src/routes/verify.rs add the Huff framework to the match json.build_config.framework statement and the compiler should yell about anything else needed from there.
    • I also think there's no huff config file support, so I guess the build hint here would just be the command line args you need to pass to huffc? Not familiar enough with huff offhand to know if there's a better way
  • [ ] Frontend PR will be needed to add Huff support

However, just note that verification results are not persisted anywhere, so users will need to visit the cove frontend anytime they want to verify. A lightweight way to do this might be to add a feature to the frontend pre-filling the form with query parameters, so you can directly link a user to a pre-filled form they can verify with.

mds1 avatar Sep 01 '23 17:09 mds1

Split up frameworks.rs into a frameworks folder so each framework can live in it's own file, e.g. foundry.rs. This is a good initial PR.

Just completed this one in https://github.com/ScopeLift/cove-backend/pull/21

mds1 avatar Sep 01 '23 22:09 mds1

Awesome! I'll start working on the next PR. I'm not 100% sure if I could make this work, but it would be great if I could, as there are no options to verify huff atm. Will create a draft PR once I have some reviewable code as it would be easier to review smaller chunks and also it helps me to make sure that I steer towards the right direction / catch mistakes early (as I'm still a rust noob). Thanks for accepting this feature request! :))

PraneshASP avatar Sep 02 '23 07:09 PraneshASP

Sounds great, looking forward to it!

mds1 avatar Sep 05 '23 18:09 mds1