Skip to content

fix: embed contract metadata and report compile-time version - #816

Open
EurekaZainMalik wants to merge 1 commit into
Goldii-locks:mainfrom
EurekaZainMalik:fix/issue-735-embed-contract-metadata-with-contractmeta-and
Open

EurekaZainMalik wants to merge 1 commit into
Goldii-locks:mainfrom
EurekaZainMalik:fix/issue-735-embed-contract-metadata-with-contractmeta-and

Conversation

@EurekaZainMalik

Copy link
Copy Markdown

Overview

This PR embeds contract metadata (contractmeta!) into the milestone-escrow WASM so explorers and stellar contract info meta can surface the contract name, version and source repo, and changes version() to return a compile-time CONTRACT_VERSION constant instead of an incrementing upgrade counter. DataKey::Version is retained as the storage schema version for migrations.

Related Issue

Changes

📦 Contract Metadata

  • [MODIFY] contracts/milestone-escrow/src/lib.rs

    • Added contractmeta!(key = "name", val = "milesto-milestone-escrow").
    • Added contractmeta!(key = "version", val = env!("CARGO_PKG_VERSION")).
    • Added contractmeta!(key = "source_repo", val = "...") pointing at the source repository.
    • Introduced a compile-time CONTRACT_VERSION constant derived from CARGO_PKG_VERSION.
    • Changed version() to return CONTRACT_VERSION instead of reading DataKey::Version.
    • Kept DataKey::Version as the storage schema version used by migrations; initialize/upgrade no longer drive the reported version.
  • [MODIFY] contracts/milestone-escrow/Cargo.toml

    • Ensured the crate version is the single source of truth consumed by env!("CARGO_PKG_VERSION").
  • [ADD] contracts/milestone-escrow/src/version_tests.rs

    • Asserts version() matches the Cargo.toml package version.
    • Asserts version() is stable across upgrade calls (no longer increments).

Verification Results

cargo test -p milestone-escrow version_tests
✅ version() matches CARGO_PKG_VERSION
✅ version() unchanged after upgrade
Acceptance Criteria Status
stellar contract info meta --wasm ... shows name, version and repo ✅ contractmeta! entries added for name, version and source repo
version() matches Cargo.toml in tests ✅ Covered by version_tests.rs

Closes #735

@drips-wave

drips-wave Bot commented Oct 19, 2026

Copy link
Copy Markdown

@EurekaZainMalik 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.

Embed contract metadata with contractmeta! and report the code version, not an upgrade counter

1 participant