Skip to content
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

Verify testnet4 deploy #2820

Merged
merged 15 commits into from
Oct 23, 2023
Prev Previous commit
Next Next commit
Update deployer to repro verification artifacts
yorhodes committed Oct 19, 2023

Unverified

This user has not yet uploaded their public signing key.
commit 68cce80a4f88b2a4bc44914413b0ce621b5a2c72
17 changes: 0 additions & 17 deletions typescript/sdk/src/consts/environments/testnet.json
Original file line number Diff line number Diff line change
@@ -190,22 +190,5 @@
"protocolFee": "0x244d1F7e30Be144A87602905baBF86630e8f39DC",
"mailbox": "0x2d1889fe5B092CD988972261434F7E5f26041115",
"validatorAnnounce": "0x99303EFF09332cDd93E8BC8b2F07b2416e4501e5"
},
"solanadevnet": {
"storageGasOracle": "0x0000000000000000000000000000000000000000",
"validatorAnnounce": "0x0000000000000000000000000000000000000000",
"proxyAdmin": "0x0000000000000000000000000000000000000000",
"mailbox": "4v25Dz9RccqUrTzmfHzJMsjd1iVoNrWzeJ4o6GYuJrVn",
"interchainGasPaymaster": "7hMPEGdgBQFsjEz3aaNwZp8WMFHs615zAM3erXBDJuJR",
"defaultIsmInterchainGasPaymaster": "0x0000000000000000000000000000000000000000",
"multisigIsm": "0x0000000000000000000000000000000000000000",
"testRecipient": "0x0000000000000000000000000000000000000000",
"interchainAccountIsm": "0x0000000000000000000000000000000000000000",
"aggregationIsmFactory": "0x0000000000000000000000000000000000000000",
"routingIsmFactory": "0x0000000000000000000000000000000000000000",
"interchainQueryRouter": "0x0000000000000000000000000000000000000000",
"interchainAccountRouter": "0x0000000000000000000000000000000000000000",
"merkleRootMultisigIsmFactory": "0x0000000000000000000000000000000000000000",
"messageIdMultisigIsmFactory": "0x0000000000000000000000000000000000000000"
}
}
12 changes: 12 additions & 0 deletions typescript/sdk/src/deploy/HyperlaneDeployer.ts
Original file line number Diff line number Diff line change
@@ -18,6 +18,7 @@ import {
ProtocolType,
eqAddress,
runWithTimeout,
strip0x,
} from '@hyperlane-xyz/utils';

import {
@@ -266,6 +267,17 @@ export abstract class HyperlaneDeployer<
): Promise<ReturnType<F['deploy']>> {
const cachedContract = this.readCache(chain, factory, contractName);
if (cachedContract) {
const encodedConstructorArgs = strip0x(
factory.interface.encodeDeploy(constructorArgs),
);
const verificationInput = getContractVerificationInput(
contractName,
cachedContract,
factory.bytecode,
false,
encodedConstructorArgs,
);
this.addVerificationArtifact(chain, verificationInput);
return cachedContract;
}

16 changes: 14 additions & 2 deletions typescript/sdk/src/deploy/verify/ContractVerifier.ts
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ enum ExplorerApiErrors {
ALREADY_VERIFIED_ALT = 'Already Verified',
VERIFICATION_PENDING = 'Pending in queue',
PROXY_FAILED = 'A corresponding implementation contract was unfortunately not detected for the proxy address.',
BYTECODE_MISMATCH = 'Fail - Unable to verify. Compiled contract deployment bytecode does NOT match the transaction deployment bytecode.',
}

export class ContractVerifier extends MultiGeneric<VerificationInput> {
@@ -106,7 +107,12 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
case ExplorerApiErrors.ALREADY_VERIFIED_ALT:
return;
case ExplorerApiErrors.PROXY_FAILED:
this.logger(`Proxy verification failed, try manually?`);
this.logger(`Proxy verification failed for, try manually?`);
return;
case ExplorerApiErrors.BYTECODE_MISMATCH:
this.logger(
`Compiled bytecode does not match deployed bytecode, check constructor arguments?`,
);
return;
default:
this.logger(
@@ -233,7 +239,13 @@ export class ContractVerifier extends MultiGeneric<VerificationInput> {
}

if (await this.isAlreadyVerified(chain, input)) {
this.logger(`Contract ${input.name} already verified on ${chain}`);
const addressUrl = await this.multiProvider.tryGetExplorerAddressUrl(
chain,
input.address,
);
this.logger(
`Contract ${input.name} already verified on ${chain} at ${addressUrl}#code`,
);
// There is a rate limit of 5 requests per second
await sleep(200);
return;
3 changes: 2 additions & 1 deletion typescript/sdk/src/deploy/verify/utils.ts
Original file line number Diff line number Diff line change
@@ -40,7 +40,8 @@ export function getContractVerificationInput(
contract: ethers.Contract,
bytecode: string,
isProxy?: boolean,
constructorArgs?: string,
): ContractVerificationInput {
const args = getConstructorArguments(contract, bytecode);
const args = constructorArgs ?? getConstructorArguments(contract, bytecode);
return buildVerificationInput(name, contract.address, args, isProxy);
}