Skip to content

Verify EulerChains.json is in sync with addresses#215

Merged
kanvgupta merged 3 commits intomasterfrom
verification
Apr 24, 2026
Merged

Verify EulerChains.json is in sync with addresses#215
kanvgupta merged 3 commits intomasterfrom
verification

Conversation

@kasperpawlowski
Copy link
Copy Markdown
Collaborator

Summary

  • Add a PR-gating GitHub Actions workflow that re-runs node chains.js and fails if the committed EulerChains.json differs from what the generator produces against the current addresses/ and config/addresses/ trees.
  • Motivation: EulerChains.json is a generated artifact, but nothing stops it from drifting from its source of truth. A contributor can hand-edit the manifest, or update an addresses file and forget to re-run the generator. Both are silent today.

Changes

  • New workflow .github/workflows/verify-chains-manifest.yml runs on pull_request and push to master, scoped via paths to changes that could affect the output: chains.js, EulerChains.json, addresses/**, config/addresses/**. Also exposes workflow_dispatch for manual re-runs.
  • The job checks out the tree, sets up Node 20, runs node chains.js, and then runs git diff --quiet -- EulerChains.json. On drift, emits a GitHub ::error:: annotation pointing contributors to run node chains.js locally, then prints the diff for context and exits 1.
  • No npm install step — chains.js uses only Node built-ins (fs), so there are no dependencies to cache or pin.
  • Verified on the current tree: node chains.js produces a byte-identical EulerChains.json right now, so the check starts green.

Required follow-up (repo admin)

  • To actually block merges, add verify-chains-manifest as a required status check in the branch protection rule for master. Without that, the workflow will report status but will not prevent merging.

Test plan

  • Open a PR that edits an addresses file (e.g. addresses/1/LensAddresses.json) without re-running chains.js — workflow must fail with the "out of sync" error and show the diff in the job log.
  • On the same PR, run node chains.js locally, commit the updated EulerChains.json, push — workflow must pass.
  • Open a PR that hand-edits EulerChains.json only — workflow must fail (the regenerated file will overwrite the hand-edit and the diff will surface).
  • Open a PR that does not touch any of the scoped paths (e.g. README only) — workflow is correctly skipped (path filter), and skipped required checks are treated as passed by branch protection.
  • Trigger the workflow manually via workflow_dispatch on master — must report "EulerChains.json matches the output of chains.js."

Add a PR-gating workflow that regenerates EulerChains.json via
'node chains.js' and fails the check if the committed file does not
match the generator's output against the current addresses/ and
config/addresses/ trees.

This catches two error modes that have no other guard today:
- A contributor hand-edits EulerChains.json without updating the
  underlying addresses files.
- A contributor updates an addresses file but forgets to re-run
  chains.js before committing.

The job runs on pull_request and push to master, scoped to changes
that could affect the output (chains.js, EulerChains.json, and the
two address directories). No npm install step is needed — chains.js
uses only Node built-ins.

To actually block merges, configure 'verify-chains-manifest' as a
required status check in the master branch protection rules.
This commit intentionally hand-edits EulerChains.json so that it no
longer matches the output of chains.js. The verify-chains-manifest
workflow must fail on this commit. A revert commit follows immediately
to restore the green state.
@kanvgupta kanvgupta merged commit 47d47d4 into master Apr 24, 2026
1 check passed
@kanvgupta kanvgupta deleted the verification branch April 24, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants