Skip to content

feat: add script for verifying smart contracts with Sourcify #132

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

virajbhartiya
Copy link

Closes #64

@virajbhartiya
Copy link
Author

I am currently running into Error: Metadata file not found. Did you include "metadata.json"? Full response: {"error":"Metadata file not found. Did you include \"metadata.json\"?","message":"Metadata file not found. Did you include \"metadata.json\"?"}

while I try to generate the metadata.json via

solc \
  --base-path . \
  --include-path node_modules \
  --include-path lib \
  --allow-paths "node_modules,lib" \
  src/PDPVerifier.sol

@virajbhartiya
Copy link
Author

make verify \
  CONTRACT_NAME=PDPVerifier \
  CONTRACT_FILE=src/PDPVerifier.sol \
  CONTRACT_ADDRESS=<ADDRESS> \
  NETWORK=calibration;

@rjan90
Copy link
Contributor

rjan90 commented Apr 23, 2025

I was testing out the make verify cmd here, but it is failing with:

Full response: {"error":"Detected 0 contracts (), but can only verify 1 at a time. Please choose a main contract and click Verify again.","contractsToChoose":[]}
make: *** [verify] Error 1

Any idea what I was doing wrong here @virajbhartiya?

Full output here:

make verify \
  CONTRACT_NAME=PDPVerifier \
  CONTRACT_FILE=src/PDPVerifier.sol \
  CONTRACT_ADDRESS=0x6170dE2b09b404776197485F3dc6c968Ef948505 \
  NETWORK=calibration;
./tools/verify-contract.sh \
                --compiler v0.8.23+commit.f704f362 \
                --optimize \
                --node-modules ./node_modules \
                --contract-name PDPVerifier \
                src/PDPVerifier.sol \
                0x6170dE2b09b404776197485F3dc6c968Ef948505 \
                calibration
