feat(#105): lock sweep destination to one address per account - #197
Merged
phertyameen merged 11 commits intoJun 25, 2026
Conversation
…account On first sweep() call the destination is stored under SweepDestination in contract storage. Any subsequent sweep() call with a different destination is rejected with Error::SweepDestinationLocked (bridgelet-org#15).
Verifies that sweeping with a different destination than the locked one reverts with Error::SweepDestinationLocked (bridgelet-org#15).
|
@Tyler7x 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
|
@Tyler7x please resolve conflict |
Contributor
|
@Tyler7x Please resolve conflict |
phertyameen
approved these changes
Jun 25, 2026
5 tasks
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
Closes #105
Implements the single-destination restriction for
sweep(). Once the function is called successfully, the destination address is persisted in contract storage and any subsequent sweep attempt with a different address is rejected.Changes
contracts/ephemeral_account/src/storage.rsSweepDestinationvariant toDataKey.set_sweep_destination/get_sweep_destinationhelpers.contracts/ephemeral_account/src/errors.rsError::SweepDestinationLocked = 15— returned when a sweep is attempted with a destination that differs from the locked address.contracts/ephemeral_account/src/lib.rssweep(): before executing, checkget_sweep_destination. If already set and differs fromdestination, returnSweepDestinationLocked. Otherwise, persist the destination on the first call.sweep()rustdoc to document the locking behaviour.contracts/ephemeral_account/src/test.rstest_sweep_destination_locked: creates an account, pre-populatesSweepDestinationviaenv.as_contract, then callssweep()with a different address and assertsError(Contract, #15).Testing