Skip to content

Test/vault batch deduct dup request id property#474

Merged
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
blockchainrafik:test/vault-batch-deduct-dup-request-id-property
Jun 26, 2026
Merged

Test/vault batch deduct dup request id property#474
greatest0fallt1me merged 3 commits into
CalloraOrg:mainfrom
blockchainrafik:test/vault-batch-deduct-dup-request-id-property

Conversation

@blockchainrafik

@blockchainrafik blockchainrafik commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Closes #437


test(vault): Add property test for duplicate request_id handling in batch_deduct

This PR adds deterministic property-based test coverage to ensure the vault contract rejects duplicate request_id values within a single batch_deduct call atomically.

What's included

  • test_idempotency.rs

    • Added a seeded PRNG helper for deterministic test generation.
    • Added build_duplicate_batch helper.
    • Added batch_deduct_duplicate_request_id_within_batch_rejected_atomically.
    • Verifies that duplicate request_id values within the same batch cause the entire operation to be rejected atomically.
    • Confirms meta.balance remains unchanged after rejection.
    • Verifies the duplicate request_id is not marked as processed.
  • INVARIANTS.md

    • Documented the invariant that duplicate request_id values within a batch are rejected atomically without modifying the vault balance.

Purpose

Provide deterministic property-based test coverage for intra-batch duplicate request_id handling while documenting the expected vault invariant to prevent regressions.

Closes: #437

@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@blockchainrafik 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

@greatest0fallt1me greatest0fallt1me merged commit ffa7e04 into CalloraOrg:main Jun 26, 2026
1 of 3 checks passed
@greatest0fallt1me

Copy link
Copy Markdown
Contributor

nice work — “Test/vault batch deduct dup request id property”. merged onto current main 🙏

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.

Vault batch_deduct per-request_id idempotency property test — duplicates inside one batch

3 participants