Skip undeterministic deployment verification - #807
Conversation
…proved deployment validation
bdrhn9
left a comment
There was a problem hiding this comment.
I don't think this PR addresses issue #461. Issue #461 asks for the opposite: maintaining an allowlist of chains that were deployed non-deterministically. This is because non-deterministic deployments are normally validated using this else condition, and CI passes. For example, ronin, mantle-sepolia-testnet, and taiko have non-deterministic deployments for the OwnableCallForwarder, AccessControlRegistry, and Api3ServerV1 contracts.
For this PR, it's probably better to keep the behavior as-is but have it only say "Skip verify-deployments on Filecoin, whose RPC does not index historical transactions". We should then create a follow-up PR, maybe with a function written specifically for this chain, to verify the contract code, probably by calling eth_getCode and checking the immutable parts of the code. Otherwise, skipping verification completely isn't acceptable, imo.
| } | ||
| if (goFetchContractCode.data === '0x') { | ||
| throw new Error(`${network} ${contractName} (undeterministic) contract code does not exist`); | ||
| } |
There was a problem hiding this comment.
The else if body is identical to the if body, except the two error strings use undeterministic instead of deterministic. I'd suggest the following implementation to reduce duplication:
const deployedDeterministically = deployment.address === expectedDeterministicDeploymentAddress;
if (deployedDeterministically || skippedChainAliasesInUndeterministicDeploymentVerification.includes(network)) {
const deploymentType = deployedDeterministically ? 'deterministic' : 'undeterministic';
const goFetchContractCode = await go(async () => provider.getCode(deployment.address), goAsyncOptions);
if (!goFetchContractCode.success || !goFetchContractCode.data) {
throw new Error(`${network} ${contractName} (${deploymentType}) contract code could not be fetched`);
}
if (goFetchContractCode.data === '0x') {
throw new Error(`${network} ${contractName} (${deploymentType}) contract code does not exist`);
}
} else {
Closes #461
Problem
verify-deploymentsfails on both Filecoin chains:All contracts on these two chains are deployed undeterministically, so they are verified
through their creation transactions. Filecoin's Ethereum JSON-RPC implementation only
indexes recent messages, which means
eth_getTransactionByHashreturnsnullfor thedeployment transactions and verification cannot proceed.
This is a property of the chains' RPC retention rather than a problem with the
deployments themselves.
Solution
Add
skippedChainAliasesInUndeterministicDeploymentVerificationtoscripts/constants.ts,following the existing skip-list convention in that file. For the listed chains,
verify-deploymentsconfirms that contract code exists at the deployment address insteadof fetching and comparing the creation transaction.