Conversation
aac9665 to
8a293f3
Compare
|
Looking good thanks for taking this on. Please add the |
Johnosezele
left a comment
There was a problem hiding this comment.
Looking at the scope of things, wouldn't it be beneficial if we extract the shared require_xprv, require_xpub and from_template helpers so the validation lives in one place, I think there's already an existing debt that would keep compounding if someone later decides MultiXPrv should map to a different error than Single, or adds a fourth variant, they'd need to update eight sites... mssing one is how unreachable!() survived in the first place.
8a293f3 to
b47a869
Compare
|
@Johnosezele Addressed in b47a869: key-type validation now lives in shared |
Description
Closes #1071.
The BIP44, BIP49, BIP84, and BIP86 descriptor constructors accepted descriptor key objects whose underlying single or multipath variants were handled with
unreachable!(). This allowed generated binding callers to trigger a Rust panic after successfully parsing a WIF or other valid descriptor key.This change makes every BIP template constructor return
DescriptorError::InvalidKeyTypefor unsupported variants. The secret-key constructors now returnResult, and their template build errors are propagated instead of unwrapped.Breaking change
The four secret BIP template constructors are now throwable in generated bindings.
Validation
cargo fmt --all -- --config format_code_in_doc_comments=true --checkcargo clippy --all-targets --features "uniffi/bindgen-tests"CLASSPATH=./tests/jna/jna-5.14.0.jar cargo test --features uniffi/bindgen-tests