Repository navigation
Per-network deploy step data: make deployStepData and deployedAddress virtual - #415
Merged
Merged
Conversation
…y data Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…e or owner() is unreadable Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…in of the deploy step Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ompile) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… networks Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…vation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the per-network deploy key seat Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er read A short owner() answer is refused SuiteOwnerUnreadable; a Zoltu formula/factory disagreement is refused DeployStepAddressMismatch on the first derived chain; the fork-through-vm case keeps the suite on catalogue networks so derivation resolves them before the bad name is forked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
RainDeploySuitesBase.deployStepData(d, suite, chainId)anddeployedAddress(d, suite, chainId)are nowvirtual.DeployMechanismHandlergainsdeployStepLocally, the non-broadcasting local twin ofdeployStep(Zoltu:etchAndDeployZoltu).RainDeploySuitesBase.deployStepDataLocally(d, index, vm, suite, chainId, deployer)etches the dependency closure and deploysdeployStepData(d, suite, chainId)through it, refusingDeployStepAddressMismatchunless it lands atdeployedAddress(d, suite, chainId).checkSeatsNoDeployKeydeploys through it per chain id, so it readsowner()on exactly what the broadcast deploys on that network.RainDeployBroadcast.checkSeatsNoDeployKeyalso fails closed: it refusesSuiteOwnerUnreadable(suite, deployed, chainId)whendeployedAddress(d, suite, chainId)holds no code after the local deploy, or whenowner()there succeeds with less than a word. Previously a no-code address answeredowner()with empty data and the check passed.RainDeployVerifyBase.deriveDeploymentderives per chain id: for each of the suite's networks with a nonzerodeployedAddress, it deploysdeployStepData(d, suite, chainId)undervm.chainId(chainId)throughdeployStepDataLocallyand records that chain's code hash.derivedBytecodeHash(derived, chainId)returns it, refusingNotDerivedOnChain(suite, chainId)for a chain with no derivation.checkSuiteOnNetworkchecks each network's deployed code against that network's derived hash, andcheckInternallyConsistentchecks the stored code hash against every derived chain's hash. A per-chain beacon proxy (rain.factory Per-network beacon for registry beacon proxy suites rain.factory#309, beacon stored as an immutable) therefore has its own code hash on each chain.Why
Ruling: multi-network deploys use per-network deploy data. The hooks already take the chain id and
RainDeployBroadcast.networkDeploysalready calls them once per network, fillingNetworkDeploys.deployStepData[i]/derivedAddresses[i], whichcheckNetworkDeployslength-checks anddeployToConfigsbroadcasts per network. They were not overridable, so a consumer could not supply per-chain data (st0x.deploy S01-Issuer/st0x.deploy#656 needs each chain's live beacon in its token suites' deploy data). OverridingdeployStepDatagives each network its own data in one run; overridingdeployedAddresskeeps the derived address consistent with that data innetworkDeploysand the chain matrix.Making them virtual opened a hole: the seat check deploys the mechanism's own creation code at the mechanism's address (
deployLocallyOnChain), then readsowner()at the overriddendeployedAddress, which holds no code, so a deploy-key-owned per-network deploy was never refused. The seat check now deploys each network'sdeployStepDataat itsdeployedAddressthroughdeployStepLocally, and the read fails closed.Breaking
DeployMechanismHandlerhas a new required field,deployStepLocally: a consumer that builds its own mechanism handler must add it.DerivedDeploy.bytecodeHash(one hash) is replaced bychainIdsandbytecodeHashes(one per network, in the suite's network order); read a chain's hash withderivedBytecodeHash(derived, chainId).RainDeployVerifyChain.checkSuiteOnNetworktakes aSupportedNetworkinstead of the network name.checkInternallyConsistent,deployToConfigs, sibling dependency code checks) useexpectedBytecodeHash(d, suite, chainId), a virtual hook defaulting tostoredBytecodeHash; a suite whose code differs per chain overrides it. A chain whose expected hash is zero refusesNoExpectedBytecodeHash(suite, chainId).Consumers that only use the shipped Zoltu mechanism, or only override
deployStepData/deployedAddress, are not broken by the handler field; those hook signatures are unchanged.Behaviour for consumers that do not override
Unchanged except: a Zoltu address mismatch in the seat check or in
deriveDeploymentnow refusesDeployStepAddressMismatchinstead ofZoltuDerivationMismatch, and anowner()that succeeds with less than a word is now refused rather than passed. A suite with noowner()(the call reverts) still passes, as before.QA
RainDeployBroadcast.perNetworkDeployKeySeat.t.sol(the seat probe: a per-network suite owned by the deploy key refusesSuiteSeatsDeployKeyfromcheckSeatsNoDeployKeyandbroadcastSuite, and passed before the fail-closed read); per-chain code acrossRainDeployVerifySnapshotBase.perChainCode.t.sol,RainDeployVerifyChain.perChainCode.t.sol,RainDeployDeclarationChecks.perChainCode.t.solandRainDeployBroadcast.perChainCode.t.sol(each chain against its own hash, another chain's refused,NoExpectedBytecodeHash,NotDerivedOnChain,NoDerivedDeployment,DeployStepAddressMismatch).🤖 Generated with Claude Code