Skip to content

Chore: protect genesis files#1732

Open
justinfrevert wants to merge 7 commits into
mainfrom
chore/protect-genesis-files
Open

Chore: protect genesis files#1732
justinfrevert wants to merge 7 commits into
mainfrom
chore/protect-genesis-files

Conversation

@justinfrevert

@justinfrevert justinfrevert commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Overview

Protect changes against genesis files of live networks.

🗹 TODO before merging

  • Ready

📌 Submission Checklist

  • All commits are signed off (git commit -s) for the DCO
  • Changes are backward-compatible (or flagged if breaking)
  • Pull request description explains why the change is needed
  • Self-reviewed the diff
  • I have included a change file, or skipped for this reason:
  • If the changes introduce a new feature, I have bumped the node minor version
  • Update documentation (if relevant)
  • Updated AGENTS.md if build commands, architecture, or workflows changed
  • No new todos introduced

🧪 Testing Evidence

Please describe any additional testing aside from CI:

  • Additional tests are provided (if possible)

🔱 Fork Strategy

  • Node Runtime Update
  • Node Client Update
  • Other:
  • N/A

Links

Signed-off-by: Justin Frevert <justinfrevert@gmail.com>
Signed-off-by: Justin Frevert <justinfrevert@gmail.com>
@justinfrevert justinfrevert requested a review from a team as a code owner June 20, 2026 00:15
@datadog-official

datadog-official Bot commented Jun 20, 2026

Copy link
Copy Markdown

Pipelines

⚠️ Warnings

🚦 1 Pipeline job failed

Changes Check | check-changes   View in Datadog   GitHub Actions

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 693409e | Docs | Give us feedback!

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ef59c2f3d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/ci/check-frozen-res.sh Outdated
BASE_REF="${1:-origin/main}"

# Folders that must never change. Anchored at the start of the path.
PROTECTED_RE='^res/(mainnet|qanet|preprod|preview)/'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include res/genesis in the frozen-path guard

For PRs that touch the actual live genesis artifacts, such as res/genesis/genesis_state_mainnet.mn or res/genesis/genesis_block_qanet.mn, this regex does not match them, so check-frozen-res.sh reports OK even though the live chain configs point at those files (res/cfg/mainnet.toml:6-7) and the genesis docs list res/genesis/ as the generated ledger-state location. Since this check is meant to protect deployed genesis artifacts, add the live-network res/genesis/genesis_{state,block}_*.mn paths to the protected set.

Useful? React with 👍 / 👎.

Signed-off-by: Justin Frevert <justinfrevert@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 66ba5ac2aa

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

- name: Frozen res/ network config
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
run: scripts/ci/check-frozen-res.sh "$BASE_SHA"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run the frozen-path check from trusted code

For a PR that changes a protected res/ path and also edits scripts/ci/check-frozen-res.sh to skip or narrow the check, the checkout step has already put the PR's version of the script in the worktree before this line runs, so the required guard can pass while frozen artifacts change. Since this is the enforcement point for immutable paths, run the diff logic from a trusted base-revision copy or keep it in the workflow/API without executing PR-controlled code.

Useful? React with 👍 / 👎.

Comment thread scripts/ci/check-frozen-res.sh Outdated
changed="$(git diff --name-only --no-renames "${BASE_REF}...HEAD" | grep -E "$PROTECTED_RE" || true)"

if [ -n "$changed" ]; then
echo "::error::Frozen res/ network config changed. These files are deployed artifacts and must never be modified:"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sentence is false in few distinct ways:

  • some of the config files were modified or even created after the chain-spec was created and network started
  • "never" - preview is perhaps going to be restarted
  • some of the config file should be changed, because they are just wrong and not consistent with chain-spec

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True. Only updatable in rare cases, which get flagged, and we can review case-by-case. Updated the language to allow for that.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1ace59fa71

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/ci/check-frozen-res.sh Outdated
Comment thread scripts/ci/check-frozen-res.sh Outdated
Signed-off-by: Justin Frevert <justinfrevert@gmail.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 693409e10c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

name: "Frozen Paths Check"
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rerun the frozen check when PR bases change

Because this workflow only subscribes to opened, synchronize, reopened, and ready_for_review, retargeting a PR to a different base branch does not rerun scripts/ci/check-frozen-res.sh with the new BASE_SHA. In that case the PR can keep a green result computed against an old/non-main base while its diff against the new base includes a protected res/... change, until another head commit is pushed; include edited or avoid narrowing the activity types so the guard is recomputed on base changes.

Useful? React with 👍 / 👎.

@LGLO LGLO left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, but it makes fixes like #1730 harder to land. Main question for now is if the existing chain-spec files are really the exact same chain-specs that were used for genesis of the 4 networks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants