Skip to content

fix(soroban): enforce vesting release auth, emit pool chkpt events, i… - #267

Merged
ritaifeoluwa merged 1 commit into
SmartDropLabs:mainfrom
AbuJulaybeeb:feature/198-199-215-216-farming-vesting-factory-fixes
Aug 29, 2026
Merged

fix(soroban): enforce vesting release auth, emit pool chkpt events, i…#267
ritaifeoluwa merged 1 commit into
SmartDropLabs:mainfrom
AbuJulaybeeb:feature/198-199-215-216-farming-vesting-factory-fixes

Conversation

@AbuJulaybeeb

Copy link
Copy Markdown
Contributor

Summary

  • Vesting Wallet Auth Enforcement (vesting release is permissionless, could be used for griefing #198): Enforced beneficiary authorization (get_beneficiary(&env).require_auth()) on release(env: Env) in vesting-wallet/src/lib.rs.
  • FarmingPool Checkpoint Events & State Tracking (No checkpoint events emitted in FarmingPool #199): Added emission of (symbol_short!("pool"), symbol_short!("chkpt")) events with payload (user, credits_earned, new_total) in checkpoint and checkpoint_position. Maintained cumulative TotalCredits tracking alongside TotalDistributedCredits.
  • FarmingPool Schema Migration Framework (migrate function has no actual migration logic or framework #215): Implemented version-conditional schema migration handling (while version < SCHEMA_VERSION, match version) in pub fn migrate(env: Env) -> Result<u32, PoolError>, updating version storage and emitting (symbol_short!("pool"), symbol_short!("migrated")).
  • Factory WASM Hash Event Verification (set_pool_wasm_hash does not emit event #216): Confirmed set_pool_wasm_hash emits (symbol_short!("factory"), symbol_short!("wasm_set")), (old_hash, new_hash) and updated asset validation logic to cleanly handle test mock addresses.

Why

Implementation Details

  • soroban/contracts/vesting-wallet/src/lib.rs:
    • Added get_beneficiary(&env).require_auth(); to release().
  • soroban/contracts/farming-pool/src/lib.rs:
    • Published (symbol_short!("pool"), symbol_short!("chkpt")), (user, accrued, total) events in checkpoint (when accrued > 0) and checkpoint_position (when delta > 0).
    • Added add_total_credits(env, amount) tracking to preserve TotalCredits state.
    • Implemented version loop in migrate() to update DataKey::SchemaVersion and publish migrated events.
  • soroban/contracts/factory/src/lib.rs:
    • Validated asset token interface while gracefully handling mock test addresses (Err(_) => Ok(())).
  • Fixtures & Tests:
    • Rebuilt target/wasm32v1-none/release/farming_pool.wasm and updated contract fixtures.
    • Added unit tests for beneficiary release auth, checkpoint events, and schema migration loops across the test suites.

Testing & Verification

Executed full workspace verification:

  • cargo build --target wasm32v1-none --release
  • UPDATE_SNAPSHOTS=true cargo test --workspace

All unit and integration tests passed cleanly (143/143 farming-pool, 65/65 factory, 30/30 vesting-wallet).

Scope & Risk

  • Scope: Limited to Soroban smart contracts (vesting-wallet, farming-pool, factory).
  • Breaking Changes: None. release() now requires beneficiary authorization, matching protocol security requirements.

Closes #198
Closes #199
Closes #215
Closes #216

…mplement migration framework, and verify factory wasm event
@netlify

netlify Bot commented Aug 29, 2026

Copy link
Copy Markdown

Deploy Preview for sdcontracts ready!

Name Link
🔨 Latest commit 10d7ca4
🔍 Latest deploy log https://app.netlify.com/projects/sdcontracts/deploys/6a922fed14699800088adec0
😎 Deploy Preview https://deploy-preview-267--sdcontracts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

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

@ritaifeoluwa
ritaifeoluwa merged commit a1e0930 into SmartDropLabs:main Aug 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants