Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[move] slow wallet v2.0 #332

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

sirouk
Copy link
Contributor

@sirouk sirouk commented Jan 8, 2025

Implementation of the new "lockbox" structure for slow wallets v2.0.

Does NOT include migration logic.

@0o-de-lally 0o-de-lally changed the title Slow Wallet V2 [move] slow wallet v2.0 Jan 8, 2025
/// Duration not in allowed list
const EINVALID_DURATION: u64 = 9;

const DEFAULT_LOCKS: vector<u64> = vector[6, 1*12, 2*12, 3*12, 4*12, 8*12, 16*12, 20*12, 24*12, 28*12, 32*12];
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps unnecessarily pedantic, but...these aren't "default" lock durations -- they appear to be "valid" or "mandatory" lock durations. You can't create a locked account with a duration that's not in this vector. Default would imply that if you don't provide a duration, you get one of the values in this vector. I think this difference between functionality and naming crosses the line into just the wrong variable name to use, unless I'm not reading the code correctly.

let balance = balance_duration(bob_addr, 4*12);
assert!(balance == 100, 7357003);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In general test coverage feels a bit low. E.g. should we test a locked account all the way to the end of its lifetime? Test moving unlocked funds from a lockbox account then continue to drip it after. Test moving locked funds to another lockbox account, then move again to a third. Try to extract more coins from a lockbox account than are currently unlocked.

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.

4 participants