Skip to content

Comments

Implement Reserve Contract and Stabilize Sweep Controller Tests#31

Closed
Emrys02 wants to merge 0 commit intobridgelet-org:mainfrom
Emrys02:main
Closed

Implement Reserve Contract and Stabilize Sweep Controller Tests#31
Emrys02 wants to merge 0 commit intobridgelet-org:mainfrom
Emrys02:main

Conversation

@Emrys02
Copy link

@Emrys02 Emrys02 commented Feb 20, 2026

Summary

This PR introduces the reserve_contract for managing base reserves and resolves critical build and test issues within the sweep_controller.


Changes

Reserve Contract

  • New Contract — Implemented reserve_contract to manage persistent base reserve storage with admin-only controls.
  • Core Functions — Added initialize, set_base_reserve, and get_base_reserve.
  • Unit Testing — Added 7 comprehensive tests covering initialization, authorized updates, and error handling.

Sweep Controller Fixes

  • Build Stabilization — Replaced problematic contractimport! macros with direct crate dependencies on ephemeral_account.
  • Integration Test Fixes — Resolved the "mis-tagged object reference" (HostError 11) by ensuring Soroban objects are created within the correct test environment (Env).
  • 100% Test Pass Rate — Fixed 16 integration tests, ensuring all authorization and sweep scenarios are correctly verified.

Workspace Cleanup

  • Centralized Configuration — Moved [profile.release] from individual sub-crates to the root Cargo.toml to eliminate workspace warnings.
  • Modernized SDK Usage — Updated all deprecated env.register_contract calls to the modern env.register method.
  • General Cleanup — Removed unused imports (EphemeralAccountContract) and addressed all remaining compiler warnings for a crystal-clear build.

Checklist

  • reserve_contract implemented with admin-only persistent storage
  • Core functions added: initialize, set_base_reserve, get_base_reserve
  • 7 unit tests added for reserve contract
  • contractimport! macros replaced with direct crate dependencies
  • HostError 11 resolved in integration tests
  • 16 sweep controller integration tests passing
  • [profile.release] centralized to root Cargo.toml
  • Deprecated env.register_contract calls modernized to env.register
  • Unused imports and compiler warnings fully resolved

Verification

Screenshot 2026-02-20 013020 Screenshot 2026-02-20 013034

closes 26

Copy link
Contributor

@phertyameen phertyameen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is solving two separate issues at once.

  • The reserve_contract storage implementation (set_base_reserve, get_base_reserve, tests) → (assigned to you)
  • The sweep_controller import fix, env.register modernization, and workspace cleanup → belongs to issue #25 (pending assignment)

The work itself looks correct and valid, as it stands, issue #25 would remain open even though this PR resolves it, which creates confusion for the team.

Please create another pr or branch and touch only the intended files.
Also, remove all auto generated testSnapshots. Or better add it to gitignore. 3-5 files are much easier and faster to review.

env.mock_all_auths();

let contract_id = env.register_contract(None, EphemeralAccountContract);
let contract_id = env.register(EphemeralAccountContract, ());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change this format?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you delete this profile.release?

@phertyameen
Copy link
Contributor

@Emrys02 Please update your forked branch and make a pull locally before pushing. Important tests were changed!

@Emrys02
Copy link
Author

Emrys02 commented Feb 22, 2026

ok

@Emrys02
Copy link
Author

Emrys02 commented Feb 22, 2026

This PR is solving two separate issues at once.

The work itself looks correct and valid, as it stands, issue #25 would remain open even though this PR resolves it, which creates confusion for the team.

Please create another pr or branch and touch only the intended files. Also, remove all auto generated testSnapshots. Or better add it to gitignore. 3-5 files are much easier and faster to review.

@phertyameen , sorry for the late response, i am just seeing this now. Yeah when i ran cargo test, i got errors, i had to fix it so i can also test the work i did.

@Emrys02
Copy link
Author

Emrys02 commented Feb 22, 2026

@phertyameen i will update it now

@drips-wave
Copy link

drips-wave bot commented Feb 23, 2026

Hey @Emrys02! 👋 It looks like this PR isn't linked to any issue.

If this PR is for one of the issues assigned to you as part of a Wave, please link it to ensure your contribution is tracked properly. You can do this by adding a keyword to the PR description (e.g., Closes #123), or by clicking a button below:

Issue Title
#26 Implement Base Reserve Storage Layer Link to this issue

ℹ️ Learn more about linking PRs to issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants