Validate FFI primitive inputs + refresh bindings/tests#1263
Validate FFI primitive inputs + refresh bindings/tests#1263benalleng merged 4 commits intopayjoin:masterfrom
Conversation
Pull Request Test Coverage Report for Build 22112284749Details
💛 - Coveralls |
cd3391a to
a44a282
Compare
59affc6 to
93bc4e8
Compare
055a2bb to
53db1cb
Compare
Thanks... applying that now |
759be1b to
10ee724
Compare
732c40a to
f331ef3
Compare
5771b7a to
c1c3600
Compare
51d9f8b to
3f78b70
Compare
Co-authored-by: Benalleng <benalleng@gmail.com>
777f16b to
2b8e63e
Compare
spacebear21
left a comment
There was a problem hiding this comment.
utACK. I rebased to squash Ben's commit into the relevant 2nd commit, and added an additional commit that renames PrimitiveError to the more descriptive FfiValidationError
| pub struct SerdeJsonError(#[from] serde_json::Error); | ||
|
|
||
| #[derive(Debug, thiserror::Error, uniffi::Error)] | ||
| pub enum PrimitiveError { |
There was a problem hiding this comment.
I think this type (and the PrimitiveError variants on specific error types) could be more descriptive as e.g. ValidationError or TypeCastError.
2b8e63e to
edbe432
Compare
| /// Amount exceeds allowed maximum. | ||
| #[error("Amount out of range: {amount_sat} sats (max {max_sat})")] | ||
| AmountOutOfRange { amount_sat: u64, max_sat: u64 }, | ||
| /// Weight must be positive and no more than a block. | ||
| #[error("Weight out of range: {weight_units} wu (max {max_wu})")] | ||
| WeightOutOfRange { weight_units: u64, max_wu: u64 }, |
There was a problem hiding this comment.
Seems these should just be part of the FfiValidation variant?
edbe432 to
b4a64e4
Compare
Rename error type and variants for clarity
b4a64e4 to
0679a8c
Compare
There was a problem hiding this comment.
re-re-ACK 0679a8c
I cleaned up the python checks which were false negatives before
This PR addresses #1262 and hardens the FFI boundary by validating primitive inputs and surfacing explicit errors. Updates integration tests/bindings to match the new error shapes and removes silent acceptance of invalid fee rates/amounts.
Follow-ups
Decide final script/witness size caps and document rationale.
Add Dart integration fix for large fee rate parsing (separate PR).