Skip to content

[Feat] Simplify Shield Swap setup and upgrade snarkVM - #72

Open
iamalwaysuncomfortable wants to merge 13 commits into
masterfrom
codex/first-swap-example
Open

iamalwaysuncomfortable wants to merge 13 commits into
masterfrom
codex/first-swap-example

Conversation

@iamalwaysuncomfortable

@iamalwaysuncomfortable iamalwaysuncomfortable commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Include a runnable first-swap example in the checkout and release wheel. The example authenticates an account, confirms a testnet airdrop, looks up USDCx and ETH, quotes one pool, submits one swap, waits for successful confirmation, and submits one claim.

SDK changes

  • The first account.from_private_key() import sets an unset default account. Subsequent imports preserve the current default, in both sync and async clients.
  • confirm_airdrop() requests tokens and polls the faucet job. It returns settled per-token outcomes or an initial rate-limit response; other failures propagate. A timeout carries the job ID.
  • get_token(symbol) resolves exact symbols and rejects unknown or ambiguous matches.
  • swap() converts string and Decimal token amounts internally, including the quoted output. Integers remain base units. Conversion rejects floats, excess precision, non-finite values, and u128 overflow.
  • record_wait_seconds optionally waits for a covering scanner record before reserving a counter or submitting. Sync and async callers default to no wait; the example allows 120 seconds. Provider errors propagate, and transaction submissions are never retried.
  • Journaled delegated swaps save claim secrets before confirmation reads. ID-only responses first save a provisional handle, then complete it after transaction lookup. The README explains recovery when confirmation times out.

Example and packaging

SHIELD_SWAP_PRIVATE_KEY can supply an account. Otherwise the SDK profile saves a generated key with owner-only permissions and reuses it. ENABLE_JOURNAL remains optional and only controls the swap journal; both settings use the same client and record scanner. The example has no custom helper functions or console logging.

The wheel includes the example and README and requires aleo-sdk>=0.5.1. Run from the checkout or with python -m aleo_shield_swap.examples.first_swap.swap after installing a release containing it.

snarkVM

Upgrade both sdk and sdk-abi from crates.io snarkVM 4.9.1 to 4.10.0. Both lockfiles resolve all 58 snarkVM crates to 4.10.0. The pinned Leo revision remains compatible, and its ABI-only features remain isolated. No binding-source changes were required.

Validation

  • 119 targeted tests pass for swaps, sync/async parity, scanner waits, journal timeout recovery, account persistence, profile handling, amounts, package checks, and generated guides.
  • The updated wheel builds, and its example and README match the source exactly.
  • Upgrade checks passed for both network builds, mainnet and ABI clippy, and formatting. Against the rebuilt binaries, 892 SDK tests and 8 ABI tests passed; live/proving tests were excluded.
  • Earlier Shield Swap regression checks passed 377 tests in the sandbox. Network-dependent failures reproduced with old bindings; the affected modules passed all 43 tests with network access.

Keep this PR in draft pending a complete live Python swap and claim. The scanner 422 was reproduced as "UUID not registered with the service"; registration succeeded on retry and a subsequent records query succeeded. SDK-created sync and async scanners now re-register on an owned-record 422 and retry the read once, preserving registration errors. The example checks initial registration success. An additional 89 targeted scanner, facade, account-example, and package tests pass. No release has been published.

@iamalwaysuncomfortable iamalwaysuncomfortable changed the title [Feat] Include a runnable first-swap example in the Python SDK [Feat] Simplify first-swap setup and ship the Python example Sep 25, 2026
@iamalwaysuncomfortable iamalwaysuncomfortable changed the title [Feat] Simplify first-swap setup and ship the Python example [Feat] Simplify Shield Swap setup and upgrade snarkVM Sep 25, 2026
@iamalwaysuncomfortable
iamalwaysuncomfortable marked this pull request as ready for review September 25, 2026 19:29

This branch has not been deployed

No deployments
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.

1 participant