Skip to content

test(fee): add recipient validation tests and error stability checks - #1339

Open
Osuochasam wants to merge 1 commit into
CalloraOrg:mainfrom
Osuochasam:fix/zero-address
Open

Osuochasam wants to merge 1 commit into
CalloraOrg:mainfrom
Osuochasam:fix/zero-address

Conversation

@Osuochasam

Copy link
Copy Markdown
Contributor

Overview
This PR introduces explicit test coverage for the validate_recipient logic within the fee contract. It ensures that withdrawal transactions sent to the contract itself or to the hardcoded ZERO_CONTRACT_ADDRESS correctly fail with an InvalidRecipient error. Most importantly, it proves that the hardcoded zero address parses safely via Address::from_str without trapping, which would otherwise brick fee payouts. It also locks in the associated error code to prevent undocumented API breaks.

Key Changes

Recipient Validation Tests (contracts/fee/...):

Added a test verifying that attempting to withdraw to the contract's own address correctly returns InvalidRecipient.

Added a test verifying that withdraw to ZERO_CONTRACT_ADDRESS returns InvalidRecipient, effectively proving the constant parses successfully.

Added a success case test verifying that withdrawals to a standard, valid address process correctly.

Error Code Stability (contracts/fee/tests/err_stab.rs):

Appended InvalidRecipient = 8 to the error stability assertions to ensure the error code does not silently drift in future refactors.

closes #1191

@drips-wave

drips-wave Bot commented Sep 30, 2026

Copy link
Copy Markdown

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

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.

Test fee recipient validation against zero address

1 participant