separate BRK and mempool output types#38
Conversation
|
thanks ! didn't really expect anyone to use p2pk hashes tbh haha |
|
so PR is good but I think we should just do p2pk33 and p2pk65 like everywhere else for consistency like me know if you wanna do it |
|
Yep, happy to update it. Just to confirm scope: should |
|
basically we should remove serde and strum from: to be consistent with the rest of the codebase, I did it a bit too fast and didn't think it through fully but we still wanna be 100% compatible with mempool.space, thus we need to fix the trout.rs serialize method, and more specifically this one: state.serialize_field("scriptpubkey_type", &output_type)?; should be output_type.normalized(, which probably should be its own type (OutputTypeNormalized?) thus we could remove (or actually "move") all the other serde/strum to that other enum better and cleaner separation of what's BRK and what's esplora/mempool.space |
|
Done. BRK APIs now use native output types, including |
|
thank you ! will merge into next after I merge next-next there |
Summary
p2pk33andp2pk65hash-prefix routes with exact payload validationTxOut.scriptpubkey_typemempool-compatible throughOutputTypeNormalizedNative and normalized behavior
OutputTypenow uses BRK-native values such asp2pk33,p2pk65,p2wpkh,p2wsh,p2tr,p2ms, andopreturn.TxOut.scriptpubkey_typecontinues to use mempool.space values such asp2pk,v0_p2wpkh,v0_p2wsh,v1_p2tr,multisig, andop_returnthrough the newOutputTypeNormalized.Compatibility impact
Native BRK routes, JSON, formatting, OpenAPI, and generated clients no longer accept compatibility aliases.
/p2pk33/...and/p2pk65/...query their exact stores, while the old/p2pk/...route is no longer accepted. Persisted binary state is unchanged because the native enum order and representation are preserved.Generated clients and docs
The Rust, JavaScript, and Python clients now emit native route values and enforce exact 33-byte and 65-byte P2PK payload lengths. The affected JavaScript API documentation and native
addr_typewording were updated.Validation
cargo test --workspacecargo clippy -p brk_types -p brk_query -p brk_bindgen -p brk_client --all-targets -- -D warningscargo clippy -p brk_server --all-targets --features bindgen -- -D warningsnpm run test:hash-prefixuv run --frozen pytest tests/test_hash_prefix.py -qrustfmt --edition 2024 --checkgit diff --checkFixes #37