Skip to content

Fix stale event-decoding test after payment_received gained a token field - #727

Merged
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
Onomebello:fix/payment-received-token-event-test
Aug 30, 2026
Merged

Fix stale event-decoding test after payment_received gained a token field#727
Kingsman-99 merged 1 commit into
Stellar-split:mainfrom
Onomebello:fix/payment-received-token-event-test

Conversation

@Onomebello

@Onomebello Onomebello commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • events::payment_received in contracts/split/src/events.rs already emits (payer, amount, token, event_seq) — the token: &Address field was added in a prior commit so off-chain indexers can distinguish which asset (XLM, USDC, etc.) a payment was made in, without a separate lookup. Every call site in lib.rs already passes the correct token.
  • However, test_payment_received_event_includes_tip in contracts/split/src/test.rs was left decoding that event's data as (Address, i128, i128, u64), treating the third field as a nonexistent tip amount. There is no tip parameter or computation anywhere in the pay() path — that decode shape predates the token field and no longer matches what's actually published, so the type mismatch (Address decoded as i128) causes the .unwrap() to panic at runtime.
  • Renamed the test to test_payment_received_event_includes_token, decode it as (Address, i128, Address, u64), and assert the decoded token equals the invoice's funding token — giving the multi-token event field real regression coverage instead of a test exercising a shape that no longer exists.

Test plan

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.
@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@Onomebello Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Kingsman-99
Kingsman-99 merged commit 08651cf into Stellar-split:main Aug 30, 2026
1 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add token field to payment_received event data

2 participants