test: add TransferFee test for transfer_recurring_delegation#154
Conversation
|
@gamandeepsingh is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds a single integration test,
Confidence Score: 5/5Safe to merge — adds a single, self-contained integration test with no production code changes. The test is arithmetically correct, mirrors the already-passing fixed-delegation counterpart exactly, and all three assertions (Alice's debit, Bob's net credit, gross amount tracked in delegation state) are consistent with Token-2022 transfer-fee mechanics and the rest of the test suite. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant Alice as Alice (delegator)
participant Program as Subscriptions Program
participant Mint as Token-2022 Mint (1% fee)
participant Bob as Bob (delegatee)
Alice->>Program: initialize_subscription_authority
Alice->>Program: create_recurring_delegation(50_000_000/period)
Bob->>Program: "transfer_recurring_delegation(amount=10_000_000)"
Program->>Mint: transfer_checked_with_fee(10_000_000)
Mint-->>Alice: debit 10_000_000 (gross)
Mint-->>Bob: credit 9_900_000 (net, 100_000 withheld)
Program->>Program: "record amount_pulled_in_period = 10_000_000 (gross)"
Reviews (1): Last reviewed commit: "test: add recurring transfer fee test fo..." | Re-trigger Greptile |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thanks for the work :) signed commits are required, for this time it's fine but next contributions we'll need signed commits |
|
Thanks for the review and for merging it! understood regarding signed commits. I'll make sure future contributions use signed commits and follow the repository guidelines |
Summary
Closes #153
Adds
test_recurring_transfer_token_2022_transfer_feetotests/integration-tests/src/test_transfer_recurring_delegation.rs,closing a parity gap with the fixed-delegation test suite.
What the test verifies:
TransferFeeConfig(1% fee)amount_pulled_in_periodrecords the gross amount (10,000,000), not the netThe third assertion is the important one: it documents that the per-period
cap enforces limits on what is pulled from the delegator, independent
of what the delegatee actually receives after fees.
Test plan
cargo test -p tests-subscriptions test_transfer_recurring_delegation— all 22 tests pass