Skip to content

Build invoice payment replay protection #175

Description

@Kingsman-99

Label: complexity: high
Points: 200

Description

Without comprehensive replay protection, signed payment transactions could be resubmitted. This issue adds a global transaction ID registry — every state-changing function accepts an optional tx_id: BytesN<32> that is stored on-chain after first use, rejecting any duplicate submission.

Technical Context

Involves lib.rs. Store used transaction IDs in persistent key ("txid", tx_id) as bool. Add check_and_mark_txid(env, tx_id: Option<BytesN<32>>) helper called at the start of pay(), release(), refund(). If tx_id already exists in storage, panic with "duplicate transaction".

Acceptance Criteria

  • pay(), release(), refund() accept optional tx_id parameter
  • First use of a tx_id succeeds and marks it as used
  • Second use of same tx_id panics with "duplicate transaction"
  • tx_id = None skips replay check (backward compatible)
  • Test submits same tx_id twice and verifies second call panics
  • All existing cargo tests pass
  • cargo clippy passes with zero warnings

Metadata

Metadata

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 pts

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions