Pull Request: Add Unit Test for Request ID in Deduct Event#90
Merged
greatest0fallt1me merged 11 commits intoCalloraOrg:mainfrom Feb 27, 2026
Merged
Pull Request: Add Unit Test for Request ID in Deduct Event#90greatest0fallt1me merged 11 commits intoCalloraOrg:mainfrom
greatest0fallt1me merged 11 commits intoCalloraOrg:mainfrom
Conversation
Contributor
Author
|
@greatest0fallt1me merge please |
Contributor
|
@clintjeff2 please resolve the conflicts |
Contributor
Author
|
Fixed, Merge please |
Contributor
|
please resolve the conflicts |
…lora-Contracts into unit-indempotency
Contributor
Author
|
@greatest0fallt1me @greatest0fallt1me MERGE PLEASE |
Contributor
|
please resolve the conflicts |
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.
Pull Request: Add Unit Test for Request ID in Deduct Event
Description
Implements Issue #51: Add Unit Test for Request ID or Idempotency Key in Deduct Event
This PR adds a comprehensive unit test to verify that the
deductfunction properly includes the request_id parameter in emitted events, enabling backend correlation and idempotency tracking.Changes Made
Test Implementation
deduct_event_includes_request_idin contracts/vault/src/test.rstopics=(Symbol("deduct"), caller, request_id), data=(amount, new_balance)Additional Coverage Improvements
init_with_invalid_max_deduct_fails- validates max_deduct parameter validationinit_with_insufficient_usdc_fails- validates initial_balance checksinit_with_revenue_pool- tests revenue_pool optional parameterdeduct_batch_exceeds_max_deduct_fails- validates batch deduction limitsBug Fixes During Development
init()function to properly storerevenue_poolandmax_deduct_valparametersdeposit()to usetransferinstead oftransfer_fromfor better authorization handlingTesting Performed
All 35 vault contract tests pass successfully:
cargo test -p callora-vaultTest Results:
Key Test Validations
Coverage Report
Current test coverage: 92.08% (221/240 lines)
Coverage improved by +9.27% with additional test cases covering:
Screenshot Placeholder
[Attach screenshot here showing successful test execution]
To generate test proof:
Take screenshot of terminal output showing all tests passing.
Related Issue
Closes #51
Checklist