Skip to content

Stellar Release 0.7.0 Integration#788

Open
ozgunozerk wants to merge 25 commits intomasterfrom
stellar-codex-trial
Open

Stellar Release 0.7.0 Integration#788
ozgunozerk wants to merge 25 commits intomasterfrom
stellar-codex-trial

Conversation

@ozgunozerk
Copy link
Copy Markdown
Contributor

@ozgunozerk ozgunozerk commented Mar 30, 2026

@brozorec, I have reviewed almost everything here, including vote extensions as well.
I haven't reviewed the Upgradeable part though, could you take a look at there? If you have time, double checking the votes extension part may be beneficial.

I have 2 comments/questions from what I've reviewed, will post them under relevant places.

Keep in mind that, this doesn't include the audit changes. If my comments/questions are not posing big problems, then I can go ahead and also include the audit related changes here.

Additionally, we also need to release the crates in order to pass the tests.

Till then, this is a draft PR.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 30, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 642469d2-38c1-48c8-880b-9661a6e0df8d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This changeset introduces support for a new Governor contract type in the Stellar wizard, enabling token-based governance. It extends existing contract types (Fungible, NonFungible, Stablecoin) with voting capabilities and refactors the upgrade mechanism to use explicit trait implementations. Version dependencies are bumped to OpenZeppelin Stellar Soroban Contracts v0.7.0 and Soroban SDK 25.3.0.

Changes

