DEV Community

Ramkumar SG for RippleX Developers

Posted on

Batch Transaction - Testcases

Automated test coverage for the Batch transaction feature (XLS-56), grouped by the invariant or execution mode each test exercises with 189 tests.

Category Test Count
Execution Modes 42
Multi-Account & Multi-Sign 23
Tickets, Replay & Metadata 7
Vault, Loan & Transaction Types 24
Signature & Structural Validation 10
Security & Adversarial 56
Cross-Feature Interactions 27
Total 189

1. Execution Modes

AllOrNothing

  1. Test Batch allornothing all payments succeed
  2. Test Batch allornothing submit batch multiple times
  3. Test Batch allornothing one payment fails
  4. Test Batch allornothing all payments fail
  5. Test Batch allornothing mixed transaction types
  6. Test Batch allornothing fee calculation
  7. Test Batch allornothing max inner transactions
  8. Test Batch allornothing more than max inner transactions
  9. Test Batch allornothing cash same check multiple times
  10. Test Batch allornothing fail and then succeed
  11. Test Batch allornothing with tickets
  12. Test Batch allornothing deep rollback on late inner failure
  13. Test Batch allornothing value conservation

OnlyOne

  1. Test Batch onlyone first succeeds
  2. Test Batch onlyone first fails second succeeds
  3. Test Batch onlyone all fail
  4. Test Batch onlyone offer priority
  5. Test Batch onlyone max inner transactions
  6. Test Batch onlyone more than max inner transactions
  7. Test Batch onlyone cash same check multiple times
  8. Test Batch onlyone fail and then succeed

UntilFailure

  1. Test Batch untilfailure all succeed
  2. Test Batch untilfailure stops at first
  3. Test Batch untilfailure stops at second
  4. Test Batch untilfailure stops at third
  5. Test Batch untilfailure sequential setup
  6. Test Batch untilfailure progressive payments
  7. Test Batch untilfailure mixed success failure pattern
  8. Test Batch untilfailure max inner transactions
  9. Test Batch untilfailure more than max inner transactions
  10. Test Batch untilfailure cash same check multiple times
  11. Test Batch untilfailure fail and then succeed

Independent

  1. Test Batch independent all succeed
  2. Test Batch independent some fail
  3. Test Batch independent all fail
  4. Test Batch independent parallel operations
  5. Test Batch independent mixed transaction types
  6. Test Batch independent account setup operations
  7. Test Batch independent max transactions
  8. Test Batch independent more than max transactions
  9. Test Batch independent cash same check multiple times
  10. Test Batch independent fail and then succeed

2. Multi-Account & Multi-Sign

Multi-Account

  1. Test Batch multiaccount workflow all payments succeed
  2. Test Batch multiaccount atomic swap xrp for xrp
  3. Test Batch multiaccount atomic swap xrp for token
  4. Test Batch multiaccount circular three way swap
  5. Test Batch multiaccount with submitter not in inner txns
  6. Test Batch multiaccount without signers
  7. Test Batch multiaccount with max signers
  8. Test Batch multiaccount with more than max signers
  9. Test Batch multiaccount txn1 fails txn2 succeeds
  10. Test Batch multiaccount create check succeeds cash check fails
  11. Test Batch multiaccount delete accounts too soon with other account as signer
  12. Test Batch multiaccount delete accounts after flag ledger with other account as signer
  13. Test Batch multiaccount delete submitting account after flag ledger with no signer
  14. Test Batch multiaccount delete submitting account after flag ledger with signer
  15. Test Batch multiaccount alice creates offer bob creates offer
  16. Test Batch multiaccount create nftokenmint nftokenoffercreate fails reverts nftokenmint
  17. Test Batch multiaccount exploit steal funds
  18. Test Batch multiaccount ticket based outer succeeds

Multi-Sign

  1. Test multisigned outer batch succeeds
  2. Test multisigned outer with multisigned batch signer succeeds
  3. Test multisigned outer below quorum rejected tefBAD_QUORUM
  4. Test multisigned batch signer below quorum rejected tefBAD_QUORUM
  5. Test multisigned outer with unauthorized signer rejected tefBAD_SIGNATURE

