Skip to content

Implement contract metadata versioning and compatibility validation #514

Description

@Just-Bamford

Description

Problem

Contract metadata can evolve as contracts are upgraded. The SDK currently has no standardized mechanism for determining whether cached or generated metadata remains compatible with the contract version being invoked.

This can lead to confusing runtime failures when function signatures, argument types, storage definitions, or contract interfaces change.

Solution

Introduce metadata version tracking and compatibility validation.

The SDK should associate metadata with a contract identifier and version/fingerprint. Before using cached metadata, it should validate that the metadata corresponds to the expected contract interface.

Provide compatibility checks capable of identifying breaking and non-breaking changes and expose migration hooks for supported metadata transformations.

Acceptance Criteria

  • Contract metadata contains a deterministic version or fingerprint.
  • Metadata versions are associated with contract identifiers.
  • Compatibility checking distinguishes compatible and breaking changes.
  • Stale metadata is detected before contract invocation.
  • Clear compatibility errors/warnings are returned.
  • Metadata migration hooks are supported.
  • Cached metadata is invalidated when incompatible metadata is detected.
  • Tests cover identical, compatible, incompatible, and missing metadata versions.
  • Existing metadata consumers remain backward compatible.
  • Exported through src/soroban/index.ts and src/index.ts.

Note for Contributors

Avoid relying exclusively on semantic version strings. Contract interface fingerprints should provide deterministic compatibility validation where possible.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programbackendBackend / SDK logicenhancementNew feature or requestsmart-contractSoroban contract related

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions