Skip to content

feat(commitment_interface): align live contract drift checks#379

Open
zainabb-dev wants to merge 1 commit intoCommitlabs-Org:masterfrom
zainabb-dev:feature/commitment-interface-align-commitment-interface-types-with-live-contracts-drift-c
Open

feat(commitment_interface): align live contract drift checks#379
zainabb-dev wants to merge 1 commit intoCommitlabs-Org:masterfrom
zainabb-dev:feature/commitment-interface-align-commitment-interface-types-with-live-contracts-drift-c

Conversation

@zainabb-dev
Copy link

Overview

This PR aligns the commitment_interface ABI crate with the live Soroban contracts and adds a dedicated drift-check CI job so interface/type drift is caught automatically. The interface crate now mirrors the canonical commitment structs, event payloads, and the key read-only commitment_core entrypoints used by downstream bindings and integrators.

Related Issue

Closes #285

Changes

⚙️ Commitment Interface Alignment

  • [MODIFY] contracts/commitment_interface/src/lib.rs

    • Expanded the interface surface to mirror the live commitment_core read-only API.
    • Added interface entrypoints for:
      • list_commitments_by_owner
      • get_total_value_locked
      • get_commitments_created_between
      • get_admin
      • get_nft_contract
    • Re-exported the canonical interface types for downstream consumers.
    • Extended drift tests to compare live signatures and struct definitions against commitment_core and attestation_engine.
  • [MODIFY] contracts/commitment_interface/src/types.rs

    • Kept CommitmentRules and Commitment aligned with live contract types.
    • Added canonical event payload types:
      • CommitmentCreatedEvent
      • CommitmentSettledEvent
    • Added Rustdoc/security notes on public ABI types.

🧪 Drift Check Coverage

  • [MODIFY] contracts/commitment_interface/src/lib.rs
    • Added deterministic drift tests that verify:
      • CommitmentRules matches commitment_core
      • CommitmentRules matches attestation_engine
      • Commitment matches commitment_core
      • Commitment matches attestation_engine
      • CommitmentCreatedEvent matches commitment_core
      • CommitmentSettledEvent matches commitment_core
      • expected live commitment_core public signatures are still present

🚦 CI

  • [MODIFY] .github/workflows/soroban-contracts-ci.yml
    • Added a dedicated Commitment Interface Drift Check job.
    • Moved the interface drift validation into its own CI job for clearer failure isolation.
    • Fixed a workflow YAML indentation issue so the workflow parses correctly.

📚 Documentation

  • [MODIFY] contracts/commitment_interface/README.md

    • Updated the interface documentation to reflect the expanded ABI surface and drift-check scope.
  • [MODIFY] docs/CONTRACT_FUNCTIONS.md

    • Updated integrator-facing docs to describe the full commitment_interface surface and its CI-backed drift guarantees.

Verification Results

Acceptance Criteria Status
commitment_interface types align with live contract structs
Drift checks cover live signatures and canonical event payloads
Dedicated CI job exists for interface drift detection
Integrator-facing docs reflect the updated interface surface

Security Notes

  • commitment_interface remains ABI-only and introduces no storage mutation or cross-contract execution.
  • Drift coverage now explicitly protects interface consumers from silent schema mismatch with live commitment_core.
  • Public docs note trust boundaries for mutating live functions such as create_commitment, settle, and early_exit.
  • No new auth, reentrancy, or arithmetic paths were introduced in live contract logic by this PR.

How to Test

# 1. Confirm you're on the branch
git branch --show-current

# 2. Run the interface drift checks
cargo test -p commitment_interface

# 3. Optional: run the wasm-target command if the target is installed
cargo test -p commitment_interface --target wasm32v1-none --release

# 4. Optional: inspect the changed files
git diff -- .github/workflows/soroban-contracts-ci.yml \
  contracts/commitment_interface/src/lib.rs \
  contracts/commitment_interface/src/types.rs \
  contracts/commitment_interface/README.md \
  docs/CONTRACT_FUNCTIONS.md

Screenshots

✅ Interface drift tests pass

A screenshot of:

cargo test -p commitment_interface
image

@drips-wave
Copy link

drips-wave bot commented Mar 25, 2026

@zainabb-dev 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! 🚀

Learn more about application limits

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.

Align commitment_interface types with live contracts \u2014 drift check CI job

2 participants