Skip to content

Fix wormhole derivation path#93

Merged
n13 merged 1 commit intomainfrom
wormhole_derivation_path_fix
Apr 18, 2026
Merged

Fix wormhole derivation path#93
n13 merged 1 commit intomainfrom
wormhole_derivation_path_fix

Conversation

@n13
Copy link
Copy Markdown
Contributor

@n13 n13 commented Apr 18, 2026

also printing out wormhole address for clarity

also printing out wormhole address for clarity
@n13 n13 merged commit b65854a into main Apr 18, 2026
6 checks passed
n13 added a commit that referenced this pull request Apr 18, 2026
Port the derivation-path fix from main (#93): the wormhole HD path
for `collect_rewards` must be `m/44'/CHAIN/0'/0'/index'` — the
intermediate segment is 0', not 1'. Also move the `derive` progress
call to after resolution so it reports the actual derived SS58
address, matching main's behavior.

Add `test_resolve_credential_mnemonic_pinned_derivation_path` which
pins the expected (address_bytes, secret_bytes) for the canonical
abandon-art test mnemonic at index 0. Any future silent regression of
the path segments will fail this test.
n13 added a commit that referenced this pull request Apr 18, 2026
* Cover new credential code paths and drop duplicate address compute

Follow-up review feedback for #92. The original PR tested helpers
indirectly (parse_secret_hex_str, compute_wormhole_address) but never
exercised the new match arms in collect_rewards, and left the clap
mutual-exclusion constraints without a guardrail.

- Extract credential resolution into `resolve_credential` so the
  Mnemonic / Secret branches are directly testable, and call it from
  `collect_rewards`.
- Remove the redundant `compute_wormhole_address` call inside the
  per-transfer proof loop now that `wormhole_address_bytes` is already
  produced at the top of the flow.
- Replace the 6 indirect tests with 7 direct tests that actually run
  `resolve_credential`, including a mnemonic -> HD-derived-secret ->
  `Secret { hex }` equivalence test and the `HD derivation failed`
  error path.
- Add 3 clap parsing tests covering `required_unless_present_any` and
  the three `conflicts_with_all` pairs (wallet+mnemonic, wallet+secret,
  mnemonic+secret).

* Fix wormhole HD path and pin it with a regression test

Port the derivation-path fix from main (#93): the wormhole HD path
for `collect_rewards` must be `m/44'/CHAIN/0'/0'/index'` — the
intermediate segment is 0', not 1'. Also move the `derive` progress
call to after resolution so it reports the actual derived SS58
address, matching main's behavior.

Add `test_resolve_credential_mnemonic_pinned_derivation_path` which
pins the expected (address_bytes, secret_bytes) for the canonical
abandon-art test mnemonic at index 0. Any future silent regression of
the path segments will fail this test.

* format
illuzen added a commit that referenced this pull request Apr 18, 2026
* allow using secret to collect rewards

* add tests

* Cover new credential code paths and drop duplicate address compute (#94)

* Cover new credential code paths and drop duplicate address compute

Follow-up review feedback for #92. The original PR tested helpers
indirectly (parse_secret_hex_str, compute_wormhole_address) but never
exercised the new match arms in collect_rewards, and left the clap
mutual-exclusion constraints without a guardrail.

- Extract credential resolution into `resolve_credential` so the
  Mnemonic / Secret branches are directly testable, and call it from
  `collect_rewards`.
- Remove the redundant `compute_wormhole_address` call inside the
  per-transfer proof loop now that `wormhole_address_bytes` is already
  produced at the top of the flow.
- Replace the 6 indirect tests with 7 direct tests that actually run
  `resolve_credential`, including a mnemonic -> HD-derived-secret ->
  `Secret { hex }` equivalence test and the `HD derivation failed`
  error path.
- Add 3 clap parsing tests covering `required_unless_present_any` and
  the three `conflicts_with_all` pairs (wallet+mnemonic, wallet+secret,
  mnemonic+secret).

* Fix wormhole HD path and pin it with a regression test

Port the derivation-path fix from main (#93): the wormhole HD path
for `collect_rewards` must be `m/44'/CHAIN/0'/0'/index'` — the
intermediate segment is 0', not 1'. Also move the `derive` progress
call to after resolution so it reports the actual derived SS58
address, matching main's behavior.

Add `test_resolve_credential_mnemonic_pinned_derivation_path` which
pins the expected (address_bytes, secret_bytes) for the canonical
abandon-art test mnemonic at index 0. Any future silent regression of
the path segments will fail this test.

* format

---------

Co-authored-by: Nikolaus Heger <nheger@gmail.com>
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