diff --git a/.git_commit_msg.txt b/.git_commit_msg.txt deleted file mode 100644 index 0f87c928..00000000 --- a/.git_commit_msg.txt +++ /dev/null @@ -1,46 +0,0 @@ -feat: implement canonical error registry system with build-time sync - -This commit introduces a single source of truth for error definitions -across all Hermes contracts, solving the three-copy synchronization problem. - -CHANGES: -- Add crates/hermes-errors: Canonical error registry with 93+ definitions -- Add crates/hermes-codegen: Code generation library for contract-specific files -- Add contracts/analytics/build.rs: Build script template for integration -- Update root Cargo.toml: Include new crates in workspace members - -BENEFITS: -- Zero drift: All error files auto-generated from canonical registry -- Compile-time validation: Registry enforces unique codes and range boundaries -- Automatic sync: build.rs regenerates files on every cargo build -- Time savings: 13 minutes per error (11+ hours/year reduction) -- Safe deployment: Breaking changes caught at compile time - -DOCUMENTATION: -- SOLUTION_SUMMARY.md: Executive overview -- ERROR_DOCS_SYNC.md: Complete architecture guide -- MIGRATION_ERROR_SYNC.md: Step-by-step migration guide -- CONTRIBUTING_ERRORS.md: Error addition workflow -- crates/hermes-errors/README.md: Registry API reference -- ERROR_DOCUMENTATION_INDEX.md: Navigation hub - -IMPLEMENTATION: -Registry stores error definitions with: -- Numeric code (frozen once deployed) -- Variant name -- User-facing description -- Code range (for organization and validation) -- Contract scope - -Each contract's build.rs: -1. Reads canonical registry -2. Filters errors for that contract -3. Calls code generation library -4. Generates fresh src/errors.rs and tests/err_stab.rs - -Result: No manual duplication, impossible to drift, validated at compile time. - -NEXT STEPS: -- Review solution in SOLUTION_SUMMARY.md -- Follow MIGRATION_ERROR_SYNC.md for contract-by-contract migration -- Team training on CONTRIBUTING_ERRORS.md workflow diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48f36879..92959e46 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,25 @@ jobs: with: fetch-depth: 0 - uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Verify active Rust toolchain + run: | + python3 - <<'PY' + import subprocess + import tomllib + from pathlib import Path + + expected = tomllib.loads(Path("rust-toolchain.toml").read_text())["toolchain"]["channel"] + active = subprocess.check_output( + ["rustup", "show", "active-toolchain"], text=True + ).split()[0] + host = subprocess.check_output(["rustup", "show", "host"], text=True).strip() + + if active not in (expected, f"{expected}-{host}"): + raise SystemExit( + f"Rust toolchain mismatch: expected {expected!r}, got {active!r}" + ) + print(f"Verified active Rust toolchain: {active} (configured: {expected})") + PY - name: Run workspace tests run: cargo test --workspace - name: Verify committed snapshot goldens diff --git a/.gitignore b/.gitignore index 92e15eeb..7a5de424 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ commit_out.txt +.git_commit_msg.txt # Rust build artifacts target/ diff --git a/contracts/oracles/src/views.rs b/contracts/oracles/src/views.rs index 4b4b6810..6284932d 100644 --- a/contracts/oracles/src/views.rs +++ b/contracts/oracles/src/views.rs @@ -36,6 +36,16 @@ /// Named bit-flag constants for oracle contract capabilities. /// +/// This unit struct is a namespace, not a typed flag set. The contract returns +/// a `u64` bitmap as its stable ABI, which lets older clients inspect known +/// bits while preserving unknown bits introduced by future versions. Changing +/// the return type would change that ABI; wrapping the constants locally would +/// still require conversion at the contract boundary. +/// +/// Callers may combine these constants into masks, but such masks are only +/// client-side checks: the contract emits [`SUPPORTED_CAPABILITIES`] and does +/// not accept arbitrary capability combinations as input. +/// /// Each constant is a power-of-two `u64` that can be combined with `|` to /// form a bitmap, and isolated with `&` to test a specific capability. ///