Skip to content

test(wallet-core): add known-vector round-trip tests for provision_wallet/import_wallet - #398

Merged
Emmyt24 merged 2 commits into
Octo-Protocol-org:dev-branchfrom
daree-dev:test/wallet-core/provision-import-known-vector-roundtrip
Sep 29, 2026
Merged

Emmyt24 merged 2 commits into
Octo-Protocol-org:dev-branchfrom
daree-dev:test/wallet-core/provision-import-known-vector-roundtrip

Conversation

@daree-dev

Copy link
Copy Markdown
Contributor

Summary

provision_wallet and import_wallet in crates/wallet-core/src/provision.rs lacked a known-answer test proving that a specific mnemonic derives a specific, independently-verifiable account address — unlike the rigor already applied to raw derivation in derive.rs via SEP-0005's own test vectors. This PR closes that gap.

What changed

crates/wallet-core/src/provision.rs — two new tests added, two existing tests renamed for clarity:

import_wallet_derives_the_expected_account_for_a_known_sep0005_test_vector

Uses the published SEP-0005 Test 1 vector (no passphrase, 12-word mnemonic):

  • Source: https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0005.md § "Test Cases" — "Test 1"
  • The same vector is independently confirmed by js-stellar-base, go/txnbuild, Python stellar-sdk, and derive.rs's own sep0005_account_0_matches_official_vector test
  • Asserts import_wallet derives exactly GDRXE2BQUC3AZNPVFSCEZ76NJ3WWL25FYFK6RGZGIEKWE4SOOHSUJUJ6 from the known mnemonic

provision_wallet_returns_a_mnemonic_and_account_that_are_mutually_consistent_via_import_wallet

  • Calls provision_wallet, then re-imports the returned mnemonic via import_wallet
  • Asserts the derived account is identical in both calls
  • Proves the two functions are mutual inverses end-to-end across the full provision/import/seal stack

Renamed existing tests (no logic change)

  • provision_then_reopen_seed_yields_same_account → sealed_seed_opens_and_re_derives_same_account
  • import_reproduces_account_from_mnemonic → superseded by the explicit cited-vector test above

Test vector citation

SEP-0005 Test 1 (no passphrase, 12-word mnemonic)
Mnemonic: illness spike retreat truth genius clock brain pass fit cave bargain toe
m/44'/148'/0': GDRXE2BQUC3AZNPVFSCEZ76NJ3WWL25FYFK6RGZGIEKWE4SOOHSUJUJ6
Source: https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0005.md

Tested

cargo test -p octo-wallet-core provision
# 4 passed; 0 failed
#   provision::tests::import_wallet_derives_the_expected_account_for_a_known_sep0005_test_vector ... ok
#   provision::tests::provision_wallet_returns_a_mnemonic_and_account_that_are_mutually_consistent_via_import_wallet ... ok
#   provision::tests::sealed_seed_opens_and_re_derives_same_account ... ok
#   provision::tests::provisioned_wallets_are_unique ... ok

cargo test -p octo-wallet-core
# 62 passed; 0 failed

Closes #360

…allet/import_wallet

provision_wallet/import_wallet lacked a known-answer test vector proving a specific
mnemonic derives a specific, independently-verifiable account, unlike the rigor already
applied to raw derivation in derive.rs. Adds a cited test vector and round-trip tests.

Two required tests are added to crates/wallet-core/src/provision.rs:

- import_wallet_derives_the_expected_account_for_a_known_sep0005_test_vector
  Uses the published SEP-0005 Test 1 vector (no passphrase, 12-word mnemonic) from
  https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0005.md.
  The same vector is independently verified by js-stellar-base, go/txnbuild, and the
  Python stellar-sdk, plus derive.rs's own sep0005_account_0_matches_official_vector.
  Asserts import_wallet derives exactly GDRXE2BQUC3AZNPVFSCEZ76NJ3WWL25FYFK6RGZGIEKWE4SOOHSUJUJ6.

- provision_wallet_returns_a_mnemonic_and_account_that_are_mutually_consistent_via_import_wallet
  Calls provision_wallet, then re-imports its mnemonic via import_wallet and asserts the
  account matches — proving the two functions are mutual inverses end-to-end.

The two pre-existing tests are preserved and renamed for clarity:
- provision_then_reopen_seed_yields_same_account → sealed_seed_opens_and_re_derives_same_account
- import_reproduces_account_from_mnemonic → superseded by the explicit vector test above

Closes Octo-Protocol-org#360
@drips-wave

drips-wave Bot commented Sep 27, 2026

Copy link
Copy Markdown

@daree-dev Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Emmyt24
Emmyt24 merged commit 4237e5f into Octo-Protocol-org:dev-branch Sep 29, 2026
2 of 5 checks passed
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 test vectors for provision_wallet/import_wallet round-tripping a known SEP-0005 test mnemonic

2 participants