Skip to content

Commit 3e34fcf

Browse files
Merge pull request #2919 from rainlanguage/2026-10-25-deploy-convention
Convert raindex to the .deploy convention: prod/subgraph tests pin the released suite
2 parents 3afdf51 + f9f310d commit 3e34fcf

22 files changed

Lines changed: 236 additions & 291 deletions

‎CLAUDE.md‎

Lines changed: 29 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@ Read and follow @AGENTS.md.
22

33
# Merge / Publish / Deploy runbook
44

5-
Contract change chain: edit source → **deploy** the new bytecode to its new
6-
CREATE2 address → **merge**. Publishing to soldeer is a separate manual tag
7-
release (below), never a side effect of merging. All of it is routine and
8-
pre-authorized; don't stop to ask about address/codehash churn.
5+
Deploy repo: a source change regenerates `src/generated/candidate/` and merges
6+
without deploying. Deploying and publishing happen together at a release
7+
(below). `LibRaindexDeploy` is the candidate. The start-block, `networks.json`
8+
and `subgraph.yaml` tests read the released RaindexV6 from the newest entry of
9+
the generated `LibRaindexV6Released`. Address/codehash churn is routine; don't
10+
stop to ask about it.
911

1012
## Merging a PR
1113

@@ -28,41 +30,29 @@ pre-authorized; don't stop to ask about address/codehash churn.
2830
workflow re-runs and history rewrites are hook-blocked — these are the allowed
2931
equivalents; don't spell the blocked forms out or you'll trip those hooks.)
3032

31-
## Deploying a contract (the bytecode cascade)
33+
## Source changes
3234

33-
Any source change to a CREATE2/zoltu-deployed contract moves its on-chain
34-
address + codehash. Do the whole cascade without asking:
35+
Regenerate artifacts — run the `rainix-copy-artifacts` step sequence (see that
36+
workflow) in `nix develop github:rainlanguage/rainix#sol-shell`. Stage ALL
37+
changed artifacts or `git-clean` drifts red. Nothing is deployed.
3538

36-
1. Regenerate artifacts — run the `rainix-copy-artifacts` step sequence (see
37-
that workflow) in `nix develop github:rainlanguage/rainix#sol-shell`. Stage
38-
ALL changed artifacts or `git-clean` drifts red.
39-
2. Deploy each changed suite:
40-
`gh workflow run manual-sol-artifacts.yaml --ref <branch> -f suite=<x>`. One
41-
dispatch deploys all seven chains. **Never run two deploys concurrently** —
42-
they share one deployer EOA and race the nonce, leaving a partial deploy;
43-
serialize dispatches. A `completed/failure` run still deployed if the log has
44-
`ONCHAIN EXECUTION COMPLETE & SUCCESSFUL` — only etherscan `--verify` failed
45-
(cosmetic).
46-
3. If RaindexV6 moved, run `script/build-start-blocks.sh` — rewrites the
47-
`RAINDEX_START_BLOCK_*` constants, `subgraph/networks.json` and
48-
`subgraph/subgraph.yaml` (else `testIsStartBlock*` / `testNetworksJson*` /
49-
`testSubgraphYamlAddress` red). Uses foundry `rpc_endpoints` env vars,
50-
falling back to public archive RPCs.
51-
4. `testProdDeploy*` fork tests stay red until the new addresses have code
52-
on-chain; re-trigger PR CI with an empty commit after deploying.
53-
54-
## Publishing to soldeer (tag release)
39+
## Releasing (deploy + publish)
5540

56-
- Manual tag release via rainix `rainix-tag-release.yaml@main`
57-
(`package-release.yaml`, `sol-v*` tags). Merges to main do NOT publish.
58-
- To cut a release: deploy changed suites first, then one PR that runs
59-
`forge script ./script/Build.sol --sig 'cutRelease()'` — freezing the
60-
candidate pins as `src/generated/<tag>/` — and bumps
61-
`foundry.toml [external.package].version` to match. Merge, then push tag
62-
`sol-v<version>`.
63-
- The tag re-runs the fork suite and `release-guard` (version == tag, frozen dir
64-
present and byte-identical to `candidate/`, clean tree after regeneration, no
65-
later tag frozen), then publishes `raindex~<version>` and cuts the GitHub
66-
release.
67-
- `src/generated/<tag>/` snapshots are append-only — the
68-
`frozen-snapshots-append-only` gate reds any PR that edits or deletes one.
41+
1. Deploy each changed suite:
42+
`gh workflow run manual-sol-artifacts.yaml --ref main -f suite=<x>`. One
43+
dispatch deploys all seven chains. **Never run two deploys concurrently** —
44+
they share one deployer EOA and race the nonce; serialize dispatches. A
45+
`completed/failure` run still deployed if the log has
46+
`ONCHAIN EXECUTION COMPLETE & SUCCESSFUL` (only `--verify` failed).
47+
2. One PR: bump `foundry.toml [external.package].version`, run
48+
`forge script ./script/Build.sol --sig 'cutRelease()'` (freezes `candidate/`
49+
as `src/generated/<tag>/`), and if RaindexV6 moved run
50+
`script/build-start-blocks.sh` (`LibRaindexV6StartBlock`, `networks.json`,
51+
`subgraph.yaml`).
52+
3. Merge, then push tag `sol-v<version>`. Via rainix `rainix-tag-release.yaml`
53+
(`package-release.yaml`) it re-runs the fork suite and `release-guard`
54+
(version == tag, frozen dir byte-identical to `candidate/`, clean tree, no
55+
later tag frozen), then publishes `raindex-deploy~<version>`.
56+
57+
`src/generated/<tag>/` snapshots are append-only — the
58+
`frozen-snapshots-append-only` gate reds any PR that edits or deletes one.

