Skip to content

Commit 3bcc32c

Browse files
Wait 2 confirmations before verifying contracts on Etherscan
Without the waiting, the verification of contracts on Etherscan was sometimes failing with errors like these: ``` NomicLabsHardhatPluginError: Failed to send contract verification request. Endpoint URL: https://api-sepolia.etherscan.io/api Reason: The Etherscan API responded that the address 0xAdF78eb37FDE0F3CbF59d11F0DF54b1170a3937b does not have bytecode. This can happen if the contract was recently deployed and this fact hasn't propagated to the backend yet. Try waiting for a minute before verifying your contract. If you are invoking this from a script, try to wait for five confirmations of your contract deployment transaction before running the verification subtask. ``` Despite the suggestion to wait 5 confirmation, it seems 2 are enough for us (we can always increase that number if we find cases where it isn't enough).
1 parent 8de530a commit 3bcc32c

6 files changed

+30
-0
lines changed

solidity/random-beacon/deploy/01_deploy_reimbursement_pool.ts

+5
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
1616
})
1717

1818
if (hre.network.tags.etherscan) {
19+
await hre.ethers.provider.waitForTransaction(
20+
ReimbursementPool.transactionHash,
21+
2,
22+
300000
23+
)
1924
await helpers.etherscan.verify(ReimbursementPool)
2025
}
2126

solidity/random-beacon/deploy/02_deploy_beacon_sortition_pool.ts

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
2727
)
2828

2929
if (hre.network.tags.etherscan) {
30+
await hre.ethers.provider.waitForTransaction(
31+
BeaconSortitionPool.transactionHash,
32+
2,
33+
300000
34+
)
3035
await helpers.etherscan.verify(BeaconSortitionPool)
3136
}
3237

solidity/random-beacon/deploy/03_deploy_beacon_dkg_validator.ts

+5
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
1515
})
1616

1717
if (hre.network.tags.etherscan) {
18+
await hre.ethers.provider.waitForTransaction(
19+
BeaconDkgValidator.transactionHash,
20+
2,
21+
300000
22+
)
1823
await helpers.etherscan.verify(BeaconDkgValidator)
1924
}
2025

solidity/random-beacon/deploy/04_deploy_random_beacon.ts

+5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
5959
)
6060

6161
if (hre.network.tags.etherscan) {
62+
await hre.ethers.provider.waitForTransaction(
63+
RandomBeacon.transactionHash,
64+
2,
65+
300000
66+
)
6267
await helpers.etherscan.verify(BLS)
6368
await helpers.etherscan.verify(BeaconAuthorization)
6469
await helpers.etherscan.verify(BeaconDkg)

solidity/random-beacon/deploy/07_deploy_random_beacon_governance.ts

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
2020
)
2121

2222
if (hre.network.tags.etherscan) {
23+
await hre.ethers.provider.waitForTransaction(
24+
RandomBeaconGovernance.transactionHash,
25+
2,
26+
300000
27+
)
2328
await helpers.etherscan.verify(RandomBeaconGovernance)
2429
}
2530

solidity/random-beacon/deploy/09_deploy_random_beacon_chaosnet.ts

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ const func: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
1919
)
2020

2121
if (hre.network.tags.etherscan) {
22+
await hre.ethers.provider.waitForTransaction(
23+
RandomBeaconChaosnet.transactionHash,
24+
2,
25+
300000
26+
)
2227
await helpers.etherscan.verify(RandomBeaconChaosnet)
2328
}
2429

0 commit comments

Comments
 (0)