Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,8 @@ Via [soldeer](https://soldeer.xyz):
forge soldeer install rain-deploy~<version>
```

**You also need `forge-std` 1.16.1 and `rain-sol-codegen` 0.1.6**, remapped as
`forge-std-1.16.1/` and `rain-sol-codegen-0.1.6/`. The published package ships
**You also need `forge-std` 1.16.2 and `rain-sol-codegen` 0.1.36**, remapped as
`forge-std-1.16.2/` and `rain-sol-codegen-0.1.36/`. The published package ships
`src/`, `script/` and the licence and README files — no `test/`, no
`foundry.toml`, no `remappings.txt`, no `soldeer.lock`, no `dependencies/` — so
a consumer resolves both itself. The requirement is transitive rather than
Expand All @@ -356,8 +356,8 @@ every abstract a consumer inherits pulls them in — `Script` via

```toml
[dependencies]
forge-std = "1.16.1"
rain-sol-codegen = "0.1.6"
forge-std = "1.16.2"
rain-sol-codegen = "0.1.36"
rain-deploy = "<version>"
```

Expand Down
4 changes: 2 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ fs_permissions = [
]

[dependencies]
forge-std = "1.16.1"
rain-sol-codegen = "0.1.6"
forge-std = "1.16.2"
rain-sol-codegen = "0.1.36"

[soldeer]
recursive_deps = false
Expand Down
4 changes: 2 additions & 2 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
forge-std-1.16.1/=dependencies/forge-std-1.16.1/
rain-sol-codegen-0.1.6/=dependencies/rain-sol-codegen-0.1.6/
forge-std-1.16.2/=dependencies/forge-std-1.16.2/
rain-sol-codegen-0.1.36/=dependencies/rain-sol-codegen-0.1.36/
105 changes: 24 additions & 81 deletions script/Build.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,88 +2,43 @@
// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd
pragma solidity =0.8.25;

import {Script} from "forge-std-1.16.1/src/Script.sol";
import {Script} from "forge-std-1.16.2/src/Script.sol";
import {DeployCandidate} from "../src/abstract/RainDeploySuitesBase.sol";
import {RegistryDeploySuites} from "../src/abstract/RegistryDeploySuites.sol";
import {LibRainDeploySnapshot} from "../src/lib/LibRainDeploySnapshot.sol";

/// One contract's generated files: the rolling snapshot, the alias lib that
/// re-exports its pins and the released-suites lib emitted from its record.
///
/// The candidate carries the creation code the snapshot is written from and the
/// declaration metadata the released lib copies, so the only things a generated
/// contract adds to it are the two names codegen needs.
struct GeneratedContract {
/// The contract's name, which places its snapshot inside
/// `src/generated/<dir>/` and names both generated libs.
/// Places the snapshot inside `src/generated/<dir>/` and names both
/// generated libs.
string contractName;
/// The prefix for the constants the alias lib exports, e.g.
/// `ADDRESS_REGISTRY`. Passed rather than derived; see `writeAliasLib`.
/// Prefix for the constants the alias lib exports, e.g. `ADDRESS_REGISTRY`.
string constantPrefix;
/// The rolling candidate from the declaration. Its `sourceCreationCode`
/// and its `snapshot.dependencies` are what the snapshot is generated FROM
/// — both are frozen into it — and its `snapshot` is the template the
/// released lib takes its key and artifact path from.
/// Snapshots are written from its `sourceCreationCode` and
/// `snapshot.dependencies`; the released lib takes its suite key and
/// artifact path from its `snapshot`.
DeployCandidate candidate;
}

/// @title Build
/// @notice Generates the deterministic-deploy pins for every contract this repo
/// deploys.
///
/// Two entry points, because there are two different things to do and only one
/// of them happens on an ordinary build:
///
/// - `run()` — every build. Regenerates the ROLLING snapshots under
/// `src/generated/candidate/` from current source, and the alias libs that
/// point at them. Nothing here is frozen, so a source change simply moves it.
/// - `cutRelease()` — a release. Regenerates the rolling snapshots and freezes
/// them as `src/generated/<tag>/`, in ONE call, in that order.
///
/// The alias libs always point at `candidate`, so consumers' import paths never
/// move and `LibAddressRegistry` and `LibMigrationRegistry` always resolve
/// against what this repo currently compiles. The frozen `<tag>/` directories
/// are the historical record — what each release actually deployed — which is
/// what `RegistryDeploySuites.releasedSuites()` enumerates.
///
/// BOTH entry points also regenerate the released-suites libs from the record.
/// `run()` must: they are imported by ordinary source, so a repo before its
/// first release still has to have them, and with nothing frozen they declare
/// an empty set.
///
/// ## One list, three readers
///
/// `generatedContracts()` is the whole of what this script declares, and the
/// regeneration, the lib writers and the freeze all read it. A contract added
/// to it is generated, aliased, released and frozen; there is no second list to
/// add it to and therefore no way to add it to one and not the other. That
/// matters most for the freeze: a contract regenerated but left out of the
/// names `freeze` is given is a contract silently absent from the release,
/// which nothing downstream can notice, because a tag that never held it has
/// nothing missing from it.
///
/// The metadata each released entry carries beyond its frozen snapshot comes
/// from the named candidate on the declaration, which is why this inherits the
/// declaration rather than restating it. There is one suite key, one artifact
/// path and one dependency list per contract in this repo, and a second copy of
/// them here is a second copy that drifts.
///
/// The dependency list goes into the SNAPSHOT rather than into the released lib
/// on every build. It is a precondition of the broadcast, not metadata, so a
/// release keeps the list it was cut with. `freeze` regenerates before it
/// freezes, so the list a release records is the declaration's as of the cut.
/// - `run()` rewrites the rolling snapshots under `src/generated/candidate/`,
/// the alias libs pointing at them, and the released-suites libs.
/// - `cutRelease()` does the same, freezing the rolling snapshots as
/// `src/generated/<tag>/` in between.
///
/// Candidates are reached by NAME rather than by index into `candidateSuites()`
/// for the same reason: a released-suites lib describes one contract, so a
/// positional read would silently write another contract's metadata the moment
/// the list is reordered.
/// Alias libs always point at `candidate`, so `LibAddressRegistry` and
/// `LibMigrationRegistry` resolve against what this repo currently compiles.
/// The frozen `<tag>/` directories are what
/// `RegistryDeploySuites.releasedSuites()` enumerates.
///
/// The tag, both snapshot paths, the freeze, the snapshot writer and both
/// generated-lib writers all come from `LibRainDeploySnapshot`, which in turn
/// emits every constant through `LibCodeGen` and writes snapshots through
/// `LibFs`. This script is the declaration and the sequencing, nothing else.
/// `generatedContracts()` is the only list, read by the regeneration, both lib
/// writers and the freeze.
contract Build is Script, RegistryDeploySuites {
/// Every contract this repo generates deploy pins for, declared ONCE.
/// Every contract this repo generates deploy pins for.
/// @return contracts The generated contracts.
function generatedContracts() internal pure returns (GeneratedContract[] memory contracts) {
contracts = new GeneratedContract[](2);
Expand All @@ -97,26 +52,16 @@ contract Build is Script, RegistryDeploySuites {
});
}

/// @notice Every build: regenerate the rolling snapshots, their alias libs
/// and the released-suites libs.
/// @notice Regenerate the rolling snapshots, their alias libs and the
/// released-suites libs.
function run() external {
regenerateCandidates();
regenerateLibs();
}

/// @notice A release: regenerate the rolling snapshots, freeze them as this
/// release's immutable record, then regenerate the declaration of that
/// record.
///
/// One invocation, so the ordering is a property of the tool rather than of
/// whoever wrote the release command. `LibRainDeploySnapshot.freeze` takes
/// the regeneration and runs it FIRST; there is no entry point that freezes
/// without regenerating, so a stale freeze has nowhere to come from.
///
/// The released-suites libs are written from the record AFTER the freeze,
/// so the release being cut is in them. A frozen tag no released suite
/// declares is a release that drops out of every check there is, which is
/// exactly what generating the two from one call removes.
/// @notice Regenerate the rolling snapshots, freeze them as
/// `src/generated/<tag>/`, then rewrite the libs from the record, so the
/// release being cut is in them.
function cutRelease() external {
GeneratedContract[] memory contracts = generatedContracts();
string[] memory contractNames = new string[](contracts.length);
Expand All @@ -127,9 +72,7 @@ contract Build is Script, RegistryDeploySuites {
regenerateLibs();
}

/// @notice Rewrite every alias lib and every released-suites lib. Both
/// entry points end here, so there is no entry point that regenerates one
/// and not the other.
/// @notice Rewrite every alias lib and every released-suites lib.
function regenerateLibs() internal {
GeneratedContract[] memory contracts = generatedContracts();
for (uint256 i = 0; i < contracts.length; i++) {
Expand Down
16 changes: 8 additions & 8 deletions soldeer.lock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[[dependencies]]
name = "forge-std"
version = "1.16.1"
url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_16_1_08-05-2026_08:51:16_forge-std-1.16.zip"
checksum = "839b61832925c7152c7b6dffbfa4998d9e606211179bd8f604733124e8a7cb57"
integrity = "60e55d10150354ca4a1e2985c5456c834b92b82ef85ab0e1d92a7786cddbd219"
version = "1.16.2"
url = "https://soldeer-revisions.s3.amazonaws.com/forge-std/1_16_2_03-07-2026_07:37:45_forge-std-1.16.zip"
checksum = "405dccc9d60d753f6abc412b4adf0359f4390f65dbadbbb277a12b4946ed8969"
integrity = "5fb4325b60d7d4194bd0481e2f94398cf1d9c6561dd12a66fb2748ef4a68205f"

[[dependencies]]
name = "rain-sol-codegen"
version = "0.1.6"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-sol-codegen/0_1_6_13-08-2026_19:05:33_rain.sol.zip"
checksum = "906ebec1dff49612802ce04db626827aba348f4efd174fc7cb483f7d9ce8a06d"
integrity = "2e911fdf161eed28e1d94c50a1cc2ee0d353aa4c9d1a4dc2bdbfa0ac4f3b1de7"
version = "0.1.36"
url = "https://soldeer-revisions.s3.amazonaws.com/rain-sol-codegen/0_1_36_18-08-2026_09:20:33_rain.sol.zip"
checksum = "b5d101d46941a95fee441224e101004139814ae9afa2793138874bd7e93991ff"
integrity = "164e2655ac8b66bcf52c799421706d3dfaab987addaaeadd74574e70fd2eb6ed"
2 changes: 1 addition & 1 deletion src/abstract/RainDeployBroadcast.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 {Script} from "forge-std-1.16.1/src/Script.sol";
import {Script} from "forge-std-1.16.2/src/Script.sol";

import {DeploySuite, RainDeploySuitesBase} from "./RainDeploySuitesBase.sol";
import {LibRainDeploy} from "../lib/LibRainDeploy.sol";
Expand Down
2 changes: 1 addition & 1 deletion src/abstract/RainDeployVerifyBase.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 {Test} from "forge-std-1.16.1/src/Test.sol";
import {Test} from "forge-std-1.16.2/src/Test.sol";

import {DeploySuite, RainDeploySuitesBase} from "./RainDeploySuitesBase.sol";
import {LibRainDeploy} from "../lib/LibRainDeploy.sol";
Expand Down
4 changes: 2 additions & 2 deletions src/lib/LibRainDeploy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd
pragma solidity ^0.8.25;

import {Vm} from "forge-std-1.16.1/src/Vm.sol";
import {console2} from "forge-std-1.16.1/src/console2.sol";
import {Vm} from "forge-std-1.16.2/src/Vm.sol";
import {console2} from "forge-std-1.16.2/src/console2.sol";

/// @title LibRainDeploy
/// Library for deploying contracts via the Zoltu factory across all the networks
Expand Down
Loading
Loading