Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
2090b60
feat(settlement): add checkpoint entrypoint for bounded storage growth
Jun 28, 2026
c5ce3ad
fix(vault): repair broken test function signatures
Jun 28, 2026
93e1f4d
fix(vault): remove duplicate contractimpl functions that broke compil…
Jun 28, 2026
3ebb95c
fix: repair all broken merge artifacts (sync from version-view branch)
Jun 28, 2026
55c0c08
sync: apply version-view fixes to checkpoint branch
Jun 28, 2026
d943fa4
sync: error module fixes to checkpoint
Jun 28, 2026
fbf7876
sync: fix SettlementError definition
Jun 28, 2026
a0cab3b
fix: add mod types declaration
Jun 28, 2026
e01afca
fix(test): remove extra arg from try_withdraw_developer_balance, add …
Jun 28, 2026
5d4d8b8
feat: implement checkpoint/current_checkpoint, fix OverDraft variant,…
Jun 28, 2026
29e8c77
fix: implement checkpoint, fix test arg counts, fix OverDraft variant…
Jun 28, 2026
1737b32
fix: add Instance/Persistent trait imports for get_ttl in cfg(test) b…
Jun 28, 2026
b8ce672
fix: add Instance/Persistent trait imports for get_ttl in vault
Jun 28, 2026
8e080d3
fix: revert all vault changes to match main (vault was pre-existing b…
Jun 28, 2026
87ada02
fix(vault): remove duplicate broadcast and get_max_deduct functions, …
Jun 28, 2026
d947b00
fix(vault): add missing closing brace for first contractimpl block
Jun 28, 2026
faa4391
fix(vault): add missing developer to DeductItem tests, u16→u32::MAX, …
Jun 28, 2026
848e96c
fix(vault): u16→u32 for max_fee_bps, add token arg to receive_payment…
Jun 28, 2026
312024c
fix(settlement): restore from pre-broken-merge base + add checkpoint …
Jun 28, 2026
982e3fd
chore: trigger CI
Jun 28, 2026
405022d
fix(settlement): resolve compilation errors from bad merge
Jun 28, 2026
7534533
fix: resolve compilation errors in settlement contract
Jun 29, 2026
1ab4389
style: cargo fmt
Jun 29, 2026
51dba25
fix: repair vault test syntax + settlement _all naming
Jun 29, 2026
f1e7c11
fix: token module alias, withdraw args, PaymentReceivedEvent, missing…
Jun 29, 2026
f3b650d
fix: resolve all test compilation errors (token alias, withdraw args,…
Jun 29, 2026
74ed74e
fix: remove unused alloc import causing global allocator build error
Jun 29, 2026
d43f8fb
fix: update u16::MAX to u32::MAX in vault tests to match function sig…
Jun 29, 2026
7d7022d
ci: re-trigger workflow for PR #589
Jun 29, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions contracts/helpers/src/snapshot_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,14 @@ impl<K, V> Change<K, V> {
///
/// # Ordering Guarantees
/// The resulting change list is guaranteed to be sorted in a stable, deterministic order based
/// on the `Ord` implementation of the key. This ensures consistent diff reports regardless of
/// on the `Ord` implementation of the key. This ensures consistent diff reports regardless of
/// the input ordering of elements.
///
/// # Efficiency
/// The snapshots are loaded into `BTreeMap` structures in $O(N \log N + M \log M)$ time,
/// and then compared in a single linear $O(N + M)$ pass. The final list of changes is
/// sorted in $O(C \log C)$ where $C$ is the number of changes.
pub fn diff_snapshots<K, V>(
before: &[(K, V)],
after: &[(K, V)],
) -> Vec<Change<K, V>>
pub fn diff_snapshots<K, V>(before: &[(K, V)], after: &[(K, V)]) -> Vec<Change<K, V>>
where
K: Ord + Clone,
V: PartialEq + Clone,
Expand Down Expand Up @@ -117,9 +114,9 @@ where
#[cfg(test)]
mod tests {
use super::*;
use alloc::vec;
use alloc::string::String;
use alloc::string::ToString;
use alloc::vec;

#[test]
fn test_identical_snapshots() {
Expand Down
5 changes: 4 additions & 1 deletion contracts/revenue_pool/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ mod tests {
#[test]
fn test_event_admin_broadcast_bytes() {
let env = Env::default();
assert_eq!(event_admin_broadcast(&env), Symbol::new(&env, "admin_broadcast"));
assert_eq!(
event_admin_broadcast(&env),
Symbol::new(&env, "admin_broadcast")
);
}
}
15 changes: 12 additions & 3 deletions contracts/revenue_pool/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#![no_std]

use soroban_sdk::{
contract, contracterror, contractimpl, contracttype, token, Address, BytesN, Env, Map, String, Symbol, Vec,
contract, contracterror, contractimpl, contracttype, token, Address, BytesN, Env, Map, String,
Symbol, Vec,
};

/// Revenue settlement contract: receives USDC from vault deducts and distributes to developers.
Expand Down Expand Up @@ -85,7 +86,6 @@ pub struct StorageEntryTtl {
pub bump_amount: u32,
}


/// TTL bump constants for instance storage archival risk mitigation.
/// Soroban archives ledger entries after ~7 days (631 ledgers) of inactivity.
/// Bumping TTL ensures state remains accessible for critical operations.
Expand Down Expand Up @@ -152,6 +152,15 @@ impl RevenuePool {
.expect("revenue pool not initialized")
}

/// Return the contract semver string.
///
/// Read-only view returning the Cargo package version embedded at
/// compile time, enabling off-chain tooling to detect capability
/// deltas after upgrades.
pub fn version(_env: Env) -> soroban_sdk::String {
soroban_sdk::String::from_str(&_env, env!("CARGO_PKG_VERSION"))
}

/// Initiate replacement of the current admin. Only the existing admin may call this.
/// The new admin must call `claim_admin` to complete the transfer.
///
Expand Down Expand Up @@ -898,6 +907,7 @@ impl RevenuePool {
let instance_ttl = {
#[cfg(any(test, feature = "testutils"))]
{
use soroban_sdk::testutils::storage::Instance;
env.storage().instance().get_ttl()
}
#[cfg(not(any(test, feature = "testutils")))]
Expand All @@ -918,7 +928,6 @@ impl RevenuePool {
}
}


mod events;
/// Split `payments` into consecutive chunks of at most `chunk_size` legs each,
/// preserving order.
Expand Down
5 changes: 4 additions & 1 deletion contracts/revenue_pool/src/test_error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ fn error_code_docs_list_every_revenue_pool_code() {
];

for line in expected_lines {
assert!(docs.contains(line), "missing revenue-pool docs line: {line}");
assert!(
docs.contains(line),
"missing revenue-pool docs line: {line}"
);
}
}
3 changes: 1 addition & 2 deletions contracts/revenue_pool/src/test_proptest.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

extern crate std;

use crate::{RevenuePool, RevenuePoolClient, Severity};
use proptest::prelude::*;
use proptest::strategy::ValueTree;
use soroban_sdk::testutils::Address as _;
use soroban_sdk::token::{self, StellarAssetClient};
use soroban_sdk::{Address, Env};
use soroban_sdk::Vec as SorobanVec;
use soroban_sdk::{Address, Env};
use std::panic::{catch_unwind, AssertUnwindSafe};

fn create_usdc<'a>(
Expand Down
16 changes: 7 additions & 9 deletions contracts/settlement/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@

use soroban_sdk::{Address, Env, Vec};

use crate::{
events, timelock, AdminMigrationEvent, CalloraSettlement, SettlementError, StorageKey,
};
use crate::types::AdminMigrationEvent;
use crate::{events, timelock, CalloraSettlement, SettlementError, StorageKey};

fn require_admin(env: &Env, caller: &Address) {
caller.require_auth();
Expand Down Expand Up @@ -38,7 +37,10 @@ pub(crate) fn propose_balance_migration(env: &Env, caller: &Address, from: &Addr
let amount: i128 = env
.storage()
.persistent()
.get(&StorageKey::DeveloperBalance(from.clone(), usdc_token.clone()))
.get(&StorageKey::DeveloperBalance(
from.clone(),
usdc_token.clone(),
))
.unwrap_or(0);
if amount <= 0 {
env.panic_with_error(SettlementError::NoDeveloperBalance);
Expand Down Expand Up @@ -76,11 +78,7 @@ pub(crate) fn execute_balance_migration(env: &Env, caller: &Address, from: &Addr
let source_key = StorageKey::DeveloperBalance(from.clone(), usdc_token.clone());
let destination_key = StorageKey::DeveloperBalance(migration.to.clone(), usdc_token.clone());

let source_balance: i128 = env
.storage()
.persistent()
.get(&source_key)
.unwrap_or(0);
let source_balance: i128 = env.storage().persistent().get(&source_key).unwrap_or(0);
let new_source_balance = source_balance
.checked_sub(migration.amount)
.filter(|b| *b >= 0)
Expand Down
4 changes: 3 additions & 1 deletion contracts/settlement/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,7 @@ pub enum SettlementError {
MigrationNotFound = 20,
TimelockNotExpired = 21,
MigrationBalanceChanged = 22,
MinimumBalanceRequired = 23,
OverDraft = 23,
InvalidClaimWindow = 24,
ClaimWindowClosed = 25,
}
10 changes: 9 additions & 1 deletion contracts/settlement/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ pub fn event_admin_migration(env: &Env) -> Symbol {
Symbol::new(env, "admin_migration")
}

/// Returns the Symbol for a checkpoint snapshot.
pub fn event_checkpoint_created(env: &Env) -> Symbol {
Symbol::new(env, "checkpoint_created")
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down Expand Up @@ -209,7 +214,10 @@ mod tests {
#[test]
fn test_event_admin_broadcast_bytes() {
let env = Env::default();
assert_eq!(event_admin_broadcast(&env), Symbol::new(&env, "admin_broadcast"));
assert_eq!(
event_admin_broadcast(&env),
Symbol::new(&env, "admin_broadcast")
);
}

#[test]
Expand Down
Loading
Loading