You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add two new `AccountType` variants for DIP-13 sub-feature 0' (per-identity
signing keys the user employs to sign Dash Platform state transitions):
- `IdentityAuthenticationEcdsa { identity_index }` — key_type 0',
backed by a regular `Account` (secp256k1).
- `IdentityAuthenticationBls { identity_index }` — key_type 1',
backed by `BLSAccount`, gated on `#[cfg(feature = "bls")]`.
Both account types use the DIP-13 derivation path
`m/9'/coin_type'/5'/0'/key_type'/identity_index'` with hardened children
for individual keys (`.../identity_index'/key_index'`). Address pools use
`AbsentHardened` since DIP-13 mandates hardened leaves.
### Wiring
- `AccountCollection` gains `identity_authentication_ecdsa:
BTreeMap<u32, Account>` and (under `bls`) `identity_authentication_bls:
BTreeMap<u32, BLSAccount>`, keyed by `identity_index`. All collection
methods (`new`, `insert`, `insert_bls_account`, `contains_account_type`,
`account_of_type[_mut]`, `bls_account_of_type[_mut]`, `all_accounts[_mut]`,
`count`, `is_empty`, `clear`) are updated.
- `ManagedAccountCollection`, `ManagedAccountType`, `CoreAccountTypeMatch`
mirror the new variants and are routed through the usual matchers.
- `AccountTypeToCheck::IdentityAuthentication{Ecdsa,Bls}` variants are
added so conversions from `ManagedAccountType`/`AccountType` stay
total. Identity authentication accounts are **Platform-only**: they are
deliberately absent from every `TransactionType` relevance set
(`TransactionRouter::get_relevant_account_types`), and the
`ManagedAccountCollection::check_account_type` arms return empty
results. Address matching in `ManagedCoreAccount::check_transaction_for_match`
returns `None` for these variants for the same reason.
- `Wallet::add_bls_account` now accepts `IdentityAuthenticationBls` in
addition to `ProviderOperatorKeys`.
- Two new DIP-9 `IndexConstPath<5>` constants per network
(`IDENTITY_AUTHENTICATION_{ECDSA,BLS}_PATH_{MAINNET,TESTNET}`) and the
matching `DerivationPathReference::BlockchainIdentityAuthentication{Ecdsa,Bls}`
variants.
- `asset_lock_builder::resolve_funding_account` is intentionally left
untouched — identity authentication accounts do not fund asset locks.
- `WalletAccountCreationOptions` is unchanged. Identity authentication
accounts are per-identity and come into existence when the user
registers a Platform identity, not at wallet creation. Callers insert
them post-hoc via `Wallet::add_account` (ECDSA) or
`Wallet::add_bls_account` (BLS).
### FFI
`FFIAccountType` gains `IdentityAuthenticationEcdsa = 16` and
`IdentityAuthenticationBls = 17`; `to_account_type` / `from_account_type`
route the `index` parameter as `identity_index`. `FFIAccountMatch`
emission for `CoreAccountTypeMatch::IdentityAuthentication*` reports the
identity index in `account_index` (these variants are never produced by
the L1 transaction router, but the FFI matcher stays exhaustive).
### Tests
New `identity_authentication_tests` module in `account_type.rs` covers:
ECDSA and BLS mainnet/testnet/regtest path derivation, `index()` /
`derivation_path_reference()` / `AccountTypeToCheck` round-trip, and
end-to-end insert / `contains_account_type` / `account_of_type` /
`bls_account_of_type` round-trips through `AccountCollection`. BLS tests
are `#[cfg(feature = "bls")]`-gated. Existing
`test_wrong_account_type_for_bls` message was updated for the broadened
`insert_bls_account` validation.
### Serialization compatibility
Adding enum variants is forward-incompatible for `bincode::Encode`/
`Decode` — wallet blobs serialized by earlier v0.42-dev builds will fail
to decode after this change. This is acceptable given the unstable 0.x
API per `CLAUDE.md`. Serde uses its default (externally tagged)
representation, so new readers still decode old data identically and old
readers will error cleanly on new variants they cannot name.
Verified: `cargo build -p key-wallet --all-features`,
`cargo test -p key-wallet --lib --all-features`,
`cargo clippy -p key-wallet --all-features --all-targets -- -D warnings`,
`cargo fmt -p key-wallet --check`, and downstream `key-wallet-ffi` /
`key-wallet-manager` builds and lib tests.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments