Fix stale event-decoding test after payment_received gained a token field - #727
Merged
Kingsman-99 merged 1 commit intoAug 30, 2026
Conversation
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.
|
@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! 🚀 |
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
events::payment_receivedincontracts/split/src/events.rsalready emits(payer, amount, token, event_seq)— thetoken: &Addressfield 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 inlib.rsalready passes the correct token.test_payment_received_event_includes_tipincontracts/split/src/test.rswas left decoding that event's data as(Address, i128, i128, u64), treating the third field as a nonexistenttipamount. There is notipparameter or computation anywhere in thepay()path — that decode shape predates the token field and no longer matches what's actually published, so the type mismatch (Addressdecoded asi128) causes the.unwrap()to panic at runtime.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
cargo test -p split test_payment_received_event_includes_tokencargo test -p split(full suite, to confirm no other stale assumptions aboutpayment_received's event shape)closes Add
tokenfield topayment_receivedevent data #600