Upstream change
rainlanguage/rain.deploy#242 removes DeployCandidate.sourceCreationCode and
makes checkCandidatesAnchoredToSource resolve the candidate's own
snapshot.artifactPath through vm.getCode instead. The source operand now
comes from the compiler rather than from the declaration.
The removed field was one a consumer filled in. Pointing it at the same
generated constant as the record made the one check that catches a snapshot of
the wrong contract compare a value with itself — green for any candidate at all,
in CI and on the irreversible RainDeployBroadcast.run() path alike. That is
rainlanguage/rain.factory.deploy#34, which #242 closes.
This is a BREAKING change. This repo has five candidates and four tests
that read the removed field, so it carries more of the migration than any other
consumer except raindex.
What this repo has to change
Current pin: rain-deploy = "0.1.10" (foundry.toml:60).
1. src/abstract/RainlangDeploySuites.sol — five candidates
Delete the sourceCreationCode: line from each DeployCandidate({...}) literal,
and the trailing comma on the snapshot: DeploySuite({...}) entry above it:
| Suite |
sourceCreationCode line |
artifactPath line |
Path |
parser |
114 — type(RainlangParser).creationCode |
111 |
src/concrete/RainlangParser.sol:RainlangParser |
store |
134 — type(RainlangStore).creationCode |
131 |
src/concrete/RainlangStore.sol:RainlangStore |
interpreter |
161 — type(RainlangInterpreter).creationCode |
158 |
src/concrete/RainlangInterpreter.sol:RainlangInterpreter |
expression-deployer |
191 — type(RainlangExpressionDeployer).creationCode |
188 |
src/concrete/RainlangExpressionDeployer.sol:RainlangExpressionDeployer |
rainlang |
224 — type(Rainlang).creationCode |
221 |
src/concrete/Rainlang.sol:Rainlang |
All five artifact paths were checked against the tree: each file exists and
declares the named contract, so all five resolve and none needs correction.
The five concrete imports on lines 6-10 — RainlangParser, RainlangStore,
RainlangInterpreter, RainlangExpressionDeployer, Rainlang — exist only to
spell those type(X).creationCode expressions and all become unused.
2. test/src/abstract/RainlangDeploySuites.t.sol — four tests read the removed field
This is the substantial part of the migration here.
testArtifactPathsResolveToTheCandidateSource (line 92, external view)
asserts keccak256(vm.getCode(artifactPath)) == keccak256(sourceCreationCode) —
exactly the property #242 moves into the package. Its right-hand operand
disappears, and restating it against the same vm.getCode call would compare a
value with itself, which is the shape #242 exists to eliminate. Delete it, and
note in its place that checkCandidatesAnchoredToSource now enforces it. Its doc
comment at lines 86-91 ("nothing in rain-deploy dereferences it") also stops
being true and goes with it.
Three external pure tests scan the removed field's bytes for addresses and
need a new source of those bytes:
testCandidatesDependOnTheSiblingsTheyReach — line 142,
containsAddress(candidates[i].sourceCreationCode, candidates[j].snapshot.storedDeployedAddress)
testCandidatesReachEveryDependencyTheyDeclare — line 181,
containsAddress(candidates[i].sourceCreationCode, deps[j])
testCandidatesDependOnTheExternalsTheyReach — line 224,
containsAddress(candidates[i].sourceCreationCode, externals[j])
There are two spellings and this issue does not pick one:
candidates[i].snapshot.creationCode — the recorded constant. Keeps all three
tests pure, no other edit. Sound only because the anchor now guarantees the
record equals the compiled artifact; these tests would be asserting about the
snapshot rather than about source.
vm.getCode(candidates[i].snapshot.artifactPath) — the compiled artifact.
Preserves the "what the source actually embeds" meaning the tests were written
for, but each of the three must change from external pure to external view.
3. script/Build.sol
- Line 99 —
contracts[i].candidate.sourceCreationCode, becomes
vm.getCode(contracts[i].candidate.snapshot.artifactPath),, so
regenerateSnapshots writes from the same origin the anchor reads back.
- Line 26 — the
GeneratedContract doc comment names sourceCreationCode.
4. Version pin, when there is one to move to
Five files spell the versioned remapping prefix rain-deploy-0.1.10/ and each
has to be rewritten together with foundry.toml and soldeer.lock:
src/abstract/RainDeploySuitesBase.sol (the re-export shim holding the one
local spelling of the package path, which the generated libs reach through a
relative import and so cannot be skipped)
script/Build.sol, script/Deploy.sol
test/src/abstract/RainlangDeployChain.t.sol,
test/src/abstract/RainlangDeploySnapshot.t.sol
The version to bump to does not exist yet
rainlanguage/rain.deploy#242 is open, unmerged and unreleased. There is no
published rain-deploy version carrying this change, so this issue deliberately
names none. The bump target has to be filled in once #242 merges and a Soldeer
release is cut; until then this issue is the record of what the edit will be,
not a request to make it.
Not affected in this repo
Migration item 3 of #242 — "any consumer wrapper marked pure must become
view" — needs no edit here. This repo inherits RainDeployVerifySnapshot
without redeclaring testSnapshotMatchesSource or wrapping
checkCandidatesAnchoredToSource, so the mutability change lands entirely
inside the package.
Migration item 4 — no foundry.toml change is required, because vm.getCode
does not go through fs_permissions.
Upstream change
rainlanguage/rain.deploy#242 removes
DeployCandidate.sourceCreationCodeandmakes
checkCandidatesAnchoredToSourceresolve the candidate's ownsnapshot.artifactPaththroughvm.getCodeinstead. The source operand nowcomes from the compiler rather than from the declaration.
The removed field was one a consumer filled in. Pointing it at the same
generated constant as the record made the one check that catches a snapshot of
the wrong contract compare a value with itself — green for any candidate at all,
in CI and on the irreversible
RainDeployBroadcast.run()path alike. That israinlanguage/rain.factory.deploy#34, which #242 closes.
This is a BREAKING change. This repo has five candidates and four tests
that read the removed field, so it carries more of the migration than any other
consumer except
raindex.What this repo has to change
Current pin:
rain-deploy = "0.1.10"(foundry.toml:60).1.
src/abstract/RainlangDeploySuites.sol— five candidatesDelete the
sourceCreationCode:line from eachDeployCandidate({...})literal,and the trailing comma on the
snapshot: DeploySuite({...})entry above it:sourceCreationCodelineartifactPathlineparsertype(RainlangParser).creationCodesrc/concrete/RainlangParser.sol:RainlangParserstoretype(RainlangStore).creationCodesrc/concrete/RainlangStore.sol:RainlangStoreinterpretertype(RainlangInterpreter).creationCodesrc/concrete/RainlangInterpreter.sol:RainlangInterpreterexpression-deployertype(RainlangExpressionDeployer).creationCodesrc/concrete/RainlangExpressionDeployer.sol:RainlangExpressionDeployerrainlangtype(Rainlang).creationCodesrc/concrete/Rainlang.sol:RainlangAll five artifact paths were checked against the tree: each file exists and
declares the named contract, so all five resolve and none needs correction.
The five concrete imports on lines 6-10 —
RainlangParser,RainlangStore,RainlangInterpreter,RainlangExpressionDeployer,Rainlang— exist only tospell those
type(X).creationCodeexpressions and all become unused.2.
test/src/abstract/RainlangDeploySuites.t.sol— four tests read the removed fieldThis is the substantial part of the migration here.
testArtifactPathsResolveToTheCandidateSource(line 92,external view)asserts
keccak256(vm.getCode(artifactPath)) == keccak256(sourceCreationCode)—exactly the property #242 moves into the package. Its right-hand operand
disappears, and restating it against the same
vm.getCodecall would compare avalue with itself, which is the shape #242 exists to eliminate. Delete it, and
note in its place that
checkCandidatesAnchoredToSourcenow enforces it. Its doccomment at lines 86-91 ("nothing in
rain-deploydereferences it") also stopsbeing true and goes with it.
Three
external puretests scan the removed field's bytes for addresses andneed a new source of those bytes:
testCandidatesDependOnTheSiblingsTheyReach— line 142,containsAddress(candidates[i].sourceCreationCode, candidates[j].snapshot.storedDeployedAddress)testCandidatesReachEveryDependencyTheyDeclare— line 181,containsAddress(candidates[i].sourceCreationCode, deps[j])testCandidatesDependOnTheExternalsTheyReach— line 224,containsAddress(candidates[i].sourceCreationCode, externals[j])There are two spellings and this issue does not pick one:
candidates[i].snapshot.creationCode— the recorded constant. Keeps all threetests
pure, no other edit. Sound only because the anchor now guarantees therecord equals the compiled artifact; these tests would be asserting about the
snapshot rather than about source.
vm.getCode(candidates[i].snapshot.artifactPath)— the compiled artifact.Preserves the "what the source actually embeds" meaning the tests were written
for, but each of the three must change from
external puretoexternal view.3.
script/Build.solcontracts[i].candidate.sourceCreationCode,becomesvm.getCode(contracts[i].candidate.snapshot.artifactPath),, soregenerateSnapshotswrites from the same origin the anchor reads back.GeneratedContractdoc comment namessourceCreationCode.4. Version pin, when there is one to move to
Five files spell the versioned remapping prefix
rain-deploy-0.1.10/and eachhas to be rewritten together with
foundry.tomlandsoldeer.lock:src/abstract/RainDeploySuitesBase.sol(the re-export shim holding the onelocal spelling of the package path, which the generated libs reach through a
relative import and so cannot be skipped)
script/Build.sol,script/Deploy.soltest/src/abstract/RainlangDeployChain.t.sol,test/src/abstract/RainlangDeploySnapshot.t.solThe version to bump to does not exist yet
rainlanguage/rain.deploy#242 is open, unmerged and unreleased. There is no
published
rain-deployversion carrying this change, so this issue deliberatelynames none. The bump target has to be filled in once #242 merges and a Soldeer
release is cut; until then this issue is the record of what the edit will be,
not a request to make it.
Not affected in this repo
Migration item 3 of #242 — "any consumer wrapper marked
puremust becomeview" — needs no edit here. This repo inheritsRainDeployVerifySnapshotwithout redeclaring
testSnapshotMatchesSourceor wrappingcheckCandidatesAnchoredToSource, so the mutability change lands entirelyinside the package.
Migration item 4 — no
foundry.tomlchange is required, becausevm.getCodedoes not go through
fs_permissions.