Skip to content

feat(common): add ABI compatibility checks and reorganize CI scripts#2167

Closed
Eikix wants to merge 24 commits intomainfrom
elias/abi-compat-check
Closed

feat(common): add ABI compatibility checks and reorganize CI scripts#2167
Eikix wants to merge 24 commits intomainfrom
elias/abi-compat-check

Conversation

@Eikix
Copy link
Copy Markdown
Contributor

@Eikix Eikix commented Mar 24, 2026

Summary

  • Add a shared ABI compatibility checker plus a CI entrypoint for host and gateway contracts
  • Add a local wrapper command to compare two refs with the same core logic used in CI
  • Reorganize ci/ into subsystem folders: abi-compat/, upgrade-check/, shared/
  • Fix code smells: broken import in exceptions.ts, missing error handling in upgrade-check list.ts, incorrect repoRoot computation

Structure

ci/
├── abi-compat/     check.ts, config.ts, exceptions.ts, lib.ts, list.ts, README.md
├── upgrade-check/  check.ts, config.ts, hints.ts, lib.ts, list.ts
├── shared/         merge-address-constants.ts
└── README.md

Both subsystems follow the same pattern:

  • check.ts — CI entrypoint (single package, GitHub Actions annotations)
  • lib.ts — core comparison logic
  • list.ts — local multi-package report (creates worktrees, installs deps, runs comparison)
  • config.ts — package names, contract lists, build deps

What ABI compat checks

  • Compares deployed contract ABIs against a baseline tag
  • Matches by full canonical ABI signature (overloads supported)
  • Filters out initializer/reinitializer and gated admin/protocol-only functions by modifier pattern
  • Allows additions and fails when a stable signature disappears

Local usage

bun ci/abi-compat/list.ts --from v0.11.1 --to v0.12.0-0
bun ci/abi-compat/list.ts --from v0.11.1 --package host-contracts
bun ci/upgrade-check/list.ts --from v0.11.1 --to v0.12.0-0

Code smell fixes

  • ci/abi-compat/exceptions.ts: import from ./abi-compat-config (nonexistent) fixed to ./config
  • ci/upgrade-check/list.ts: run() now captures stderr/stdout on failure instead of swallowing errors; worktrees cleaned up explicitly instead of relying on git worktree prune
  • ci/upgrade-check/list.ts: repoRoot used dirname(import.meta.dir) which would resolve to wrong directory after move; fixed to resolve(import.meta.dir, "../..")
  • ci/upgrade-check/list.ts: inline PackageName/PACKAGE_CONFIG extracted to config.ts

Validation

  • All 5 entrypoints verified with bun build --no-bundle
  • No stale references to old paths (grep verified)
  • zizmor clean on both workflow files

@cla-bot cla-bot bot added the cla-signed label Mar 24, 2026
@Eikix Eikix changed the title feat(ci): add contract ABI compatibility checks feat(contracts): add contract ABI compatibility checks Mar 25, 2026
@Eikix Eikix marked this pull request as ready for review March 25, 2026 08:27
@Eikix Eikix requested a review from a team as a code owner March 25, 2026 08:27
@eudelins-zama
Copy link
Copy Markdown
Contributor

Would be nice to put your scripts in a dedicated folder within the ci folder

Eikix added 18 commits March 26, 2026 12:32
Used by both abi-compat and upgrade-check subsystems.
Mirrors the ci/abi-compat/ structure: check.ts (CI entrypoint),
lib.ts (core logic), list.ts (local multi-package report), hints.ts
(domain config).
Capture exec errors with truncated output instead of swallowing them.
Clean up worktrees explicitly on failure instead of relying on prune.
Matches the pattern established in abi-compat/list.ts.
@Eikix Eikix changed the title feat(contracts): add contract ABI compatibility checks feat(ci): add ABI compatibility checks and reorganize CI scripts Mar 26, 2026
@Eikix Eikix force-pushed the elias/abi-compat-check branch from e654507 to 9b50494 Compare March 26, 2026 11:39
Eikix added 3 commits March 26, 2026 12:42
- Remove --force flag from forge inspect in abi-compat/lib.ts to avoid
  redundant recompilation (4x per side per package).
- Simplify printPackageReport return in abi-compat/list.ts.
- Derive valid package names from PACKAGE_CONFIG in upgrade-check
  parseArgs instead of hardcoding strings.
Without --force, a prior failed compilation (e.g. before address
constants are generated) leaves error artifacts in forge's cache.
Subsequent runs reuse the cached failure even after the source
files are fixed. Reproduced by: forge clean, attempt compilation
without addresses (fails), generate addresses, run check — forge
returns the cached error for Decryption while other contracts work.
Forge may prepend compilation progress text to stdout on the first
invocation in a clean directory. This caused Decryption (the first
contract checked) to fail JSON.parse in CI while subsequent contracts
succeeded from cache. Extract the JSON array from the output instead
of parsing the whole string, matching the approach used by the
upgrade-check bytecode extraction.
@Eikix Eikix changed the title feat(ci): add ABI compatibility checks and reorganize CI scripts feat(common): add ABI compatibility checks and reorganize CI scripts Mar 26, 2026
@Eikix
Copy link
Copy Markdown
Contributor Author

Eikix commented Mar 26, 2026

Superseded by a refreshed PR opened from a new head branch to avoid stale bot review state and Mergify issues.

@Eikix Eikix closed this Mar 26, 2026
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.

4 participants