sablier-labs / v2-core

⏳ Core smart contracts of the Sablier V2 token distribution protocol
https://sablier.com
Other
311 stars 47 forks source link

Write a multi-chain source code verify script #749

Closed PaulRBerg closed 10 months ago

PaulRBerg commented 10 months ago

Similar to the multi-chain deployment script written by @andreivladbrg and polished by @smol-ninja, we should also write a multi-chain verification script.

It is often the case that the verification part fails in a forge script command (example here).

Having to manually verify each contract is a chore.

smol-ninja commented 10 months ago

The issue is not related to verification but to the RPC endpoint.

The following command also throws the "Deserialization Error: EOF while parsing a value at line 1 column 0."

FOUNDRY_PROFILE=optimized \
forge script script/DeployDeterministicCore3.s.sol \
--rpc-url "https://bnbsmartchain-mainnet.infura.io/v3/68967a55fb91488684a9c1000f321d7f" \
--sig "run(string,address,address,uint256)" "ChainID 56, Version 1.1.1" 0x6666cA940D2f4B65883b454b7Bc7EEB039f64fa3 0x33511f69A784Fd958E6713aCaC7c9dCF1A5578E8 300 \
-vvv

Instead of writing a separate script for verification, we can add checks in the deploy-multi-chain.sh and generate-deployment-command.sh scripts. It will first simulate all the deployments in a forked environment and only if there are no errors, will broadcast them.

We will also modify it such that if the script is called with only --verify argument, it will use the cached data to re-run the verification on etherscan for chains.

smol-ninja commented 10 months ago

I think we can close this issue (please re-open it if you think otherwise). The issue is related to RPC endpoint and not related to verification process. I recently tried multiple deployments and all of them got verified automatically. The latest script is able to handle such errors easily PR https://github.com/sablier-labs/v2-core/pull/752

  1. https://sepolia.etherscan.io/address/0x54888671ee181afc5ab3b1a7ed0c46e8bf10760c#code
  2. See all deployments: https://sepolia.etherscan.io/address/0xeaf39695973254d21c8956037c0baf5fdda92ec6
PaulRBerg commented 10 months ago

I don't see how the deployment simulation helps with errors related to RPC endpoints. And also, there are verification-specific issues (such as the recent debacle with via IR).

But anyway, I'm happy to close this issue on the basis that we're not frequently making deployments, and this script wouldn't be needed that often.