Creating verification payload...
Copying source files to payload directory...
Copied dependency: ./BitOps.sol
Copied dependency: ./Cids.sol
Copied dependency: ./Proofs.sol
Copied dependency: ./BitOps.sol
Copied dependency: ./Fees.sol
Copied dependency: ./BitOps.sol
Copied dependency: ../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol
Copied dependency: ../lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/UUPSUpgradeable.sol
Warning: Could not find dependency: @openzeppelin/contracts/interfaces/draft-IERC1822.sol
Warning: Could not find dependency: @openzeppelin/contracts/proxy/ERC1967/ERC1967Utils.sol
Copied dependency: ./Initializable.sol
Copied dependency: ../lib/openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol
Copied dependency: ../utils/ContextUpgradeable.sol
Copied dependency: ../proxy/utils/Initializable.sol
Copied dependency: ../proxy/utils/Initializable.sol
Warning: Could not find dependency: @pythnetwork/pyth-sdk-solidity/IPyth.sol
Warning: Could not find dependency: @pythnetwork/pyth-sdk-solidity/PythStructs.sol
Generating metadata.json using forge...
./tools/verify-contract.sh: line 92: forge: command not found
Generated metadata.json successfully
Verifying contract on calibration (chain ID: 314159)...
Files to be submitted:
147017125       24 -rw-r--r--    1 phi              staff                8910 Apr 23 14:43 ./Initializable.sol
147017114        8 -rw-r--r--    1 phi              staff                1208 Apr 23 14:43 ./Cids.sol
147017117        8 -rw-r--r--    1 phi              staff                3711 Apr 23 14:43 ./Fees.sol
147017142      136 -rw-r--r--    1 phi              staff               65735 Apr 23 14:43 ./input.json
147017113        8 -rw-r--r--    1 phi              staff                2401 Apr 23 14:43 ./BitOps.sol
147017134        0 -rw-r--r--    1 phi              staff                   0 Apr 23 14:43 ./metadata.json
147017115       24 -rw-r--r--    1 phi              staff               12180 Apr 23 14:43 ./Proofs.sol
147017112       72 -rw-r--r--    1 phi              staff               33249 Apr 23 14:43 ./src/PDPVerifier.sol
Submitting verification request...
Note: Unnecessary use of -X or --request, POST is already inferred.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Host sourcify.dev:443 was resolved.
* IPv6: (none)
* IPv4: 34.54.86.181
*   Trying 34.54.86.181:443...
* Connected to sourcify.dev (34.54.86.181) port 443
* ALPN: curl offers h2,http/1.1
* (304) (OUT), TLS handshake, Client hello (1):
} [317 bytes data]
*  CAfile: /etc/ssl/cert.pem
*  CApath: none
* (304) (IN), TLS handshake, Server hello (2):
{ [122 bytes data]
* (304) (IN), TLS handshake, Unknown (8):
{ [19 bytes data]
* (304) (IN), TLS handshake, Certificate (11):
{ [4019 bytes data]
* (304) (IN), TLS handshake, CERT verify (15):
{ [264 bytes data]
* (304) (IN), TLS handshake, Finished (20):
{ [36 bytes data]
* (304) (OUT), TLS handshake, Finished (20):
} [36 bytes data]
* SSL connection using TLSv1.3 / AEAD-CHACHA20-POLY1305-SHA256 / [blank] / UNDEF
* ALPN: server accepted h2
* Server certificate:
*  subject: CN=sourcify.dev
*  start date: Mar 29 22:11:21 2025 GMT
*  expire date: Jun 27 23:05:15 2025 GMT
*  subjectAltName: host "sourcify.dev" matched cert's "sourcify.dev"
*  issuer: C=US; O=Google Trust Services; CN=WR3
*  SSL certificate verify ok.
* using HTTP/2
* [HTTP/2] [1] OPENED stream for https://sourcify.dev/server/verify
* [HTTP/2] [1] [:method: POST]
* [HTTP/2] [1] [:scheme: https]
* [HTTP/2] [1] [:authority: sourcify.dev]
* [HTTP/2] [1] [:path: /server/verify]
* [HTTP/2] [1] [user-agent: curl/8.7.1]
* [HTTP/2] [1] [accept: */*]
* [HTTP/2] [1] [content-length: 129011]
* [HTTP/2] [1] [content-type: multipart/form-data; boundary=------------------------6y3BAUIIg3EsJV1E08tmsr]
> POST /server/verify HTTP/2
> Host: sourcify.dev
> User-Agent: curl/8.7.1
> Accept: */*
> Content-Length: 129011
> Content-Type: multipart/form-data; boundary=------------------------6y3BAUIIg3EsJV1E08tmsr
> 
} [9489 bytes data]
* upload completely sent off: 129011 bytes
100  125k    0     0  100  125k      0  1492k --:--:-- --:--:-- --:--:-- 1482k< HTTP/2 400 
< x-powered-by: Express
< access-control-allow-origin: *
< content-type: application/json; charset=utf-8
< etag: W/"92-msdB+UB1Z1YS0hiWTY1ftiiI9as"
< x-cloud-trace-context: 3ac28c8209628535aec76e338b515932
< date: Wed, 23 Apr 2025 12:43:05 GMT
< server: Google Frontend
< content-length: 146
< via: 1.1 google
< alt-svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
< 
{ [146 bytes data]
100  126k  100   146  100  125k    757   653k --:--:-- --:--:-- --:--:--  653k
* Connection #0 to host sourcify.dev left intact
Contract verification failed!
Error: Unknown error
Full response: {"error":"Detected 0 contracts (), but can only verify 1 at a time. Please choose a main contract and click Verify again.","contractsToChoose":[]}
make: *** [verify] Error 1

@rjan90 rjan90 moved this to 🔎 Awaiting review in PDP May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔎 Awaiting review
Development

Successfully merging this pull request may close these issues.

Get contracts verified on filfox / other block explorers
2 participants