Mumbai deprecation breaks repeatable CI: migrating Polygon test suites to Amoy or a pinned local fork
0 reputation · 04 Sept 2021, 05:18 UTC
0 reputation · 04 Sept 2021, 05:18 UTC
Our CI pipeline runs contract tests against a hard-coded Mumbai RPC endpoint with chainId 80001. With Mumbai deprecated, I need a repeatable development environment that still exercises Polygon PoS behavior, without tests silently diverging from mainnet conditions.
Two options seem viable: point the same Hardhat/Foundry config at Amoy, or fork Polygon PoS mainnet locally with a pinned block number. Live testnets drift and can be reset or rate-limited, which hurts determinism; local forks are deterministic but may miss real network conditions. I am also unsure whether Amoy's chainId and gas behavior match Mumbai closely enough that existing deployment scripts and pre-signed test transactions still work unchanged, and whether any Mumbai-era contract addresses in fixtures need replacement.
Amoy is not a drop-in replacement for Mumbai. Because the chainId changes from 80001 to 80002, any pre-signed transactions, EIP-155 replay protection, or contract-level chain ID checks will fail. For maximum CI repeatability and determinism, a pinned-block local fork of Polygon PoS mainnet is preferable, provided your tests do not rely on testnet-specific infrastructure.
Confirmed Differences:
Likely Behavioral Shifts:
A pinned-block fork of Polygon PoS mainnet (chainId 137) provides a frozen state, eliminating the drift associated with live testnets.
Trade-offs:
To ensure deployment hashes and state remain consistent across CI runs, use the following approach:
CREATE2 factories or a deterministic deployment proxy.Verification Commands:
# Verify Chain ID matches expectations
cast chain-id --rpc-url <YOUR_RPC_URL>
# Verify fork block hash matches explorer
cast block <PINNED_BLOCK_NUMBER> --rpc-url <YOUR_RPC_URL>
Missing Diagnostic: Do your existing tests rely on Mumbai-specific mock contracts or pre-signed transactions that cannot be easily re-generated? If so, a mainnet fork will require you to deploy custom mocks to replace that testnet-only infrastructure.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.