feat(contracts): verify bridge-compat ABI shape in CI - #1424
Draft
broda-spendy wants to merge 1 commit into
Draft
broda-spendy wants to merge 1 commit into
broda-spendy wants to merge 1 commit into
Conversation
Add scripts/check_bridge_abi.sh plus an approved abi_snapshot.json and a bridge-abi job in rust-wasm.yml. The checker extracts bridge-compat exported functions and event topics and the vault entry points, and fails on drift.
|
@broda-spendy Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Verifies the bridge-compat ABI shape and event signatures against the vault contract on every upgrade.
scripts/check_bridge_abi.sh— pure text analysis (no Rust toolchain needed, so it gates even while the workspace does not compile). Extracts everypub fninside each#[contractimpl]block (normalized signatures) plus allsymbol_short!event topics, and diffs the regenerated surface against the snapshot.contracts/bridge-compat/abi_snapshot.json— approved surface: 18 bridge functions, 6 event topics, 162 vault entry points.bridge-abijob inrust-wasm.yml(with the script path added to the workflow triggers).After an intentional change:
bash scripts/check_bridge_abi.sh --update.Design notes
#[contractimpl]blocks only, ending at the first column-0}. Brace counting was tried first and abandoned — string literals and comments routinely contain unbalanced braces. Test-only sources (tests/,test.rs,*_tests.rs,fuzz_*,deposit_withdraw_props.rs,benji_strategy.rs) are excluded so test churn never reads as ABI drift; this matters becausetest.rsandbenji_strategy.rscontain their own#[contractimpl]blocks.while readsilently dropped the last alphabetical entry (each list lost one row), and unquoted globs broke on the space in the local checkout path (arrays now).Validation (MSYS2 bash, login shell)
bash -nsyntax check — clean.bash scripts/check_bridge_abi.sh— passes against the committed snapshot.--updatetwice in a row — byte-identical (deterministic).pub fn fake_drift_probe(env: Env) -> u32inside the impl block fails the check with a one-line diff naming the function; reverting restores green. A free function appended outside the impl is correctly ignored (not contract ABI).Not verified: an actual GitHub Actions run (no runner access from here).
Scope notes
rust-wasm.ymlwith ci(contracts): type-check every contract crate before merge #1417 (cargo checkgate) but in different regions (trigger paths + appended job vs. a step insiderust-test); both should merge cleanly.Closes #1305