Skip to content

fix: bind vault initialization to creator and creation salt - #35

Closed
qingfeng312 wants to merge 1 commit into
YieldAnchor:mainfrom
qingfeng312:bounty/8-creator-authorized-initialization
Closed

qingfeng312 wants to merge 1 commit into
YieldAnchor:mainfrom
qingfeng312:bounty/8-creator-authorized-initialization

Conversation

@qingfeng312

Copy link
Copy Markdown

Closes #8.

The current contract already requires admin.require_auth(), but a first caller
can still select itself and authorize its own initialization. Implement issue
option 2: derive the current contract address from the supplied creator and exact
creation salt, reject mismatches, require creator authorization, and also require
any distinct admin's consent. Keep AlreadyInit, storage layout, event encoding
and existing error numbers; append BadDeployer (17).

This changes the initialization ABI for new builds. Update input validation,
transaction encoding, error descriptions and both deploy scripts together. The
creation helper now returns the exact salt used, even when omitted by the caller.
Single-signer scripts reject a distinct admin before creation; callers needing a
different admin must provide both parties' authorization separately. SDK stays at
locked 21.7.7. Existing deployed Wasm is not upgraded by this change.

Verified locally on macOS arm64 with Node24.22.1, pnpm9.15.0 and Rust1.99.1:

  • pnpm run test: 228 TypeScript tests and 25 contract tests pass. Six new native
    authorization regressions use explicit mocked authorization; the original
    self-signed capture regression fails against the unmodified initialize logic.
  • pnpm run contract:clippy (-D warnings), typecheck, format:check,
    contract:fmt:check and shell syntax checks pass.
  • pnpm run lint exits 0 with three pre-existing warnings in the unchanged
    wallet context. Wasm release and full application/service builds pass.
  • Salt assertions compare helper results to actual transaction XDR bytes.

Native Soroban and stub-RPC checks are not live Testnet verification. No real
account signing, deployment or ledger Wasm execution was performed. Historical
deployment records remain historical. The initialization method has a local
too_many_arguments allowance, propagated by the SDK to its generated clients,
to preserve the original metadata parameters while appending creation proof.

Implementation, tests and this PR description were prepared with OpenAI Codex.
Human review and maintainer acceptance of this ABI choice are pending.

@qingfeng312
qingfeng312 deleted the bounty/8-creator-authorized-initialization branch October 23, 2026 07:32
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.

fix: initialize is unauthenticated, so a front-runner can capture admin on a fresh vault

1 participant