Cohort / File(s) Summary
Governor Core Builder
packages/core/stellar/src/governor.ts, packages/core/stellar/src/build-generic.ts, packages/core/stellar/src/api.ts, packages/core/stellar/src/index.ts
Introduces complete Governor contract builder with configurable voting parameters (votingDelay, votingPeriod, proposalThreshold, quorum), optional timelock integration, and access control support. Adds Governor variant to build pipeline.
Governor Schema & Descriptions
packages/common/src/ai/schemas/stellar.ts, packages/common/src/ai/descriptions/stellar.ts, packages/common/src/ai/schemas/index.ts, packages/common/src/ai/schemas/schemas.test.ts
Defines Governor contract schema with governance-related fields and extracts reusable stellarInfoSchema. Adds AI descriptions for Governor configuration parameters.
Governor CLI & Registry
packages/cli/src/cli.test.ts.md, packages/cli/src/registry.ts, packages/common/src/ai/descriptions/stellar.ts
Registers Governor in CLI with help text snapshot, updates command ordering in help output. Adds governor schema and prompt to registry.
Governor UI & MCP Tools
packages/ui/src/stellar/GovernorControls.svelte, packages/mcp/src/stellar/tools/governor.ts, packages/mcp/src/stellar/tools/governor.test.ts, packages/ui/src/stellar/App.svelte, packages/ui/api/ai-assistant/function-definitions/stellar.ts, packages/ui/api/ai-assistant/types/languages.ts
Adds Governor control component with form fields for governance settings, MCP tool registration, AI function definition, and UI integration.
Votes Feature Across Contracts
packages/core/stellar/src/fungible.ts, packages/core/stellar/src/non-fungible.ts, packages/core/stellar/src/stablecoin.ts, packages/core/stellar/src/fungible.test.ts, packages/core/stellar/src/non-fungible.test.ts, packages/core/stellar/src/stablecoin.test.ts
Adds optional votes boolean flag to Fungible, NonFungible, and Stablecoin contracts. Updates trait wiring to use *Votes variants when enabled. Validates incompatibilities (votes with enumerable/consecutive/limitations).
Upgrade Mechanism Refactoring
packages/core/stellar/src/add-upgradeable.ts
Replaces internal auth-guarded upgrade functions with explicit upgrade and upgrade_unused_operator entry functions. Changes from derive-based Upgradeable to explicit trait implementation with contractimpl tag.
Votes Test Coverage
packages/core/stellar/src/fungible.compile.test.ts, packages/core/stellar/src/non-fungible.compile.test.ts, packages/core/stellar/src/stablecoin.compile.test.ts, packages/core/stellar/src/governor.compile.test.ts
Adds compilation tests for votes feature across contract types and new Governor variants.
Governor Tests
packages/core/stellar/src/governor.test.ts, packages/core/stellar/src/governor.test.ts.md, packages/core/stellar/src/test.ts
Comprehensive Governor snapshot tests covering configurations, upgradeability, timelocks, and API equivalence. Adds Governor to test suite.
Snapshot Updates
packages/core/stellar/src/fungible.test.ts.md, packages/core/stellar/src/non-fungible.test.ts.md, packages/core/stellar/src/stablecoin.test.ts.md, packages/core/stellar/src/zip-rust.compile.test.ts.md
Updates generated contract code snapshots to v0.7.0 compatibility. Adds snapshots for Votes-enabled variants and refactored Upgradeable trait pattern.
Generator & Build Support
packages/core/stellar/src/generate/governor.ts, packages/core/stellar/src/generate/fungible.ts, packages/core/stellar/src/generate/non-fungible.ts, packages/core/stellar/src/generate/stablecoin.ts, packages/core/stellar/src/generate/sources.ts, packages/core/stellar/src/kind.ts
Introduces Governor option generator. Extends existing generators to include votes flag. Updates kind detection to recognize 'Governor'.
Contract & Printing Infrastructure
packages/core/stellar/src/contract.ts, packages/core/stellar/src/print.ts
Adds topLevelDeclarations field to Contract for accumulating top-level code blocks. Updates printing logic to render these declarations.
Compilation Test Infrastructure
packages/core/stellar/src/utils/compile-test.ts
Enhances compilation test infrastructure with workspace Cargo rewriting to use local dependencies and upstream version pinning when STELLAR_CONTRACTS_PATH is set.
MCP & UI Tool Integration
packages/mcp/src/stellar/tools/fungible.ts, packages/mcp/src/stellar/tools/non-fungible.ts, packages/mcp/src/stellar/tools/stablecoin.ts, packages/mcp/src/stellar/tools.ts, packages/mcp/src/stellar/tools/fungible.test.ts, packages/mcp/src/stellar/tools/non-fungible.test.ts, packages/mcp/src/stellar/tools/stablecoin.test.ts
Updates MCP tool handlers to accept and pass votes parameter. Adds votes test coverage in tool tests.
UI Feature Controls
packages/ui/src/stellar/FungibleControls.svelte, packages/ui/src/stellar/NonFungibleControls.svelte, packages/ui/src/stellar/StablecoinControls.svelte
Adds "Votes" checkbox feature toggles with help text and error handling to Fungible, NonFungible, and Stablecoin control components.
Version & Dependencies
packages/core/stellar/src/utils/version.ts, packages/core/stellar/src/zip-shared.ts, packages/core/stellar/src/zip-shared.test.ts, packages/core/stellar/src/zip-scaffold.compile.test.ts
Bumps OpenZeppelin Stellar Soroban Contracts from v0.6.0 to v0.7.0. Bumps Soroban SDK from 23.4.0 to 25.3.0. Adds stellar-governance dependency.
Changeset
.changeset/curvy-dolls-return.md
Minor version bump for @openzeppelin/wizard-stellar recording additive Governor feature and voting extensions.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • PR #728: Adds explicitImplementations flag support across Stellar builders, schemas, tooling, and UI—shares similar architectural patterns and touches many overlapping files in the generator ecosystem.
  • PR #768: Updates the same version constants in packages/core/stellar/src/utils/version.ts, indicating coordinated version bumping across related features.
  • PR #631: Exports MCP register functions including registerStellarTools—directly related to the new registerStellarGovernor tool registration added in this changeset.

Suggested reviewers

  • ericglau
  • ozgunozerk
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Stellar Release 0.7.0 Integration' directly describes the main change: integrating OpenZeppelin Stellar 0.7.0 contracts, which is the central theme across the entire changeset.
Description check ✅ Passed The description is related to the changeset as it discusses code review status, pending work items (Upgradeable review, audit changes), and testing requirements—all relevant to the 0.7.0 integration pull request being merged.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch stellar-codex-trial

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

@ozgunozerk ozgunozerk requested a review from brozorec April 6, 2026 14:09
@ozgunozerk
Copy link
Copy Markdown
Contributor Author

ozgunozerk commented Apr 8, 2026

@brozorec

the code generated for timelock does not match the examples we have, and I'm not sure whether it may even compile.

Also after conflict is resolved and tests are passing again, I think we can mark this PR ready for review

