Skip to content

Should payjoin-ffi be covered by cargo mutants? #1888

Open

Description

@xstoicunicornx

Which crate is this feature request for (if any)?

payjoin-ffi

Question

Currently payjoin-ffi doesn't seem to be covered by cargo mutants. Should it be?

Activity

  1. benalleng commented on Sep 21, 2026

    @benalleng
    Collaborator

    Yes, probably. It can't hurt. I guess especially since I would expect we are fast approaching 1.0's for the different langs this seems likely to be smart

  2. benalleng commented on Sep 21, 2026

    @benalleng
    Collaborator

    My only follow-up would be how we get the baseline test to make sense of the coverage here? Like do we expect the coverage to be done within the rust code or should each mutant be checked against a built language? I honestly have no insight on the correct approach here

  3. benalleng commented on Sep 21, 2026

    @benalleng
    Collaborator

    With that said most of the mutants are pretty simple. though they are flaky so didn't come up every time. I need to look a little deeper to figure out why. disk size issue

    Details
    MISSED   payjoin-ffi/src/receive/mod.rs:372:9: replace ReceiverSessionHistory::fallback_tx -> Option
    <Vec<u8>> with None in 4s build + 3s test
    MISSED   payjoin-ffi/src/receive/mod.rs:372:9: replace ReceiverSessionHistory::fallback_tx -> Option
    <Vec<u8>> with Some(vec![]) in 4s build + 4s test
    MISSED   payjoin-ffi/src/receive/mod.rs:372:9: replace ReceiverSessionHistory::fallback_tx -> Option
    <Vec<u8>> with Some(vec![0]) in 4s build + 4s test
    MISSED   payjoin-ffi/src/receive/mod.rs:372:9: replace ReceiverSessionHistory::fallback_tx -> Option
    <Vec<u8>> with Some(vec![1]) in 4s build + 4s test
    MISSED   payjoin-ffi/src/receive/mod.rs:514:13: delete field witness_utxo from struct payjoin::bitco
    in::psbt::Input expression in PsbtInput::into_core in 4s build + 4s test
    MISSED   payjoin-ffi/src/receive/mod.rs:515:13: delete field redeem_script from struct payjoin::bitc
    oin::psbt::Input expression in PsbtInput::into_core in 4s build + 3s test
    MISSED   payjoin-ffi/src/receive/mod.rs:516:13: delete field witness_script from struct payjoin::bit
    coin::psbt::Input expression in PsbtInput::into_core in 4s build + 4s test
    MISSED   payjoin-ffi/src/receive/mod.rs:881:9: replace MaybeInputsOwned::extract_tx_to_schedule_broa
    dcast -> Vec<u8> with vec![] in 6s build + 3s test
    MISSED   payjoin-ffi/src/receive/mod.rs:881:9: replace MaybeInputsOwned::extract_tx_to_schedule_broa
    dcast -> Vec<u8> with vec![0] in 4s build + 4s test
    MISSED   payjoin-ffi/src/receive/mod.rs:881:9: replace MaybeInputsOwned::extract_tx_to_schedule_broa
    dcast -> Vec<u8> with vec![1] in 4s build + 3s test
    MISSED   payjoin-ffi/src/receive/mod.rs:1329:44: replace ProvisionalProposal::psbt_to_sign -> String
     with String::new() in 6s build + 4s test
    MISSED   payjoin-ffi/src/receive/mod.rs:1329:44: replace ProvisionalProposal::psbt_to_sign -> String
     with "xyzzy".into() in 3s build + 4s test
    MISSED   payjoin-ffi/src/receive/mod.rs:1375:9: replace PayjoinProposal::psbt -> String with String:
    :new() in 5s build + 3s test
    MISSED   payjoin-ffi/src/receive/mod.rs:1375:9: replace PayjoinProposal::psbt -> String with "xyzzy"
    .into() in 4s build + 3s test
    MISSED   payjoin-ffi/src/receive/mod.rs:1714:9: replace ReceiverPendingFallback::fallback_tx -> Vec<
    u8> with vec![] in 5s build + 3s test
    MISSED   payjoin-ffi/src/receive/mod.rs:1714:9: replace ReceiverPendingFallback::fallback_tx -> Vec<
    u8> with vec![0] in 4s build + 4s test
    MISSED   payjoin-ffi/src/receive/mod.rs:1714:9: replace ReceiverPendingFallback::fallback_tx -> Vec<
    u8> with vec![1] in 4s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:159:9: replace SenderSessionOutcome::is_success -> bool with tr
    ue in 4s build + 4s test
    MISSED   payjoin-ffi/src/send/mod.rs:159:9: replace SenderSessionOutcome::is_success -> bool with fa
    lse in 3s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:163:9: replace SenderSessionOutcome::success_psbt_base64 -> Opt
    ion<String> with None in 5s build + 4s test
    MISSED   payjoin-ffi/src/send/mod.rs:163:9: replace SenderSessionOutcome::success_psbt_base64 -> Opt
    ion<String> with Some(String::new()) in 3s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:163:9: replace SenderSessionOutcome::success_psbt_base64 -> Opt
    ion<String> with Some("xyzzy".into()) in 3s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:164:13: delete match arm payjoin::send::v2::SessionOutcome::Suc
    cess(psbt) in SenderSessionOutcome::success_psbt_base64 in 5s build + 4s test
    MISSED   payjoin-ffi/src/send/mod.rs:170:9: replace SenderSessionOutcome::is_aborted -> bool with tr
    ue in 3s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:170:9: replace SenderSessionOutcome::is_aborted -> bool with fa
    lse in 3s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:263:9: replace PjParam::receiver_pubkey -> Vec<u8> with vec![] 
    in 3s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:263:9: replace PjParam::receiver_pubkey -> Vec<u8> with vec![0]
     in 3s build + 4s test
    MISSED   payjoin-ffi/src/send/mod.rs:263:9: replace PjParam::receiver_pubkey -> Vec<u8> with vec![1]
     in 3s build + 4s test
    MISSED   payjoin-ffi/src/send/mod.rs:282:9: replace SenderSessionHistory::fallback_tx -> Vec<u8> wit
    h vec![] in 3s build + 4s test
    MISSED   payjoin-ffi/src/send/mod.rs:282:9: replace SenderSessionHistory::fallback_tx -> Vec<u8> wit
    h vec![0] in 3s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:282:9: replace SenderSessionHistory::fallback_tx -> Vec<u8> wit
    h vec![1] in 3s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:723:9: replace SenderPendingFallback::fallback_tx -> Vec<u8> wi
    th vec![] in 3s build + 3s test
    MISSED   payjoin-ffi/src/send/mod.rs:723:9: replace SenderPendingFallback::fallback_tx -> Vec<u8> wi
    th vec![0] in 3s build + 4s test
    MISSED   payjoin-ffi/src/send/mod.rs:723:9: replace SenderPendingFallback::fallback_tx -> Vec<u8> wi
    th vec![1] in 3s build + 4s test
    MISSED   payjoin-ffi/src/test_utils.rs:90:25: replace init_tracing with () in 3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:124:9: replace TestServices::cert -> Vec<u8> with vec![] in 4
    s build + 4s test
    MISSED   payjoin-ffi/src/test_utils.rs:124:9: replace TestServices::cert -> Vec<u8> with vec![0] in 
    3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:124:9: replace TestServices::cert -> Vec<u8> with vec![1] in 
    3s build + 4s test
    MISSED   payjoin-ffi/src/test_utils.rs:129:9: replace TestServices::directory_url -> String with Str
    ing::new() in 4s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:129:9: replace TestServices::directory_url -> String with "xy
    zzy".into() in 3s build + 4s test
    MISSED   payjoin-ffi/src/test_utils.rs:140:9: replace TestServices::ohttp_relay_url -> String with S
    tring::new() in 4s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:140:9: replace TestServices::ohttp_relay_url -> String with "
    xyzzy".into() in 3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:145:9: replace TestServices::ohttp_gateway_url -> String with
     String::new() in 4s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:145:9: replace TestServices::ohttp_gateway_url -> String with
     "xyzzy".into() in 3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:197:34: replace example_url -> String with String::new() in 4
    s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:197:34: replace example_url -> String with "xyzzy".into() in 
    3s build + 4s test
    MISSED   payjoin-ffi/src/test_utils.rs:200:35: replace query_params -> String with String::new() in 
    3s build + 4s test
    MISSED   payjoin-ffi/src/test_utils.rs:200:35: replace query_params -> String with "xyzzy".into() in
     3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:203:36: replace original_psbt -> String with String::new() in
     3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:203:36: replace original_psbt -> String with "xyzzy".into() i
    n 3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:206:35: replace invalid_psbt -> String with String::new() in 
    3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:206:35: replace invalid_psbt -> String with "xyzzy".into() in
     3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:209:39: replace payjoin_proposal -> String with String::new()
     in 3s build + 4s test
    MISSED   payjoin-ffi/src/test_utils.rs:209:39: replace payjoin_proposal -> String with "xyzzy".into(
    ) in 3s build + 4s test
    MISSED   payjoin-ffi/src/test_utils.rs:213:5: replace payjoin_proposal_with_sender_info -> String wi
    th String::new() in 3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:213:5: replace payjoin_proposal_with_sender_info -> String wi
    th "xyzzy".into() in 3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:217:50: replace receiver_input_contribution -> String with St
    ring::new() in 3s build + 3s test
    MISSED   payjoin-ffi/src/test_utils.rs:217:50: replace receiver_input_contribution -> String with "x
    yzzy".into() in 3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:28:39: replace Uri::address -> String with String::new() in 3s b
    uild + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:28:39: replace Uri::address -> String with "xyzzy".into() in 3s 
    build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:30:48: replace Uri::amount_sats -> Option<u64> with None in 3s b
    uild + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:30:48: replace Uri::amount_sats -> Option<u64> with Some(0) in 3
    s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:30:48: replace Uri::amount_sats -> Option<u64> with Some(1) in 3
    s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:31:45: replace Uri::label -> Option<String> with None in 3s buil
    d + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:31:45: replace Uri::label -> Option<String> with Some(String::ne
    w()) in 3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:31:45: replace Uri::label -> Option<String> with Some("xyzzy".in
    to()) in 3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:32:47: replace Uri::message -> Option<String> with None in 3s bu
    ild + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:32:47: replace Uri::message -> Option<String> with Some(String::
    new()) in 3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:32:47: replace Uri::message -> Option<String> with Some("xyzzy".
    into()) in 3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:41:41: replace Uri::as_string -> String with String::new() in 3s
     build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:41:41: replace Uri::as_string -> String with "xyzzy".into() in 3
    s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:57:39: replace PjUri::address -> String with String::new() in 3s
     build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:57:39: replace PjUri::address -> String with "xyzzy".into() in 3
    s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:59:48: replace PjUri::amount_sats -> Option<u64> with None in 3s
     build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:59:48: replace PjUri::amount_sats -> Option<u64> with Some(0) in
     3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:59:48: replace PjUri::amount_sats -> Option<u64> with Some(1) in
     3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:69:43: replace PjUri::pj_endpoint -> String with String::new() i
    n 3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:69:43: replace PjUri::pj_endpoint -> String with "xyzzy".into() 
    in 3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:71:41: replace PjUri::as_string -> String with String::new() in 
    3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:71:41: replace PjUri::as_string -> String with "xyzzy".into() in
     3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:91:45: replace Url::query -> Option<String> with None in 3s buil
    d + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:91:45: replace Url::query -> Option<String> with Some(String::ne
    w()) in 3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:91:45: replace Url::query -> Option<String> with Some("xyzzy".in
    to()) in 3s build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:92:41: replace Url::as_string -> String with String::new() in 3s
     build + 3s test
    MISSED   payjoin-ffi/src/uri/mod.rs:92:41: replace Url::as_string -> String with "xyzzy".into() in 3
    s build + 3s test
    MISSED   payjoin-ffi/src/validation.rs:17:19: replace > with == in validate_amount_sat in 3s build +
     3s test
    MISSED   payjoin-ffi/src/validation.rs:17:19: replace > with < in validate_amount_sat in 3s build + 
    4s test
    MISSED   payjoin-ffi/src/validation.rs:17:19: replace > with >= in validate_amount_sat in 3s build +
     3s test
    MISSED   payjoin-ffi/src/validation.rs:47:21: replace && with || in validate_script_bytes in 3s buil
    d + 3s test
    MISSED   payjoin-ffi/src/validation.rs:47:8: delete ! in validate_script_bytes in 3s build + 3s test
    MISSED   payjoin-ffi/src/validation.rs:50:20: replace > with == in validate_script_bytes in 3s build
     + 3s test
    MISSED   payjoin-ffi/src/validation.rs:50:20: replace > with < in validate_script_bytes in 3s build 
    + 3s test
    MISSED   payjoin-ffi/src/validation.rs:50:20: replace > with >= in validate_script_bytes in 3s build
     + 3s test
    MISSED   payjoin-ffi/src/validation.rs:61:22: replace > with == in validate_witness_stack in 3s buil
    d + 4s test
    MISSED   payjoin-ffi/src/validation.rs:61:22: replace > with < in validate_witness_stack in 3s build
     + 3s test
    MISSED   payjoin-ffi/src/validation.rs:61:22: replace > with >= in validate_witness_stack in 3s buil
    d + 3s test
    MISSED   payjoin-ffi/src/validation.rs:70:23: replace > with == in validate_witness_stack in 3s buil
    d + 3s test
    MISSED   payjoin-ffi/src/validation.rs:70:23: replace > with < in validate_witness_stack in 3s build
     + 3s test
    MISSED   payjoin-ffi/src/validation.rs:70:23: replace > with >= in validate_witness_stack in 3s buil
    d + 3s test
    MISSED   payjoin-ffi/src/validation.rs:80:14: replace > with == in validate_witness_stack in 3s buil
    d + 3s test
    MISSED   payjoin-ffi/src/validation.rs:80:14: replace > with < in validate_witness_stack in 3s build
     + 3s test
    MISSED   payjoin-ffi/src/validation.rs:80:14: replace > with >= in validate_witness_stack in 3s buil
    d + 4s test
    MISSED   payjoin-ffi/src/validation.rs:92:26: replace || with && in validate_weight_units in 3s buil
    d + 3s test
    MISSED   payjoin-ffi/src/validation.rs:92:21: replace == with != in validate_weight_units in 3s buil
    d + 4s test
    MISSED   payjoin-ffi/src/validation.rs:92:42: replace > with == in validate_weight_units in 3s build
     + 3s test
    MISSED   payjoin-ffi/src/validation.rs:92:42: replace > with < in validate_weight_units in 3s build 
    + 3s test
    MISSED   payjoin-ffi/src/validation.rs:92:42: replace > with >= in validate_weight_units in 3s build
     + 3s test
    MISSED   payjoin-ffi/src/validation.rs:130:16: replace > with == in validate_expiration_secs in 3s b
    uild + 4s test
    MISSED   payjoin-ffi/src/validation.rs:130:16: replace > with < in validate_expiration_secs in 3s bu
    ild + 4s test
    MISSED   payjoin-ffi/src/validation.rs:130:16: replace > with >= in validate_expiration_secs in 3s b
    uild + 3s test
    
  4. self-assigned this
    on Sep 21, 2026
  5. spacebear21 commented on Oct 9, 2026

    @spacebear21
    Collaborator

    My only follow-up would be how we get the baseline test to make sense of the coverage here? Like do we expect the coverage to be done within the rust code or should each mutant be checked against a built language? I honestly have no insight on the correct approach here

    I'm not sure, and this open question is also why FFI is excluded from code coverage currently. My instinct says we should check coverage/mutants against the actual generated code, not the rust ffi wrapper. But I'm not sure how to achieve this.

  6. benalleng commented on Oct 12, 2026

    @benalleng
    Collaborator

    Looking closer I think Sadly I think this is not possible with the current cargo mutants test infrastrucutre.

    https://mutants.rs/limitations.html note the line about generated code. perhaps we could look at some non-rust mutation testers but that may be out of scope for this.

  7. spacebear21 commented on Oct 15, 2026

    @spacebear21
    Collaborator

    Fwiw i think fuzzing is more relevant to the FFI layer than mutation testing or test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions