Add missing indexer events: allowlist toggle, auto-resume, tip, forward_to - #658
Open
Olakunle567 wants to merge 1 commit into
Open
Conversation
…ip, and forward_to Four indexer-visible state changes were previously silent: - InvoiceExt2::contributor_allowlist could be toggled on/off (via add_contributor_to_allowlist / remove_contributor_allowlist) with no event, so indexers enforcing compliance rules couldn't observe it. Now emits contributor_allowlist_toggled(creator, enabled) exactly on the None <-> Some transition (first add / last remove), not on every list edit. - Automatic (timer-triggered) invoice resume via auto_resume_at emitted no event at all (the lazy check lives in pay()'s internal _pay path). Now emits invoice_auto_resumed(auto_resume_at), distinct from the existing invoice_resumed event which remains manual-resume-only. - Payment.tip was tracked in storage but never surfaced on the payment_received event, forcing indexers to re-parse Invoice.payments to see tipping behaviour. payment_received now carries tip in its data tuple. - InvoiceOptions.forward_to, when set at invoice creation, had no dedicated event and was invisible until funds were actually forwarded at release time. Now emits forward_configured(forward_to) right after invoice_created when forward_to is Some. Adds one test per feature following the existing topic0_is/topic1_is event-assertion pattern in test.rs.
|
@Olakunle567 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! 🚀 |
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
Four state changes were previously invisible to indexers because no event was emitted. This PR closes all four gaps, additively (no behavior or storage changes):
contributor_allowlisttoggle —InvoiceExt2::contributor_allowlistgates who can callpay/contribute, but flipping it on (first entry added viaadd_contributor_to_allowlist) or off (last entry removed viaremove_contributor_allowlist) was silent. Now emitscontributor_allowlist_toggled(creator, enabled)exactly on theNone <-> Sometransition — not on every list edit, so adding/removing a non-last entry stays quiet as before.invoice_auto_resumed— an invoice paused withauto_resume_atset resumes lazily the next timepay()is called after the timestamp passes, inside the internal_paypath. That path emitted no event at all (not even the existinginvoice_resumed), so indexers had no way to see it, let alone distinguish it from a manual resume. Now emitsinvoice_auto_resumed(auto_resume_at); the manualresume_invoicepath is untouched and still emitsinvoice_resumed.tiponpayment_received—Payment.tip(contracts/split/src/types.rs) was tracked in storage and aggregated internally (e.g.compress_payments, fee/payout math) but never surfaced on thepayment_receivedevent, forcing indexers to re-parseInvoice.paymentsto see tipping behaviour.payment_received's data tuple now includestip. Note: no public entry point currently lets a caller set a nonzero tip — everyPaymentconstruction site in the contract still hardcodestip: 0— so the event will carry0until tip-setting is wired up elsewhere; this PR only closes the event-visibility gap for the field as it exists today.forward_configured—InvoiceOptions.forward_tolets surplus funds be forwarded to another address on release, but setting it at creation time was invisible until funds actually moved. Now emitsforward_configured(forward_to)right afterinvoice_createdwhenforward_toisSome.Changes
contracts/split/src/events.rs— newforward_configured,invoice_auto_resumed,contributor_allowlist_toggledevent functions;payment_receivedgains atip: i128parameter.contracts/split/src/lib.rs— wires the above in at the 4 relevant call sites (_create_invoice_inner, the lazy auto-resume block in_pay,add_contributor_to_allowlist/remove_contributor_allowlist), and updates all 7 existingpayment_receivedcall sites to passtip(currently always0).contracts/split/src/test.rs— one new/extended test per feature, using the existingtopic0_is/topic1_isevent-assertion helpers already established in the file.Test plan
cargo test -p split— full suite plus the new/extended tests:test_auto_resume_allows_payment_after_timestamp(extended): assertsinvoice_auto_resumedfires andinvoice_resumeddoes not, on lazy auto-resume.test_forward_configured_event_emitted_when_forward_to_set/test_forward_configured_event_absent_when_forward_to_unsettest_contributor_allowlist_toggle_events: add (enabled=true) then remove-last (enabled=false), asserting exactly one toggle event each time.test_payment_received_event_includes_tip: decodes the event data tuple and checks thetipfield.cargo build --target wasm32-unknown-unknown --release --package splitto confirm the WASM build is unaffected.Note: this PR was authored in an environment without a local Rust toolchain, so the above was verified by careful manual review (signatures, field names, call-site consistency) rather than a local
cargo testrun — please confirm CI is green before merging.closes #604
closes #606
closes #605
closes #603