Skip to content
Closed
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
19 changes: 19 additions & 0 deletions .circleci/continue/rust-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,20 @@ jobs:
command: typos
# No cache save: downloads no crates.

# Fails while the reth fork is pinned by anything but an op-<base>-<n> tag. Its own job,
# so a PR pinned on a fork PR's commit still runs every other check and is red only here.
rust-reth-pin:
docker:
- image: <<pipeline.parameters.c-default_docker_image>>
resource_class: small.gen2
steps:
- checkout-with-mise:
checkout-method: blobless
- run:
name: Check the reth fork is pinned by tag
working_directory: rust
command: just check-reth-pin

# Shared no_std compatibility check job
rust-ci-check-no-std:
parameters:
Expand Down Expand Up @@ -1018,6 +1032,10 @@ workflows:
directory: rust
context: *rust-ci-context

- rust-reth-pin:
context:
- circleci-repo-readonly-authenticated-github-token

- rust-ci-cargo-tests:
name: rust-tests
directory: rust
Expand Down Expand Up @@ -1131,6 +1149,7 @@ workflows:
- rust-deny: terminal
- rust-typos: terminal
- rust-zepter: terminal
- rust-reth-pin: terminal
- rust-tests: terminal
- interop-deposits-diff: terminal
- rust-doctest: terminal
Expand Down
6 changes: 6 additions & 0 deletions rust/UPDATING-RETH.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,12 @@ PR's head commit with `rev = "<sha>"` meanwhile. Once the fork PR merges, tag
its merged commit and switch the monorepo PR to the tag before it merges, so
a fork pin on `develop` is always a tag.

CI enforces this: the required `rust-reth-pin` job (`just check-reth-pin` in
`rust/`) fails while any crate from the fork resolves through anything but an
`op-<base>-<n>` tag. It runs apart from the other jobs, so a PR on a `rev` pin
still gets the full CI result and is red only on this check. Keep that PR in
draft until the switch to the tag.

## After the monorepo PR merges

Repin the premium PR's monorepo dependency to the merge commit on `develop`
Expand Down
27 changes: 27 additions & 0 deletions rust/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,33 @@ check-sp1-guest-lock:
exit 1
fi

# Fail unless every crate from the ethereum-optimism/reth fork resolves through an
# `op-<base>-<n>` tag. A `rev` pin on an open fork PR is fine while both PRs are in
# development, but not on develop. CI runs this as its own required job, so such a PR
# still runs every other check. Reads the lockfiles, which `--locked` CI jobs keep in
# sync with the manifests, so a transitive fork dependency is caught too.
[script('bash')]
check-reth-pin:
set -euo pipefail
# Fail closed: a git or grep error must not read as "no untagged sources".
files=$(git ls-files -- '*Cargo.lock')
locks=()
while IFS= read -r f; do [ -n "$f" ] && locks+=("$f"); done <<< "$files"
[ "${#locks[@]}" -gt 0 ] || { echo "error: no Cargo.lock found" >&2; exit 1; }
rc=0
sources=$(grep -hoE '"git\+https://github\.com/ethereum-optimism/reth(\.git)?[?#][^"]*"' "${locks[@]}") || rc=$?
[ "$rc" -le 1 ] || exit "$rc"
# `<base>` may contain hyphens, e.g. an upstream pre-release `v2.8.0-rc.1`.
untagged=$(printf '%s\n' "$sources" | grep -vE '^$|\?tag=op-[0-9A-Za-z.-]+-[0-9]+#[0-9a-f]{40}"$' | sort -u) || true
if [ -n "$untagged" ]; then
echo "error: the reth fork is pinned by something other than an op-<base>-<n> tag:" >&2
echo "$untagged" | sed 's/^/ /' >&2
echo " Before merging: merge the ethereum-optimism/reth PRs this pin points at," >&2
echo " tag the merged commit, and pin \`tag = \"op-<base>-<n>\"\` in rust/Cargo.toml." >&2
echo " See rust/UPDATING-RETH.md, \"Pinning a fork change\"." >&2
exit 1
fi

# Cargo only warns when a [patch.crates-io] entry is unused. Assert that every
# crypto crate used by each guest program resolves exclusively to its SP1 fork.
[script('bash')]
Expand Down
Loading