Skip to content

add stellar metadata section to contract cargo.toml files#680

Open
knQzx wants to merge 1 commit intoOpenZeppelin:mainfrom
knQzx:add-stellar-metadata
Open

add stellar metadata section to contract cargo.toml files#680
knQzx wants to merge 1 commit intoOpenZeppelin:mainfrom
knQzx:add-stellar-metadata

Conversation

@knQzx
Copy link
Copy Markdown

@knQzx knQzx commented Apr 5, 2026

summary

test plan

  • verified cargo.toml files parse correctly

fixes #341

Summary by CodeRabbit

  • Chores
    • Updated build configuration metadata across package and example manifests to support Stellar tooling configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 5, 2026

Walkthrough

This pull request adds a [package.metadata.stellar] section with cargo_inherit = true to 47 Cargo.toml files across example and package crates, establishing Stellar-specific package metadata configuration for the toolchain without altering functional code or dependencies.

Changes

Cohort / File(s) Summary
Fee Forwarder Examples
examples/fee-forwarder-permissioned/Cargo.toml, examples/fee-forwarder-permissionless/Cargo.toml
Added [package.metadata.stellar] section with cargo_inherit = true.
Fungible Token Examples
examples/fungible-allowlist/Cargo.toml, examples/fungible-blocklist/Cargo.toml, examples/fungible-capped/Cargo.toml, examples/fungible-governor-timelock/(governor|token)/Cargo.toml, examples/fungible-governor/(governor|token)/Cargo.toml, examples/fungible-merkle-airdrop/Cargo.toml, examples/fungible-pausable/Cargo.toml, examples/fungible-vault/Cargo.toml, examples/fungible-votes/Cargo.toml
Added [package.metadata.stellar] section with cargo_inherit = true.
NFT Examples
examples/nft-access-control/Cargo.toml, examples/nft-consecutive/Cargo.toml, examples/nft-enumerable/Cargo.toml, examples/nft-royalties/Cargo.toml, examples/nft-sequential-minting/Cargo.toml
Added [package.metadata.stellar] section with cargo_inherit = true.
Multi-Signature Smart Account Examples
examples/multisig-smart-account/(account|ed25519-verifier|spending-limit-policy|threshold-policy|webauthn-verifier|weighted-threshold-policy)/Cargo.toml
Added [package.metadata.stellar] section with cargo_inherit = true.
RWA Examples
examples/rwa/(claim-issuer|claim-topics-and-issuers|compliance|identity-registry|identity-verifier|identity|sign-claim|token)/Cargo.toml
Added [package.metadata.stellar] section with cargo_inherit = true.
Miscellaneous Examples
examples/merkle-voting/Cargo.toml, examples/ownable/Cargo.toml, examples/pausable/Cargo.toml, examples/sac-admin-generic/Cargo.toml, examples/sac-admin-wrapper/Cargo.toml, examples/timelock-controller/Cargo.toml, examples/upgradeable/(lazy-v1|lazy-v2|upgrader|v1|v2)/Cargo.toml
Added [package.metadata.stellar] section with cargo_inherit = true.
Package Crates
packages/(access|accounts|contract-utils|fee-abstraction|governance|macros|test-utils\/event-assertion|tokens|zk-email)/Cargo.toml
Added [package.metadata.stellar] section with cargo_inherit = true.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

Suggested reviewers

  • ozgunozerk

Poem

🐇 With metadata we sow the seeds,
cargo_inherit = true fulfills our needs,
Forty-seven files now inherit with care,
Stellar tooling config everywhere!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Stellar metadata sections to Cargo.toml files across the project.
Description check ✅ Passed The description covers the main change, references the relevant issue and standard (SEP-49), provides test verification, but lacks explicit test and documentation checklist items.
Linked Issues check ✅ Passed The PR successfully addresses issue #341 by adding [package.metadata.stellar] sections with cargo_inherit = true to all contract Cargo.toml files, meeting the stated objective.
Out of Scope Changes check ✅ Passed All changes are narrowly scoped to adding the [package.metadata.stellar] metadata section to Cargo.toml files, with no modifications to actual Rust code or dependencies.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@examples/fungible-allowlist/Cargo.toml`:
- Around line 9-10: The root Cargo.toml is missing a
[workspace.metadata.stellar] section so the per-crate setting
package.metadata.stellar.cargo_inherit = true is a no-op; add a top-level
[workspace.metadata.stellar] block in the root Cargo.toml containing the
canonical SEP-49 fields you expect to share (the same keys present in individual
package.metadata.stellar blocks) so cargo_inherit works, or alternatively remove
cargo_inherit = true from crates and copy those explicit values into each
package.metadata.stellar block; locate usages by searching for
package.metadata.stellar and cargo_inherit to mirror the shared metadata into
workspace.metadata.stellar.

In `@examples/fungible-governor-timelock/governor/Cargo.toml`:
- Around line 9-10: The crates declare cargo_inherit = true under
[package.metadata.stellar] but there is no root source to inherit from; add a
[workspace.metadata.stellar] block to the root Cargo.toml providing the shared
SEP-49 metadata (the keys that child crates expect) so cargo_inherit can work;
update the root Cargo.toml to include a [workspace.metadata.stellar] section
with the canonical fields used by child crates (matching the names under
package.metadata.stellar) rather than adding metadata to each crate.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9b5f7d0f-1576-453b-acad-de36c1c2cbcd

📥 Commits

Reviewing files that changed from the base of the PR and between 4a5efba and cfde273.

📒 Files selected for processing (52)
  • examples/fee-forwarder-permissioned/Cargo.toml
  • examples/fee-forwarder-permissionless/Cargo.toml
  • examples/fungible-allowlist/Cargo.toml
  • examples/fungible-blocklist/Cargo.toml
  • examples/fungible-capped/Cargo.toml
  • examples/fungible-governor-timelock/governor/Cargo.toml
  • examples/fungible-governor-timelock/token/Cargo.toml
  • examples/fungible-governor/governor/Cargo.toml
  • examples/fungible-governor/token/Cargo.toml
  • examples/fungible-merkle-airdrop/Cargo.toml
  • examples/fungible-pausable/Cargo.toml
  • examples/fungible-vault/Cargo.toml
  • examples/fungible-votes/Cargo.toml
  • examples/merkle-voting/Cargo.toml
  • examples/multisig-smart-account/account/Cargo.toml
  • examples/multisig-smart-account/ed25519-verifier/Cargo.toml
  • examples/multisig-smart-account/spending-limit-policy/Cargo.toml
  • examples/multisig-smart-account/threshold-policy/Cargo.toml
  • examples/multisig-smart-account/webauthn-verifier/Cargo.toml
  • examples/multisig-smart-account/weighted-threshold-policy/Cargo.toml
  • examples/nft-access-control/Cargo.toml
  • examples/nft-consecutive/Cargo.toml
  • examples/nft-enumerable/Cargo.toml
  • examples/nft-royalties/Cargo.toml
  • examples/nft-sequential-minting/Cargo.toml
  • examples/ownable/Cargo.toml
  • examples/pausable/Cargo.toml
  • examples/rwa/claim-issuer/Cargo.toml
  • examples/rwa/claim-topics-and-issuers/Cargo.toml
  • examples/rwa/compliance/Cargo.toml
  • examples/rwa/identity-registry/Cargo.toml
  • examples/rwa/identity-verifier/Cargo.toml
  • examples/rwa/identity/Cargo.toml
  • examples/rwa/sign-claim/Cargo.toml
  • examples/rwa/token/Cargo.toml
  • examples/sac-admin-generic/Cargo.toml
  • examples/sac-admin-wrapper/Cargo.toml
  • examples/timelock-controller/Cargo.toml
  • examples/upgradeable/lazy-v1/Cargo.toml
  • examples/upgradeable/lazy-v2/Cargo.toml
  • examples/upgradeable/upgrader/Cargo.toml
  • examples/upgradeable/v1/Cargo.toml
  • examples/upgradeable/v2/Cargo.toml
  • packages/access/Cargo.toml
  • packages/accounts/Cargo.toml
  • packages/contract-utils/Cargo.toml
  • packages/fee-abstraction/Cargo.toml
  • packages/governance/Cargo.toml
  • packages/macros/Cargo.toml
  • packages/test-utils/event-assertion/Cargo.toml
  • packages/tokens/Cargo.toml
  • packages/zk-email/Cargo.toml

Comment on lines +9 to +10
[package.metadata.stellar]
cargo_inherit = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether workspace-level stellar metadata exists and where inheritance is used.
set -euo pipefail

echo "== Root/workspace stellar metadata tables =="
rg -n '^\[workspace\.metadata\.stellar\]' Cargo.toml || true

echo
echo "== Crates using package.metadata.stellar and cargo_inherit = true =="
rg -n '^\[package\.metadata\.stellar\]|^cargo_inherit\s*=\s*true' --type toml

Repository: OpenZeppelin/stellar-contracts

Length of output: 7161


🏁 Script executed:

# Check the root Cargo.toml for workspace configuration
cat -n Cargo.toml | head -50

Repository: OpenZeppelin/stellar-contracts

Length of output: 1958


🏁 Script executed:

# Check if there's any workspace.metadata section (even without stellar)
rg -n '^\[workspace' Cargo.toml

Repository: OpenZeppelin/stellar-contracts

Length of output: 138


🏁 Script executed:

# Verify if cargo_inherit appears in the git history to understand if it's new
git log --oneline --all -S 'cargo_inherit' | head -10

Repository: OpenZeppelin/stellar-contracts

Length of output: 160


Add workspace-level Stellar metadata to root Cargo.toml to make cargo_inherit effective

The pattern of using cargo_inherit = true appears across 60+ crates in this repository, but the root Cargo.toml lacks a [workspace.metadata.stellar] section to inherit from. This means the inheritance directive is currently a no-op and won't achieve the SEP-49 metadata consistency objective across the workspace.

Add a [workspace.metadata.stellar] section to the root Cargo.toml with the appropriate metadata entries, or replace cargo_inherit = true with explicit values in each crate if inheritance is not intended.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/fungible-allowlist/Cargo.toml` around lines 9 - 10, The root
Cargo.toml is missing a [workspace.metadata.stellar] section so the per-crate
setting package.metadata.stellar.cargo_inherit = true is a no-op; add a
top-level [workspace.metadata.stellar] block in the root Cargo.toml containing
the canonical SEP-49 fields you expect to share (the same keys present in
individual package.metadata.stellar blocks) so cargo_inherit works, or
alternatively remove cargo_inherit = true from crates and copy those explicit
values into each package.metadata.stellar block; locate usages by searching for
package.metadata.stellar and cargo_inherit to mirror the shared metadata into
workspace.metadata.stellar.

Comment on lines +9 to +10
[package.metadata.stellar]
cargo_inherit = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify whether workspace-level stellar metadata exists and where cargo_inherit is used.

set -euo pipefail

echo "== Workspace Cargo manifests =="
fd -a '^Cargo\.toml$' | sed 's#^\./##'

echo
echo "== Find workspace metadata.stellar blocks =="
rg -n --type toml '^\[workspace\.metadata\.stellar\]|^cargo_inherit\s*='

echo
echo "== Find package metadata.stellar blocks =="
rg -n --type toml '^\[package\.metadata\.stellar\]|^cargo_inherit\s*='

Repository: OpenZeppelin/stellar-contracts

Length of output: 13642


Add [workspace.metadata.stellar] to the root Cargo.toml

This file uses cargo_inherit = true, but the root workspace Cargo.toml has no [workspace.metadata.stellar] block. The same pattern appears across 50+ crates in this repository—all declaring cargo inheritance without a source to inherit from. This prevents SEP-49 metadata inheritance from working as intended.

Add to root Cargo.toml
+[workspace.metadata.stellar]
+# define shared stellar metadata inherited by member crates
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@examples/fungible-governor-timelock/governor/Cargo.toml` around lines 9 - 10,
The crates declare cargo_inherit = true under [package.metadata.stellar] but
there is no root source to inherit from; add a [workspace.metadata.stellar]
block to the root Cargo.toml providing the shared SEP-49 metadata (the keys that
child crates expect) so cargo_inherit can work; update the root Cargo.toml to
include a [workspace.metadata.stellar] section with the canonical fields used by
child crates (matching the names under package.metadata.stellar) rather than
adding metadata to each crate.

@knQzx
Copy link
Copy Markdown
Author

knQzx commented Apr 5, 2026

hey, thanks for flagging but this is actually fine - cargo_inherit = true in the stellar context inherits from the crate's own [package] section (name -> name, version -> binver, authors -> authors, etc.), not from workspace.metadata.stellar. it's processed by stellar-scaffold-cli, not standard cargo. you can see the same pattern in the contracts-wizard PR #613 and in stellar-core's own test contracts. no workspace-level section needed here.

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.

Add [metadata.stellar] section to Stellar contracts

1 participant