Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
014f0ea
Per-network beacon for registry beacon proxy suites
thedavidmeister Nov 30, 2026
92645ab
Keep params.beaconName in registry beacon proxy simulation
thedavidmeister Nov 30, 2026
10adff1
Declare an empty beaconPerNetwork in single-beacon registry beacon pr…
thedavidmeister Nov 30, 2026
0ef8273
Keep the verify-chain registry params encoded in storage
thedavidmeister Nov 30, 2026
89d5c8e
Registry beacon proxy suites carry only the per-chain beacon list
thedavidmeister Nov 30, 2026
5264cd8
Port registry beacon proxy tests to the per-chain beacon list
thedavidmeister Nov 30, 2026
6ca3c4b
Test per-chain beacons on registry-beacon-proxy suites (WIP, uncompiled)
thedavidmeister Nov 30, 2026
536ed16
Consume rain.deploy #415: local deploy steps and per-chain expected c…
thedavidmeister Nov 30, 2026
38f89b0
Read per-chain derived code hashes in tests
thedavidmeister Nov 30, 2026
9ed6360
forge fmt
thedavidmeister Nov 30, 2026
21411a1
Rename locals shadowing the beacon helper in on-chain checks tests
thedavidmeister Nov 30, 2026
bfd3435
Test per-chain derivation and internal consistency of per-chain regis…
thedavidmeister Nov 30, 2026
20bf7c2
Carry each chain's registry beacon proxy runtime code and code hash; …
thedavidmeister Nov 30, 2026
54279a8
Remove dead local stub implementation; add per-chain proxy fields at …
thedavidmeister Nov 30, 2026
ec6b12e
Drop blank line left by stub removal
thedavidmeister Nov 30, 2026
ef10a34
Initialize the local registry beacon proxy through the real implement…
thedavidmeister Nov 30, 2026
77ea2ac
Lock the rain-deploy git dependency
thedavidmeister Nov 30, 2026
35c8f0e
Carry the implementation through registry beacon proxy test literals
thedavidmeister Nov 30, 2026
34c6d0b
Check per-network registry beacon proxy suites against each chain's p…
thedavidmeister Nov 30, 2026
609ff5a
Validate each chain's registry beacon proxy code record and the candi…
thedavidmeister Nov 30, 2026
176da19
Generate a registry beacon proxy's runtime code from its chain's entr…
thedavidmeister Nov 30, 2026
aec864a
Fill per-chain proxy code in the registry test helpers (WIP, uncompiled)
thedavidmeister Nov 30, 2026
4ece5f5
Bump rain-deploy to the 0.1.44 release
thedavidmeister Nov 30, 2026
c5d24a5
Restore the caller's startPrank around the registry beacon proxy loca…
thedavidmeister Nov 30, 2026
2a47ebf
Format the registry beacon proxy tests
thedavidmeister Nov 30, 2026
e8c4032
Keep tx.origin when pranking the factory in the local registry beacon…
thedavidmeister Nov 30, 2026
eeead20
Format LibRainDeployCloneMechanism
thedavidmeister Nov 30, 2026
3319d40
Test each chain's proxy code record is refused wherever a registry be…
thedavidmeister Nov 30, 2026
48929a9
Test each chain of a registry beacon proxy suite on its own proxy cod…
thedavidmeister Nov 30, 2026
faa5b8f
Test each mechanism's local deploy step against its broadcast step
thedavidmeister Nov 30, 2026
668fdf6
Merge branch 'registry-beacon-per-network' of https://github.com/rain…
thedavidmeister Nov 30, 2026
501861e
Format the local deploy step tests
thedavidmeister Nov 30, 2026
5cbafb6
Give registry beacon proxy test params an entry per listed chain and …
thedavidmeister Nov 30, 2026
e6448f2
Merge branch 'registry-beacon-per-network' of https://github.com/rain…
thedavidmeister Nov 30, 2026
81f22fe
Check resolved beacons against the chain id they resolved on
thedavidmeister Nov 30, 2026
cd4d8b1
Check registry beacon proxies against the checked network's beacon
thedavidmeister Nov 30, 2026
a7a4045
Declare the registry beacon proxy candidate in the per-network verify…
thedavidmeister Nov 30, 2026
211f2dd
Merge branch 'registry-beacon-per-network' of https://github.com/rain…
thedavidmeister Nov 30, 2026
4468f73
Run the registry beacon proxy chain matrix on the factory's code from…
thedavidmeister Nov 30, 2026
c4d5994
Fit the chain matrix storage comment to the line length
thedavidmeister Nov 30, 2026
2750227
Declare the on-chain check test's registry beacon on the chain it checks
thedavidmeister Nov 30, 2026
63f92f2
Format the registry beacon proxy mechanism and snapshot tests
thedavidmeister Nov 30, 2026
d1b0834
Name the proxy code record test's beacons without a truncating cast
thedavidmeister Nov 30, 2026
34378da
Refuse a chain listed twice with RegistryBeaconProxyBeaconListedTwice
thedavidmeister Nov 30, 2026
1f5c718
Drop false proxyCodeHash field comment
thedavidmeister Nov 30, 2026
6e529b8
test: expect RegistryBeaconProxyBeaconListedTwice for a chain listed …
thedavidmeister Nov 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ forge-std = "1.17.0"
# a bump that changes `src/generated/` needs a new interface version.
"@openzeppelin-contracts" = "5.7.0"
rain-sol-codegen = "0.1.39"
rain-deploy = "0.1.43"
rain-deploy = "0.1.44"
# rain-deploy imports it by path.
rain-extrospection = "0.1.31"
# rain-extrospection imports it by path.
Expand Down
4 changes: 2 additions & 2 deletions script/Build.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {BeaconProxy} from "@openzeppelin-contracts-5.7.0/proxy/beacon/BeaconProx
import {RegistryBeaconProxy} from "./RegistryBeaconProxy.sol";
import {LibCodeGen} from "rain-sol-codegen-0.1.39/src/lib/LibCodeGen.sol";
import {LibFs} from "rain-sol-codegen-0.1.39/src/lib/LibFs.sol";
import {LibRainDeploy} from "rain-deploy-0.1.43/src/lib/LibRainDeploy.sol";
import {LibRainDeployConfig} from "rain-deploy-0.1.43/src/lib/LibRainDeployConfig.sol";
import {LibRainDeploy} from "rain-deploy-0.1.44/src/lib/LibRainDeploy.sol";
import {LibRainDeployConfig} from "rain-deploy-0.1.44/src/lib/LibRainDeployConfig.sol";

