test: end-to-end vault -> settlement -> revenue_pool full cycle #471
Merged
Conversation
|
@V1ctor-o 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! 🚀 |
Contributor
|
an end-to-end vault → settlement → revenue_pool cycle test is exactly the integration coverage this workspace needed. merged 🙏 |
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.
Description
Summary
Adds
tests/e2e_full_cycle.rs, a workspace-level smoke test that deployscallora-vault,callora-settlement, andcallora-revenue-pooltogether inone
Envand walks a full production-style fund cycle, asserting balancesat every stage. Shared setup boilerplate lives in
scripts/e2e_setup.rs.Topology note
The issue described one chain:
vault -> settlement -> developer withdraw -> revenue_pool sweep -> admin batch_distribute. That chain doesn't actuallyexist on-chain — there's no
sweepfunction, and settlement/revenue_poolhave no call path between them. They're two independent destinations
for vault-deducted funds:
(
to_pool=true); a developer can also be credited directly and callwithdraw_developer_balanceto pull USDC out.vault.distribute, then paidout via
distribute/batch_distribute.This test exercises both real paths so the conservation check is meaningful
across all three contracts. Full diagram and rationale are in the test
file's module doc comment.
What's covered
Deposit → single + batch deduct (with idempotency rejection) → settlement
pool/developer crediting → developer withdraw → vault surplus swept into
revenue_pool →
batch_distribute→ paused-vault edge cases (deposit/deductblocked, owner withdraw still allowed) → paused-revenue_pool edge cases →
oversized
batch_distributeproven atomic (zero partial transfers) → finalcross-contract conservation assertion.
Invariant, checked at every stage:
Files changed
tests/e2e_full_cycle.rs— the testscripts/e2e_setup.rs— shared deploy/wiring helperCargo.toml— added[package]+[dev-dependencies](was a virtualworkspace; root needs a real package for a top-level
tests/binary tocompile against the three contract crates)
src/lib.rs— empty; required for the new root package to be validcargo build -p callora-vaultfails on a cleanmaincheckout (no PRchanges applied), in the existing
remove_offering_indexhelper:This blocks the project's own existing test suite too, not just this PR.
As a result I haven't been able to confirm this test compiles or passes
locally. The code has been carefully reviewed against the real contract
source (signatures, error enums, event payloads) but is unverified pending
a fix to that line. Suggest fixing separately before merging/reviewing this.
Checklist
Envcargo test --workspace e2e_full_cyclepasses — blocked, see abovecargo fmt/cargo clippy/./scripts/check-wasm-size.shCloses #425