@brozorec brozorec marked this pull request as ready for review April 8, 2026 10:40
@brozorec brozorec requested review from a team as code owners April 8, 2026 10:40
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: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (4)
packages/core/stellar/src/zip-shared.test.ts (1)

202-231: ⚠️ Potential issue | 🟠 Major

Remove stellar-governance from the unconditional shared dependencies.

stellar-governance is now included in every generated Stellar contract via libDependencies (line 46 in zip-shared.ts), which feeds into printContractCargo. This adds the governance crate to all templates regardless of whether they use Governor features, broadening the scope of any release blocker affecting that dependency.

If governance is only needed for Governor/votes variants, move it out of libDependencies and add it conditionally based on scaffold type instead. Otherwise, all generated contracts—including those that don't use voting or governance—will carry the extra dependency.

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

In `@packages/core/stellar/src/zip-shared.test.ts` around lines 202 - 231, The
shared dependency list libDependencies currently unconditionally includes
"stellar-governance", causing printContractCargo to add it to every contract;
remove "stellar-governance" from the libDependencies array and instead add logic
in the code path that builds cargo dependencies for a scaffold to include
"stellar-governance" only when the scaffold type indicates Governor/votes
variants (the code that calls printContractCargo or the function that merges
libDependencies into the contract-specific dependencies should detect scaffold
type and append stellar-governance conditionally). Update the functions
printContractCargo and the scaffold dependency assembly to rely on the revised
libDependencies plus this conditional addition so non-governor templates no
longer get the governance crate.
packages/common/src/ai/schemas/schemas.test.ts (1)

94-96: ⚠️ Potential issue | 🟡 Minor

Missing stellarGovernorSchema from description presence tests.

The stellarGovernorSchema is correctly imported and used in the type assertion function (line 152), but it's not added to the allSchemas array. This means the Governor schema fields won't be tested for .describe() presence like the other stellar schemas.

🔧 Proposed fix
   ['stellarFungible', stellarFungibleSchema],
+  ['stellarGovernor', stellarGovernorSchema],
   ['stellarStablecoin', stellarStablecoinSchema],
   ['stellarNonFungible', stellarNonFungibleSchema],
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/common/src/ai/schemas/schemas.test.ts` around lines 94 - 96, The
tests for schema `.describe()` presence are missing the stellarGovernorSchema
entry; add the pair ['stellarGovernor', stellarGovernorSchema] into the
allSchemas array alongside the other stellar schemas so the Governor schema
fields are included in the describe-presence tests (the type assertion already
references stellarGovernorSchema elsewhere). Locate the allSchemas array in the
schemas.test.ts file and insert the ['stellarGovernor', stellarGovernorSchema]
tuple so the describe presence loop covers it.
packages/core/stellar/src/fungible.ts (1)

2-3: ⚠️ Potential issue | 🟠 Major

mintable still disappears when access is omitted.

case false exits before either mint entrypoint is emitted, so mintable: true still generates a token with no public mint. The new votes permutations inherit the same bug — the added fungible votes burnable mintable snapshot already shows that path missing mint.

🔧 Suggested fix
-import { requireAccessControl, setAccessControl } from './set-access-control';
+import { DEFAULT_ACCESS_CONTROL, requireAccessControl, setAccessControl } from './set-access-control';
...
 function addMintable(
   c: ContractBuilder,
   access: Access,
   votes: boolean,
   pausable: boolean,
   explicitImplementations: boolean,
 ) {
+  const effectiveAccess = access === false ? DEFAULT_ACCESS_CONTROL : access;
   const mintFn = votes ? votesFunctions.mint : functions.mint;
   const mintWithCallerFn = votes ? votesFunctions.mint_with_caller : functions.mint_with_caller;
 
-  switch (access) {
-    case false:
-      break;
-    case 'ownable': {
+  switch (effectiveAccess) {
+    case 'ownable': {
       c.addFreeFunction(mintFn);
 
-      requireAccessControl(c, undefined, mintFn, access, undefined, explicitImplementations);
+      requireAccessControl(c, undefined, mintFn, effectiveAccess, undefined, explicitImplementations);
 
       if (pausable) {
         c.addFunctionTag(mintFn, 'when_not_paused');
       }
       break;
     }
     case 'roles': {
       c.addFreeFunction(mintWithCallerFn);
 
       requireAccessControl(
         c,
         undefined,
         mintWithCallerFn,
-        access,
+        effectiveAccess,
         {
           useMacro: true,
           caller: 'caller',
           role: 'minter',
         },
         explicitImplementations,
       );

Also applies to: 161-209

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

In `@packages/core/stellar/src/fungible.ts` around lines 2 - 3, The mint
entrypoint is skipped when access is omitted because the code returns early in
the `case false` branch before emitting mint logic; update the control flow so
`mintable: true` always emits the mint entrypoint regardless of whether `access`
was provided. Concretely, in the function handling fungible token generation
(references: the `access` parameter, the `mintable` flag, and the helpers
`requireAccessControl` / `setAccessControl`) ensure you compute a canonical
access (e.g., default public access or call
`setAccessControl`/`requireAccessControl` as needed) and move the mint-emission
logic out of the early-return path so that when `mintable` is true you always
add the public `mint` entrypoint; apply the same change to the other
permutations mentioned (the block covering lines ~161-209).
packages/core/stellar/src/add-upgradeable.ts (1)

2-3: ⚠️ Potential issue | 🟠 Major

Normalize access before selecting the upgrade function variant.

Line 32 branches on the raw access value before normalization. When access === false (default), it selects functions.upgrade (with operator parameter), but requireAccessControl then normalizes access to 'ownable' internally (at line 87 of set-access-control.ts), creating a signature mismatch: the function declaration won't match the access guard applied. Other helpers (add-pausable.ts, non-fungible.ts) correctly normalize access to effectiveAccess before branching.

🔧 Suggested direction
+import { DEFAULT_ACCESS_CONTROL, requireAccessControl } from './set-access-control';
-import { requireAccessControl } from './set-access-control';
...
+  const effectiveAccess = access === false ? DEFAULT_ACCESS_CONTROL : access;
+  const upgradeFn: BaseFunction = effectiveAccess === 'ownable' ? functions.upgrade_unused_operator : functions.upgrade;
-  const upgradeFn: BaseFunction = access === 'ownable' ? functions.upgrade_unused_operator : functions.upgrade;
...
   requireAccessControl(
     c,
     upgradeableTrait,
     upgradeFn,
-    access,
+    effectiveAccess,
     {
       useMacro: true,
       role: 'upgrader',
       caller: 'operator',
     },
     explicitImplementations,
   );
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/stellar/src/add-upgradeable.ts` around lines 2 - 3, Normalize
the incoming access value before choosing the upgrade function variant: call the
same normalization used by requireAccessControl (so you get an effectiveAccess)
and branch on that normalized value instead of the raw access variable; then
select the proper function (e.g., functions.upgrade vs
functions.upgradeWithOperator or the variant that expects an operator) based on
effectiveAccess so the declared function signature matches the access guard
applied (refer to add-upgradeable.ts variable access, functions.upgrade, and
requireAccessControl for where to apply this change).
🧹 Nitpick comments (4)
packages/mcp/src/stellar/tools/stablecoin.test.ts (1)

41-47: Please add one votes: true fixture.

Both added assertions only cover the disabled branch, so a regression that ignores votes when enabled would still pass here.

Also applies to: 63-69

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

In `@packages/mcp/src/stellar/tools/stablecoin.test.ts` around lines 41 - 47, The
tests only exercise the votes:false branch in the stablecoin tests; add a
separate fixture where votes: true and assert the enabled-votes behavior so
regressions that ignore votes when enabled will fail. Specifically, in the test
suite around test('all default', ...) create an additional test case (or modify
the existing suite) that supplies params with votes: true (same shape as
DeepRequired<z.infer<typeof t.context.schema>>) and add assertions that validate
the contract/state changes expected when votes are enabled; do the same for the
analogous test near lines 63-69 so both the enabled and disabled branches of
votes are covered.
packages/mcp/src/stellar/tools/non-fungible.test.ts (1)

42-49: Please add one votes: true fixture.

Both new cases only exercise the default/false branch, so a tool that accidentally drops votes when enabled would still pass this suite.

Also applies to: 69-76

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

