Skip to content

feat: add Soroban vault operations CLI#465

Merged
carrion256 merged 21 commits into
devfrom
codex/soroban-vault-cli
Jun 11, 2026
Merged

feat: add Soroban vault operations CLI#465
carrion256 merged 21 commits into
devfrom
codex/soroban-vault-cli

Conversation

@carrion256

@carrion256 carrion256 commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds a new tmplr-soroban-vault CLI crate for deploying and operating Soroban vault deployments through the Stellar CLI.

The CLI includes typed deployment, curator, user, governance, share-token, and Blend adapter operations. It records deployment state in a manifest, reuses uploaded WASM by hash where possible, supports dry-run and machine-readable output modes, and adds a deployment-wide extend-ttl command for every TTL-capable contract in the manifest.

This also adds a Docker operator image at tools/soroban-vault-cli/Dockerfile. The image includes tmplr-soroban-vault, stellar-cli v26, Python for the runtime contractspec-strip step, and Rust toolchains/targets for stellar contract build so operators can run deployment flows from a container.

The curator proxy TTL gap is fixed: the proxy now has its own permissionless extend_ttl entrypoint and refreshes its instance TTL when initialized config is read, matching the 4626 proxy liveness pattern.

The CLI no longer requires or defaults a source account CLI argument. Operators can use the Stellar keystore/default identity via stellar keys use <identity>, or pass a non-secret identity alias/public account with --source-account/SOROBAN_IDENTITY. Explicit source-account overrides are provided to child stellar commands through a redacted STELLAR_ACCOUNT environment override instead of --source-account argv.

The CLI rejects obvious raw secret keys and seed phrases passed to --source-account, redacts source-account environment overrides from dry-run output and errors, zeroizes in-process override buffers after use, and scrubs source-account values from deployment manifests. If raw STELLAR_ACCOUNT is set directly for signing, the CLI refuses to derive admin/caller addresses from it because that Stellar subcommand would require placing the secret in child argv; operators must pass explicit public --admin/--caller values or use a keystore/default identity for that flow.

This update also adds safer operator and automation surfaces:

  • Decimal amount flags such as --assets 1.25 --asset-decimals 7, --shares 10 --share-decimals manifest, and curator --amount 1.25 --asset-decimals 7 convert to raw contract units without floating point.
  • Raw unit flags remain available for exact machine use, including --assets-raw, --shares-raw, and --amount-raw.
  • Public TOML profiles via profile init <name> and --profile <name> can carry network/RPC/passphrase/state/workspace/config-dir/default public admin/caller/operator values without storing secrets.
  • completions zsh|bash|fish and man generate shell completions and a roff manpage.
  • Dangerous governance submissions for admin rotation, timelock changes, supply queue replacement, and fee updates print semantic old/new context in human mode and require --yes or interactive confirmation; JSON modes remain non-interactive.
  • Deployment writes checkpoint the manifest after each artifact upload/reuse decision, contract deploy/import record, asset-token record, and successful initialize, so a failed later initialize leaves enough state to resume/reuse deployed IDs.n- Interactive human runs show a TTY progress bar across WASM upload/reuse, contract deployment/reuse, initialization, and adapter deployment stages; progress rendering is disabled for JSON, JSON-lines, dry-run, and non-TTY output.
  • --json now emits a stable envelope with type, ok, network, manifest, commands, tx_hashes, warnings, and command-specific data or structured error.
  • --json-lines emits the same newline-delimited envelope shape for automation that consumes long-running flows.
  • Structured errors include codes such as missing_manifest_contract, mainnet_guard, secret_in_argv, invalid_args, and command_failed, including JSON parse-error output before clap exits.
  • The output envelope schema is checked in at tools/soroban-vault-cli/schema/output.schema.json.
  • Successful non-dry-run writes append richer manifest transaction records with timestamp, command/action, target contract/function when known, tx hash when visible, source public address when known, result status, and artifact hash when applicable.

This update also adds operator UX helpers:

  • doctor checks Stellar CLI availability, configured network/passphrase/RPC, source identity availability without printing secrets, manifest writability, WASM artifact/build readiness, Docker mount health, and mainnet guard status.
  • deploy plan stack and deploy plan adapters emit reuse/deploy/upload/manifest decisions and redacted Stellar command shapes without network writes or manifest changes.
  • Governance planning helpers cover plan-accept, plan-submit-set-supply-queue, and plan-submit-set-timelock.
  • Governance lifecycle helpers add queue, explain, accept-ready, and submit-and-wait flows with conservative decoding of pending proposal readiness.

