ethereum / sourcify

Decentralized Solidity contract source code verification service
https://sourcify.dev
MIT License
775 stars 388 forks source link

Update url handling in SourcifyDatabase to support SourcifyDB-only and SourcifyDB+repov2 configurations #1640

Open marcocastignoli opened 1 day ago

marcocastignoli commented 1 day ago

Currently, the getTree() function retrieves the file tree from repositoryV1, which forces you to run RepositoryV1Service (+ an http server) together with SourcifyDatabase. This prevents running sourcify with SourcifyDatabaseService alone or in combination with RepositoryV2Service.

In the current implementation, URLs are constructed using repositoryV1.serverUrl. We should directly use the https://sourcify.dev/server/repository/contracts/{full_match | partial_match}/{chain}/{address}/{filePath} API for URL construction.

kuzdogan commented 1 day ago

Ah ok, I thought we were reading the literal file tree from repositoryV1 like tree -L 2 /Users/kuzdogan/sourcify/repositoryV1/contracts/full_match/1/0x025030BdAa159f281cAe63873E68313a703725A5 and that's why I preferred not working on this now.

If we are using that for the URLs only and it's a simple fix, we can do this after #1637