Skip to content

Commit 442a7bf

Browse files
Read released RaindexV6 from LibRaindexV6Released; drop copied prod lib
The start-block, networks.json and subgraph.yaml tests and build-start-blocks.sh read the newest LibRaindexV6Released entry. Only the start blocks remain hand-written, in LibRaindexV6StartBlock. On-chain release checks stay with RaindexDeployChainTest. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 837c494 commit 442a7bf

22 files changed

Lines changed: 206 additions & 392 deletions

‎CLAUDE.md‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Read and follow @AGENTS.md.
44

55
Deploy repo: a source change regenerates `src/generated/candidate/` and merges
66
without deploying. Deploying and publishing happen together at a release
7-
(below). `LibRaindexDeploy` is the candidate; `LibRaindexProdDeploy` pins the
8-
release `[external.package].version` names, and every on-chain, start-block,
9-
`networks.json` and `subgraph.yaml` test reads it. Address/codehash churn is
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
1010
routine; don't stop to ask about it.
1111

1212
## Merging a PR
@@ -46,9 +46,8 @@ changed artifacts or `git-clean` drifts red. Nothing is deployed.
4646
`ONCHAIN EXECUTION COMPLETE & SUCCESSFUL` (only `--verify` failed).
4747
2. One PR: bump `foundry.toml [external.package].version`, run
4848
`forge script ./script/Build.sol --sig 'cutRelease()'` (freezes `candidate/`
49-
as `src/generated/<tag>/`), repoint `LibRaindexProdDeploy`'s imports at
50-
`<tag>` (`LibRaindexProdDeployTest` reds until it agrees with the version),
51-
and if RaindexV6 moved run `script/build-start-blocks.sh` (start blocks,
49+
as `src/generated/<tag>/`), and if RaindexV6 moved run
50+
`script/build-start-blocks.sh` (`LibRaindexV6StartBlock`,
5251
`networks.json`, `subgraph.yaml`).
5352
3. Merge, then push tag `sol-v<version>`. Via rainix `rainix-tag-release.yaml`
5453
(`package-release.yaml`) it re-runs the fork suite and `release-guard`

‎script/build-start-blocks.sh‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
# Refresh the RaindexV6 deploy-block bookkeeping after a release.
66
#
7-
# Finds the exact block at which the released RaindexV6 that LibRaindexProdDeploy
8-
# pins was deployed on each mainnet by binary-searching `eth_getCode` over an
9-
# archive RPC, then rewrites the new per-chain blocks + that address into:
10-
# - the RAINDEX_START_BLOCK_* constants in src/lib/deploy/LibRaindexProdDeploy.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,11 +20,14 @@
1920
# tests.
2021
set -euo pipefail
2122

22-
LIB="src/lib/deploy/LibRaindexProdDeploy.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/$(grep -aoE "generated/[0-9]+_[0-9]+_[0-9]+/RaindexV6.sol" "$LIB" | head -1)
26-
[ -f "$PTR" ] || { echo "could not read the released RaindexV6 snapshot from $LIB" >&2; exit 1; }
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; }
2731

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

‎src/lib/deploy/LibRaindexProdDeploy.sol‎

Lines changed: 0 additions & 55 deletions
This file was deleted.
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/LibRaindexProdDeploy.t.sol‎

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

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

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

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

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)