From 993a2852275e25fa293c3c70c50d552eff63f4f8 Mon Sep 17 00:00:00 2001 From: MacBook M1 Air Date: Sat, 29 Aug 2026 17:45:49 +0100 Subject: [PATCH] Fix stale test.rs against payment_received's token event field events::payment_received already emits (payer, amount, token, event_seq) per the multi-token reconciliation fix, but test_payment_received_event_includes_tip still decoded the event data as (Address, i128, i128, u64), treating the third field as a nonexistent tip amount. That field is actually the payment token Address, so the decode's type does not match the on-chain event shape and fails at runtime. Rename the test to test_payment_received_event_includes_token and decode it as (Address, i128, Address, u64), asserting the decoded token matches the invoice's funding token. This gives the token-in-event-data change real regression coverage instead of a test that silently exercises the wrong shape. --- contracts/split/src/test.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/contracts/split/src/test.rs b/contracts/split/src/test.rs index 498ea3b..3f67578 100644 --- a/contracts/split/src/test.rs +++ b/contracts/split/src/test.rs @@ -7071,7 +7071,7 @@ fn test_contributor_allowlist_toggle_events() { } #[test] -fn test_payment_received_event_includes_tip() { +fn test_payment_received_event_includes_token() { let (env, contract_id, token_id) = setup_initialized(); let c = client(&env, &contract_id); @@ -7086,17 +7086,17 @@ fn test_payment_received_event_includes_tip() { c.pay(&payer, &id, &200_i128, &0_u64, &false, &false, &None); use soroban_sdk::TryIntoVal; - let mut found_tip: Option = None; + let mut found_token: Option
= None; for (_contract, topics, data) in env.events().all().iter() { if topic1_is(&env, &topics, "paid") { - let decoded: (Address, i128, i128, u64) = data.try_into_val(&env).unwrap(); - found_tip = Some(decoded.2); + let decoded: (Address, i128, Address, u64) = data.try_into_val(&env).unwrap(); + found_token = Some(decoded.2); } } assert_eq!( - found_tip, - Some(0), - "payment_received event data should include the tip amount" + found_token, + Some(token_id), + "payment_received event data should include the payment token address" ); }