/// @title Build
/// @notice Writes `src/generated/BeaconProxy.sol`: OpenZeppelin `BeaconProxy`'s
Expand Down
8 changes: 4 additions & 4 deletions soldeer.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ integrity = "fa706c8a7caf3426c90f75e6aafa3224b0a6c899b490800cf6944e4ec42f9344"

[[dependencies]]
name = "rain-deploy"
version = "0.1.43"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-deploy/0_1_43_27-11-2026_16:25:33_rain.zip"
checksum = "6b3502113b36819382320351c569bc7dc76106b9dbb141f904e6e8f9f61b7c53"
integrity = "8bedc496af60801ae3c540b23d8b7b036df7145091215e8b2deee0674ba97b69"
version = "0.1.44"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-deploy/0_1_44_30-11-2026_18:00:04_rain.zip"
checksum = "2d014abdc7c24f538b3fe681aca69bd90da02cc98f7f483eeaf0e8cef910a994"
integrity = "46a335fae8cf3ca9aa60cb3d7240426af770ce2c2abd7543991c98e6c8991379"

[[dependencies]]
name = "rain-extrospection"
Expand Down
6 changes: 3 additions & 3 deletions src/lib/LibCloneCandidates.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd
pragma solidity ^0.8.25;

import {DeployCandidate, DeployDeclaration} from "rain-deploy-0.1.43/src/abstract/RainDeploySuitesBase.sol";
import {LibRainDeploy} from "rain-deploy-0.1.43/src/lib/LibRainDeploy.sol";
import {LibRainDeployDeclaration} from "rain-deploy-0.1.43/src/lib/LibRainDeployDeclaration.sol";
import {DeployCandidate, DeployDeclaration} from "rain-deploy-0.1.44/src/abstract/RainDeploySuitesBase.sol";
import {LibRainDeploy} from "rain-deploy-0.1.44/src/lib/LibRainDeploy.sol";
import {LibRainDeployDeclaration} from "rain-deploy-0.1.44/src/lib/LibRainDeployDeclaration.sol";
import {CloneDeploy} from "./LibRainDeployClone.sol";
import {BeaconProxyDeploy} from "./LibRainDeployBeaconProxy.sol";
import {RegistryBeaconProxyDeploy} from "./LibRainDeployRegistryBeaconProxy.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/lib/LibICloneableFactoryV7.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "../interface/ICloneableFactoryV7.sol";
import {LibICloneableFactoryV5} from "./LibICloneableFactoryV5.sol";
import {REGISTRY_BEACON_PROXY_CREATION_CODE} from "../generated/RegistryBeaconProxy.sol";
import {IConfigRegistryV5} from "rain-deploy-0.1.43/src/interface/IConfigRegistryV5.sol";
import {IConfigRegistryV5} from "rain-deploy-0.1.44/src/interface/IConfigRegistryV5.sol";

/// @dev The value type hash a beacon binding must carry.
bytes32 constant BEACON_BINDING_VALUE_TYPE_HASH = keccak256("address");
Expand Down
15 changes: 10 additions & 5 deletions src/lib/LibRainDeployBeacon.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ pragma solidity ^0.8.25;
import {IBeacon} from "@openzeppelin-contracts-5.7.0/proxy/beacon/IBeacon.sol";
import {IERC5313} from "@openzeppelin-contracts-5.7.0/interfaces/IERC5313.sol";
import {Ownable2Step} from "@openzeppelin-contracts-5.7.0/access/Ownable2Step.sol";
import {MIGRATION_HEAD_GENESIS, Prerequisite} from "rain-deploy-0.1.43/src/interface/IMigrationRegistryV5.sol";
import {LibMigrationRegistry} from "rain-deploy-0.1.43/src/lib/LibMigrationRegistry.sol";
import {LibRainDeploy} from "rain-deploy-0.1.43/src/lib/LibRainDeploy.sol";
import {MIGRATION_HEAD_GENESIS, Prerequisite} from "rain-deploy-0.1.44/src/interface/IMigrationRegistryV5.sol";
import {LibMigrationRegistry} from "rain-deploy-0.1.44/src/lib/LibMigrationRegistry.sol";
import {LibRainDeploy} from "rain-deploy-0.1.44/src/lib/LibRainDeploy.sol";

/// The declared suite a beacon points at, by key, and its owner.
/// @param implementation The key of the released suite `implementation()` MUST return the address of.
Expand Down Expand Up @@ -111,10 +111,15 @@ library LibRainDeployBeacon {
/// `LibMigrationRegistry.UnexpectedMigrationRegistryCodeHash` when a transition is declared and the registry is
/// not deployed, and `BeaconTransitionsOutOfOrder`.
/// @param network The network's name, for the refusal.
/// @param chainId The beacon's network's chain id, for `checkTransitionMigrations`' refusals.
/// @param beacon The beacon, resolved: `beacon` set, as `RainDeployVerifyBase.resolveBeacon` sets it.
/// @return The state index, as `stateAt` takes it.
function appliedState(string memory network, DeployBeacon memory beacon) internal view returns (uint256) {
checkTransitionMigrations(block.chainid, beacon);
function appliedState(string memory network, uint256 chainId, DeployBeacon memory beacon)
internal
view
returns (uint256)
{
checkTransitionMigrations(chainId, beacon);
uint256 state = 0;
for (uint256 i = 0; i < beacon.transitions.length; i++) {
Prerequisite memory migration = beacon.transitions[i].migration;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/LibRainDeployBeaconDeclarationChecks.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd
pragma solidity ^0.8.25;

import {DeployDeclaration} from "rain-deploy-0.1.43/src/abstract/RainDeploySuitesBase.sol";
import {DeployDeclaration} from "rain-deploy-0.1.44/src/abstract/RainDeploySuitesBase.sol";
import {LibRainDeployBeaconResolution} from "./LibRainDeployBeaconResolution.sol";

/// @param chainId The beacon's chain id.
Expand Down
9 changes: 8 additions & 1 deletion src/lib/LibRainDeployBeaconProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {ICloneableFactoryV6} from "../interface/deprecated/ICloneableFactoryV6.s
import {BEACON_PROXY_CREATION_CODE} from "../generated/BeaconProxy.sol";
import {LibICloneableFactoryV5} from "./LibICloneableFactoryV5.sol";

import {DeployDependency} from "rain-deploy-0.1.43/src/lib/LibRainDeploy.sol";
import {DeployDependency} from "rain-deploy-0.1.44/src/lib/LibRainDeploy.sol";
import {CloneParams} from "./LibRainDeployClone.sol";

/// @dev The artifact path a beacon proxy suite carries. It names no compiled source here: see
Expand Down Expand Up @@ -176,4 +176,11 @@ library LibRainDeployBeaconProxy {
}
return proxy;
}

/// `beaconProxyDeployStep` without the broadcast.
function beaconProxyDeployStepLocally(Vm, address, bytes memory paramsData) internal returns (address) {
CloneParams memory params = abi.decode(paramsData, (CloneParams));
return ICloneableFactoryV6(params.factory)
.beaconProxyDeterministicOpenSalt(params.implementation, params.data, params.salt);
}
}
45 changes: 36 additions & 9 deletions src/lib/LibRainDeployBeaconResolution.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ import {
DeployDeclaration,
DeploySuite,
DerivationSnapshotRevertFailed
} from "rain-deploy-0.1.43/src/abstract/RainDeploySuitesBase.sol";
import {DerivedDeploy, NoDerivedDeployment} from "rain-deploy-0.1.43/src/abstract/RainDeployVerifyBase.sol";
import {LibRainDeploy, SupportedNetwork} from "rain-deploy-0.1.43/src/lib/LibRainDeploy.sol";
import {DeploySuiteIndex, LibRainDeployDeclaration} from "rain-deploy-0.1.43/src/lib/LibRainDeployDeclaration.sol";
} from "rain-deploy-0.1.44/src/abstract/RainDeploySuitesBase.sol";
import {
DerivedDeploy,
NoDerivedDeployment,
NotDerivedOnChain
} from "rain-deploy-0.1.44/src/abstract/RainDeployVerifyBase.sol";
import {LibRainDeploy, SupportedNetwork} from "rain-deploy-0.1.44/src/lib/LibRainDeploy.sol";
import {DeploySuiteIndex, LibRainDeployDeclaration} from "rain-deploy-0.1.44/src/lib/LibRainDeployDeclaration.sol";
import {ChainBeacon, DeployBeacon, LibRainDeployBeacon} from "./LibRainDeployBeacon.sol";
import {LibRainDeployCloneMechanism} from "./LibRainDeployCloneMechanism.sol";
import {
Expand Down Expand Up @@ -88,32 +92,35 @@ library LibRainDeployBeaconResolution {
DeployBeacon memory beacon = resolved.beacon;
// Deliberately rechecked by `checkBeacon`, which holds a beacon to its code hash on its own.
if (bytes(beacon.beaconSuite).length != 0) {
checkSuiteOnNetwork(network, resolved.suite, resolved.derived, beacon.beacon);
checkSuiteOnNetwork(network, resolved.chainId, resolved.suite, resolved.derived, beacon.beacon);
}
uint256 state = LibRainDeployBeacon.appliedState(network, beacon);
uint256 state = LibRainDeployBeacon.appliedState(network, resolved.chainId, beacon);
LibRainDeployBeacon.checkBeacon(
network, beacon, resolved.implementationAddresses[state], LibRainDeployBeacon.stateAt(beacon, state).owner
);
checkSuiteOnNetwork(
network,
resolved.chainId,
resolved.implementations[state],
resolved.implementationDerived[state],
resolved.implementationAddresses[state]
);
}

/// @param network The selected fork's network.
/// @param chainId The chain id the suite was resolved on, whose derived code hash it is held to.
/// @param suite The suite.
/// @param derived Its derivation.
/// @param deployedAddress Its address on the selected fork.
function checkSuiteOnNetwork(
string memory network,
uint256 chainId,
DeploySuite memory suite,
DerivedDeploy memory derived,
address deployedAddress
) internal view {
LibRainDeploy.checkDeclaredDependencies(network, suite.dependencies);
LibRainDeploy.checkDeployedCode(network, deployedAddress, derived.bytecodeHash);
LibRainDeploy.checkDeployedCode(network, deployedAddress, derivedCodeHash(derived, chainId));
}

/// When a beacon is declared, `BeaconOnUncheckedNetwork` for any beacon off `d.networks` before resolving any; then,
Expand Down Expand Up @@ -221,7 +228,7 @@ library LibRainDeployBeaconResolution {
(resolved.suite, resolved.derived) = resolveReleased(d, index, beacon.beaconSuite);
beacon.beacon =
LibRainDeployDeclaration.mechanismOf(d, resolved.suite).deployedAddress(d, resolved.suite, chainId);
beacon.beaconCodeHash = resolved.derived.bytecodeHash;
beacon.beaconCodeHash = derivedCodeHash(resolved.derived, chainId);
} else if (beacon.beacon == address(0) || beacon.beaconCodeHash == bytes32(0)) {
revert BeaconUnnamed(chainId, beaconIndex);
}
Expand Down Expand Up @@ -296,7 +303,10 @@ library LibRainDeployBeaconResolution {
revert NoDerivedDeployment(suite.suite);
}
DerivedDeploy memory derivedDeploy = DerivedDeploy({
suite: suite.suite, deployedAddresses: deployedAddresses, bytecodeHash: deployedAddresses[deployed].codehash
suite: suite.suite,
chainIds: LibRainDeploy.networkChainIds(LibRainDeploy.declaredNetworkConfigs(suite.networks)),
deployedAddresses: deployedAddresses,
bytecodeHashes: codeHashes(deployedAddresses)
});
if (!vm.revertToState(snapshotId)) {
revert DerivationSnapshotRevertFailed(suite.suite, snapshotId);
Expand Down Expand Up @@ -330,4 +340,21 @@ library LibRainDeployBeaconResolution {
revert BeaconSeatedImplementation(resolved.chainId, beaconIndex, probe.implementation);
}
}

function codeHashes(address[] memory addresses) internal view returns (bytes32[] memory) {
bytes32[] memory hashes = new bytes32[](addresses.length);
for (uint256 i = 0; i < addresses.length; i++) {
hashes[i] = addresses[i].codehash;
}
return hashes;
}

function derivedCodeHash(DerivedDeploy memory derived, uint256 chainId) internal pure returns (bytes32) {
for (uint256 i = 0; i < derived.chainIds.length; i++) {
if (derived.chainIds[i] == chainId && derived.deployedAddresses[i] != address(0)) {
return derived.bytecodeHashes[i];
}
}
revert NotDerivedOnChain(derived.suite, chainId);
}
}
10 changes: 9 additions & 1 deletion src/lib/LibRainDeployClone.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {console2} from "forge-std-1.17.0/src/console2.sol";
import {ICloneableFactoryV6} from "../interface/deprecated/ICloneableFactoryV6.sol";
import {LibICloneableFactoryV5} from "./LibICloneableFactoryV5.sol";

import {DeployDependency} from "rain-deploy-0.1.43/src/lib/LibRainDeploy.sol";
import {DeployDependency} from "rain-deploy-0.1.44/src/lib/LibRainDeploy.sol";
import {ChainDeploy} from "./LibRainDeployExtendedNetworks.sol";

uint256 constant EIP1167_CREATION_CODE_PREFIX_LENGTH = 10;
Expand Down Expand Up @@ -261,4 +261,12 @@ library LibRainDeployClone {
vm.stopBroadcast();
return cloneDeployedAddr;
}

/// `cloneDeployStep` without the broadcast.
function cloneDeployStepLocally(Vm, address, bytes memory paramsData) internal returns (address) {
CloneParams memory params = abi.decode(paramsData, (CloneParams));
return
ICloneableFactoryV6(params.factory)
.cloneDeterministicOpenSalt(params.implementation, params.data, params.salt);
}
}
2 changes: 1 addition & 1 deletion src/lib/LibRainDeployCloneBuild.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity ^0.8.25;

import {Vm} from "forge-std-1.17.0/src/Vm.sol";
import {RAIN_COPYRIGHT_TEXT, RAIN_SPDX_LICENSE_IDENTIFIER} from "rain-sol-codegen-0.1.39/src/lib/LibCodeGen.sol";
import {DeployDeclaration} from "rain-deploy-0.1.43/src/abstract/RainDeploySuitesBase.sol";
import {DeployDeclaration} from "rain-deploy-0.1.44/src/abstract/RainDeploySuitesBase.sol";
import {ChainDeploy, LibRainDeployExtendedNetworks} from "./LibRainDeployExtendedNetworks.sol";
import {CloneLayerConfig, LibRainDeployCloneMechanism} from "./LibRainDeployCloneMechanism.sol";

Expand Down
51 changes: 42 additions & 9 deletions src/lib/LibRainDeployCloneMechanism.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import {
DeployDeclaration,
DeployMechanismHandler,
DeploySuite
} from "rain-deploy-0.1.43/src/abstract/RainDeploySuitesBase.sol";
import {LibRainDeploy, SupportedNetwork} from "rain-deploy-0.1.43/src/lib/LibRainDeploy.sol";
import {DeploySuiteIndex, LibRainDeployDeclaration} from "rain-deploy-0.1.43/src/lib/LibRainDeployDeclaration.sol";
} from "rain-deploy-0.1.44/src/abstract/RainDeploySuitesBase.sol";
import {LibRainDeploy, SupportedNetwork} from "rain-deploy-0.1.44/src/lib/LibRainDeploy.sol";
import {DeploySuiteIndex, LibRainDeployDeclaration} from "rain-deploy-0.1.44/src/lib/LibRainDeployDeclaration.sol";
import {ChainDeploy, LibRainDeployExtendedNetworks} from "./LibRainDeployExtendedNetworks.sol";
import {ChainBeacon} from "./LibRainDeployBeacon.sol";
import {LibRainDeploySnapshot} from "rain-deploy-0.1.43/src/lib/LibRainDeploySnapshot.sol";
import {LibRainDeploySnapshot} from "rain-deploy-0.1.44/src/lib/LibRainDeploySnapshot.sol";
import {
CLONE_ARTIFACT_PATH,
CLONE_UNANCHORABLE_REASON,
Expand Down Expand Up @@ -171,6 +171,7 @@ library LibRainDeployCloneMechanism {
recordedAddress: recordedAddress,
deployStepData: deployStepData,
deployStep: deployStep,
deployStepLocally: deployStepLocally,
deployLocally: deployLocally,
deployLocallyOnChain: deployLocallyOnChain,
addUnrecordedNetworks: addUnrecordedNetworks,
Expand Down Expand Up @@ -490,7 +491,7 @@ library LibRainDeployCloneMechanism {
}

/// @param suite A registry beacon proxy suite.
/// @return Its factory call, its factory, registry and beacon checked among its dependencies.
/// @return Its factory call, its factory and registry checked among its dependencies.
function registryBeaconProxyParams(DeploySuite memory suite)
internal
pure
Expand All @@ -499,7 +500,6 @@ library LibRainDeployCloneMechanism {
RegistryBeaconProxyParams memory params = abi.decode(payload(suite), (RegistryBeaconProxyParams));
LibRainDeployClone.checkDependencyDeclared(params.factory, suite.dependencies);
LibRainDeployClone.checkDependencyDeclared(params.registry, suite.dependencies);
LibRainDeployClone.checkDependencyDeclared(params.beacon, suite.dependencies);
return params;
}

Expand Down Expand Up @@ -607,6 +607,21 @@ library LibRainDeployCloneMechanism {
isBeaconProxy(suite) ? LibRainDeployBeaconProxy.beaconProxyDeployStep : LibRainDeployClone.cloneDeployStep;
}

/// @param suite A clone or beacon proxy suite.
/// @return The local twin of its `deployStep`.
function deployStepLocally(DeployDeclaration memory, DeploySuite memory suite)
internal
pure
returns (function(Vm, address, bytes memory) internal returns (address))
{
if (isRegistryBeaconProxy(suite)) {
return LibRainDeployRegistryBeaconProxy.registryBeaconProxyDeployStepLocally;
}
return isBeaconProxy(suite)
? LibRainDeployBeaconProxy.beaconProxyDeployStepLocally
: LibRainDeployClone.cloneDeployStepLocally;
}

/// A per-network suite with an entry for every network in `chainIds` its candidate has and it lacks, each at the
/// address the candidate's init data derives there. Any other suite, or one whose candidate is under another
/// mechanism, is returned as it is.
Expand Down Expand Up @@ -740,6 +755,17 @@ library LibRainDeployCloneMechanism {
return false;
}

/// For a consumer's `expectedBytecodeHash` override.
/// @param suite The suite.
/// @param chainId The chain id.
/// @return A registry beacon proxy's stored proxy code hash on `chainId`, else `suite.storedBytecodeHash`.
function expectedBytecodeHash(DeploySuite memory suite, uint256 chainId) internal pure returns (bytes32) {
if (!isRegistryBeaconProxy(suite)) {
return suite.storedBytecodeHash;
}
return LibRainDeployRegistryBeaconProxy.beaconOnNetwork(registryBeaconProxyParams(suite), chainId).proxyCodeHash;
}

/// @param suite A clone or beacon proxy suite.
/// @param data The new payload.
/// @return A deep copy of `suite` whose mechanism data wraps `data` under its tag; `suite` is not changed.
Expand All @@ -758,7 +784,11 @@ library LibRainDeployCloneMechanism {
function deployParams(Vm vm, DeploySuite memory suite, uint256 chainId, address expected) internal {
if (isRegistryBeaconProxy(suite)) {
checkRegistryBeaconProxyCreationCode(suite);
vm.etch(expected, suite.storedRuntimeCode);
vm.etch(
expected,
LibRainDeployRegistryBeaconProxy.beaconOnNetwork(registryBeaconProxyParams(suite), chainId)
.proxyRuntimeCode
);
return;
}
CloneParams memory params = cloneParamsOn(suite, chainId);
Expand Down Expand Up @@ -893,10 +923,13 @@ library LibRainDeployCloneMechanism {
registry: proxy.registry,
authority: proxy.authority,
beaconName: proxy.beaconName,
beacon: proxy.beacon,
beaconPerNetwork: proxy.beaconPerNetwork,
data: proxy.data,
salt: proxy.salt
salt: proxy.salt,
implementation: proxy.implementation,
implementationRuntimeCode: proxy.implementationRuntimeCode
});
LibRainDeployRegistryBeaconProxy.checkProxyCode(params, proxy.runtimeCode);
return DeployCandidate({
snapshot: DeploySuite({
suite: proxy.suite,
Expand Down
Loading
Loading