diff --git a/crates/iota-framework-snapshot/bytecode_snapshot/1/0x0000000000000000000000000000000000000000000000000000000000000002 b/crates/iota-framework-snapshot/bytecode_snapshot/1/0x0000000000000000000000000000000000000000000000000000000000000002 index 8222db7eec3..0bc77f04160 100644 Binary files a/crates/iota-framework-snapshot/bytecode_snapshot/1/0x0000000000000000000000000000000000000000000000000000000000000002 and b/crates/iota-framework-snapshot/bytecode_snapshot/1/0x0000000000000000000000000000000000000000000000000000000000000002 differ diff --git a/crates/iota-framework-snapshot/manifest.json b/crates/iota-framework-snapshot/manifest.json index 5fc48001399..a1d2ede02b0 100644 --- a/crates/iota-framework-snapshot/manifest.json +++ b/crates/iota-framework-snapshot/manifest.json @@ -1,6 +1,6 @@ { "1": { - "git_revision": "79d2e3399d20", + "git_revision": "f1f6c498eb44", "package_ids": [ "0x0000000000000000000000000000000000000000000000000000000000000001", "0x0000000000000000000000000000000000000000000000000000000000000002", diff --git a/crates/iota-framework/packages/iota-framework/sources/authenticator_state.move b/crates/iota-framework/packages/iota-framework/sources/authenticator_state.move index d368ea29371..debe3bef2ea 100644 --- a/crates/iota-framework/packages/iota-framework/sources/authenticator_state.move +++ b/crates/iota-framework/packages/iota-framework/sources/authenticator_state.move @@ -82,9 +82,9 @@ module iota::authenticator_state { fun jwk_equal(a: &JWK, b: &JWK): bool { (&a.kty == &b.kty) && - (&a.e == &b.e) && - (&a.n == &b.n) && - (&a.alg == &b.alg) + (&a.e == &b.e) && + (&a.n == &b.n) && + (&a.alg == &b.alg) } fun jwk_id_equal(a: &JwkId, b: &JwkId): bool { diff --git a/crates/iota-framework/packages/iota-framework/sources/coin.move b/crates/iota-framework/packages/iota-framework/sources/coin.move index ae0d3118c12..a44e9a8e103 100644 --- a/crates/iota-framework/packages/iota-framework/sources/coin.move +++ b/crates/iota-framework/packages/iota-framework/sources/coin.move @@ -493,16 +493,4 @@ module iota::coin { } } - // === Deprecated code === - - // oops, wanted treasury: &TreasuryCap - public fun supply(treasury: &mut TreasuryCap): &Supply { - &treasury.total_supply - } - - // deprecated as we have CoinMetadata now - #[allow(unused_field)] - public struct CurrencyCreated has copy, drop { - decimals: u8 - } } diff --git a/crates/iota-framework/packages/iota-framework/sources/coin_manager.move b/crates/iota-framework/packages/iota-framework/sources/coin_manager.move index 384660541b5..faf184e92c8 100644 --- a/crates/iota-framework/packages/iota-framework/sources/coin_manager.move +++ b/crates/iota-framework/packages/iota-framework/sources/coin_manager.move @@ -361,11 +361,11 @@ module iota::coin_manager { /// Mint `amount` of `Coin` and send it to `recipient`. Invokes `mint()`. public fun mint_and_transfer( - _: &CoinManagerTreasuryCap, - manager: &mut CoinManager, - amount: u64, - recipient: address, - ctx: &mut TxContext + _: &CoinManagerTreasuryCap, + manager: &mut CoinManager, + amount: u64, + recipient: address, + ctx: &mut TxContext ) { assert!(total_supply(manager) + amount <= maximum_supply(manager), EMaximumSupplyReached); coin::mint_and_transfer(&mut manager.treasury_cap, amount, recipient, ctx) diff --git a/crates/iota-framework/packages/iota-framework/sources/config.move b/crates/iota-framework/packages/iota-framework/sources/config.move index 27d26b64392..68f632a3f73 100644 --- a/crates/iota-framework/packages/iota-framework/sources/config.move +++ b/crates/iota-framework/packages/iota-framework/sources/config.move @@ -263,9 +263,7 @@ module iota::config { ) } - /* - This is kept native to keep gas costing consistent. - */ + /* This is kept native to keep gas costing consistent. */ native fun read_setting_impl< FieldSettingValue: key, SettingValue: store, @@ -276,15 +274,12 @@ module iota::config { name: address, current_epoch: u64, ): Option; - /* - // but the code is essentially + /* but the code is essentially: if (!field::exists_with_type(&config.id, setting)) return option::none() let sobj: &Setting = field::borrow(&config.id, setting); let data = sobj.data.borrow(); if (current_epoch > data.newer_value_epoch) option::some(data.newer_value) else data.older_value_opt - - } */ } diff --git a/crates/iota-framework/packages/iota-framework/sources/display.move b/crates/iota-framework/packages/iota-framework/sources/display.move index 755fb89699f..bf6cc92765a 100644 --- a/crates/iota-framework/packages/iota-framework/sources/display.move +++ b/crates/iota-framework/packages/iota-framework/sources/display.move @@ -34,12 +34,12 @@ module iota::display { /// on the property values of an Object. /// ``` /// // Example of a display object - /// Display<0x...::capy::Capy> { + /// Display<0x107A::nft::Nft> { /// fields: - /// - /// - /// - /// + /// + /// + /// + /// /// } /// ``` /// @@ -200,26 +200,26 @@ module iota::display_tests { #[allow(unused_field)] /// An example object. /// Purely for visibility. - public struct Capy has key { + public struct IotestNft has key { id: UID, name: String } /// Test witness type to create a Publisher object. - public struct CAPY has drop {} + public struct IOTESTNFT has drop {} #[test] - fun capy_init() { + fun nft_test_init() { let mut test = test::begin(@0x2); - let pub = package::test_claim(CAPY {}, test.ctx()); + let pub = package::test_claim(IOTESTNFT {}, test.ctx()); // create a new display object - let mut display = display::new(&pub, test.ctx()); + let mut display = display::new(&pub, test.ctx()); - display.add(b"name".to_string(), b"Capy {name}".to_string()); - display.add(b"link".to_string(), b"https://capy.art/capy/{id}".to_string()); - display.add(b"image".to_string(), b"https://api.capy.art/capy/{id}/svg".to_string()); - display.add(b"description".to_string(), b"A Lovely Capy".to_string()); + display.add(b"name".to_string(), b"IOTEST Nft {name}".to_string()); + display.add(b"link".to_string(), b"https://iotestnft.com/nft/{id}".to_string()); + display.add(b"image".to_string(), b"https://api.iotestnft.com/nft/{id}/svg".to_string()); + display.add(b"description".to_string(), b"One of many Iotest Nfts".to_string()); pub.burn_publisher(); transfer::public_transfer(display, @0x2); diff --git a/crates/iota-framework/packages/iota-framework/sources/kiosk/kiosk.move b/crates/iota-framework/packages/iota-framework/sources/kiosk/kiosk.move index 89bae9ea51f..feb0db46b38 100644 --- a/crates/iota-framework/packages/iota-framework/sources/kiosk/kiosk.move +++ b/crates/iota-framework/packages/iota-framework/sources/kiosk/kiosk.move @@ -116,8 +116,7 @@ module iota::kiosk { const EWrongKiosk: u64 = 5; /// Trying to exclusively list an already listed item. const EAlreadyListed: u64 = 6; - /// Trying to call `uid_mut` when `allow_extensions` set to false. - const EUidAccessNotAllowed: u64 = 7; + /// 7 is reserved due to a previous interface having EUidAccessNotAllowed. /// Attempt to `take` an item that is locked. const EItemLocked: u64 = 8; /// Taking or mutably borrowing an item that is listed. @@ -143,12 +142,6 @@ module iota::kiosk { /// Number of items stored in a Kiosk. Used to allow unpacking /// an empty Kiosk if it was wrapped or has a single owner. item_count: u32, - /// [DEPRECATED] Please, don't use the `allow_extensions` and the matching - /// `set_allow_extensions` function - it is a legacy feature that is being - /// replaced by the `kiosk_extension` module and its Extensions API. - /// - /// Exposes `uid_mut` publicly when set to `true`, set to `false` by default. - allow_extensions: bool } /// A Capability granting the bearer a right to `place` and `take` items @@ -248,7 +241,6 @@ module iota::kiosk { profits: balance::zero(), owner: ctx.sender(), item_count: 0, - allow_extensions: false }; let cap = KioskOwnerCap { @@ -265,7 +257,7 @@ module iota::kiosk { public fun close_and_withdraw( self: Kiosk, cap: KioskOwnerCap, ctx: &mut TxContext ): Coin { - let Kiosk { id, profits, owner: _, item_count, allow_extensions: _ } = self; + let Kiosk { id, profits, owner: _, item_count } = self; let KioskOwnerCap { id: cap_id, `for` } = cap; assert!(id.to_inner() == `for`, ENotOwner); @@ -532,16 +524,6 @@ module iota::kiosk { &mut self.id } - /// [DEPRECATED] - /// Allow or disallow `uid` and `uid_mut` access via the `allow_extensions` - /// setting. - public fun set_allow_extensions( - self: &mut Kiosk, cap: &KioskOwnerCap, allow_extensions: bool - ) { - assert!(self.has_access(cap), ENotOwner); - self.allow_extensions = allow_extensions; - } - /// Get the immutable `UID` for dynamic field access. /// Always enabled. /// @@ -551,13 +533,6 @@ module iota::kiosk { &self.id } - /// Get the mutable `UID` for dynamic field access and extensions. - /// Aborts if `allow_extensions` set to `false`. - public fun uid_mut(self: &mut Kiosk): &mut UID { - assert!(self.allow_extensions, EUidAccessNotAllowed); - &mut self.id - } - /// Get the owner of the Kiosk. public fun owner(self: &Kiosk): address { self.owner diff --git a/crates/iota-framework/packages/iota-framework/sources/labeler.move b/crates/iota-framework/packages/iota-framework/sources/labeler.move index bf9317456dc..5a68219f8a2 100644 --- a/crates/iota-framework/packages/iota-framework/sources/labeler.move +++ b/crates/iota-framework/packages/iota-framework/sources/labeler.move @@ -1,6 +1,8 @@ // Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +/// Defines a LabelerCap used for creating labels in a ``iota::timelock::Timelock`` object. +/// The LabelerCap can be created only be consuming an OTW, making then labels unique for each cap. module iota::labeler { /// Error code for when a type passed to the `create_labeler_cap` function is not a one-time witness. diff --git a/crates/iota-framework/packages/iota-framework/sources/math.move b/crates/iota-framework/packages/iota-framework/sources/math.move deleted file mode 100644 index a164fe39cbf..00000000000 --- a/crates/iota-framework/packages/iota-framework/sources/math.move +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Mysten Labs, Inc. -// Modifications Copyright (c) 2024 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -/// DEPRECATED, use the each integer type's individual module instead, e.g. `std::u64` -#[deprecated(note = b"Use the each integer type's individual module instead, e.g. `std::u64`")] -module iota::math { - - /// DEPRECATED, use `std::u64::max` instead - public fun max(x: u64, y: u64): u64 { - x.max(y) - } - - /// DEPRECATED, use `std::u64::min` instead - public fun min(x: u64, y: u64): u64 { - x.min(y) - } - - /// DEPRECATED, use `std::u64::diff` instead - public fun diff(x: u64, y: u64): u64 { - x.diff(y) - } - - /// DEPRECATED, use `std::u64::pow` instead - public fun pow(base: u64, exponent: u8): u64 { - base.pow(exponent) - } - - /// DEPRECATED, use `std::u64::sqrt` instead - public fun sqrt(x: u64): u64 { - x.sqrt() - } - - /// DEPRECATED, use `std::u128::sqrt` instead - public fun sqrt_u128(x: u128): u128 { - x.sqrt() - } - - /// DEPRECATED, use `std::u64::divide_and_round_up` instead - public fun divide_and_round_up(x: u64, y: u64): u64 { - x.divide_and_round_up(y) - } -} diff --git a/crates/iota-framework/packages/iota-framework/sources/pay.move b/crates/iota-framework/packages/iota-framework/sources/pay.move index 6775411e7e3..d09de62eba9 100644 --- a/crates/iota-framework/packages/iota-framework/sources/pay.move +++ b/crates/iota-framework/packages/iota-framework/sources/pay.move @@ -59,12 +59,6 @@ module iota::pay { vec.destroy_empty(); } - /// Join `coin` into `self`. Re-exports `coin::join` function. - /// Deprecated: you should call `coin.join(other)` directly. - public entry fun join(self: &mut Coin, coin: Coin) { - self.join(coin) - } - /// Join everything in `coins` with `self` public entry fun join_vec(self: &mut Coin, mut coins: vector>) { let (mut i, len) = (0, coins.length()); diff --git a/crates/iota-framework/packages/iota-framework/sources/tx_context.move b/crates/iota-framework/packages/iota-framework/sources/tx_context.move index 0d539c0eeb2..38e5d0d8838 100644 --- a/crates/iota-framework/packages/iota-framework/sources/tx_context.move +++ b/crates/iota-framework/packages/iota-framework/sources/tx_context.move @@ -17,7 +17,7 @@ module iota::tx_context { const ENoIDsCreated: u64 = 1; /// Information about the transaction currently being executed. - /// This cannot be constructed by a transaction--it is a privileged object created by + /// This cannot be constructed by a transaction. It is a privileged object created by /// the VM and passed in to the entrypoint of the transaction as `&mut TxContext`. public struct TxContext has drop { /// The address of the user that signed the current transaction @@ -52,7 +52,7 @@ module iota::tx_context { /// Return the epoch start time as a unix timestamp in milliseconds. public fun epoch_timestamp_ms(self: &TxContext): u64 { - self.epoch_timestamp_ms + self.epoch_timestamp_ms } /// Create an `address` that has not been used. As it is an object address, it will never diff --git a/crates/iota-framework/packages/iota-framework/sources/vec_map.move b/crates/iota-framework/packages/iota-framework/sources/vec_map.move index 1875ce26661..d1888096c1f 100644 --- a/crates/iota-framework/packages/iota-framework/sources/vec_map.move +++ b/crates/iota-framework/packages/iota-framework/sources/vec_map.move @@ -23,8 +23,8 @@ module iota::vec_map { const EUnequalLengths: u64 = 5; /// A map data structure backed by a vector. The map is guaranteed not to contain duplicate keys, but entries - /// are *not* sorted by key--entries are included in insertion order. - /// All operations are O(N) in the size of the map--the intention of this data structure is only to provide + /// are *not* sorted by key. Entries are included in insertion order. + /// All operations are O(N) in the size of the map. The intention of this data structure is only to provide /// the convenience of programming against a map API. /// Large maps should use handwritten parent/child relationships instead. /// Maps that need sorted iteration rather than insertion order iteration should also be handwritten. diff --git a/crates/iota-framework/packages/iota-framework/sources/vec_set.move b/crates/iota-framework/packages/iota-framework/sources/vec_set.move index c9a1387c1b8..9aaa8f09234 100644 --- a/crates/iota-framework/packages/iota-framework/sources/vec_set.move +++ b/crates/iota-framework/packages/iota-framework/sources/vec_set.move @@ -11,8 +11,8 @@ module iota::vec_set { const EKeyDoesNotExist: u64 = 1; /// A set data structure backed by a vector. The set is guaranteed not to - /// contain duplicate keys. All operations are O(N) in the size of the set - /// - the intention of this data structure is only to provide the convenience + /// contain duplicate keys. All operations are O(N) in the size of the set. + /// The intention of this data structure is only to provide the convenience /// of programming against a set API. Sets that need sorted iteration rather /// than insertion order iteration should be handwritten. public struct VecSet has copy, drop, store { diff --git a/crates/iota-framework/packages/iota-framework/tests/address_tests.move b/crates/iota-framework/packages/iota-framework/tests/address_tests.move index e9656da0016..75fc9a7a207 100644 --- a/crates/iota-framework/packages/iota-framework/tests/address_tests.move +++ b/crates/iota-framework/packages/iota-framework/tests/address_tests.move @@ -95,7 +95,7 @@ module iota::address_tests { assert!(@0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff.to_ascii_string() == b"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff".to_ascii_string()); } - #[test] + #[test] fun to_string_ok() { assert!(@0x0.to_string() == b"0000000000000000000000000000000000000000000000000000000000000000".to_string()); assert!(@0x1.to_string() == b"0000000000000000000000000000000000000000000000000000000000000001".to_string()); diff --git a/crates/iota-framework/packages/iota-framework/tests/coin_tests.move b/crates/iota-framework/packages/iota-framework/tests/coin_tests.move index 848ceceda6e..676a848be40 100644 --- a/crates/iota-framework/packages/iota-framework/tests/coin_tests.move +++ b/crates/iota-framework/packages/iota-framework/tests/coin_tests.move @@ -2,7 +2,7 @@ // Modifications Copyright (c) 2024 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -#[test_only, allow(deprecated_usage)] +#[test_only] module iota::coin_tests { use iota::coin::{Self, Coin}; use iota::pay; diff --git a/crates/iota-framework/packages/iota-framework/tests/crypto/groth16_tests.move b/crates/iota-framework/packages/iota-framework/tests/crypto/groth16_tests.move index 6b8d8d67468..0c3e729d267 100644 --- a/crates/iota-framework/packages/iota-framework/tests/crypto/groth16_tests.move +++ b/crates/iota-framework/packages/iota-framework/tests/crypto/groth16_tests.move @@ -28,7 +28,7 @@ module iota::groth16_tests { let vk_bytes = arr.pop_back(); assert!(vk_bytes == expected_vk_bytes); - } + } #[test] #[expected_failure(abort_code = groth16::EInvalidVerifyingKey)] diff --git a/crates/iota-framework/packages/iota-framework/tests/crypto/poseidon_tests.move b/crates/iota-framework/packages/iota-framework/tests/crypto/poseidon_tests.move index 59ec6bc03cf..1561ce4033e 100644 --- a/crates/iota-framework/packages/iota-framework/tests/crypto/poseidon_tests.move +++ b/crates/iota-framework/packages/iota-framework/tests/crypto/poseidon_tests.move @@ -19,22 +19,22 @@ module iota::poseidon_tests { assert!(actual == expected); let msg = vector[1u256, 2u256, 3u256, 4u256, 5u256, 6u256, 7u256, 8u256, 9u256, 10u256, - 11u256, 12u256, 13u256, 14u256, 15u256]; + 11u256, 12u256, 13u256, 14u256, 15u256]; let expected = 4203130618016961831408770638653325366880478848856764494148034853759773445968u256; let actual = poseidon_bn254(&msg); assert!(actual == expected); let msg = vector[0u256, 1u256, 2u256, 3u256, 4u256, 5u256, 6u256, 7u256, 8u256, 9u256, - 10u256, 11u256, 12u256, 13u256, 14u256, 15u256, 16u256, 17u256, 18u256, 19u256, - 20u256, 21u256, 22u256, 23u256, 24u256, 25u256, 26u256, 27u256, 28u256, 29u256]; + 10u256, 11u256, 12u256, 13u256, 14u256, 15u256, 16u256, 17u256, 18u256, 19u256, + 20u256, 21u256, 22u256, 23u256, 24u256, 25u256, 26u256, 27u256, 28u256, 29u256]; let expected = 4123755143677678663754455867798672266093104048057302051129414708339780424023u256; let actual = poseidon_bn254(&msg); assert!(actual == expected); let msg = vector[0u256, 1u256, 2u256, 3u256, 4u256, 5u256, 6u256, 7u256, 8u256, 9u256, - 10u256, 11u256, 12u256, 13u256, 14u256, 15u256, 16u256, 17u256, 18u256, 19u256, - 20u256, 21u256, 22u256, 23u256, 24u256, 25u256, 26u256, 27u256, 28u256, 29u256, - 30u256, 31u256, 32u256]; + 10u256, 11u256, 12u256, 13u256, 14u256, 15u256, 16u256, 17u256, 18u256, 19u256, + 20u256, 21u256, 22u256, 23u256, 24u256, 25u256, 26u256, 27u256, 28u256, 29u256, + 30u256, 31u256, 32u256]; let expected = 15368023340287843142129781602124963668572853984788169144128906033251913623349u256; let actual = poseidon_bn254(&msg); assert!(actual == expected); diff --git a/crates/iota-framework/packages/iota-framework/tests/event_tests.move b/crates/iota-framework/packages/iota-framework/tests/event_tests.move index e8bd969ad14..cf2dfad34d8 100644 --- a/crates/iota-framework/packages/iota-framework/tests/event_tests.move +++ b/crates/iota-framework/packages/iota-framework/tests/event_tests.move @@ -40,7 +40,7 @@ module iota::event_tests { assert_eq(event::events_by_type().length(), 2) } - #[test] + #[test] fun test_emit_heterogenous() { let e0 = S1(0); let e1 = S2(1); diff --git a/crates/iota-framework/packages/iota-framework/tests/kiosk/kiosk_tests.move b/crates/iota-framework/packages/iota-framework/tests/kiosk/kiosk_tests.move index f25c4627e04..77f7d604780 100644 --- a/crates/iota-framework/packages/iota-framework/tests/kiosk/kiosk_tests.move +++ b/crates/iota-framework/packages/iota-framework/tests/kiosk/kiosk_tests.move @@ -292,15 +292,6 @@ module iota::kiosk_tests { abort 1337 } - #[test] - fun test_disallow_extensions_access_as_owner() { - let ctx = &mut test::ctx(); - let (mut kiosk, owner_cap) = test::get_kiosk(ctx); - - kiosk.set_allow_extensions(&owner_cap, false); - let _uid_mut = kiosk.uid_mut_as_owner(&owner_cap); - test::return_kiosk(kiosk, owner_cap, ctx); - } #[test] fun test_uid_access() { @@ -313,26 +304,4 @@ module iota::kiosk_tests { test::return_kiosk(kiosk, owner_cap, ctx); } - #[test] - #[expected_failure(abort_code = iota::kiosk::EUidAccessNotAllowed)] - fun test_disallow_extensions_uid_mut() { - let ctx = &mut test::ctx(); - let (mut kiosk, owner_cap) = test::get_kiosk(ctx); - - kiosk.set_allow_extensions(&owner_cap, false); - let _ = kiosk.uid_mut(); - - abort 1337 - } - - #[test] - fun test_disallow_extensions_uid_available() { - let ctx = &mut test::ctx(); - let (mut kiosk, owner_cap) = test::get_kiosk(ctx); - - kiosk.set_allow_extensions(&owner_cap, false); - let _ = kiosk.uid(); - - test::return_kiosk(kiosk, owner_cap, ctx); - } } diff --git a/crates/iota-framework/packages/iota-framework/tests/math_tests.move b/crates/iota-framework/packages/iota-framework/tests/math_tests.move deleted file mode 100644 index 3f6f7f16be5..00000000000 --- a/crates/iota-framework/packages/iota-framework/tests/math_tests.move +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Mysten Labs, Inc. -// Modifications Copyright (c) 2024 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -#[test_only, allow(deprecated_usage)] -module iota::math_tests { - use iota::math; - - #[test] - fun test_max() { - assert!(math::max(10, 100) == 100); - assert!(math::max(100, 10) == 100); - assert!(math::max(0, 0) == 0); - } - - #[test] - fun test_min() { - assert!(math::min(10, 100) == 10); - assert!(math::min(100, 10) == 10); - assert!(math::min(0, 0) == 0); - } - - #[test] - fun test_pow() { - assert!(math::pow(1, 0) == 1); - assert!(math::pow(3, 1) == 3); - assert!(math::pow(2, 10) == 1024); - assert!(math::pow(10, 6) == 1000000); - } - - #[test] - #[expected_failure] - fun test_pow_overflow() { - math::pow(10, 100); - } - - #[test] - fun test_perfect_sqrt() { - let mut i = 0; - while (i < 1000) { - assert!(math::sqrt(i * i) == i); - i = i + 1; - }; - let mut i = 0xFFFFFFFFFu128; - while (i < 0xFFFFFFFFFu128 + 1) { - assert!(math::sqrt_u128(i * i) == i); - i = i + 1; - } - } - - #[test] - // This function tests whether the (square root)^2 equals the - // initial value OR whether it is equal to the nearest lower - // number that does. - fun test_imperfect_sqrt() { - let mut i = 1; - let mut prev = 1; - while (i <= 1000) { - let root = math::sqrt(i); - - assert!(i == root * root || root == prev); - - prev = root; - i = i + 1; - } - } - - #[test] - fun test_sqrt_big_numbers() { - let u64_max = 18446744073709551615; - assert!(4294967295 == math::sqrt(u64_max)) - } -} diff --git a/crates/iota-framework/packages/iota-framework/tests/timelock/timelocked_balance_tests.move b/crates/iota-framework/packages/iota-framework/tests/timelock/timelocked_balance_tests.move index 82fa561f3b9..ed1e69e9371 100644 --- a/crates/iota-framework/packages/iota-framework/tests/timelock/timelocked_balance_tests.move +++ b/crates/iota-framework/packages/iota-framework/tests/timelock/timelocked_balance_tests.move @@ -265,7 +265,7 @@ module iota::timelocked_balance_tests { scenario.end(); } - #[test] + #[test] fun test_split_and_transfer_timelocked_balances() { // Set up a test environment. let sender = @0xA; diff --git a/crates/iota-framework/packages/iota-system/sources/timelocked_staking.move b/crates/iota-framework/packages/iota-system/sources/timelocked_staking.move index c5cd343cb39..9788e123a18 100644 --- a/crates/iota-framework/packages/iota-system/sources/timelocked_staking.move +++ b/crates/iota-framework/packages/iota-system/sources/timelocked_staking.move @@ -83,7 +83,7 @@ module iota_system::timelocked_staking { let (timelocked_balance, reward) = request_withdraw_stake_non_entry(iota_system, timelocked_staked_iota, ctx); // Transfer the withdrawn time-locked balance to the sender. - timelocked_balance.transfer_to_sender(ctx); + timelocked_balance.transfer_to_sender(ctx); // Send coins only if the reward is not zero. if (reward.value() > 0) { @@ -312,8 +312,8 @@ module iota_system::timelocked_staking { fun transfer_multiple(mut stakes: vector, receiver: address) { // Transfer all the time-locked stakes to the recipient. while (!stakes.is_empty()) { - let stake = stakes.pop_back(); - transfer::transfer(stake, receiver); + let stake = stakes.pop_back(); + transfer::transfer(stake, receiver); }; // Destroy the empty vector. diff --git a/crates/iota-framework/packages/iota-system/sources/validator.move b/crates/iota-framework/packages/iota-system/sources/validator.move index 4b4b7175ccf..3e19f8fddf8 100644 --- a/crates/iota-framework/packages/iota-system/sources/validator.move +++ b/crates/iota-framework/packages/iota-system/sources/validator.move @@ -557,7 +557,7 @@ module iota_system::validator { // MUSTFIX: We need to check this when updating metadata as well. public fun is_duplicate(self: &ValidatorV1, other: &ValidatorV1): bool { - self.metadata.iota_address == other.metadata.iota_address + self.metadata.iota_address == other.metadata.iota_address || self.metadata.name == other.metadata.name || self.metadata.net_address == other.metadata.net_address || self.metadata.p2p_address == other.metadata.p2p_address diff --git a/crates/iota-framework/packages/iota-system/sources/validator_set.move b/crates/iota-framework/packages/iota-system/sources/validator_set.move index a725dbc3a6a..b0579a00205 100644 --- a/crates/iota-framework/packages/iota-system/sources/validator_set.move +++ b/crates/iota-framework/packages/iota-system/sources/validator_set.move @@ -180,7 +180,7 @@ module iota_system::validator_set { /// Called by `iota_system` to remove a validator candidate, and move them to `inactive_validators`. public(package) fun request_remove_validator_candidate(self: &mut ValidatorSetV1, ctx: &mut TxContext) { let validator_address = ctx.sender(); - assert!( + assert!( self.validator_candidates.contains(validator_address), ENotValidatorCandidate ); @@ -424,7 +424,7 @@ module iota_system::validator_set { if (stake >= low_stake_threshold) { // The validator is safe. We remove their entry from the at_risk map if there exists one. if (self.at_risk_validators.contains(&validator_address)) { - self.at_risk_validators.remove(&validator_address); + self.at_risk_validators.remove(&validator_address); } } else if (stake >= very_low_stake_threshold) { // The stake is a bit below the threshold so we increment the entry of the validator in the map. @@ -548,7 +548,7 @@ module iota_system::validator_set { self: &ValidatorSetV1, validator_address: address, ): bool { - find_validator(&self.active_validators, validator_address).is_some() + find_validator(&self.active_validators, validator_address).is_some() } // ==== private helpers ==== diff --git a/crates/iota-framework/packages/iota-system/tests/timelocked_delegation_tests.move b/crates/iota-framework/packages/iota-system/tests/timelocked_delegation_tests.move index e7d1ba96f28..295a04d6d8c 100644 --- a/crates/iota-framework/packages/iota-system/tests/timelocked_delegation_tests.move +++ b/crates/iota-framework/packages/iota-system/tests/timelocked_delegation_tests.move @@ -925,12 +925,12 @@ module iota_system::timelocked_stake_tests { // The computation reward is lower than the target reward, so 400 IOTA should be minted. // Each validator pool has 50% of the voting power and thus gets 50% of the reward (400 IOTA). assert_validator_total_stake_amounts( - validator_addrs(), - vector[ - (200 + 400) * NANOS_PER_IOTA, - (200 + 400) * NANOS_PER_IOTA, - ], - scenario + validator_addrs(), + vector[ + (200 + 400) * NANOS_PER_IOTA, + (200 + 400) * NANOS_PER_IOTA, + ], + scenario ); unstake_timelocked(STAKER_ADDR_1, 0, scenario); @@ -963,12 +963,12 @@ module iota_system::timelocked_stake_tests { // The computation reward is higher than the target reward, so 200 IOTA should be burned. // Each validator pool has 50% of the voting power and thus gets 50% of the reward (400 IOTA). assert_validator_total_stake_amounts( - validator_addrs(), - vector[ - (200 + 400) * NANOS_PER_IOTA, - (250 + 400) * NANOS_PER_IOTA, - ], - scenario + validator_addrs(), + vector[ + (200 + 400) * NANOS_PER_IOTA, + (250 + 400) * NANOS_PER_IOTA, + ], + scenario ); unstake_timelocked(STAKER_ADDR_1, 0, scenario); diff --git a/crates/iota-framework/packages/stardust/sources/nft/irc27.move b/crates/iota-framework/packages/stardust/sources/nft/irc27.move index 7c3a04b66a0..07a1034c887 100644 --- a/crates/iota-framework/packages/stardust/sources/nft/irc27.move +++ b/crates/iota-framework/packages/stardust/sources/nft/irc27.move @@ -115,7 +115,7 @@ module stardust::irc27 { attributes: _, non_standard_fields: _, } = irc27; - } + } #[test_only] public fun create_for_testing( diff --git a/crates/iota-framework/packages_compiled/iota-framework b/crates/iota-framework/packages_compiled/iota-framework index 2568bfa1275..5ad34b2f135 100644 Binary files a/crates/iota-framework/packages_compiled/iota-framework and b/crates/iota-framework/packages_compiled/iota-framework differ diff --git a/crates/iota-framework/published_api.txt b/crates/iota-framework/published_api.txt index 8bd50d6ea10..7b25f4da602 100644 --- a/crates/iota-framework/published_api.txt +++ b/crates/iota-framework/published_api.txt @@ -1933,9 +1933,6 @@ TreasuryCap DenyCapV1 public struct 0x2::coin -CurrencyCreated - public struct - 0x2::coin total_supply public fun 0x2::coin @@ -2053,9 +2050,6 @@ get_description get_icon_url public fun 0x2::coin -supply - public fun - 0x2::coin CoinManager public struct 0x2::coin_manager @@ -2611,15 +2605,9 @@ has_access uid_mut_as_owner public fun 0x2::kiosk -set_allow_extensions - public fun - 0x2::kiosk uid public fun 0x2::kiosk -uid_mut - public fun - 0x2::kiosk owner public fun 0x2::kiosk @@ -2770,27 +2758,6 @@ destroy_empty drop public fun 0x2::linked_table -max - public fun - 0x2::math -min - public fun - 0x2::math -diff - public fun - 0x2::math -pow - public fun - 0x2::math -sqrt - public fun - 0x2::math -sqrt_u128 - public fun - 0x2::math -divide_and_round_up - public fun - 0x2::math ObjectBag public struct 0x2::object_bag @@ -2875,9 +2842,6 @@ split_and_transfer divide_and_keep public entry fun 0x2::pay -join - public entry fun - 0x2::pay join_vec public entry fun 0x2::pay