‎foundry.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# `release-guard` checks it against the pushed `sol-v<version>` tag before
1212
# anything publishes.
1313
[external.package]
14-
name = "raindex"
14+
name = "raindex-deploy"
1515
version = "0.1.15"
1616

1717
[profile.default]

‎script/build-start-blocks.sh‎

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22
# SPDX-License-Identifier: LicenseRef-DCL-1.0
33
# SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd
44

5-
# Refresh the RaindexV6 deploy-block bookkeeping after a redeploy.
5+
# Refresh the RaindexV6 deploy-block bookkeeping after a release.
66
#
7-
# Finds the exact block at which the currently-pinned RaindexV6 was deployed on
8-
# each mainnet by binary-searching `eth_getCode` over an archive RPC, then
9-
# rewrites the new per-chain blocks + the current pinned address into:
10-
# - the RAINDEX_START_BLOCK_* constants in src/lib/deploy/LibRaindexDeploy.sol
7+
# Finds the exact block at which the newest released RaindexV6 (the last entry
8+
# of LibRaindexV6Released) was deployed on each mainnet by binary-searching
9+
# `eth_getCode` over an archive RPC, then rewrites the new per-chain blocks +
10+
# that address into:
11+
# - the RAINDEX_START_BLOCK_* constants in src/lib/deploy/LibRaindexV6StartBlock.sol
1112
# - subgraph/networks.json (address + startBlock per network)
1213
# - subgraph/subgraph.yaml (data source address)
1314
#
@@ -19,10 +20,14 @@
1920
# tests.
2021
set -euo pipefail
2122

22-
LIB="src/lib/deploy/LibRaindexDeploy.sol"
23+
LIB="src/lib/deploy/LibRaindexV6StartBlock.sol"
24+
RELEASED="src/lib/LibRaindexV6Released.sol"
2325
NET="subgraph/networks.json"
2426
YAML="subgraph/subgraph.yaml"
25-
PTR="src/generated/candidate/RaindexV6.sol"
27+
TAG=$(grep -aoE 'storedDeployedAddress: RaindexV6_[A-Za-z0-9_]+_DEPLOYED_ADDRESS' "$RELEASED" | tail -1 \
28+
| sed -E 's/.*RaindexV6_(.+)_DEPLOYED_ADDRESS/\1/' || true)
29+
PTR="src/generated/${TAG}/RaindexV6.sol"
30+
[ -n "$TAG" ] && [ -f "$PTR" ] || { echo "could not read the newest released RaindexV6 snapshot from $RELEASED" >&2; exit 1; }
2631

2732
ARB_RPC="${ARBITRUM_RPC_URL:-https://arbitrum.drpc.org}"
2833
BASE_RPC="${BASE_RPC_URL:-https://mainnet.base.org}"

‎src/lib/deploy/LibRaindexDeploy.sol‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,4 @@ library LibRaindexDeploy {
7878
/// The code hash of the `GenericPoolRaindexV6FlashBorrower` contract when
7979
/// deployed with the rain standard zoltu deployer.
8080
bytes32 constant GENERIC_POOL_FLASH_BORROWER_DEPLOYED_CODEHASH = GENERIC_POOL_FB_HASH;
81-
82-
uint256 constant RAINDEX_START_BLOCK_ARBITRUM = 473899359;
83-
uint256 constant RAINDEX_START_BLOCK_BASE = 47387582;
84-
uint256 constant RAINDEX_START_BLOCK_FLARE = 63011168;
85-
uint256 constant RAINDEX_START_BLOCK_POLYGON = 88573024;
8681
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-License-Identifier: LicenseRef-DCL-1.0
2+
// SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd
3+
pragma solidity ^0.8.25;
4+
5+
/// @title LibRaindexV6StartBlock
6+
/// @notice The block the newest released RaindexV6 was deployed at on each
7+
/// chain the subgraph indexes.
8+
library LibRaindexV6StartBlock {
9+
uint256 constant RAINDEX_START_BLOCK_ARBITRUM = 473899359;
10+
uint256 constant RAINDEX_START_BLOCK_BASE = 47387582;
11+
uint256 constant RAINDEX_START_BLOCK_FLARE = 63011168;
12+
uint256 constant RAINDEX_START_BLOCK_POLYGON = 88573024;
13+
}

‎test/lib/deploy/LibRaindexDeployIsStartBlockBase.t.sol‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎test/lib/deploy/LibRaindexDeployIsStartBlockFlare.t.sol‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎test/lib/deploy/LibRaindexDeployIsStartBlockPolygon.t.sol‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎test/lib/deploy/LibRaindexDeployNetworksJsonAddresses.t.sol‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎test/lib/deploy/LibRaindexDeployNetworksJsonStartBlockFlare.t.sol‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)