Operator impact

  • Deploy or import vault stacks and append Blend adapters without redeploying existing components.
  • Resume deployments after mid-flow initialize failures using incrementally checkpointed manifest records.n- See visual progress across stack deployment stages in interactive terminals.
  • Check local readiness before deployment with doctor.
  • Plan deployments and common governance transactions before signing or mutating manifests.
  • Run typed curator, user, governance, share-token, and adapter commands without hand-encoding compact payloads.
  • Use human-scale decimal amount flags for operator workflows while preserving raw unit flags for scripts.
  • Reduce repeated Docker/local flags with non-secret TOML profiles.
  • Install shell completions and generate a manpage from the CLI.
  • Consume stable JSON/JSON-lines envelopes and checked-in schema from automation.
  • Inspect pending governance proposals, accept ready proposals in batches, and submit selected proposal types with wait-and-accept handling.
  • Extend TTL across vault, governance, ERC-4626 proxy, curator proxy, share token, and all Blend adapters from one command.
  • Report manifest entries skipped by TTL maintenance when they have no deployment-wide TTL entrypoint.
  • Build and run a containerized CLI with mounted workspace, Stellar config, deployment state, and build outputs.
  • Avoid accidental source-account leakage through shell history, dry-run output, error messages, or manifest persistence.
  • Use manifest transaction history as a deployment audit trail for successful write operations.

Validation

  • cargo fmt --package templar-curator-proxy-soroban --package templar-soroban-vault-cli --check
  • cargo fmt --package templar-soroban-vault-cli --check
  • cargo test -p templar-curator-proxy-soroban -- --nocapture (13 unit + 3 integration passed)
  • cargo test -p templar-soroban-vault-cli -- --nocapture (45 passed)
  • cargo clippy -p templar-curator-proxy-soroban --all-targets -- -D warnings
  • cargo clippy -p templar-soroban-vault-cli --all-targets -- -D warnings (exits 0; repo-level unknown lint: clippy::ignore_without_reason warning remains)
  • cargo run -q -p templar-soroban-vault-cli -- --json --source-account SC36XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX status (expected exit 2; emits secret_in_argv JSON envelope)
  • TEMPLAR_SOROBAN_VAULT_PROFILE_DIR=$(mktemp -d) cargo run -q -p templar-soroban-vault-cli -- profile init testnet
  • cargo run -q -p templar-soroban-vault-cli -- completions bash > <tempfile>
  • cargo run -q -p templar-soroban-vault-cli -- man > <tempfile>
  • docker build --check -f tools/soroban-vault-cli/Dockerfile .
  • docker build --network=host -f tools/soroban-vault-cli/Dockerfile -t templar/soroban-vault-cli:codex .
  • docker run --rm --network=none templar/soroban-vault-cli:codex --help
  • Post-commit hook: Soroban size-budget-check passed (123720 bytes)

This change is Reviewable

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 056f6c54-7fc4-4d0d-8907-ef013a77b277

📥 Commits

Reviewing files that changed from the base of the PR and between 2290773 and e254a8d.

📒 Files selected for processing (1)
  • .github/workflows/test.yml

📝 Walkthrough

Overview

  • Adds a new Rust CLI crate/tools and operator image: tools/soroban-vault-cli (binary: tmplr-soroban-vault), Dockerfile, README, JSON output schema, and public TOML profile support.
  • Implements manifest-backed deployment state with incremental checkpointing, WASM-hash reuse (sha256), dry-run and machine-readable outputs (--json / --json-lines) validated by tools/soroban-vault-cli/schema/output.schema.json.
  • Introduces a typed, safety-minded CLI (clap) with strong parsing/validation, secret-aware SourceAccount, decimal→raw integer conversion (no floats), artifact build/upload logic, Stellar CLI wrapper with preflight, redaction, zeroize, and reconciliation/polling behavior.

Key locations

  • Curator proxy contract: contract/proxy-curator-soroban/{src/contract.rs, governance_abi.rs, lib.rs, tests.rs}
  • CLI crate: tools/soroban-vault-cli/src/{artifacts.rs, cli.rs, commands.rs, lib.rs, main.rs, manifest.rs, profile.rs, stellar.rs, types.rs}
  • Sample deployment manifest: contract/vault/deployments/tTUSDC/mainnet/manifest.json (+ README)
  • Operator image and docs: tools/soroban-vault-cli/Dockerfile, README
  • JSON schema: tools/soroban-vault-cli/schema/output.schema.json

Notable functional changes

  • Curator proxy (contract/proxy-curator-soroban):
    • Adds governance ABI module (vendored types) and re-exports; new GovernanceAction, Timelocks, FeeParams, PendingProposal, GovernanceError.
    • Replaces extend_vault_ttl with a permissionless extend_ttl entrypoint and refreshes the contract instance TTL on initialize and on successful require_initialized() calls.
    • Adds INSTANCE_TTL_THRESHOLD / INSTANCE_TTL_EXTEND_TO constants and tests asserting extend_ttl behavior (succeeds post-initialize, fails when not initialized) and that extend_ttl does not call the vault.
  • CLI/tooling:
    • Full CLI tree: deploy/reconcile/status/profile/completions/man/user/curator/governance/share-token/adapter/extend-ttl; typed args and is_write classification.
    • types.rs: SourceAccount rejects likely secret seeds, redacts Display/Debug, exposes public address only when input looks like G/M; DecimalAmount converts decimals→i128 safely with checks; AddressStr/WasmHash and governance-related arg types with FromStr parsing.
    • artifacts.rs: ArtifactSpec + ensure_uploaded(build optional) that computes local sha256, reuses manifest.remote_wasm_hash when verified via stellar.fetch_wasm_hash, otherwise uploads and records ArtifactRecord in manifest.
    • manifest.rs: versioned Manifest model; load_or_new clears source_account on load; save writes pretty JSON; records ArtifactRecord, ContractRecord, TransactionRecord and includes unit tests.
    • profile.rs: public TOML profiles, expand_args injects profile values safely unless CLI/ENV override present; init_profile templating.
    • stellar.rs: CommandExecutor trait + RealExecutor; Stellar wrapper builds network args, sets redacted STELLAR_ACCOUNT env when source provided, does preflight rewrites for contract invoke/deploy/upload, parses contract IDs/wasm hashes/tx hashes, polls tx status and appends tx-hash lines, redacts and zeroizes secrets after execution; prevents deriving/publicly exposing address from STELLAR_ACCOUNT unless explicit SourceAccount provided.
    • schema: strict output envelope JSON Schema with conditional ok/data vs error rules.
    • Dockerfile: multi-stage build producing runtime image bundling stellar-cli, tmplr-soroban-vault, Python, Rust toolchains; non-root user and operator volumes.

Security & safety highlights (implemented)

  • Secrets: SourceAccount rejects likely seed phrases/raw secret keys; SourceAccount uses secrecy::SecretString and zeroize patterns in stellar wrapper; manifest load scrubs stored source_account; display/debug redaction and zeroize of redacted argv/env after run.
  • Write-safety: dry-run, --json/--json-lines outputs, --yes gating, allow_mainnet_write / allow_zero_timelock flags, preflight simulations for invoke/deploy/upload; safer governance confirmations and planning helpers.
  • Numeric safety: DecimalAmount avoids floats and checks fractional digits/scale/overflow.
  • Manifest safety: manifest.save creates parent dirs and writes pretty JSON; manifest load validates version and backfills network.
  • WASM reuse: ensure_uploaded avoids redundant uploads by comparing local sha256 to manifest and consulting stellar.fetch_wasm_hash.

