[Issue-3550] feat(supra-extension): predeploy canonical EVM singleton contracts at genesis - #45
Conversation
… genesis Extend the genesis transaction generator to deploy Multicall3, the ERC-2470 SingletonFactory, CreateX, and the ERC-1820 Registry at their canonical addresses, alongside the existing CREATE2 factory. Ecosystem tooling (Foundry, hardhat-deploy, ERC-777, account-abstraction stacks, etc.) expects these well-known contracts at fixed addresses on any EVM chain, so they're predeployed the same way the CREATE2 factory already is rather than relying on users/tooling to deploy them after genesis. Each contract's init-code is embedded as a static binary asset, extracted verbatim from its canonical historical deployment transaction (sender, nonce, and init-code independently verified by decoding the real presigned transactions and re-deriving each address) rather than compiled from vendored Solidity source, since these are third-party contracts we don't own or modify and any compiler/ optimizer difference risks producing bytecode that isn't byte-identical to what's deployed elsewhere. All five predeploys (Create2Factory + the four new ones) are moved into a dedicated `canonical_singletons` module, separate from Supra's own system/application genesis contracts, and are unconditional regardless of the `full_set` config flag since none relate to that feature set. The new `GenesisTransactionTags` variants are appended after the last existing named variant rather than interleaved, since `Ord`/serde's enum encoding key off declaration order rather than the explicit discriminant. Also fixes a pre-existing clippy::derive_ord_xor_partial_ord violation on `ContractCustomTag` (manual `Ord` alongside a derived `PartialOrd`) that was blocking a clean clippy run independent of this change. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Reviewed at VerifiedEach deployer/nonce/init-code tuple was checked against the real canonical deployment transaction:
Also checked: every The SuggestionsNone of these block the change; EVM is pre-release, so the format change above is fine on its own terms. 1. Nothing binds the embedded bytecode to its canonical source. The only guards are byte-length canaries and the 2. 3. The decode fix has no test that can detect it. Every test payload uses 4. 5. 6. The tag-ordering comment is imprecise ( One note outside this diffThe genesis deploy helper on the smr-moonshot side ( Also worth a line in the PR description explaining the automation decode fix and the bug it addresses — it's unrelated to genesis predeploys, and a reader hitting it in |
- Embeded Create2Factory init-code as a binary asset - Add a keccak256 hash assertion per predeploy as a tripwire against accidental corruption of the embedded init-code assets. For CreateX, the expected hash is the value pcaversaccio/createx's own README publishes and tells the community to verify against before trusting a CreateX deployment on any chain; for the other four, no such value is published by the upstream project, so those hashes are self-computed and pinned as a regression guard rather than an externally-published reference. - Ordered canonical singleton predeploys before Supra's own genesis contracts - Corrected GenesisTransactionTags ordering comment - Updated automation payload decoding test to cover decoding with non-zero value payload - Made Ord and Eq contracts of ContractCustomTag to agree on equality - Fixed formatting of the files Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This is outdated, during genesis setup transaction execution fails loudly in |
|
Re-reviewed at Verified fixedkeccak assertions. I recomputed all five hashes from the embedded bytes; every pinned value matches. CreateX's is genuinely externally anchored — Bytes unchanged. All four original blobs are still byte-identical to the mainnet deployment-transaction inputs I checked in the first pass, and the newly extracted
Tag comment corrected, and now accurate: derived
Formatting is clean, and the sweep picked up pre-existing debt in On the reorderMoving the singletons to discriminants 0–4 and shifting Supra's contracts to 5–21 is safe as far as I can tell:
It does renumber every discriminant, which the new comment itself warns against — but that warning is scoped to "once this chain has live deployments", and pre-release is precisely when this change is free to make. Two small residualsNeither is worth holding the PR for.
I did not build or run the suite (the build script compiles the Solidity contracts and needs the solc toolchain), but recomputing the hashes independently is stronger evidence than running the assertions would have been. |
Extend the genesis transaction generator to deploy Multicall3, the ERC-2470 SingletonFactory, CreateX, and the ERC-1820 Registry at their canonical addresses, alongside the existing CREATE2 factory. Ecosystem tooling (Foundry, hardhat-deploy, ERC-777, account-abstraction stacks, etc.) expects these well-known contracts at fixed addresses on any EVM chain, so they're predeployed the same way the CREATE2 factory already is rather than relying on users/tooling to deploy them after genesis.
Each contract's init-code is embedded as a static binary asset, extracted verbatim from its canonical historical deployment transaction (sender, nonce, and init-code independently verified by decoding the real presigned transactions and re-deriving each address) rather than compiled from vendored Solidity source, since these are third-party contracts we don't own or modify and any compiler/ optimizer difference risks producing bytecode that isn't byte-identical to what's deployed elsewhere.
All five predeploys (Create2Factory + the four new ones) are moved into a dedicated
canonical_singletonsmodule, separate from Supra's own system/application genesis contracts, and are unconditional regardless of thefull_setconfig flag since none relate to that feature set. The newGenesisTransactionTagsvariants are appended after the last existing named variant rather than interleaved, sinceOrd/serde's enum encoding key off declaration order rather than the explicit discriminant.Also fixes a pre-existing clippy::derive_ord_xor_partial_ord violation on
ContractCustomTag(manualOrdalongside a derivedPartialOrd) that was blocking a clean clippy run independent of this change.Fixed automation payload decoding bug caused by
abi_decodeAPI usage on an encoded sequence instead ofabi_decode_sequence