In `@packages/mcp/src/stellar/tools/non-fungible.test.ts` around lines 42 - 49,
Add a new test-case fixture that sets votes: true so the branch where votes is
enabled is exercised; specifically, in the test named 'all default' (where the
params object is built) add a separate test or modify/create a fixture variant
that uses DeepRequired<z.infer<typeof t.context.schema>> params with votes: true
(and the same other fields: name, symbol, tokenUri, burnable, enumerable) and
assert the expected behaviour, and do the same for the other test around the
69-76 block to ensure the enabled-votes path is covered.
packages/core/stellar/src/stablecoin.test.ts (1)

145-159: Consider covering the blocklist branch in the incompatibility test as well.

Line 145 currently asserts only allowlist; adding blocklist keeps this guard fully covered.

Proposed test extension
 test('throws error when votes and limitations are both enabled', t => {
-  const error = t.throws(
-    () =>
-      buildStablecoin({
-        name: 'MyStablecoin',
-        symbol: 'MST',
-        votes: true,
-        limitations: 'allowlist',
-      }),
-    { instanceOf: OptionsError },
-  );
-
-  t.is(error?.messages.votes, 'Votes extension cannot be used with stablecoin limitations');
-  t.is(error?.messages.limitations, 'Stablecoin limitations cannot be used with Votes extension');
+  for (const limitations of ['allowlist', 'blocklist'] as const) {
+    const error = t.throws(
+      () =>
+        buildStablecoin({
+          name: 'MyStablecoin',
+          symbol: 'MST',
+          votes: true,
+          limitations,
+        }),
+      { instanceOf: OptionsError },
+    );
+
+    t.is(error?.messages.votes, 'Votes extension cannot be used with stablecoin limitations');
+    t.is(error?.messages.limitations, 'Stablecoin limitations cannot be used with Votes extension');
+  }
 });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/stellar/src/stablecoin.test.ts` around lines 145 - 159, Update
the existing test "throws error when votes and limitations are both enabled" to
also assert the incompatibility when limitations is set to 'blocklist': call
buildStablecoin with votes: true and limitations: 'blocklist', expect an
OptionsError, and assert error.messages.votes equals 'Votes extension cannot be
used with stablecoin limitations' and error.messages.limitations equals
'Stablecoin limitations cannot be used with Votes extension' (use the same
pattern as the existing allowlist assertions referencing buildStablecoin and
OptionsError).
packages/core/stellar/src/contract.ts (1)

255-257: Defensively copy top-level declaration lines on insert.

Line 256 stores the caller-owned array by reference, so later mutations can unintentionally rewrite contract output.

♻️ Suggested patch
   addTopLevelDeclaration(lines: string[]): void {
-    this.topLevelDeclarations.push(lines);
+    this.topLevelDeclarations.push([...lines]);
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/core/stellar/src/contract.ts` around lines 255 - 257,
addTopLevelDeclaration currently stores the caller-owned array reference into
this.topLevelDeclarations, allowing external mutation to alter contract output;
change the implementation of addTopLevelDeclaration to push a defensive copy of
the incoming lines (e.g., clone with slice() or spread) so
this.topLevelDeclarations receives an owned array copy and subsequent external
changes to the original lines array won't affect stored declarations.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/common/src/ai/schemas/stellar.ts`:
- Around line 27-36: stellarStablecoinSchema currently inherits the votes
description from stellarFungibleSchema via spreading, causing a mismatch; locate
the stellarStablecoinSchema definition and explicitly override the votes field
(e.g., add votes:
z.boolean().optional().describe(stellarStablecoinDescriptions.votes)) in the
stellarStablecoinSchema object after spreading stellarFungibleSchema so the
stablecoin schema uses stellarStablecoinDescriptions.votes instead of
stellarFungibleDescriptions.votes.

In `@packages/core/stellar/src/governor.ts`:
- Around line 247-263: The cancel implementation only updates governor storage
but fails to cancel the corresponding timelock operation; update cancel (the
cancel entry in governor.ts) to also call the timelock's cancel_op for the
operation scheduled in queue(): compute or retrieve the same operation ID used
by queue() (using storage::hash_proposal or the persisted value that schedule_op
returned) and invoke the timelock's cancel_op before or after storage::cancel(e,
...) so the external timelock state is reset; ensure you use the same parameters
(targets, functions, args, description_hash) that queue/schedule_op used and
preserve the existing proposer/operator checks (proposer,
operator.require_auth()) around the added cancel_op call.

In `@packages/core/stellar/src/non-fungible.test.ts.md`:
- Around line 782-784: The generated upgrade function signature currently uses
an unused parameter named operator; update the signature in the upgrade
implementation (function upgrade) to use a consistently ignored parameter name
`_operator` and leave the body calling upgradeable::upgrade(e, &new_wasm_hash)
unchanged so the compiler won’t warn about an unused parameter across
governor.test.ts.md, non-fungible.test.ts.md, and fungible.test.ts.md.

In `@packages/core/stellar/src/utils/compile-test.ts`:
- Around line 71-75: The current try/catch around copyFile(upstreamLockPath,
path.join(workspaceDir, 'Cargo.lock')) swallows all errors; change it to only
ignore a missing source (errno ENOENT) and rethrow or propagate any other error
so bad paths/perm issues aren't hidden. Specifically, wrap the await copyFile
call in a try block, inspect the caught error in the catch for error.code ===
'ENOENT' and silently ignore only that case, otherwise rethrow the error (or
throw a new error with context referencing upstreamLockPath and workspaceDir) so
callers of compile-test.ts can detect unexpected failures.
- Around line 148-154: The presence check using `'explicitImplementations' in
optsWithExplicit` is wrong because tests omit the optional field; instead merge
defaults first and check the merged options or check the contract kind support
explicitly. Replace the supportsExplicitImplementations assignment so it uses
the defaults-aware options (e.g. const mergedOpts =
withCommonContractDefaults(opts as GenericOptions); const
supportsExplicitImplementations = 'explicitImplementations' in mergedOpts) or
test mergedOpts.contractKind against the known supported kinds, then keep the
rest of the guard (shouldBeExcludedOrHasAlreadyRun using
testOptions.excludeExplicitTraitTest, optsWithExplicit.explicitImplementations)
the same.

