feat(settlement): add checkpoint entrypoint for bounded storage growth#589
Open
GBOYEE wants to merge 28 commits into
Open
feat(settlement): add checkpoint entrypoint for bounded storage growth#589GBOYEE wants to merge 28 commits into
GBOYEE wants to merge 28 commits into
Conversation
added 28 commits
June 28, 2026 17:23
Adds: - StorageKey::Checkpoint and CheckpointCounter for snapshot storage - Checkpoint struct (checkpoint_id, total_pool_balance, developer_count, timestamps) - checkpoint() admin entrypoint that snapshots global pool + developer index - current_checkpoint() read-only getter - CheckpointEvent emitted on each checkpoint - Tests: before_init, creates_snapshot, increments_id Closes CalloraOrg#567
Pre-existing test compilation errors: - get_revenue_pool() called with extra args (lines 1405, 2614) - get_settlement() called with extra args (line 2937) - function with missing parameter name (line 3783) These prevented entire workspace from compiling.
…ation Removes: - Second #[contractimpl] block (lines 1753-1846) with duplicate broadcast() - Duplicate get_max_deduct() at line 1320 These caused 'name defined multiple times' compilation errors across the workspace.
- Remove duplicate get_storage_ttl from settlement - Remove broken address/token/last_address code block - Add missing type defs and StorageKey variants - Remove duplicate #[contractimpl] in vault - Fix migrate.rs and cargo fmt violations
…token to PaymentReceivedEvent
… fix test arg counts
…, fix event publish
…add contracterror import
…MetaKey - Add developer: Address::generate(&env) to all 39 DeductItem blocks in test.rs - Replace u16::MAX with u32::MAX (Soroban v22 compatibility) - Fix StorageKey::Meta → MetaKey in lib.rs Unblocks all 4 Callora PRs (vault compilation was failing CI)
…, add mod validators
…feature - Restore lib.rs, test.rs and test modules from b3d2e5f (last working state before PR CalloraOrg#579 broke the build with -X theirs merge that removed module declarations for admin, errors, timelock, types, limits) - Add Checkpoint struct and StorageKey::Checkpoint/CheckpointCounter variants - Add checkpoint() admin entrypoint and current_checkpoint() getter - SettlementError now re-exported from errors module (full enum with all variants) Fixes: \CalloraOrg#567
- Replace inline type definitions with proper mod declarations - Add missing mod declarations: admin, errors, limits, pagination, timelock, types - Add pub use re-exports for SettlementError, PendingDeveloperMigration, types - Remove duplicate get_storage_ttl functions (incompatible with SDK v22) - Fix event structs: add token field to PaymentReceivedEvent and BalanceCreditedEvent - Fix get_ttl() calls (not available in SDK v22) - Fix SettlementError::OverDraft variant in errors.rs - Fix test files: add missing token arg to receive_payment and cursor calls - Fix test_invariant.rs: &(*env).clone() borrow issue
- Add DeveloperClaimWindow variant to StorageKey enum - Fix all single-arg DeveloperBalance() calls to include token address - Fix pagination::get_page() call to include usdc_token parameter - Fix broadcast function String type mismatch (soroban_sdk::String) - Reorder usdc_address declaration in withdraw_developer_balance
… migrate method, PaymentReceivedEvent)
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
Adds a
checkpoint()admin entrypoint to the settlement contract that snapshots the global pool balance and developer index into a timestamped checkpoint record, enabling bounded storage growth via future archival/pruning logic.Changes
StorageKey::Checkpoint— persistent storage for the latest snapshotStorageKey::CheckpointCounter— instance counter for monotonic checkpoint IDsCheckpointstruct — checkpoint_id, total_pool_balance, developer_count, ledger_timestamp, timestampcheckpoint(env, caller)— admin-only entrypoint that creates a snapshotcurrent_checkpoint(env)— read-only getterCheckpointEvent— emitted on each checkpoint creationTesting
checkpoint_before_init_returns_nonecheckpoint_creates_snapshotcheckpoint_increments_idCloses #567