Skip to content

Detect ABI-version mismatch between src/starknet/abi.ts and the deployed contract at startupΒ #121

Description

@Jagadeeshftw

πŸ“Œ Description

src/starknet/abi.ts bundles a static ABI used to decode on-chain events and calls. If the deployed contract is upgraded and the bundled ABI drifts, decoding fails or silently mis-decodes fields β€” there's currently no startup check to catch this early.

🧩 Requirements and context

  • On boot, fetch the deployed contract's class hash/ABI and compare a fingerprint against the bundled ABI.
  • Fail startup loudly (or log a prominent warning, configurable) on mismatch rather than degrading silently later.

πŸ› οΈ Suggested execution

  1. Add a verifyAbiCompatibility() helper in src/starknet/abi.ts.
  2. Call it during app startup in src/index.ts, gated by an env flag for environments without RPC access.
  3. Add a test with a mocked mismatched class hash.

βœ… Acceptance criteria

  • Mismatch is detected and surfaced clearly at startup.
  • Matching ABI passes silently.
  • Behavior is configurable (fail-fast vs warn-only) via env.

πŸ”’ Security notes

A silently mis-decoded event could misrepresent payment amounts in the API β€” treat this as a data-integrity control, not just a nicety.

πŸ“‹ Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions