test: add reentrancy-equivalent mock token tests to vault#381
Open
ChukwuemekaP1 wants to merge 3 commits into
Open
test: add reentrancy-equivalent mock token tests to vault#381ChukwuemekaP1 wants to merge 3 commits into
ChukwuemekaP1 wants to merge 3 commits into
Conversation
|
Hey @ChukwuemekaP1! 👋 It looks like this PR isn't linked to any issue. If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g.,
|
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.
Summary
This PR adds a malicious mock token and tests to simulate a reentrancy attempt during Vault token transfers. The goal is to ensure the Vault cannot be exploited via external callbacks to corrupt state or double-spend balances.
Changes
Added malicious mock token in
contracts/vault/src/test.rsMock token re-enters
CalloraVault::deductduringtransferAdded tests for:
deductreentrancy attemptbatch_deductreentrancy attemptValidated that Vault state remains consistent under attack conditions
Expected Behavior
Testing
cargo test -p callora-vaultAll tests pass and confirm no state corruption under malicious token behavior.
Security Note
This strengthens Vault safety against reentrancy-equivalent attack vectors via external token callbacks.