Skip to content

Commit

Permalink
Merge pull request #17 from Jayfromthe13th/lockbox-durations-spec
Browse files Browse the repository at this point in the history
refactor: Remove test specification from lockbox.spec.move
  • Loading branch information
0o-de-lally authored Jan 10, 2025
2 parents e0d0ec3 + f2114e9 commit 15ed9e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
4 changes: 2 additions & 2 deletions framework/libra-framework/sources/ol_sources/lockbox.move
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ module ol_framework::lockbox {
}

#[test(framework = @0x1, bob_sig = @0x10002)]
#[expected_failure(abort_code = 65545)] // error::invalid_argument(EINVALID_DURATION)
#[expected_failure(abort_code = 65545, location = ol_framework::lockbox)]
fun test_non_standard_duration(framework: &signer, bob_sig: &signer) acquires SlowWalletV2 {
let bob_addr = signer::address_of(bob_sig);
let coin = test_setup(framework, 100);
Expand Down Expand Up @@ -417,4 +417,4 @@ module ol_framework::lockbox {
let balance = balance_duration(bob_addr, 4*12);
assert!(balance == 100, 7357003);
}
}
}
16 changes: 0 additions & 16 deletions framework/libra-framework/sources/ol_sources/lockbox.spec.move
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


spec ol_framework::lockbox {

/// Specification for maybe_initialize:
Expand Down Expand Up @@ -82,23 +80,9 @@ spec ol_framework::lockbox {
requires idx < vector::length(global<SlowWalletV2>(signer::address_of(user)).list);
}


/// Helper function to calculate minimum amount needed to get non-zero drip
spec fun min_amount_for_drip(duration_months: u64): u64 {
let days = math64::mul_div(duration_months, 365, 12);
days / 10000000 + 1
}

#[test]
/// Test that verifies a user CANNOT create a lockbox with a non-standard duration
/// This test demonstrates that the DEFAULT_LOCKS list IS enforced
spec test_non_standard_duration(framework: &signer, bob_sig: &signer) {
// Pre-conditions
requires signer::address_of(bob_sig) != @0x0; // Bob must have valid address

// Post-conditions
// The test should fail when attempting a non-standard duration (e.g., 5*12 months)
// This shows that DEFAULT_LOCKS is enforced
aborts_with error::invalid_argument(EINVALID_DURATION);
}
}

0 comments on commit 15ed9e7

Please sign in to comment.