fix(#615 #616 #617 #618): compact invoice validation, from_u8 panic, … - #653
Open
krypto-boi wants to merge 1 commit into
Open
fix(#615 #616 #617 #618): compact invoice validation, from_u8 panic, …#653krypto-boi wants to merge 1 commit into
krypto-boi wants to merge 1 commit into
Conversation
…it#618): compact invoice validation, from_u8 panic, event data consistency - Stellar-split#615: add from_compact data too short guard (panics if bytes < 25) - Stellar-split#616: from_u8 wildcard now panics on unknown byte instead of silently mapping to Pending - Stellar-split#617: invoice_archived data payload includes invoice_id alongside event_seq - Stellar-split#618: invoice_partially_released now calls next_seq and includes event_seq in data Tests added: from_compact_too_short_panics_cleanly, from_u8_unknown_byte_panics
|
@krypto-boi 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.
Title: fix: compact invoice validation, from_u8 panic, event data consistency (#615 #616 #617
#618)
─────────────────────────────────────────────────────────────────────────────────────────────
Description:
This PR fixes four issues in contracts/split/src/types.rs and contracts/split/src/events.rs.
─────────────────────────────────────────────────────────────────────────────────────────────
Changes
#615 — from_compact does not validate byte slice length
Added a length guard at the start of Invoice::from_compact. If compact.data contains fewer
than 25 bytes, the function now panics with "from_compact: data too short" instead of
unwrapping at an arbitrary offset.
#616 — InvoiceStatus::from_u8 silently maps unknown bytes to Pending
Replaced the _ => InvoiceStatus::Pending wildcard with _ => panic!("unknown InvoiceStatus
byte: {v}"). This surfaces data corruption from malformed migration or compact storage
encoding rather than masking it.
#617 — invoice_archived event omits invoice_id from data payload
Updated the data tuple from (event_seq,) to (invoice_id, event_seq), making it consistent
with other events like invoice_released and allowing data-only event decoders to identify the
invoice without parsing topics.
#618 — invoice_partially_released missing event_seq for ordering
Added a next_seq(env, invoice_id) call inside invoice_partially_released and changed the data
payload from recipients to (recipients, event_seq), enabling temporal ordering of
partial-release events.
─────────────────────────────────────────────────────────────────────────────────────────────
Tests
descriptive panic fires
the expected message
─────────────────────────────────────────────────────────────────────────────────────────────
Closes
Closes #615
Closes #616
Closes #617
Closes #618