Critical items for human review (prioritise)

  1. Curator proxy TTL semantics

    • Verify INSTANCE_TTL_THRESHOLD / INSTANCE_TTL_EXTEND_TO values and whether permissionless extend_ttl + require_initialized() TTL refresh can be misused to extend instance liveness without proper governance checks or to create denial-of-service or economic-exhaustion patterns.
    • Ensure extend_ttl has no side-effects on vault accounting/authorization and that initialization state cannot be spoofed to bypass checks.
  2. Vendored governance ABI correctness

    • Confirm enum ordering, discriminants, and contract-serializable layouts match all other consumers (no ABI drift). Validate GovernanceAction variants and any numeric discriminants mapping (GovernanceError repr u32).
  3. Secret handling completeness

    • Audit all paths for secret leakage: profile files, manifest writes, logs/traces (tracing config), child process env/argv, error paths. Confirm zeroization/redaction applies on all error and panic paths and profiles/templates don't include secrets.
  4. Stellar wrapper robustness

    • Validate tx-hash / contract-id / wasm-hash extraction heuristics against noisy stellar-cli output and edge cases to avoid false positives/negatives or injection/parse ambiguity.
    • Confirm preflight arg rewrites are semantically safe for targeted stellar-cli v26 (and pinned version in Dockerfile) and do not change intent for edge cases.
  5. Artifact upload correctness & TOCTOU

    • ensure_uploaded relies on stellar.fetch_wasm_hash and manifest.remote_wasm_hash — review race conditions where remote state changes between fetch and upload, and whether manifest writes/checkpoints are atomic enough for resumption.
  6. Decimal→raw conversion & integer limits

    • Review decimal_to_raw edge cases: very large inputs near i128 limits, negative values, fractional rounding/truncation rules, and consistency with contract-side expectations.
  7. Manifest atomicity and checkpointing

    • Confirm manifest.save semantics are atomic enough for resume after partial failures (consider tmp file + rename) and that checkpoint ordering protects against inconsistent state when uploads/deploys are interrupted.
  8. Tests & CI signals

    • Unit tests present for parsing, redaction, decimal conversion, manifest round-trip, artifacts path; confirm Docker build/run checks and Soroban size-budget check in CI and that curator-proxy tests pass in integration.

Smart-contract-specific checklist

  • Run a focused review against smart-contract-vulnerabilities categories (access control, improper initialization, timelock bypass, reentrancy, integer overflow, denial-of-service). Pay special attention to:
    • Permissionless extend_ttl interaction with timelocks/governance flows.
    • require_initialized gating correctness and any possibility to spoof initialization.
    • Any newly added contracttype enums/structs for serialization ambiguities or variant-index mismatches.

Minor/operational notes

  • Documentation updated to use templar_soroban_runtime.wasm as the deployable artifact and to adjust the size-budget and justfile accordingly.
  • Docker operator image includes rustup/toolchains — review operator threat model and image surface for CI/runtime usage.

Recommendation

  • Before merge/release, perform: (A) focused security audit of curator proxy TTL/extend_ttl, (B) ABI compatibility check vs all governance consumers, (C) secrets audit covering profile/manifest/stellar invocation and error paths, and (D) targeted tests exercising preflight/tx parsing and resume-after-failure flows.

Walkthrough

Refactors proxy-curator governance ABI and TTL behavior, standardizes deploy artifact to the optimized runtime WASM, and adds a new soroban-vault-cli crate (CLI, manifest, profile, Stellar integration, artifact management, tests, Docker, and docs).

Changes

Soroban proxy contract refactoring and Soroban Vault CLI implementation

Layer / File(s) Summary
Governance ABI extraction and proxy TTL handling
contract/proxy-curator-soroban/src/governance_abi.rs, contract/proxy-curator-soroban/src/contract.rs, contract/proxy-curator-soroban/src/lib.rs, contract/proxy-curator-soroban/src/tests.rs, contract/proxy-curator-soroban/Cargo.toml
Local governance_abi module defines governance types and error enum; contract imports from local module instead of templar_soroban_governance, adds TTL extension constants/helper, extends instance TTL on initialization and on successful require_initialized, replaces extend_vault_ttl with permissionless extend_ttl, and updates tests to validate behavior.
Build artifact simplification and documentation
contract/vault/soroban/justfile, contract/vault/soroban/README.md, contract/vault/soroban/AGENTS.md, contract/vault/soroban/SIZE_BUDGET.md, contract/vault/deployments/tTUSDC/mainnet/manifest.json, contract/vault/deployments/tTUSDC/mainnet/README.md
Justfile now selects the optimized templar_soroban_runtime.wasm as the deploy artifact and removes spec-stripping; documentation updated to reference the single deployable runtime WASM and its size-budget; adds a mainnet deployment manifest and README.
CLI entrypoint, manifest model, and profile expansion
tools/soroban-vault-cli/src/main.rs, tools/soroban-vault-cli/src/lib.rs, tools/soroban-vault-cli/src/manifest.rs, tools/soroban-vault-cli/src/profile.rs, tools/soroban-vault-cli/Cargo.toml
New CLI crate entrypoint and run() initialize tracing, expand profile-derived args, parse the clap CLI, and dispatch commands. Manifest model persists artifact/contract/transaction records (versioned JSON) and provides load/save/backfill behavior. Profile module reads/writes TOML profiles, injects global/auth flags when appropriate, and provides profile init templating.
Complete command tree and typed argument wrappers
tools/soroban-vault-cli/src/cli.rs, tools/soroban-vault-cli/src/types.rs
Defines the full Clap command hierarchy (deploy/reconcile/status/export-env/profile/completions/man/user/curator/governance/share-token/adapter/extend-ttl) with is_write() classification. types.rs adds secret-aware SourceAccount, DecimalAmount conversion, AddressStr/WasmHash, and governance argument wrappers (GovernanceActionKindArg, TimelockKindArg, RestrictionModeArg), plus parameter parsing for supply-queue and fee params with tests.
Stellar CLI integration and artifact management
tools/soroban-vault-cli/src/stellar.rs, tools/soroban-vault-cli/src/artifacts.rs
stellar.rs provides a CommandExecutor abstraction and Stellar wrapper for building/invoking/uploading/deploying contracts with preflight simulation, redaction/zeroization, tx-hash extraction, and RPC confirmation polling. artifacts.rs defines ArtifactSpec, build helpers, sha256_file, and ensure_uploaded to avoid redundant uploads via manifest caching and remote hash verification.
Docker containerization and operator docs
tools/soroban-vault-cli/Dockerfile, tools/soroban-vault-cli/README.md, tools/soroban-vault-cli/schema/output.schema.json, .gitignore, .dockerignore, Cargo.toml
Adds a multi-stage Dockerfile to build and package tmplr-soroban-vault and stellar binaries, a README documenting CLI workflows and safety/guardrails, a JSON Schema validating CLI output envelopes, workspace dependency addition secrecy = "0.10.3", and .gitignore/.dockerignore rules ignoring proxy test snapshot artifacts and local secrets.

Sequence Diagram(s)

sequenceDiagram
  participant UserCLI as tmplr-soroban-vault (CLI)
  participant Manifest as Manifest (state.json)
  participant Stellar as stellar CLI
  participant RPC as Soroban RPC

  UserCLI->>Manifest: load_or_new / read manifest
  UserCLI->>Stellar: build_package / upload (or invoke)
  Stellar->>RPC: submit transaction / fetch tx
  RPC-->>Stellar: tx result / wasm hash
  Stellar-->>UserCLI: stdout/stderr with tx hash
  UserCLI->>Manifest: save updated artifact/contract records
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • Templar-Protocol/contracts#419: Introduces proxy curator contract governance changes that this PR refactors by extracting governance ABI to a local module and replacing extend_vault_ttl with permissionless extend_ttl.

Suggested reviewers

  • peer2f00l
  • royalf00l
🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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 codex/soroban-vault-cli

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • LINEAR integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

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

@carrion256 carrion256 changed the title [codex] Add Soroban vault operations CLI feat: add Soroban vault operations CLI Jun 8, 2026
Comment thread tools/soroban-vault-cli/src/commands.rs Dismissed
Comment thread tools/soroban-vault-cli/src/commands.rs Dismissed
Comment thread tools/soroban-vault-cli/src/commands.rs Dismissed
Comment thread tools/soroban-vault-cli/src/commands.rs Dismissed
Comment thread tools/soroban-vault-cli/src/commands.rs Dismissed
Comment thread tools/soroban-vault-cli/src/commands.rs Dismissed
@carrion256
carrion256 marked this pull request as ready for review June 10, 2026 16:13

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8f69cd1942

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/soroban-vault-cli/src/commands.rs Outdated
Comment thread tools/soroban-vault-cli/src/commands.rs Outdated
@carrion256
carrion256 force-pushed the codex/soroban-vault-cli branch from 8f69cd1 to c00b91b Compare June 10, 2026 16:19
@carrion256

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 7

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@contract/proxy-curator-soroban/src/contract.rs`:
- Around line 262-265: The extend_ttl function currently calls
extend_instance_ttl(&env) permissively, allowing permissionless TTL extension
prior to initialization; update extend_ttl to check the contract's initialized
state (the same condition used in initialize/initialize-related checks) before
calling extend_instance_ttl and return an appropriate ContractError if the
instance is not initialized; locate and reuse the existing initialized flag or
helper used by initialize() (and the init-gating logic around
initialize/extend_instance_ttl) so only initialized instances may have their TTL
extended.

In `@contract/vault/deployments/tTUSDC/mainnet/manifest.json`:
- Line 79: The manifest.json entry for the governance contract sets
"timelock_ns": "0" which violates the repo safety guidance; either change the
manifest's timelock_ns to a non-zero value appropriate for mainnet governance
(e.g., a conservative seconds->nanoseconds duration) in the same manifest that
contains the "Test Templar USDC" metadata, or if this is intentionally a test
deployment, add an explicit note to the mainnet README.md documenting that this
deployment is experimental (reference "Test Templar USDC"), that it uses
SOROBAN_GOV_TIMELOCK_NS=0, and that SOROBAN_ALLOW_ZERO_GOV_TIMELOCK=1 must be
set to permit zero timelock; ensure the README callout explains the risk to user
funds and the temporary/test-only status so reviewers can verify intent.
- Line 43: The manifest's wasm_path currently points to
"templar_soroban_runtime.deploy.wasm" which no longer matches the new build
convention used by the CLI (see tools/soroban-vault-cli/src/artifacts.rs:55);
update the wasm_path value in manifest.json to "templar_soroban_runtime.wasm" so
it aligns with the new workflow and the hardcoded CLI lookup, or alternatively
add a brief note in the mainnet README explaining the historical ".deploy"
suffix and how to verify this manifest with the new tooling; modify the
wasm_path key (in manifest.json) or add the README comment accordingly to ensure
manifest verification works with the updated CLI.

In `@tools/soroban-vault-cli/Dockerfile`:
- Line 77: The Dockerfile currently uses a broad COPY --chown=templar:templar .
/workspace which bakes the entire build context (including .git, target, .env,
editor temp files) into the image; either add a repository-level .dockerignore
to exclude .git, target, .env, *.swp, .DS_Store etc., or replace the single COPY
with selective copies of only the build inputs (e.g., Cargo.toml, Cargo.lock,
relevant source directories like contract/ and tools/) so only necessary files
are included; if the full workspace truly is required, add a clear comment above
the COPY and ensure .dockerignore at minimum excludes .git and secrets.
- Around line 79-84: The Dockerfile creates runtime directories
(/home/templar/.cargo, /home/templar/.config/stellar,
/workspace/contract/vault/soroban/.deploy-state, /workspace/target) but later
declares a VOLUME for /workspace/target and possibly
/workspace/contract/vault/soroban/.deploy-state, which will hide any build-time
artifacts copied into /workspace; update the Dockerfile around the RUN mkdir -p
and the VOLUME declaration to add a clear comment documenting that VOLUME mounts
will shadow the image’s /workspace/target and
/workspace/contract/vault/soroban/.deploy-state (and instruct operators to mount
local paths to persist prebuilt artifacts if needed), or alternatively avoid
declaring those directories as VOLUME so prebuilt artifacts remain available at
runtime—reference the RUN mkdir -p block and the VOLUME entries to make the
change.

In `@tools/soroban-vault-cli/src/stellar.rs`:
- Line 263: The temporary-file removal call currently swallows errors with let _
= fs::remove_file(&out_file); — change it to check the Result and log failures
so cleanup errors (permissions, disk, open handle) are visible; locate the place
where out_file is removed (the fs::remove_file(&out_file) call) and replace the
ignore with an error-aware branch (e.g., if let Err(e) =
fs::remove_file(&out_file) { /* log e with context mentioning out_file and the
operation */ }) using the existing logging facility or eprintln! if none is
available.
- Around line 476-477: fetch_transaction_status currently treats
transaction_status_from_output(&output.stdout).unwrap_or(TransactionConfirmationStatus::Success)
which masks parse failures as successes; change fetch_transaction_status to
treat a None result as an error (or return an explicit
TransactionConfirmationStatus::Unknown/Unconfirmed) instead of defaulting to
Success, and include a short excerpt of output.stdout (e.g., first N bytes or
trimmed snippet) in the error message to aid diagnosis; update any call sites
expecting Success on parse failure to handle the new error/Unknown variant and
adjust signatures/errors accordingly (refer to fetch_transaction_status,
transaction_status_from_output, output.stdout, and
TransactionConfirmationStatus).
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 459e1bd6-a2bf-4142-bf22-7cb8a297efca

📥 Commits

Reviewing files that changed from the base of the PR and between 0c64209 and 8f69cd1.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (26)
  • .gitignore
  • Cargo.toml
  • contract/proxy-curator-soroban/Cargo.toml
  • contract/proxy-curator-soroban/src/contract.rs
  • contract/proxy-curator-soroban/src/governance_abi.rs
  • contract/proxy-curator-soroban/src/lib.rs
  • contract/proxy-curator-soroban/src/tests.rs
  • contract/vault/deployments/tTUSDC/mainnet/README.md
  • contract/vault/deployments/tTUSDC/mainnet/manifest.json
  • contract/vault/soroban/AGENTS.md
  • contract/vault/soroban/README.md
  • contract/vault/soroban/SIZE_BUDGET.md
  • contract/vault/soroban/justfile
  • tools/soroban-vault-cli/Cargo.toml
  • tools/soroban-vault-cli/Dockerfile
  • tools/soroban-vault-cli/README.md
  • tools/soroban-vault-cli/schema/output.schema.json
  • tools/soroban-vault-cli/src/artifacts.rs
  • tools/soroban-vault-cli/src/cli.rs
  • tools/soroban-vault-cli/src/commands.rs
  • tools/soroban-vault-cli/src/lib.rs
  • tools/soroban-vault-cli/src/main.rs
  • tools/soroban-vault-cli/src/manifest.rs
  • tools/soroban-vault-cli/src/profile.rs
  • tools/soroban-vault-cli/src/stellar.rs
  • tools/soroban-vault-cli/src/types.rs
💤 Files with no reviewable changes (1)
  • contract/proxy-curator-soroban/Cargo.toml

Comment thread contract/proxy-curator-soroban/src/contract.rs
Comment thread contract/vault/deployments/tTUSDC/mainnet/manifest.json Outdated
Comment thread contract/vault/deployments/tTUSDC/mainnet/manifest.json
Comment thread tools/soroban-vault-cli/Dockerfile
Comment thread tools/soroban-vault-cli/Dockerfile
Comment thread tools/soroban-vault-cli/src/stellar.rs Outdated
Comment thread tools/soroban-vault-cli/src/stellar.rs Outdated
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

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.

Warning

CodeRabbit couldn't request changes on this pull request because it doesn't have sufficient GitHub permissions.

Please grant CodeRabbit Pull requests: Read and write permission and re-run the review.

👉 Steps to fix this

Actionable comments posted: 2

♻️ Duplicate comments (1)
contract/proxy-curator-soroban/src/contract.rs (1)

252-259: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Gate TTL extension on initialized state.

Line 257 extends proxy instance TTL permissively without checking initialization, allowing anyone to keep an uninitialized proxy alive indefinitely. Combined with Line 701 extending TTL before verifying initialization in require_initialized, this widens the front-running window for initialize().

Based on learnings, initialize() is highly sensitive because front-running can seize governance/curator control; pre-init TTL extension should stay explicit and constrained.

Suggested fix
 pub fn extend_ttl(env: Env) -> Result<(), ContractError> {
+    require_initialized(&env)?;
     extend_instance_ttl(&env);
     Ok(())
 }

And in require_initialized:

 pub(crate) fn require_initialized(env: &Env) -> Result<(), ContractError> {
-    extend_instance_ttl(env);
-    is_initialized(env)
-        .then_some(())
-        .ok_or(ContractError::NotInitialized)
+    if !is_initialized(env) {
+        return Err(ContractError::NotInitialized);
+    }
+    extend_instance_ttl(env);
+    Ok(())
 }

Also applies to: 700-705

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@contract/proxy-curator-soroban/src/contract.rs` around lines 252 - 259, The
extend_ttl path currently calls extend_instance_ttl unconditionally, allowing
anyone to prolong an uninitialized proxy; modify pub fn extend_ttl(env: Env) to
first verify the contract is initialized (reuse the require_initialized or the
same check it performs) and only call extend_instance_ttl when initialized,
returning an appropriate ContractError otherwise; also move the TTL-extension
call in require_initialized (around the code referenced at lines ~700) so the
extension happens after the initialization check/success, not before, ensuring
extend_instance_ttl is only invoked for already-initialized instances and
preventing pre-init TTL extensions that widen the initialize() front-running
window.

Source: Learnings

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tools/soroban-vault-cli/src/lib.rs`:
- Around line 18-51: Add a regression test that ensures profile-injected values
starting with '-' can't be parsed as extra flags: create a test that uses
profile::expand_args (or expand_args_with_dir/push_profile_arg) to inject a
ProfileConfig with a value like network = "--allow-mainnet-write" into raw args,
then attempt to parse with cli::Cli::try_parse_from and assert the parser either
fails safely (returns an error) or that the hazardous flag was not set on the
resulting Cli (i.e., parsing did not treat the injected value as a separate
option). Locate the test next to other profile tests and reference
profile::expand_args, expand_args_with_dir, and push_profile_arg when
constructing the scenario.

In `@tools/soroban-vault-cli/src/manifest.rs`:
- Around line 41-63: Add a short inline comment above the line
`manifest.source_account = None;` in the `load_or_new` function of `manifest.rs`
explaining that this explicitly clears any persisted secret/source account info
to avoid writing sensitive data to disk (security: scrub secrets from manifest
on load) so future maintainers understand this is intentional and not a bug.

---

Duplicate comments:
In `@contract/proxy-curator-soroban/src/contract.rs`:
- Around line 252-259: The extend_ttl path currently calls extend_instance_ttl
unconditionally, allowing anyone to prolong an uninitialized proxy; modify pub
fn extend_ttl(env: Env) to first verify the contract is initialized (reuse the
require_initialized or the same check it performs) and only call
extend_instance_ttl when initialized, returning an appropriate ContractError
otherwise; also move the TTL-extension call in require_initialized (around the
code referenced at lines ~700) so the extension happens after the initialization
check/success, not before, ensuring extend_instance_ttl is only invoked for
already-initialized instances and preventing pre-init TTL extensions that widen
the initialize() front-running window.
🪄 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: ASSERTIVE

Plan: Pro

Run ID: 97faf711-edfb-4c70-af3b-3c64f4b5d074

📥 Commits

Reviewing files that changed from the base of the PR and between 8f69cd1 and 6c363ec.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (26)
  • .gitignore
  • Cargo.toml
  • contract/proxy-curator-soroban/Cargo.toml
  • contract/proxy-curator-soroban/src/contract.rs
  • contract/proxy-curator-soroban/src/governance_abi.rs
  • contract/proxy-curator-soroban/src/lib.rs
  • contract/proxy-curator-soroban/src/tests.rs
  • contract/vault/deployments/tTUSDC/mainnet/README.md
  • contract/vault/deployments/tTUSDC/mainnet/manifest.json
  • contract/vault/soroban/AGENTS.md
  • contract/vault/soroban/README.md
  • contract/vault/soroban/SIZE_BUDGET.md
  • contract/vault/soroban/justfile
  • tools/soroban-vault-cli/Cargo.toml
  • tools/soroban-vault-cli/Dockerfile
  • tools/soroban-vault-cli/README.md
  • tools/soroban-vault-cli/schema/output.schema.json
  • tools/soroban-vault-cli/src/artifacts.rs
  • tools/soroban-vault-cli/src/cli.rs
  • tools/soroban-vault-cli/src/commands.rs
  • tools/soroban-vault-cli/src/lib.rs
  • tools/soroban-vault-cli/src/main.rs
  • tools/soroban-vault-cli/src/manifest.rs
  • tools/soroban-vault-cli/src/profile.rs
  • tools/soroban-vault-cli/src/stellar.rs
  • tools/soroban-vault-cli/src/types.rs
💤 Files with no reviewable changes (1)
  • contract/proxy-curator-soroban/Cargo.toml

Comment thread tools/soroban-vault-cli/src/lib.rs
Comment thread tools/soroban-vault-cli/src/manifest.rs
@carrion256
carrion256 merged commit 63d443c into dev Jun 11, 2026
26 checks passed
@carrion256
carrion256 deleted the codex/soroban-vault-cli branch June 11, 2026 09:30
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.

2 participants