lhs
public fun append<Element>(lhs: &mut vector<Element>, mut other: vector<Element>) {
other.reverse();
- while (!other.is_empty()) lhs.push_back(other.pop_back());
+ while (other.length() != 0) lhs.push_back(other.pop_back());
other.destroy_empty();
}
@@ -504,7 +504,7 @@ Aborts if i
is out of bounds.
public fun swap_remove<Element>(v: &mut vector<Element>, i: u64): Element {
- assert!(!v.is_empty(), EINDEX_OUT_OF_BOUNDS);
+ assert!(v.length() != 0, EINDEX_OUT_OF_BOUNDS);
let last_idx = v.length() - 1;
v.swap(i, last_idx);
v.pop_back()
diff --git a/crates/sui-framework/docs/sui-framework/vec_map.md b/crates/sui-framework/docs/sui-framework/vec_map.md
index 96b7c340f3f7f..ec5749359e1c4 100644
--- a/crates/sui-framework/docs/sui-framework/vec_map.md
+++ b/crates/sui-framework/docs/sui-framework/vec_map.md
@@ -262,7 +262,7 @@ Pop the most recently inserted entry from the map. Aborts if the map is empty.
public fun pop<K: copy, V>(self: &mut VecMap<K, V>): (K, V) {
- assert!(!self.contents.is_empty(), EMapEmpty);
+ assert!(self.contents.length() != 0, EMapEmpty);
let Entry { key, value } = self.contents.pop_back();
(key, value)
}
@@ -526,7 +526,7 @@ and are *not* sorted.
keys.reverse();
values.reverse();
let mut map = empty();
- while (!keys.is_empty()) map.insert(keys.pop_back(), values.pop_back());
+ while (keys.length() != 0) map.insert(keys.pop_back(), values.pop_back());
keys.destroy_empty();
values.destroy_empty();
map
diff --git a/crates/sui-framework/docs/sui-framework/vec_set.md b/crates/sui-framework/docs/sui-framework/vec_set.md
index 25007f9b3a490..c6ee170d15863 100644
--- a/crates/sui-framework/docs/sui-framework/vec_set.md
+++ b/crates/sui-framework/docs/sui-framework/vec_set.md
@@ -309,7 +309,7 @@ and are *not* sorted.
public fun from_keys<K: copy + drop>(mut keys: vector<K>): VecSet<K> {
keys.reverse();
let mut set = empty();
- while (!keys.is_empty()) set.insert(keys.pop_back());
+ while (keys.length() != 0) set.insert(keys.pop_back());
set
}
diff --git a/crates/sui-framework/docs/sui-system/voting_power.md b/crates/sui-framework/docs/sui-system/voting_power.md
index 5b9be689ab2ab..d01fff559824d 100644
--- a/crates/sui-framework/docs/sui-system/voting_power.md
+++ b/crates/sui-framework/docs/sui-system/voting_power.md
@@ -378,7 +378,7 @@ Update validators with the decided voting power.
fun update_voting_power(validators: &mut vector<Validator>, mut info_list: vector<VotingPowerInfoV2>) {
- while (!info_list.is_empty()) {
+ while (info_list.length() != 0) {
let VotingPowerInfoV2 {
validator_index,
voting_power,
diff --git a/crates/sui-framework/packages/move-stdlib/sources/vector.move b/crates/sui-framework/packages/move-stdlib/sources/vector.move
index 96a2567855501..e9557b4d3f6ac 100644
--- a/crates/sui-framework/packages/move-stdlib/sources/vector.move
+++ b/crates/sui-framework/packages/move-stdlib/sources/vector.move
@@ -86,7 +86,7 @@ public fun reverse(v: &mut vector) {
/// Pushes all of the elements of the `other` vector into the `lhs` vector.
public fun append(lhs: &mut vector, mut other: vector) {
other.reverse();
- while (!other.is_empty()) lhs.push_back(other.pop_back());
+ while (other.length() != 0) lhs.push_back(other.pop_back());
other.destroy_empty();
}
@@ -156,7 +156,7 @@ public fun insert(v: &mut vector, e: Element, mut i: u64) {
/// This is O(1), but does not preserve ordering of elements in the vector.
/// Aborts if `i` is out of bounds.
public fun swap_remove(v: &mut vector, i: u64): Element {
- assert!(!v.is_empty(), EINDEX_OUT_OF_BOUNDS);
+ assert!(v.length() != 0, EINDEX_OUT_OF_BOUNDS);
let last_idx = v.length() - 1;
v.swap(i, last_idx);
v.pop_back()
@@ -176,7 +176,7 @@ public macro fun tabulate<$T>($n: u64, $f: |u64| -> $T): vector<$T> {
/// Does not preserve the order of elements in the vector (starts from the end of the vector).
public macro fun destroy<$T>($v: vector<$T>, $f: |$T|) {
let mut v = $v;
- while (!v.is_empty()) $f(v.pop_back());
+ while (v.length() != 0) $f(v.pop_back());
v.destroy_empty();
}
@@ -185,7 +185,7 @@ public macro fun destroy<$T>($v: vector<$T>, $f: |$T|) {
public macro fun do<$T>($v: vector<$T>, $f: |$T|) {
let mut v = $v;
v.reverse();
- while (!v.is_empty()) $f(v.pop_back());
+ while (v.length() != 0) $f(v.pop_back());
v.destroy_empty();
}
diff --git a/crates/sui-framework/packages/sui-framework/sources/vec_map.move b/crates/sui-framework/packages/sui-framework/sources/vec_map.move
index d1fb7646b7e57..6b38d57d289a8 100644
--- a/crates/sui-framework/packages/sui-framework/sources/vec_map.move
+++ b/crates/sui-framework/packages/sui-framework/sources/vec_map.move
@@ -58,7 +58,7 @@ public fun remove(self: &mut VecMap, key: &K): (K, V) {
/// Pop the most recently inserted entry from the map. Aborts if the map is empty.
public fun pop(self: &mut VecMap): (K, V) {
- assert!(!self.contents.is_empty(), EMapEmpty);
+ assert!(self.contents.length() != 0, EMapEmpty);
let Entry { key, value } = self.contents.pop_back();
(key, value)
}
@@ -144,7 +144,7 @@ public fun from_keys_values(mut keys: vector, mut values: vector<
keys.reverse();
values.reverse();
let mut map = empty();
- while (!keys.is_empty()) map.insert(keys.pop_back(), values.pop_back());
+ while (keys.length() != 0) map.insert(keys.pop_back(), values.pop_back());
keys.destroy_empty();
values.destroy_empty();
map
diff --git a/crates/sui-framework/packages/sui-framework/sources/vec_set.move b/crates/sui-framework/packages/sui-framework/sources/vec_set.move
index e4d9301def975..c1b67c276191f 100644
--- a/crates/sui-framework/packages/sui-framework/sources/vec_set.move
+++ b/crates/sui-framework/packages/sui-framework/sources/vec_set.move
@@ -69,7 +69,7 @@ public fun into_keys(self: VecSet): vector {
public fun from_keys(mut keys: vector): VecSet {
keys.reverse();
let mut set = empty();
- while (!keys.is_empty()) set.insert(keys.pop_back());
+ while (keys.length() != 0) set.insert(keys.pop_back());
set
}
diff --git a/crates/sui-framework/packages/sui-system/sources/voting_power.move b/crates/sui-framework/packages/sui-system/sources/voting_power.move
index 5a9672316602b..dd0fc336e83f7 100644
--- a/crates/sui-framework/packages/sui-system/sources/voting_power.move
+++ b/crates/sui-framework/packages/sui-system/sources/voting_power.move
@@ -127,7 +127,7 @@ module sui_system::voting_power {
/// Update validators with the decided voting power.
fun update_voting_power(validators: &mut vector, mut info_list: vector) {
- while (!info_list.is_empty()) {
+ while (info_list.length() != 0) {
let VotingPowerInfoV2 {
validator_index,
voting_power,
diff --git a/crates/sui-framework/packages_compiled/move-stdlib b/crates/sui-framework/packages_compiled/move-stdlib
index 191c7bd74e552..48a182f7e21f3 100644
Binary files a/crates/sui-framework/packages_compiled/move-stdlib and b/crates/sui-framework/packages_compiled/move-stdlib differ
diff --git a/crates/sui-framework/packages_compiled/sui-framework b/crates/sui-framework/packages_compiled/sui-framework
index 343cb0eaea7ce..f7d19e30d1fdb 100644
Binary files a/crates/sui-framework/packages_compiled/sui-framework and b/crates/sui-framework/packages_compiled/sui-framework differ
diff --git a/crates/sui-framework/packages_compiled/sui-system b/crates/sui-framework/packages_compiled/sui-system
index 2f5cc8064c3d9..463f8a4cb3d7b 100644
Binary files a/crates/sui-framework/packages_compiled/sui-system and b/crates/sui-framework/packages_compiled/sui-system differ
diff --git a/crates/sui-protocol-config/src/lib.rs b/crates/sui-protocol-config/src/lib.rs
index 835463599f7b8..a76038fd14556 100644
--- a/crates/sui-protocol-config/src/lib.rs
+++ b/crates/sui-protocol-config/src/lib.rs
@@ -186,6 +186,7 @@ const MAX_PROTOCOL_VERSION: u64 = 65;
// Version 62: Makes the event's sending module package upgrade-aware.
// Version 63: Enable gas based congestion control in consensus commit.
// Version 64: Switch to distributed vote scoring in consensus in mainnet
+// Version 66: Update to Move stdlib.
#[derive(Copy, Clone, Debug, Hash, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord)]
pub struct ProtocolVersion(u64);