3. Tickets, Replay & Metadata

Tickets

  1. Test Batch inner txns consume tickets succeeds
  2. Test Batch inner tickets used out of order succeeds
  3. Test Batch inner with sequence and ticket rejected temSEQ_AND_TICKET
  4. Test Batch duplicate ticket same account rejected temREDUNDANT
  5. Test Batch nonexistent ticket rolls back allornothing

Replay

  1. Test Batch resubmission is rejected and pays inner once

Metadata

  1. Test Batch inner txns carry parent batch id and share ledger

4. Vault, Loan & Transaction Types

Single-Asset Vault (SAV)

  1. Test Batch with vault create
  2. Test Batch with vault set
  3. Test Batch with vault deposit
  4. Test Batch with vault withdraw
  5. Test Batch with vault delete
  6. Test Batch with vault clawback

LoanBroker / Loan

  1. Test Batch with loan broker set
  2. Test Batch with loan broker delete
  3. Test Batch with loan broker cover deposit
  4. Test Batch with loan broker cover withdraw
  5. Test Batch with loan broker cover clawback
  6. Test Batch with loan set
  7. Test Batch with loan pay
  8. Test Batch with loan delete
  9. Test Batch with loan manage

Supported Transaction Types

  1. Test Batch transaction type trustset
  2. Test Batch transaction type offercreate
  3. Test Batch transaction type account set
  4. Test Batch transaction type escrow create
  5. Test Batch transaction type check create
  6. Test Batch transaction type nftokenmint
  7. Test Batch with ticket create transaction
  8. Test Batch transaction type signerlistset
  9. Test Batch transaction type depositpreauth

5. Signature & Structural Validation (V1.1 Readiness)

Readiness / Preimage

  1. Test Batch v1.1 preimage matches pr1010 single
  2. Test Batch v1.1 preimage matches pr1010 multi
  3. Test Batch v1.1 preimage layout
  4. Test batchsigners signature binds outer account sequence and signer account
  5. Test Batch signers sorted by account id
  6. Test sdk encode for signing batch natively binds account and sequence

Preflight Error Ordering

  1. Test Batch inner tx with negative fee rejected at preflight
  2. Test Batch inner tx with positive xrp fee rejected at preflight
  3. Test Batch inner tx with iou fee rejected at preflight
  4. Test Batch inner tx with zero fee passes fee preflight

6. Security & Adversarial

Structural / Flag Enforcement

  1. Test Batch empty raw transactions
  2. Test Batch with one raw transaction
  3. Test Batch with all inner transactions having no tfInnerBatchTxn flag
  4. Test Batch with some inner transactions having no tfInnerBatchTxn flag
  5. Test Batch with all inner transactions having incorrect tfInnerBatchTxn flag
  6. Test Batch with tfInnerBatchTxn flag set for outer transaction
  7. Test Batch with no mode set for outer transaction
  8. Test Batch with invalid mode set for outer transaction
  9. Test Batch with inner transactions having no fee field
  10. Test Batch with inner transactions having invalid fee values
  11. Test Batch with inner transactions having bad fee values
  12. Test Batch with inner transactions with SigningPubKey
  13. Test Batch with inner transactions with fee and SigningPubKey
  14. Test Batch with inner transactions with TxnSignature
  15. Test Batch with inner transactions with Signers
  16. Test Batch with inner transactions with SponsorSignature
  17. Test Batch with inner transactions with CounterpartySignature
  18. Test Batch with invalid inner transactions
  19. Test Batch inside non empty batch
  20. Test Batch inside empty batch
  21. Test Batch inner txns with same sequence leaves no state change
  22. Test Batch inner txns with same sequence
  23. Test Batch inner txns with past sequence
  24. Test Batch inner txns with future not incremental sequences
  25. Test Batch with account does not exist
  26. Test Batch with deposit auth on account
  27. Test Batch with master key disabled on account
  28. Test Batch all payments with destination account not funded

Adversarial Attack Matrix

  1. Test Batch with single inner tx returns temARRAY_EMPTY
  2. Test inner tx with non zero fee returns temBAD_FEE
  3. Test inner tx with non empty signing pubkey returns temBAD_REGKEY
  4. Test inner tx missing inner batch flag returns temINVALID_FLAG
  5. Test standalone payment with tfInnerBatchTxn flag rejected
  6. Test Batch with outer account in BatchSigners rejected
  7. Test Batch with duplicate BatchSigners rejected
  8. Test Batch with BatchSigner for unrelated account rejected
  9. Test Batch BatchSigners signature for different batch rejected
  10. Test Batch with single inner transaction rejected temARRAY_EMPTY
  11. Test Batch with nested inner batch rejected
  12. Test Batch with duplicate inner sequences rejected temREDUNDANT
  13. Test Batch inner setregularkey succeeds when outer signed by master
  14. Test Batch innerbatch flag on standalone payment rejected
  15. Test Batch v1.1 oversized inner array rejected as tem
  16. Test Batch v1.1 far oversized inner array survives eager hashing
  17. Test Batch v1.1 far oversized inner array at scale survives eager hashing
  18. Test Batch v1.1 batchsigner sig bound to outer sequence
  19. Test Batch v1.1 batchsigner sig bound to outer account
  20. Test Batch v1.1 unsorted batchsigners rejected
  21. Test Batch v1.1 standalone tx with inner batch flag rejected
  22. Test Batch v1.1 standalone oversized path stays tel
  23. Test Batch v1.1 batchsigners over kmax rejected
  24. Test non batch tx with raw transactions rejected at construction
  25. Test non batch raw transactions rejection does not crash server
  26. Test Batch outer with sfDelegate rejected by notdelegable template
  27. Test Batch inner notdelegable type with sfDelegate inner rejected
  28. Test Batch inner delegated without permission grant returns terNO_DELEGATE_PERMISSION

7. Cross-Feature Interactions

Delegation

  1. Test delegate as outer account executes delegated inner succeeds
  2. Test delegate as batch signer authorizes delegated inner succeeds
  3. Test delegated inner without batch signer rejected temBAD_SIGNER
  4. Test delegated inner signed by account holder rejected temBAD_SIGNER
  5. Test delegate without permission inner fails and batch rolls back

Sponsorship

  1. Test outer batch with reserve sponsorship flag rejected temINVALID_FLAG
  2. Test inner batch txn with fee sponsorship rejected temINVALID_FLAG
  3. Test inner batch txn with sponsor signature material rejected temBAD_SIGNATURE
  4. Test prefunded fee sponsored outer batch succeeds

Confidential MPT

  1. Test Batch confidential mpt two sends with stale proof allornothing
  2. Test Batch confidential mpt independent send with one failing
  3. Test Batch confidential mpt convert then merge inbox allornothing
  4. Test Batch delegated send missing permission allornothing
  5. Test Batch delegated send with delegate as outer needs no batch signer
  6. Test Batch delegated send with delegate as outer with batch signer
  7. Test Batch confidential mpt two chained sends same sender allornothing
  8. Test Batch confidential mpt send then convert back same sender allornothing
  9. Test Batch confidential mpt three chained sends same sender allornothing
  10. Test Batch confidential mpt chained send wrong predicted ciphertext fails
  11. Test Batch only one with two valid chained sends executes first only
  12. Test Batch only one first send to unconverted fails falls through to second
  13. Test Batch until failure first send commits then stale second fails
  14. Test Batch allornothing issuer lock then alice send rolls back both
  15. Test Batch independent three holders converts coa aggregate correct
  16. Test Batch allornothing inner revokes delegate then later inner uses it rolls back
  17. Test Batch two chained delegated sends from same delegator both commit
  18. Test delegated send after delegator loses domain membership fails

Top comments (0)