In `@packages/ui/src/stellar/GovernorControls.svelte`:
- Around line 87-90: Update the tooltip text in GovernorControls.svelte so it is
authority-agnostic: change the HelpTooltip tied to the opts.upgradeable checkbox
to a neutral description (e.g., "Allows the contract to be upgraded by the
configured authority (owner or accounts with the upgrader role)." or similar) so
it no longer assumes owner-only permissions; locate the HelpTooltip adjacent to
the input bound to opts.upgradeable and replace the owner-specific copy.

In `@packages/ui/src/stellar/NonFungibleControls.svelte`:
- Around line 74-80: When the Votes checkbox (opts.votes) is toggled on in
NonFungibleControls.svelte, immediately clear or disable the conflicting flags
(opts.enumerable and opts.consecutive) instead of relying on later validation;
implement an on:change handler for the Votes input that, when checked, sets
opts.enumerable = false and opts.consecutive = false (and when unchecked, leaves
them unchanged), and update the Enumerable and Consecutive controls to reflect
this by disabling their inputs (disabled={opts.votes}) and visually indicating
they are unavailable when opts.votes is true so users cannot select the invalid
combinations.

---

Outside diff comments:
In `@packages/common/src/ai/schemas/schemas.test.ts`:
- Around line 94-96: The tests for schema `.describe()` presence are missing the
stellarGovernorSchema entry; add the pair ['stellarGovernor',
stellarGovernorSchema] into the allSchemas array alongside the other stellar
schemas so the Governor schema fields are included in the describe-presence
tests (the type assertion already references stellarGovernorSchema elsewhere).
Locate the allSchemas array in the schemas.test.ts file and insert the
['stellarGovernor', stellarGovernorSchema] tuple so the describe presence loop
covers it.

In `@packages/core/stellar/src/add-upgradeable.ts`:
- Around line 2-3: Normalize the incoming access value before choosing the
upgrade function variant: call the same normalization used by
requireAccessControl (so you get an effectiveAccess) and branch on that
normalized value instead of the raw access variable; then select the proper
function (e.g., functions.upgrade vs functions.upgradeWithOperator or the
variant that expects an operator) based on effectiveAccess so the declared
function signature matches the access guard applied (refer to add-upgradeable.ts
variable access, functions.upgrade, and requireAccessControl for where to apply
this change).

In `@packages/core/stellar/src/fungible.ts`:
- Around line 2-3: The mint entrypoint is skipped when access is omitted because
the code returns early in the `case false` branch before emitting mint logic;
update the control flow so `mintable: true` always emits the mint entrypoint
regardless of whether `access` was provided. Concretely, in the function
handling fungible token generation (references: the `access` parameter, the
`mintable` flag, and the helpers `requireAccessControl` / `setAccessControl`)
ensure you compute a canonical access (e.g., default public access or call
`setAccessControl`/`requireAccessControl` as needed) and move the mint-emission
logic out of the early-return path so that when `mintable` is true you always
add the public `mint` entrypoint; apply the same change to the other
permutations mentioned (the block covering lines ~161-209).

In `@packages/core/stellar/src/zip-shared.test.ts`:
- Around line 202-231: The shared dependency list libDependencies currently
unconditionally includes "stellar-governance", causing printContractCargo to add
it to every contract; remove "stellar-governance" from the libDependencies array
and instead add logic in the code path that builds cargo dependencies for a
scaffold to include "stellar-governance" only when the scaffold type indicates
Governor/votes variants (the code that calls printContractCargo or the function
that merges libDependencies into the contract-specific dependencies should
detect scaffold type and append stellar-governance conditionally). Update the
functions printContractCargo and the scaffold dependency assembly to rely on the
revised libDependencies plus this conditional addition so non-governor templates
no longer get the governance crate.

---

Nitpick comments:
In `@packages/core/stellar/src/contract.ts`:
- Around line 255-257: addTopLevelDeclaration currently stores the caller-owned
array reference into this.topLevelDeclarations, allowing external mutation to
alter contract output; change the implementation of addTopLevelDeclaration to
push a defensive copy of the incoming lines (e.g., clone with slice() or spread)
so this.topLevelDeclarations receives an owned array copy and subsequent
external changes to the original lines array won't affect stored declarations.

In `@packages/core/stellar/src/stablecoin.test.ts`:
- Around line 145-159: Update the existing test "throws error when votes and
limitations are both enabled" to also assert the incompatibility when
limitations is set to 'blocklist': call buildStablecoin with votes: true and
limitations: 'blocklist', expect an OptionsError, and assert
error.messages.votes equals 'Votes extension cannot be used with stablecoin
limitations' and error.messages.limitations equals 'Stablecoin limitations
cannot be used with Votes extension' (use the same pattern as the existing
allowlist assertions referencing buildStablecoin and OptionsError).

In `@packages/mcp/src/stellar/tools/non-fungible.test.ts`:
- Around line 42-49: Add a new test-case fixture that sets votes: true so the
branch where votes is enabled is exercised; specifically, in the test named 'all
default' (where the params object is built) add a separate test or modify/create
a fixture variant that uses DeepRequired<z.infer<typeof t.context.schema>>
params with votes: true (and the same other fields: name, symbol, tokenUri,
burnable, enumerable) and assert the expected behaviour, and do the same for the
other test around the 69-76 block to ensure the enabled-votes path is covered.

In `@packages/mcp/src/stellar/tools/stablecoin.test.ts`:
- Around line 41-47: The tests only exercise the votes:false branch in the
stablecoin tests; add a separate fixture where votes: true and assert the
enabled-votes behavior so regressions that ignore votes when enabled will fail.
Specifically, in the test suite around test('all default', ...) create an
additional test case (or modify the existing suite) that supplies params with
votes: true (same shape as DeepRequired<z.infer<typeof t.context.schema>>) and
add assertions that validate the contract/state changes expected when votes are
enabled; do the same for the analogous test near lines 63-69 so both the enabled
and disabled branches of votes are covered.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: f2752c6b-3f40-430b-ab52-46bffb7ad769

📥 Commits

Reviewing files that changed from the base of the PR and between 20141c1 and a24d5f6.

⛔ Files ignored due to path filters (7)
  • packages/cli/src/cli.test.ts.snap is excluded by !**/*.snap
  • packages/core/stellar/src/contract.test.ts.snap is excluded by !**/*.snap
  • packages/core/stellar/src/fungible.test.ts.snap is excluded by !**/*.snap
  • packages/core/stellar/src/governor.test.ts.snap is excluded by !**/*.snap
  • packages/core/stellar/src/non-fungible.test.ts.snap is excluded by !**/*.snap
  • packages/core/stellar/src/stablecoin.test.ts.snap is excluded by !**/*.snap
  • packages/core/stellar/src/zip-rust.compile.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (59)
  • .changeset/curvy-dolls-return.md
  • packages/cli/src/cli.test.ts.md
  • packages/cli/src/registry.ts
  • packages/common/src/ai/descriptions/stellar.ts
  • packages/common/src/ai/schemas/index.ts
  • packages/common/src/ai/schemas/schemas.test.ts
  • packages/common/src/ai/schemas/stellar.ts
  • packages/core/stellar/src/add-upgradeable.ts
  • packages/core/stellar/src/api.ts
  • packages/core/stellar/src/build-generic.ts
  • packages/core/stellar/src/contract.test.ts.md
  • packages/core/stellar/src/contract.ts
  • packages/core/stellar/src/fungible.compile.test.ts
  • packages/core/stellar/src/fungible.test.ts
  • packages/core/stellar/src/fungible.test.ts.md
  • packages/core/stellar/src/fungible.ts
  • packages/core/stellar/src/generate/fungible.ts
  • packages/core/stellar/src/generate/governor.ts
  • packages/core/stellar/src/generate/non-fungible.ts
  • packages/core/stellar/src/generate/sources.ts
  • packages/core/stellar/src/generate/stablecoin.ts
  • packages/core/stellar/src/governor.compile.test.ts
  • packages/core/stellar/src/governor.test.ts
  • packages/core/stellar/src/governor.test.ts.md
  • packages/core/stellar/src/governor.ts
  • packages/core/stellar/src/index.ts
  • packages/core/stellar/src/kind.ts
  • packages/core/stellar/src/non-fungible.compile.test.ts
  • packages/core/stellar/src/non-fungible.test.ts
  • packages/core/stellar/src/non-fungible.test.ts.md
  • packages/core/stellar/src/non-fungible.ts
  • packages/core/stellar/src/print.ts
  • packages/core/stellar/src/stablecoin.compile.test.ts
  • packages/core/stellar/src/stablecoin.test.ts
  • packages/core/stellar/src/stablecoin.test.ts.md
  • packages/core/stellar/src/stablecoin.ts
  • packages/core/stellar/src/test.ts
  • packages/core/stellar/src/utils/compile-test.ts
  • packages/core/stellar/src/utils/version.ts
  • packages/core/stellar/src/zip-rust.compile.test.ts.md
  • packages/core/stellar/src/zip-scaffold.compile.test.ts
  • packages/core/stellar/src/zip-shared.test.ts
  • packages/core/stellar/src/zip-shared.ts
  • packages/mcp/src/stellar/tools.ts
  • packages/mcp/src/stellar/tools/fungible.test.ts
  • packages/mcp/src/stellar/tools/fungible.ts
  • packages/mcp/src/stellar/tools/governor.test.ts
  • packages/mcp/src/stellar/tools/governor.ts
  • packages/mcp/src/stellar/tools/non-fungible.test.ts
  • packages/mcp/src/stellar/tools/non-fungible.ts
  • packages/mcp/src/stellar/tools/stablecoin.test.ts
  • packages/mcp/src/stellar/tools/stablecoin.ts
  • packages/ui/api/ai-assistant/function-definitions/stellar.ts
  • packages/ui/api/ai-assistant/types/languages.ts
  • packages/ui/src/stellar/App.svelte
  • packages/ui/src/stellar/FungibleControls.svelte
  • packages/ui/src/stellar/GovernorControls.svelte
  • packages/ui/src/stellar/NonFungibleControls.svelte
  • packages/ui/src/stellar/StablecoinControls.svelte

@ozgunozerk
Copy link
Copy Markdown
Contributor Author

@ericglau I think we are ready for a review (if you are required to review before merging)

Copy link
Copy Markdown
Member

@ericglau ericglau left a comment

Choose a reason for hiding this comment

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

Just a few comments/questions. Thanks!

ozgunozerk and others added 3 commits April 13, 2026 14:14
Co-authored-by: Eric Lau <ericglau@outlook.com>
Co-authored-by: Eric Lau <ericglau@outlook.com>
@ozgunozerk ozgunozerk requested a review from ericglau April 13, 2026 13:00
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.

3 participants