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

Beekeeping: Sui 0.18.0 #9

Merged
merged 3 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sui/Move.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[package]
name = "Movemate"
version = "1.5.0"
version = "1.6.0"
authors = ["David Lucid <[email protected]>"]

[addresses]
movemate = "0x8316fb983a7b6fd5112d7ad368483b38f5682715"
movemate = "0x52568a9f13ca3667a361f2ed5ad0d13d489b0bdc"

[dependencies.Sui]
git = "https://github.com/MystenLabs/sui.git"
subdir = "crates/sui-framework"
# devnet-0.17.0
rev = "79100a5687881eef489f347629bf5b19e417cc8e"
# devnet-0.18.0
rev = "21fcff72bef3b12f600da861b7708ca5f30d9512"
28 changes: 14 additions & 14 deletions sui/sources/crit_bit.move
Original file line number Diff line number Diff line change
Expand Up @@ -1833,7 +1833,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 3)]
#[expected_failure(abort_code = E_BORROW_EMPTY)]
/// Assert failure for attempted borrow on empty tree
fun borrow_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand All @@ -1842,7 +1842,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 3)]
#[expected_failure(abort_code = E_BORROW_EMPTY)]
/// Assert failure for attempted borrow on empty tree
fun borrow_mut_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand All @@ -1851,7 +1851,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = E_NOT_HAS_K)]
/// Assert failure for attempted borrow without matching key
fun borrow_mut_no_match():
CB<u8> {
Expand Down Expand Up @@ -1882,7 +1882,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = E_NOT_HAS_K)]
/// Assert failure for attempted borrow without matching key
fun borrow_no_match():
CB<u8> {
Expand All @@ -1892,7 +1892,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 5)]
#[expected_failure(abort_code = E_INSERT_FULL)]
/// Verify length check fails for too many elements
fun check_len_failure() {
check_len(HI_64 ^ OUT << N_TYPE); // Tree is full
Expand All @@ -1919,7 +1919,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 1)]
#[expected_failure(abort_code = E_DESTROY_NOT_EMPTY)]
/// Verify cannot destroy non-empty tree
fun destroy_empty_fail() {
// Attempt destroying singleton
Expand Down Expand Up @@ -2002,7 +2002,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 2)]
#[expected_failure(abort_code = E_HAS_K)]
/// Verify aborts when key already in tree
fun insert_general_failure():
CB<u8> {
Expand All @@ -2014,7 +2014,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 2)]
#[expected_failure(abort_code = E_HAS_K)]
/// Verify failure for attempting duplicate insertion on singleton
fun insert_singleton_failure():
CB<u8> {
Expand Down Expand Up @@ -2251,7 +2251,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 7)]
#[expected_failure(abort_code = E_LOOKUP_EMPTY)]
/// Verify maximum key lookup failure when tree empty
fun max_key_failure_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand All @@ -2274,7 +2274,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 7)]
#[expected_failure(abort_code = E_LOOKUP_EMPTY)]
/// Verify minimum key lookup failure when tree empty
fun min_key_failure_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand Down Expand Up @@ -2310,7 +2310,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 6)]
#[expected_failure(abort_code = E_POP_EMPTY)]
/// Verify failure for attempting to pop from empty tree
fun pop_failure_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand All @@ -2319,7 +2319,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = E_NOT_HAS_K)]
/// Verify failure for attempting to pop key not in tree
fun pop_general_failure_no_key():
CB<u8> {
Expand Down Expand Up @@ -2449,7 +2449,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = E_NOT_HAS_K)]
// Verify pop failure when key not in tree
fun pop_singleton_failure():
CB<u8> {
Expand Down Expand Up @@ -3000,7 +3000,7 @@ module movemate::crit_bit {
}

#[test]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = E_BIT_NOT_0_OR_1)]
/// Verify failure for non-binary-representative byte string
fun u_failure() {u(b"2");}

Expand Down
28 changes: 14 additions & 14 deletions sui/sources/crit_bit_u64.move
Original file line number Diff line number Diff line change
Expand Up @@ -1824,7 +1824,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 3)]
#[expected_failure(abort_code = E_BORROW_EMPTY)]
/// Assert failure for attempted borrow on empty tree
fun borrow_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand All @@ -1833,7 +1833,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 3)]
#[expected_failure(abort_code = E_BORROW_EMPTY)]
/// Assert failure for attempted borrow on empty tree
fun borrow_mut_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand All @@ -1842,7 +1842,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = E_NOT_HAS_K)]
/// Assert failure for attempted borrow without matching key
fun borrow_mut_no_match():
CB<u8> {
Expand Down Expand Up @@ -1873,7 +1873,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = E_NOT_HAS_K)]
/// Assert failure for attempted borrow without matching key
fun borrow_no_match():
CB<u8> {
Expand All @@ -1883,7 +1883,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 5)]
#[expected_failure(abort_code = E_INSERT_FULL)]
/// Verify length check fails for too many elements
fun check_len_failure() {
check_len(HI_64 ^ OUT << N_TYPE); // Tree is full
Expand All @@ -1910,7 +1910,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 1)]
#[expected_failure(abort_code = E_DESTROY_NOT_EMPTY)]
/// Verify cannot destroy non-empty tree
fun destroy_empty_fail() {
// Attempt destroying singleton
Expand Down Expand Up @@ -1993,7 +1993,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 2)]
#[expected_failure(abort_code = E_HAS_K)]
/// Verify aborts when key already in tree
fun insert_general_failure():
CB<u8> {
Expand All @@ -2005,7 +2005,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 2)]
#[expected_failure(abort_code = E_HAS_K)]
/// Verify failure for attempting duplicate insertion on singleton
fun insert_singleton_failure():
CB<u8> {
Expand Down Expand Up @@ -2242,7 +2242,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 7)]
#[expected_failure(abort_code = E_LOOKUP_EMPTY)]
/// Verify maximum key lookup failure when tree empty
fun max_key_failure_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand All @@ -2265,7 +2265,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 7)]
#[expected_failure(abort_code = E_LOOKUP_EMPTY)]
/// Verify minimum key lookup failure when tree empty
fun min_key_failure_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand Down Expand Up @@ -2301,7 +2301,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 6)]
#[expected_failure(abort_code = E_POP_EMPTY)]
/// Verify failure for attempting to pop from empty tree
fun pop_failure_empty() {
let cb = empty<u8>(); // Initialize empty tree
Expand All @@ -2310,7 +2310,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = E_NOT_HAS_K)]
/// Verify failure for attempting to pop key not in tree
fun pop_general_failure_no_key():
CB<u8> {
Expand Down Expand Up @@ -2440,7 +2440,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 4)]
#[expected_failure(abort_code = E_NOT_HAS_K)]
// Verify pop failure when key not in tree
fun pop_singleton_failure():
CB<u8> {
Expand Down Expand Up @@ -2991,7 +2991,7 @@ module movemate::crit_bit_u64 {
}

#[test]
#[expected_failure(abort_code = 0)]
#[expected_failure(abort_code = E_BIT_NOT_0_OR_1)]
/// Verify failure for non-binary-representative byte string
fun u_failure() {u(b"2");}

Expand Down
8 changes: 4 additions & 4 deletions sui/sources/escrow_shared.move
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ module movemate::escrow_shared {
}

#[test]
#[expected_failure(abort_code = 0x002)]
#[expected_failure(abort_code = ENOT_SENDER)]
public fun test_transfer_unauthorized() {
let scenario_wrapper = test_scenario::begin(TEST_SENDER_ADDR);
let scenario = &mut scenario_wrapper;
Expand All @@ -159,7 +159,7 @@ module movemate::escrow_shared {
}

#[test]
#[expected_failure(abort_code = 0x102)]
#[expected_failure(abort_code = ENOT_RECIPIENT)]
public fun test_refund_unauthorized() {
let scenario_wrapper = test_scenario::begin(TEST_SENDER_ADDR);
let scenario = &mut scenario_wrapper;
Expand All @@ -172,7 +172,7 @@ module movemate::escrow_shared {
}

#[test]
#[expected_failure(abort_code = 0x202)]
#[expected_failure(abort_code = ENOT_ARBITRATOR)]
public fun test_transfer_arbitrator_unauthorized() {
let scenario_wrapper = test_scenario::begin(TEST_SENDER_ADDR);
let scenario = &mut scenario_wrapper;
Expand All @@ -185,7 +185,7 @@ module movemate::escrow_shared {
}

#[test]
#[expected_failure(abort_code = 0x202)]
#[expected_failure(abort_code = ENOT_ARBITRATOR)]
public fun test_refund_arbitrator_unauthorized() {
let scenario_wrapper = test_scenario::begin(TEST_SENDER_ADDR);
let scenario = &mut scenario_wrapper;
Expand Down
8 changes: 3 additions & 5 deletions sui/sources/governance.move
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,6 @@ module movemate::governance {
struct FakeProposalCapability has drop { }

#[test]
#[expected_failure(abort_code = 0xACE)] // Abort on purpose so we don't have to deal with return_shared failing (since next_tx breaks it) // TODO: This is so hacky
public entry fun test_end_to_end() {
// Test scenario
let scenario_wrapper = test_scenario::begin(TEST_SENDER_ADDR);
Expand Down Expand Up @@ -538,7 +537,6 @@ module movemate::governance {
);

// Return forum + destroy coins since we can't drop them
assert!(false, 0xACE); // Abort on purpose so we don't have to deal with return_shared failing (since next_tx breaks it) // TODO: This is so hacky
test_scenario::return_shared(forum_wrapper);
test_scenario::return_shared(proposal_wrapper);
test_scenario::return_shared(delegate_a_wrapper);
Expand All @@ -550,7 +548,7 @@ module movemate::governance {
}

#[test]
#[expected_failure(abort_code = 0xb01)]
#[expected_failure(abort_code = ECANCELLATION_VOTES_ABOVE_THRESHOLD)]
public entry fun test_proposal_cancellation() {
let scenario_wrapper = test_scenario::begin(TEST_SENDER_ADDR);
let scenario = &mut scenario_wrapper;
Expand Down Expand Up @@ -640,7 +638,7 @@ module movemate::governance {
}

#[test]
#[expected_failure(abort_code = 0xa01)]
#[expected_failure(abort_code = EAPPROVAL_VOTES_BELOW_THRESHOLD)]
public entry fun test_proposal_lack_of_quorum() {
// Test scenario
let scenario_wrapper = test_scenario::begin(TEST_SENDER_ADDR);
Expand Down Expand Up @@ -722,7 +720,7 @@ module movemate::governance {
}

#[test]
#[expected_failure(abort_code = 0x103)]
#[expected_failure(abort_code = EPROPOSER_VOTES_BELOW_THRESHOLD)]
public entry fun test_unqualified_proposer() {
// Test scenario
let scenario_wrapper = test_scenario::begin(TEST_SENDER_ADDR);
Expand Down
Loading