From 7938f00a7e4961dbbe4f65f5686947dbfcf6e157 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Tue, 15 Oct 2024 07:13:55 +1000 Subject: [PATCH 01/15] begin API, add trait --- sway-lib-std/src/cmp.sw | 101 +++++++++++++ sway-lib-std/src/lib.sw | 1 + sway-lib-std/src/u128.sw | 11 ++ .../should_pass/stdlib/cmp_test/.gitignore | 2 + .../should_pass/stdlib/cmp_test/Forc.lock | 13 ++ .../should_pass/stdlib/cmp_test/Forc.toml | 8 + .../stdlib/cmp_test/json_abi_oracle.json | 64 ++++++++ .../json_abi_oracle_new_encoding.json | 64 ++++++++ .../should_pass/stdlib/cmp_test/src/main.sw | 139 ++++++++++++++++++ .../should_pass/stdlib/cmp_test/test.toml | 4 + 10 files changed, 407 insertions(+) create mode 100644 sway-lib-std/src/cmp.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/.gitignore create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.lock create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.toml create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle.json create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle_new_encoding.json create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/src/main.sw create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/test.toml diff --git a/sway-lib-std/src/cmp.sw b/sway-lib-std/src/cmp.sw new file mode 100644 index 00000000000..1efd42d0295 --- /dev/null +++ b/sway-lib-std/src/cmp.sw @@ -0,0 +1,101 @@ +//! A utility library for comparing values. +library; + +/// A common trait for comparing values. +pub trait Cmp { + /// Compares and returns the minimum of two values. + fn min(self, other: Self) -> Self; + /// Compares and returns the maximum of two values. + fn max(self, other: Self) -> Self; +} + +impl Cmp for u8 { + fn min(self, other: Self) -> Self { + if self < other { + self + } else { + other + } + } + + fn max(self, other: Self) -> Self { + if self > other { + self + } else { + other + } + } +} + +impl Cmp for u16 { + fn min(self, other: Self) -> Self { + if self < other { + self + } else { + other + } + } + + fn max(self, other: Self) -> Self { + if self > other { + self + } else { + other + } + } +} + +impl Cmp for u32 { + fn min(self, other: Self) -> Self { + if self < other { + self + } else { + other + } + } + + fn max(self, other: Self) -> Self { + if self > other { + self + } else { + other + } + } +} + +impl Cmp for u64 { + fn min(self, other: Self) -> Self { + if self < other { + self + } else { + other + } + } + + fn max(self, other: Self) -> Self { + if self > other { + self + } else { + other + } + } +} + + +impl Cmp for u256 { + fn min(self, other: Self) -> Self { + if self < other { + self + } else { + other + } + } + + fn max(self, other: Self) -> Self { + if self > other { + self + } else { + other + } + } +} diff --git a/sway-lib-std/src/lib.sw b/sway-lib-std/src/lib.sw index fc09e123cd6..f9d45f558ca 100644 --- a/sway-lib-std/src/lib.sw +++ b/sway-lib-std/src/lib.sw @@ -45,3 +45,4 @@ pub mod low_level_call; pub mod array_conversions; pub mod bytes_conversions; pub mod clone; +pub mod cmp; diff --git a/sway-lib-std/src/u128.sw b/sway-lib-std/src/u128.sw index c13248c5f80..da56cac7bec 100644 --- a/sway-lib-std/src/u128.sw +++ b/sway-lib-std/src/u128.sw @@ -13,6 +13,7 @@ use ::registers::{flags, overflow}; use ::math::*; use ::result::Result::{self, *}; use ::option::Option::{self, None, Some}; +use ::cmp::*; /// The 128-bit unsigned integer type. /// @@ -864,3 +865,13 @@ impl Logarithm for U128 { result } } + +impl Cmp for U128 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/.gitignore b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/.gitignore new file mode 100644 index 00000000000..77d3844f58c --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/.gitignore @@ -0,0 +1,2 @@ +out +target diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.lock new file mode 100644 index 00000000000..c003f808791 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = "cmp_test" +source = "member" +dependencies = ["std"] + +[[package]] +name = "core" +source = "path+from-root-CFA6E4A73D9B6556" + +[[package]] +name = "std" +source = "path+from-root-CFA6E4A73D9B6556" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.toml new file mode 100644 index 00000000000..7edd74bb394 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "cmp_test" + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle.json new file mode 100644 index 00000000000..b6b4a0becda --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle.json @@ -0,0 +1,64 @@ +{ + "concreteTypes": [ + { + "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", + "type": "bool" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "type": "u16" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "type": "u256" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "type": "u32" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "type": "u64" + }, + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "type": "u8" + } + ], + "configurables": [], + "encodingVersion": "1", + "functions": [ + { + "attributes": null, + "inputs": [], + "name": "main", + "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + } + ], + "loggedTypes": [ + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "logId": "14454674236531057292" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "logId": "2992671284987479467" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "logId": "15520703124961489725" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "logId": "1515152261580153489" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "logId": "1970142151624111756" + } + ], + "messagesTypes": [], + "metadataTypes": [], + "programType": "script", + "specVersion": "1" +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle_new_encoding.json new file mode 100644 index 00000000000..b6b4a0becda --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle_new_encoding.json @@ -0,0 +1,64 @@ +{ + "concreteTypes": [ + { + "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", + "type": "bool" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "type": "u16" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "type": "u256" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "type": "u32" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "type": "u64" + }, + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "type": "u8" + } + ], + "configurables": [], + "encodingVersion": "1", + "functions": [ + { + "attributes": null, + "inputs": [], + "name": "main", + "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + } + ], + "loggedTypes": [ + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "logId": "14454674236531057292" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "logId": "2992671284987479467" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "logId": "15520703124961489725" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "logId": "1515152261580153489" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "logId": "1970142151624111756" + } + ], + "messagesTypes": [], + "metadataTypes": [], + "programType": "script", + "specVersion": "1" +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/src/main.sw new file mode 100644 index 00000000000..cea65752d61 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/src/main.sw @@ -0,0 +1,139 @@ +script; + +use std::u128::*; + +fn test_cmp_u8() { + let a = 10u8; + let b = 20u8; + + let max = a.max(b); + assert_eq(max, 20u8); + + let min = a.min(b); + assert_eq(min, 10u8); + + let c = 30u8; + let d = 30u8; + + let max = c.max(d); + assert_eq(max, 30u8); + + let min = c.min(d); + assert_eq(min, 30u8); +} + +fn test_cmp_u16() { + let a = 10u16; + let b = 20u16; + + let max = a.max(b); + assert_eq(max, 20); + + let min = a.min(b); + assert_eq(min, 10); + + let c = 30u16; + let d = 30u16; + + let max = c.max(d); + assert_eq(max, 30); + + let min = c.min(d); + assert_eq(min, 30); +} + +fn test_cmp_u32() { + let a = 10u32; + let b = 20u32; + + let max = a.max(b); + assert_eq(max, 20u32); + + let min = a.min(b); + assert_eq(min, 10u32); + + let c = 30u32; + let d = 30u32; + + let max = c.max(d); + assert_eq(max, 30u32); + + let min = c.min(d); + assert_eq(min, 30u32); +} + +fn test_cmp_u64() { + let a = 10; + let b = 20; + + let max = a.max(b); + assert_eq(max, 20); + + let min = a.min(b); + assert_eq(min, 10); + + let c = 30; + let d = 30; + + let max = c.max(d); + assert_eq(max, 30); + + let min = c.min(d); + assert_eq(min, 30); + +} + +fn test_cmp_u128() { + let a = U128::from((0, 0)); + let b = U128::from((0, 1)); + + let max = a.max(b); + assert(max.upper() == 0); + assert(max.lower() == 1); + + let min = a.min(b); + assert(min.upper() == 0); + assert(min.lower() == 0); + + let c = U128::from((2, 2)); + let d = U128::from((2, 2)); + + let max = c.max(d); + assert(max.upper() == 2); + assert(max.lower() == 2); + + let min = c.min(d); + assert(min.upper() == 2); + assert(min.lower() == 2); +} + +fn test_cmp_u256() { + let a = 0x01u256; + let b = 0x02u256; + + let max = a.max(b); + assert_eq(max, 0x02u256); + + let min = a.min(b); + assert_eq(min, 0x01u256); + + let c = 0x03u256; + let d = 0x03u256; + + let max = c.max(d); + assert_eq(max, 0x03u256); + + let min = c.min(d); + assert_eq(min, 0x03u256); +} + +fn main() -> bool { + test_cmp_u8(); + test_cmp_u16(); + test_cmp_u32(); + test_cmp_u64(); + test_cmp_u128(); + test_cmp_u256(); + + true +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/test.toml new file mode 100644 index 00000000000..53fb5ce9a94 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/test.toml @@ -0,0 +1,4 @@ +category = "run" +expected_result = { action = "return", value = 1 } +expected_result_new_encoding = { action = "return_data", value = "01" } +validate_abi = true From 9cf29d55177cfb37a2cbd6cf0c6266730950f675 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sat, 19 Oct 2024 17:21:55 +1000 Subject: [PATCH 02/15] refactor cmp to totalord --- sway-lib-std/src/cmp.sw | 101 --------------------------------------- sway-lib-std/src/lib.sw | 3 +- sway-lib-std/src/u128.sw | 4 +- 3 files changed, 3 insertions(+), 105 deletions(-) delete mode 100644 sway-lib-std/src/cmp.sw diff --git a/sway-lib-std/src/cmp.sw b/sway-lib-std/src/cmp.sw deleted file mode 100644 index 1efd42d0295..00000000000 --- a/sway-lib-std/src/cmp.sw +++ /dev/null @@ -1,101 +0,0 @@ -//! A utility library for comparing values. -library; - -/// A common trait for comparing values. -pub trait Cmp { - /// Compares and returns the minimum of two values. - fn min(self, other: Self) -> Self; - /// Compares and returns the maximum of two values. - fn max(self, other: Self) -> Self; -} - -impl Cmp for u8 { - fn min(self, other: Self) -> Self { - if self < other { - self - } else { - other - } - } - - fn max(self, other: Self) -> Self { - if self > other { - self - } else { - other - } - } -} - -impl Cmp for u16 { - fn min(self, other: Self) -> Self { - if self < other { - self - } else { - other - } - } - - fn max(self, other: Self) -> Self { - if self > other { - self - } else { - other - } - } -} - -impl Cmp for u32 { - fn min(self, other: Self) -> Self { - if self < other { - self - } else { - other - } - } - - fn max(self, other: Self) -> Self { - if self > other { - self - } else { - other - } - } -} - -impl Cmp for u64 { - fn min(self, other: Self) -> Self { - if self < other { - self - } else { - other - } - } - - fn max(self, other: Self) -> Self { - if self > other { - self - } else { - other - } - } -} - - -impl Cmp for u256 { - fn min(self, other: Self) -> Self { - if self < other { - self - } else { - other - } - } - - fn max(self, other: Self) -> Self { - if self > other { - self - } else { - other - } - } -} diff --git a/sway-lib-std/src/lib.sw b/sway-lib-std/src/lib.sw index f9d45f558ca..f2819531bef 100644 --- a/sway-lib-std/src/lib.sw +++ b/sway-lib-std/src/lib.sw @@ -16,7 +16,6 @@ pub mod vec; pub mod bytes; pub mod flags; pub mod math; -pub mod u128; pub mod b512; pub mod primitive_conversions; pub mod alias; @@ -45,4 +44,4 @@ pub mod low_level_call; pub mod array_conversions; pub mod bytes_conversions; pub mod clone; -pub mod cmp; +pub mod totalord; diff --git a/sway-lib-std/src/u128.sw b/sway-lib-std/src/u128.sw index da56cac7bec..03d0da6d7e1 100644 --- a/sway-lib-std/src/u128.sw +++ b/sway-lib-std/src/u128.sw @@ -11,9 +11,9 @@ use ::flags::{ }; use ::registers::{flags, overflow}; use ::math::*; +use ::totalord::*; use ::result::Result::{self, *}; use ::option::Option::{self, None, Some}; -use ::cmp::*; /// The 128-bit unsigned integer type. /// @@ -866,7 +866,7 @@ impl Logarithm for U128 { } } -impl Cmp for U128 { +impl TotalOrd for U128 { fn min(self, other: Self) -> Self { if self < other { self } else { other } } From 94f432ccad7a62afeb81ef350a65724439d292d8 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sat, 19 Oct 2024 17:25:37 +1000 Subject: [PATCH 03/15] totalord --- sway-lib-std/src/totalord.sw | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 sway-lib-std/src/totalord.sw diff --git a/sway-lib-std/src/totalord.sw b/sway-lib-std/src/totalord.sw new file mode 100644 index 00000000000..522855f093c --- /dev/null +++ b/sway-lib-std/src/totalord.sw @@ -0,0 +1,61 @@ +//! A utility library for comparing values. +library; + +/// A common trait for comparing values. +/// This roughly maps to `std::cmp::Ord` in Rust. +pub trait TotalOrd { + /// Compares and returns the minimum of two values. + fn min(self, other: Self) -> Self; + /// Compares and returns the maximum of two values. + fn max(self, other: Self) -> Self; +} + +impl TotalOrd for u8 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} + +impl TotalOrd for u16 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} + +impl TotalOrd for u32 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} + +impl TotalOrd for u64 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} + +impl TotalOrd for u256 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} From b796462bbf137d1eb14871a9893e7a7e0082db2a Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sun, 20 Oct 2024 06:28:17 +1000 Subject: [PATCH 04/15] finish renaming cmp to totalord --- sway-lib-std/src/lib.sw | 1 + .../stdlib/cmp_test/json_abi_oracle.json | 64 ------------------- .../json_abi_oracle_new_encoding.json | 64 ------------------- .../{cmp_test => totalord_test}/.gitignore | 0 .../{cmp_test => totalord_test}/Forc.lock | 14 ++-- .../{cmp_test => totalord_test}/Forc.toml | 2 +- .../stdlib/totalord_test/json_abi_oracle.json | 64 +++++++++++++++++++ .../json_abi_oracle_new_encoding.json | 64 +++++++++++++++++++ .../{cmp_test => totalord_test}/src/main.sw | 1 - .../{cmp_test => totalord_test}/test.toml | 0 10 files changed, 137 insertions(+), 137 deletions(-) delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle.json delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle_new_encoding.json rename test/src/e2e_vm_tests/test_programs/should_pass/stdlib/{cmp_test => totalord_test}/.gitignore (100%) rename test/src/e2e_vm_tests/test_programs/should_pass/stdlib/{cmp_test => totalord_test}/Forc.lock (54%) rename test/src/e2e_vm_tests/test_programs/should_pass/stdlib/{cmp_test => totalord_test}/Forc.toml (87%) create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json rename test/src/e2e_vm_tests/test_programs/should_pass/stdlib/{cmp_test => totalord_test}/src/main.sw (99%) rename test/src/e2e_vm_tests/test_programs/should_pass/stdlib/{cmp_test => totalord_test}/test.toml (100%) diff --git a/sway-lib-std/src/lib.sw b/sway-lib-std/src/lib.sw index f2819531bef..44c9ad117bf 100644 --- a/sway-lib-std/src/lib.sw +++ b/sway-lib-std/src/lib.sw @@ -16,6 +16,7 @@ pub mod vec; pub mod bytes; pub mod flags; pub mod math; +pub mod u128; pub mod b512; pub mod primitive_conversions; pub mod alias; diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle.json deleted file mode 100644 index b6b4a0becda..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "concreteTypes": [ - { - "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", - "type": "bool" - }, - { - "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", - "type": "u16" - }, - { - "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", - "type": "u256" - }, - { - "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", - "type": "u32" - }, - { - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "type": "u64" - }, - { - "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", - "type": "u8" - } - ], - "configurables": [], - "encodingVersion": "1", - "functions": [ - { - "attributes": null, - "inputs": [], - "name": "main", - "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" - } - ], - "loggedTypes": [ - { - "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", - "logId": "14454674236531057292" - }, - { - "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", - "logId": "2992671284987479467" - }, - { - "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", - "logId": "15520703124961489725" - }, - { - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "logId": "1515152261580153489" - }, - { - "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", - "logId": "1970142151624111756" - } - ], - "messagesTypes": [], - "metadataTypes": [], - "programType": "script", - "specVersion": "1" -} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle_new_encoding.json deleted file mode 100644 index b6b4a0becda..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/json_abi_oracle_new_encoding.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "concreteTypes": [ - { - "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", - "type": "bool" - }, - { - "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", - "type": "u16" - }, - { - "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", - "type": "u256" - }, - { - "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", - "type": "u32" - }, - { - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "type": "u64" - }, - { - "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", - "type": "u8" - } - ], - "configurables": [], - "encodingVersion": "1", - "functions": [ - { - "attributes": null, - "inputs": [], - "name": "main", - "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" - } - ], - "loggedTypes": [ - { - "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", - "logId": "14454674236531057292" - }, - { - "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", - "logId": "2992671284987479467" - }, - { - "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", - "logId": "15520703124961489725" - }, - { - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "logId": "1515152261580153489" - }, - { - "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", - "logId": "1970142151624111756" - } - ], - "messagesTypes": [], - "metadataTypes": [], - "programType": "script", - "specVersion": "1" -} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/.gitignore b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/.gitignore similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/.gitignore rename to test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/.gitignore diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.lock similarity index 54% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.lock rename to test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.lock index c003f808791..13a618901d4 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.lock +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.lock @@ -1,13 +1,13 @@ -[[package]] -name = "cmp_test" -source = "member" -dependencies = ["std"] - [[package]] name = "core" -source = "path+from-root-CFA6E4A73D9B6556" +source = "path+from-root-36AEC2A470D585EB" [[package]] name = "std" -source = "path+from-root-CFA6E4A73D9B6556" +source = "path+from-root-36AEC2A470D585EB" dependencies = ["core"] + +[[package]] +name = "totalord_test" +source = "member" +dependencies = ["std"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.toml similarity index 87% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.toml index 7edd74bb394..23cf69a261d 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.toml @@ -2,7 +2,7 @@ authors = ["Fuel Labs "] entry = "main.sw" license = "Apache-2.0" -name = "cmp_test" +name = "totalord_test" [dependencies] std = { path = "../../../../../../../sway-lib-std" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json new file mode 100644 index 00000000000..5d9532112a9 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json @@ -0,0 +1,64 @@ +{ + "concreteTypes": [ + { + "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", + "type": "bool" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "type": "u16" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "type": "u256" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "type": "u32" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "type": "u64" + }, + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "type": "u8" + } + ], + "configurables": [], + "encodingVersion": "1", + "functions": [ + { + "attributes": null, + "inputs": [], + "name": "main", + "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + } + ], + "loggedTypes": [ + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "logId": "14454674236531057292" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "logId": "2992671284987479467" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "logId": "15520703124961489725" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "logId": "1515152261580153489" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "logId": "1970142151624111756" + } + ], + "messagesTypes": [], + "metadataTypes": [], + "programType": "script", + "specVersion": "1" +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json new file mode 100644 index 00000000000..5d9532112a9 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json @@ -0,0 +1,64 @@ +{ + "concreteTypes": [ + { + "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", + "type": "bool" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "type": "u16" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "type": "u256" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "type": "u32" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "type": "u64" + }, + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "type": "u8" + } + ], + "configurables": [], + "encodingVersion": "1", + "functions": [ + { + "attributes": null, + "inputs": [], + "name": "main", + "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + } + ], + "loggedTypes": [ + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "logId": "14454674236531057292" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "logId": "2992671284987479467" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "logId": "15520703124961489725" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "logId": "1515152261580153489" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "logId": "1970142151624111756" + } + ], + "messagesTypes": [], + "metadataTypes": [], + "programType": "script", + "specVersion": "1" +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/src/main.sw similarity index 99% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/src/main.sw rename to test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/src/main.sw index cea65752d61..b8247ccc13a 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/src/main.sw @@ -80,7 +80,6 @@ fn test_cmp_u64() { let min = c.min(d); assert_eq(min, 30); - } fn test_cmp_u128() { diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/test.toml similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/cmp_test/test.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/test.toml From 85507406db24029419b269f86399354311dd8b62 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sun, 20 Oct 2024 06:47:47 +1000 Subject: [PATCH 05/15] last fixes --- .../stdlib/totalord_test/json_abi_oracle.json | 2 +- .../json_abi_oracle_new_encoding.json | 2 +- .../stdlib/totalord_test/src/main.sw | 24 +++++++++---------- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json index 5d9532112a9..b9a0ad5f18f 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json @@ -61,4 +61,4 @@ "metadataTypes": [], "programType": "script", "specVersion": "1" -} \ No newline at end of file +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json index 5d9532112a9..b9a0ad5f18f 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json @@ -61,4 +61,4 @@ "metadataTypes": [], "programType": "script", "specVersion": "1" -} \ No newline at end of file +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/src/main.sw index b8247ccc13a..81e8e852ad6 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/src/main.sw @@ -2,7 +2,7 @@ script; use std::u128::*; -fn test_cmp_u8() { +fn test_totalord_u8() { let a = 10u8; let b = 20u8; @@ -22,7 +22,7 @@ fn test_cmp_u8() { assert_eq(min, 30u8); } -fn test_cmp_u16() { +fn test_totalord_u16() { let a = 10u16; let b = 20u16; @@ -42,7 +42,7 @@ fn test_cmp_u16() { assert_eq(min, 30); } -fn test_cmp_u32() { +fn test_totalord_u32() { let a = 10u32; let b = 20u32; @@ -62,7 +62,7 @@ fn test_cmp_u32() { assert_eq(min, 30u32); } -fn test_cmp_u64() { +fn test_totalord_u64() { let a = 10; let b = 20; @@ -82,7 +82,7 @@ fn test_cmp_u64() { assert_eq(min, 30); } -fn test_cmp_u128() { +fn test_totalord_u128() { let a = U128::from((0, 0)); let b = U128::from((0, 1)); @@ -106,7 +106,7 @@ fn test_cmp_u128() { assert(min.lower() == 2); } -fn test_cmp_u256() { +fn test_totalord_u256() { let a = 0x01u256; let b = 0x02u256; @@ -127,12 +127,12 @@ fn test_cmp_u256() { } fn main() -> bool { - test_cmp_u8(); - test_cmp_u16(); - test_cmp_u32(); - test_cmp_u64(); - test_cmp_u128(); - test_cmp_u256(); + test_totalord_u8(); + test_totalord_u16(); + test_totalord_u32(); + test_totalord_u64(); + test_totalord_u128(); + test_totalord_u256(); true } From d4a3923e0cdb87577526817cfbeecce4030770bf Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sun, 20 Oct 2024 06:48:50 +1000 Subject: [PATCH 06/15] comment fix --- sway-lib-std/src/totalord.sw | 1 - 1 file changed, 1 deletion(-) diff --git a/sway-lib-std/src/totalord.sw b/sway-lib-std/src/totalord.sw index 522855f093c..a6f35f54a4c 100644 --- a/sway-lib-std/src/totalord.sw +++ b/sway-lib-std/src/totalord.sw @@ -2,7 +2,6 @@ library; /// A common trait for comparing values. -/// This roughly maps to `std::cmp::Ord` in Rust. pub trait TotalOrd { /// Compares and returns the minimum of two values. fn min(self, other: Self) -> Self; From b573e5c3d8d14d688bb227034426c20b1d3fbf5d Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sun, 20 Oct 2024 12:32:21 +1000 Subject: [PATCH 07/15] begin migration to std::core::ops --- sway-lib-core/src/ops.sw | 58 ++++++++++++++++++ sway-lib-std/src/lib.sw | 1 - sway-lib-std/src/totalord.sw | 60 ------------------- sway-lib-std/src/u128.sw | 3 +- .../totalord_test/.gitignore | 0 .../totalord_test/Forc.lock | 0 .../totalord_test/Forc.toml | 0 .../totalord_test/json_abi_oracle.json | 0 .../json_abi_oracle_new_encoding.json | 0 .../totalord_test/src/main.sw | 0 .../totalord_test/test.toml | 0 11 files changed, 59 insertions(+), 63 deletions(-) delete mode 100644 sway-lib-std/src/totalord.sw rename test/src/e2e_vm_tests/test_programs/should_pass/{stdlib => language}/totalord_test/.gitignore (100%) rename test/src/e2e_vm_tests/test_programs/should_pass/{stdlib => language}/totalord_test/Forc.lock (100%) rename test/src/e2e_vm_tests/test_programs/should_pass/{stdlib => language}/totalord_test/Forc.toml (100%) rename test/src/e2e_vm_tests/test_programs/should_pass/{stdlib => language}/totalord_test/json_abi_oracle.json (100%) rename test/src/e2e_vm_tests/test_programs/should_pass/{stdlib => language}/totalord_test/json_abi_oracle_new_encoding.json (100%) rename test/src/e2e_vm_tests/test_programs/should_pass/{stdlib => language}/totalord_test/src/main.sw (100%) rename test/src/e2e_vm_tests/test_programs/should_pass/{stdlib => language}/totalord_test/test.toml (100%) diff --git a/sway-lib-core/src/ops.sw b/sway-lib-core/src/ops.sw index 3e820b71025..29ca3b1f5f5 100644 --- a/sway-lib-core/src/ops.sw +++ b/sway-lib-core/src/ops.sw @@ -1215,6 +1215,64 @@ impl Shift for u16 { } } +/// Trait to compare values. +pub trait TotalOrd { + /// Compares and returns the minimum of two values. + fn min(self, other: Self) -> Self; + /// Compares and returns the maximum of two values. + fn max(self, other: Self) -> Self; +} + +impl TotalOrd for u8 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} + +impl TotalOrd for u16 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} + +impl TotalOrd for u32 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} + +impl TotalOrd for u64 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} + +impl TotalOrd for u256 { + fn min(self, other: Self) -> Self { + if self < other { self } else { other } + } + + fn max(self, other: Self) -> Self { + if self > other { self } else { other } + } +} + impl Shift for u8 { fn lsh(self, other: u64) -> Self { __and(__lsh(self, other), Self::max()) diff --git a/sway-lib-std/src/lib.sw b/sway-lib-std/src/lib.sw index 44c9ad117bf..fc09e123cd6 100644 --- a/sway-lib-std/src/lib.sw +++ b/sway-lib-std/src/lib.sw @@ -45,4 +45,3 @@ pub mod low_level_call; pub mod array_conversions; pub mod bytes_conversions; pub mod clone; -pub mod totalord; diff --git a/sway-lib-std/src/totalord.sw b/sway-lib-std/src/totalord.sw deleted file mode 100644 index a6f35f54a4c..00000000000 --- a/sway-lib-std/src/totalord.sw +++ /dev/null @@ -1,60 +0,0 @@ -//! A utility library for comparing values. -library; - -/// A common trait for comparing values. -pub trait TotalOrd { - /// Compares and returns the minimum of two values. - fn min(self, other: Self) -> Self; - /// Compares and returns the maximum of two values. - fn max(self, other: Self) -> Self; -} - -impl TotalOrd for u8 { - fn min(self, other: Self) -> Self { - if self < other { self } else { other } - } - - fn max(self, other: Self) -> Self { - if self > other { self } else { other } - } -} - -impl TotalOrd for u16 { - fn min(self, other: Self) -> Self { - if self < other { self } else { other } - } - - fn max(self, other: Self) -> Self { - if self > other { self } else { other } - } -} - -impl TotalOrd for u32 { - fn min(self, other: Self) -> Self { - if self < other { self } else { other } - } - - fn max(self, other: Self) -> Self { - if self > other { self } else { other } - } -} - -impl TotalOrd for u64 { - fn min(self, other: Self) -> Self { - if self < other { self } else { other } - } - - fn max(self, other: Self) -> Self { - if self > other { self } else { other } - } -} - -impl TotalOrd for u256 { - fn min(self, other: Self) -> Self { - if self < other { self } else { other } - } - - fn max(self, other: Self) -> Self { - if self > other { self } else { other } - } -} diff --git a/sway-lib-std/src/u128.sw b/sway-lib-std/src/u128.sw index 03d0da6d7e1..8eb22317b64 100644 --- a/sway-lib-std/src/u128.sw +++ b/sway-lib-std/src/u128.sw @@ -11,7 +11,6 @@ use ::flags::{ }; use ::registers::{flags, overflow}; use ::math::*; -use ::totalord::*; use ::result::Result::{self, *}; use ::option::Option::{self, None, Some}; @@ -866,7 +865,7 @@ impl Logarithm for U128 { } } -impl TotalOrd for U128 { +impl core::ops::TotalOrd for U128 { fn min(self, other: Self) -> Self { if self < other { self } else { other } } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/.gitignore b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/.gitignore similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/.gitignore rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/.gitignore diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.lock similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.lock rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.lock diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.toml similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/Forc.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.toml diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle.json similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle.json rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle.json diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle_new_encoding.json similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/json_abi_oracle_new_encoding.json rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle_new_encoding.json diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/src/main.sw similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/src/main.sw rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/src/main.sw diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/test.toml similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/stdlib/totalord_test/test.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/test.toml From 8243fb938f7a79ad3e341b80018b7a83dde73e65 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sun, 20 Oct 2024 12:40:50 +1000 Subject: [PATCH 08/15] migrate tests --- .../{totalord_test => totalord}/.gitignore | 0 .../{totalord_test => totalord}/Forc.lock | 6 +- .../{totalord_test => totalord}/Forc.toml | 2 +- .../language/totalord/json_abi_oracle.json | 64 +++++++++++++++++++ .../json_abi_oracle_new_encoding.json | 2 +- .../{totalord_test => totalord}/src/main.sw | 0 .../{totalord_test => totalord}/test.toml | 0 .../totalord_test/json_abi_oracle.json | 64 ------------------- 8 files changed, 69 insertions(+), 69 deletions(-) rename test/src/e2e_vm_tests/test_programs/should_pass/language/{totalord_test => totalord}/.gitignore (100%) rename test/src/e2e_vm_tests/test_programs/should_pass/language/{totalord_test => totalord}/Forc.lock (54%) rename test/src/e2e_vm_tests/test_programs/should_pass/language/{totalord_test => totalord}/Forc.toml (87%) create mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle.json rename test/src/e2e_vm_tests/test_programs/should_pass/language/{totalord_test => totalord}/json_abi_oracle_new_encoding.json (99%) rename test/src/e2e_vm_tests/test_programs/should_pass/language/{totalord_test => totalord}/src/main.sw (100%) rename test/src/e2e_vm_tests/test_programs/should_pass/language/{totalord_test => totalord}/test.toml (100%) delete mode 100644 test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle.json diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/.gitignore b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/.gitignore similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/.gitignore rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/.gitignore diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/Forc.lock similarity index 54% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.lock rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/Forc.lock index 13a618901d4..27664e3bf63 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.lock +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/Forc.lock @@ -1,13 +1,13 @@ [[package]] name = "core" -source = "path+from-root-36AEC2A470D585EB" +source = "path+from-root-AA6BA29B6C5ED809" [[package]] name = "std" -source = "path+from-root-36AEC2A470D585EB" +source = "path+from-root-AA6BA29B6C5ED809" dependencies = ["core"] [[package]] -name = "totalord_test" +name = "totalord" source = "member" dependencies = ["std"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/Forc.toml similarity index 87% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/Forc.toml index 23cf69a261d..fbde59dd326 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/Forc.toml +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/Forc.toml @@ -2,7 +2,7 @@ authors = ["Fuel Labs "] entry = "main.sw" license = "Apache-2.0" -name = "totalord_test" +name = "totalord" [dependencies] std = { path = "../../../../../../../sway-lib-std" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle.json new file mode 100644 index 00000000000..b6b4a0becda --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle.json @@ -0,0 +1,64 @@ +{ + "concreteTypes": [ + { + "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", + "type": "bool" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "type": "u16" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "type": "u256" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "type": "u32" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "type": "u64" + }, + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "type": "u8" + } + ], + "configurables": [], + "encodingVersion": "1", + "functions": [ + { + "attributes": null, + "inputs": [], + "name": "main", + "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + } + ], + "loggedTypes": [ + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "logId": "14454674236531057292" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "logId": "2992671284987479467" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "logId": "15520703124961489725" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "logId": "1515152261580153489" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "logId": "1970142151624111756" + } + ], + "messagesTypes": [], + "metadataTypes": [], + "programType": "script", + "specVersion": "1" +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json similarity index 99% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle_new_encoding.json rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json index b9a0ad5f18f..5d9532112a9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json @@ -61,4 +61,4 @@ "metadataTypes": [], "programType": "script", "specVersion": "1" -} +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/src/main.sw similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/src/main.sw rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/src/main.sw diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/test.toml similarity index 100% rename from test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/test.toml rename to test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/test.toml diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle.json deleted file mode 100644 index b9a0ad5f18f..00000000000 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord_test/json_abi_oracle.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "concreteTypes": [ - { - "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", - "type": "bool" - }, - { - "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", - "type": "u16" - }, - { - "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", - "type": "u256" - }, - { - "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", - "type": "u32" - }, - { - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "type": "u64" - }, - { - "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", - "type": "u8" - } - ], - "configurables": [], - "encodingVersion": "1", - "functions": [ - { - "attributes": null, - "inputs": [], - "name": "main", - "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" - } - ], - "loggedTypes": [ - { - "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", - "logId": "14454674236531057292" - }, - { - "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", - "logId": "2992671284987479467" - }, - { - "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", - "logId": "15520703124961489725" - }, - { - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "logId": "1515152261580153489" - }, - { - "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", - "logId": "1970142151624111756" - } - ], - "messagesTypes": [], - "metadataTypes": [], - "programType": "script", - "specVersion": "1" -} From e204e3fe99be6190b7bd7bd5350c731db599dd59 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sun, 20 Oct 2024 12:54:11 +1000 Subject: [PATCH 09/15] add documentation --- sway-lib-core/src/ops.sw | 64 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 61 insertions(+), 3 deletions(-) diff --git a/sway-lib-core/src/ops.sw b/sway-lib-core/src/ops.sw index 29ca3b1f5f5..e061d1fadad 100644 --- a/sway-lib-core/src/ops.sw +++ b/sway-lib-core/src/ops.sw @@ -1215,11 +1215,69 @@ impl Shift for u16 { } } -/// Trait to compare values. +/// Trait to compare values of the same type. pub trait TotalOrd { - /// Compares and returns the minimum of two values. + /// Finds the minimum value of two values of the same type. + /// + /// # Arguments + /// + /// * `other`: [Self] - The value of the same type. + /// + /// # Returns + /// + /// * Self - the minimum of the two values, or the same value if they are equal. + /// + /// # Examples + /// + /// ```sway + /// struct MyStruct { + /// val: u64, + /// } + /// + /// impl TotalOrd for MyStruct { + /// fn min(self, other: Self) -> Self { + /// if self.val < other.val { self } else { other } + /// } + /// } + /// + /// fn foo() { + /// let struct1 = MyStruct { val: 10 }; + /// let struct2 = MyStruct { val: 20 }; + /// let min = struct1.min(struct2); + /// assert(min.val == struct1.val); + /// } + /// ``` fn min(self, other: Self) -> Self; - /// Compares and returns the maximum of two values. + /// Finds the maximum value of two values of the same type. + /// + /// # Arguments + /// + /// * `other`: [Self] - The value of the same type. + /// + /// # Returns + /// + /// * Self - the maximum of the two values, or the same value if they are equal. + /// + /// # Examples + /// + /// ```sway + /// struct MyStruct { + /// val: u64, + /// } + /// + /// impl TotalOrd for MyStruct { + /// fn max(self, other: Self) -> Self { + /// if self.val > other.val { self } else { other } + /// } + /// } + /// + /// fn foo() { + /// let struct1 = MyStruct { val: 10 }; + /// let struct2 = MyStruct { val: 20 }; + /// let min = struct1.max(struct2); + /// assert(min.val == struct2.val); + /// } + /// ``` fn max(self, other: Self) -> Self; } From 798d7cafc6d3d0b984a7c583544dc64bc9c2dace Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sun, 20 Oct 2024 12:57:08 +1000 Subject: [PATCH 10/15] last comment nit --- sway-lib-core/src/ops.sw | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sway-lib-core/src/ops.sw b/sway-lib-core/src/ops.sw index e061d1fadad..888761a1a71 100644 --- a/sway-lib-core/src/ops.sw +++ b/sway-lib-core/src/ops.sw @@ -1247,6 +1247,7 @@ pub trait TotalOrd { /// assert(min.val == struct1.val); /// } /// ``` + fn min(self, other: Self) -> Self; /// Finds the maximum value of two values of the same type. /// @@ -1274,8 +1275,8 @@ pub trait TotalOrd { /// fn foo() { /// let struct1 = MyStruct { val: 10 }; /// let struct2 = MyStruct { val: 20 }; - /// let min = struct1.max(struct2); - /// assert(min.val == struct2.val); + /// let max = struct1.max(struct2); + /// assert(max.val == struct2.val); /// } /// ``` fn max(self, other: Self) -> Self; From e97b7a126ffb84e102dae3d9300eb4b811c41460 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sun, 20 Oct 2024 12:59:08 +1000 Subject: [PATCH 11/15] newline --- .../should_pass/language/ops/json_abi_oracle_new_encoding.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/json_abi_oracle_new_encoding.json index 668a88f2e07..0994f5da907 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/json_abi_oracle_new_encoding.json @@ -20,4 +20,4 @@ "metadataTypes": [], "programType": "script", "specVersion": "1" -} \ No newline at end of file +} From 27606cd6990fedab05e0bde7586d6a8ba6aa6033 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Sun, 20 Oct 2024 13:01:06 +1000 Subject: [PATCH 12/15] undo unwanted change, fix newline --- .../should_pass/language/ops/json_abi_oracle_new_encoding.json | 2 +- .../language/totalord/json_abi_oracle_new_encoding.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/json_abi_oracle_new_encoding.json index 0994f5da907..668a88f2e07 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/ops/json_abi_oracle_new_encoding.json @@ -20,4 +20,4 @@ "metadataTypes": [], "programType": "script", "specVersion": "1" -} +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json index 5d9532112a9..b9a0ad5f18f 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json @@ -61,4 +61,4 @@ "metadataTypes": [], "programType": "script", "specVersion": "1" -} \ No newline at end of file +} From a8bd39f511c116d02c41eae4eb905078750bc648 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Mon, 21 Oct 2024 14:10:31 +1000 Subject: [PATCH 13/15] forc fmt ops.sw --- sway-lib-core/src/ops.sw | 1 - 1 file changed, 1 deletion(-) diff --git a/sway-lib-core/src/ops.sw b/sway-lib-core/src/ops.sw index 888761a1a71..371bbff5382 100644 --- a/sway-lib-core/src/ops.sw +++ b/sway-lib-core/src/ops.sw @@ -1247,7 +1247,6 @@ pub trait TotalOrd { /// assert(min.val == struct1.val); /// } /// ``` - fn min(self, other: Self) -> Self; /// Finds the maximum value of two values of the same type. /// From 41914c2215edbf23996af1b6e70443315b5fc5b2 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Mon, 21 Oct 2024 14:34:53 +1000 Subject: [PATCH 14/15] fix impl_trait test --- forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs b/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs index 4699c55a6a9..8f96a41e856 100644 --- a/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs +++ b/forc-plugins/forc-doc/src/tests/expects/impl_trait/mod.rs @@ -44,7 +44,7 @@ fn test_impl_traits_default() { assert_search_js( &doc_path, &expect![[r#" - var SEARCH_INDEX={"core":[{"html_filename":"trait.AsRawSlice.html","module_info":["core","raw_slice"],"name":"AsRawSlice","preview":"Trait to return a type as a raw_slice.\n","type_name":"trait"},{"html_filename":"fn.from_str_array.html","module_info":["core","str"],"name":"from_str_array","preview":"","type_name":"function"},{"html_filename":"trait.Add.html","module_info":["core","ops"],"name":"Add","preview":"Trait for the addition of two values.\n","type_name":"trait"},{"html_filename":"trait.Subtract.html","module_info":["core","ops"],"name":"Subtract","preview":"Trait for the subtraction of two values.\n","type_name":"trait"},{"html_filename":"trait.Multiply.html","module_info":["core","ops"],"name":"Multiply","preview":"Trait for the multiplication of two values.\n","type_name":"trait"},{"html_filename":"trait.Divide.html","module_info":["core","ops"],"name":"Divide","preview":"Trait for the division of two values.\n","type_name":"trait"},{"html_filename":"trait.Mod.html","module_info":["core","ops"],"name":"Mod","preview":"Trait for the modulo of two values.\n","type_name":"trait"},{"html_filename":"trait.Not.html","module_info":["core","ops"],"name":"Not","preview":"Trait to invert a type.\n","type_name":"trait"},{"html_filename":"trait.Eq.html","module_info":["core","ops"],"name":"Eq","preview":"Trait to evaluate if two types are equal.\n","type_name":"trait"},{"html_filename":"trait.Ord.html","module_info":["core","ops"],"name":"Ord","preview":"Trait to evaluate if one value is greater or less than another of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseAnd.html","module_info":["core","ops"],"name":"BitwiseAnd","preview":"Trait to bitwise AND two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseOr.html","module_info":["core","ops"],"name":"BitwiseOr","preview":"Trait to bitwise OR two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseXor.html","module_info":["core","ops"],"name":"BitwiseXor","preview":"Trait to bitwise XOR two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.Shift.html","module_info":["core","ops"],"name":"Shift","preview":"Trait to bit shift a value.\n","type_name":"trait"},{"html_filename":"fn.ok_str_eq.html","module_info":["core","ops"],"name":"ok_str_eq","preview":"","type_name":"function"},{"html_filename":"struct.StorageKey.html","module_info":["core","storage"],"name":"StorageKey","preview":"Describes a location in storage.\n","type_name":"struct"},{"html_filename":"struct.Buffer.html","module_info":["core","codec"],"name":"Buffer","preview":"","type_name":"struct"},{"html_filename":"struct.BufferReader.html","module_info":["core","codec"],"name":"BufferReader","preview":"","type_name":"struct"},{"html_filename":"trait.AbiDecode.html","module_info":["core","codec"],"name":"AbiDecode","preview":"","type_name":"trait"},{"html_filename":"trait.AbiEncode.html","module_info":["core","codec"],"name":"AbiEncode","preview":"","type_name":"trait"},{"html_filename":"fn.encode.html","module_info":["core","codec"],"name":"encode","preview":"","type_name":"function"},{"html_filename":"fn.abi_decode.html","module_info":["core","codec"],"name":"abi_decode","preview":"","type_name":"function"},{"html_filename":"fn.abi_decode_in_place.html","module_info":["core","codec"],"name":"abi_decode_in_place","preview":"","type_name":"function"},{"html_filename":"fn.contract_call.html","module_info":["core","codec"],"name":"contract_call","preview":"","type_name":"function"},{"html_filename":"fn.decode_script_data.html","module_info":["core","codec"],"name":"decode_script_data","preview":"","type_name":"function"},{"html_filename":"fn.decode_predicate_data.html","module_info":["core","codec"],"name":"decode_predicate_data","preview":"","type_name":"function"},{"html_filename":"fn.decode_predicate_data_by_index.html","module_info":["core","codec"],"name":"decode_predicate_data_by_index","preview":"","type_name":"function"},{"html_filename":"fn.decode_first_param.html","module_info":["core","codec"],"name":"decode_first_param","preview":"","type_name":"function"},{"html_filename":"fn.decode_second_param.html","module_info":["core","codec"],"name":"decode_second_param","preview":"","type_name":"function"},{"html_filename":"primitive.u256.html","module_info":["core"],"name":"u256","preview":"256-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.u64.html","module_info":["core"],"name":"u64","preview":"64-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.u32.html","module_info":["core"],"name":"u32","preview":"32-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.u16.html","module_info":["core"],"name":"u16","preview":"16-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.u8.html","module_info":["core"],"name":"u8","preview":"8-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.b256.html","module_info":["core"],"name":"b256","preview":"256 bits (32 bytes), i.e. a hash","type_name":"primitive"},{"html_filename":"primitive.str.html","module_info":["core"],"name":"str","preview":"string slice","type_name":"primitive"},{"html_filename":"primitive.bool.html","module_info":["core"],"name":"bool","preview":"Boolean true or false","type_name":"primitive"},{"html_filename":"primitive.str[0].html","module_info":["core"],"name":"str[0]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[1].html","module_info":["core"],"name":"str[1]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[2].html","module_info":["core"],"name":"str[2]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[3].html","module_info":["core"],"name":"str[3]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[4].html","module_info":["core"],"name":"str[4]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[5].html","module_info":["core"],"name":"str[5]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[6].html","module_info":["core"],"name":"str[6]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[7].html","module_info":["core"],"name":"str[7]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[8].html","module_info":["core"],"name":"str[8]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[9].html","module_info":["core"],"name":"str[9]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[10].html","module_info":["core"],"name":"str[10]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[11].html","module_info":["core"],"name":"str[11]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[12].html","module_info":["core"],"name":"str[12]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[13].html","module_info":["core"],"name":"str[13]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[14].html","module_info":["core"],"name":"str[14]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[15].html","module_info":["core"],"name":"str[15]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[16].html","module_info":["core"],"name":"str[16]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[17].html","module_info":["core"],"name":"str[17]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[18].html","module_info":["core"],"name":"str[18]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[19].html","module_info":["core"],"name":"str[19]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[20].html","module_info":["core"],"name":"str[20]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[21].html","module_info":["core"],"name":"str[21]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[22].html","module_info":["core"],"name":"str[22]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[23].html","module_info":["core"],"name":"str[23]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[24].html","module_info":["core"],"name":"str[24]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[25].html","module_info":["core"],"name":"str[25]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[26].html","module_info":["core"],"name":"str[26]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[27].html","module_info":["core"],"name":"str[27]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[28].html","module_info":["core"],"name":"str[28]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[29].html","module_info":["core"],"name":"str[29]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[30].html","module_info":["core"],"name":"str[30]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[31].html","module_info":["core"],"name":"str[31]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[32].html","module_info":["core"],"name":"str[32]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[33].html","module_info":["core"],"name":"str[33]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[34].html","module_info":["core"],"name":"str[34]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[35].html","module_info":["core"],"name":"str[35]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[36].html","module_info":["core"],"name":"str[36]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[37].html","module_info":["core"],"name":"str[37]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[38].html","module_info":["core"],"name":"str[38]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[39].html","module_info":["core"],"name":"str[39]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[40].html","module_info":["core"],"name":"str[40]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[41].html","module_info":["core"],"name":"str[41]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[42].html","module_info":["core"],"name":"str[42]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[43].html","module_info":["core"],"name":"str[43]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[44].html","module_info":["core"],"name":"str[44]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[45].html","module_info":["core"],"name":"str[45]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[46].html","module_info":["core"],"name":"str[46]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[47].html","module_info":["core"],"name":"str[47]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[48].html","module_info":["core"],"name":"str[48]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[49].html","module_info":["core"],"name":"str[49]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[50].html","module_info":["core"],"name":"str[50]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[51].html","module_info":["core"],"name":"str[51]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[52].html","module_info":["core"],"name":"str[52]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[53].html","module_info":["core"],"name":"str[53]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[54].html","module_info":["core"],"name":"str[54]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[55].html","module_info":["core"],"name":"str[55]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[56].html","module_info":["core"],"name":"str[56]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[57].html","module_info":["core"],"name":"str[57]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[58].html","module_info":["core"],"name":"str[58]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[59].html","module_info":["core"],"name":"str[59]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[60].html","module_info":["core"],"name":"str[60]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[61].html","module_info":["core"],"name":"str[61]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[62].html","module_info":["core"],"name":"str[62]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[63].html","module_info":["core"],"name":"str[63]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[64].html","module_info":["core"],"name":"str[64]","preview":"fixed-length string","type_name":"primitive"}],"impl_traits":[{"html_filename":"trait.Foo.html","module_info":["impl_traits","foo"],"name":"Foo","preview":"","type_name":"trait"},{"html_filename":"trait.Baz.html","module_info":["impl_traits","foo"],"name":"Baz","preview":"","type_name":"trait"},{"html_filename":"struct.Bar.html","module_info":["impl_traits","bar"],"name":"Bar","preview":"","type_name":"struct"}]}; + var SEARCH_INDEX={"core":[{"html_filename":"trait.AsRawSlice.html","module_info":["core","raw_slice"],"name":"AsRawSlice","preview":"Trait to return a type as a raw_slice.\n","type_name":"trait"},{"html_filename":"fn.from_str_array.html","module_info":["core","str"],"name":"from_str_array","preview":"","type_name":"function"},{"html_filename":"trait.Add.html","module_info":["core","ops"],"name":"Add","preview":"Trait for the addition of two values.\n","type_name":"trait"},{"html_filename":"trait.Subtract.html","module_info":["core","ops"],"name":"Subtract","preview":"Trait for the subtraction of two values.\n","type_name":"trait"},{"html_filename":"trait.Multiply.html","module_info":["core","ops"],"name":"Multiply","preview":"Trait for the multiplication of two values.\n","type_name":"trait"},{"html_filename":"trait.Divide.html","module_info":["core","ops"],"name":"Divide","preview":"Trait for the division of two values.\n","type_name":"trait"},{"html_filename":"trait.Mod.html","module_info":["core","ops"],"name":"Mod","preview":"Trait for the modulo of two values.\n","type_name":"trait"},{"html_filename":"trait.Not.html","module_info":["core","ops"],"name":"Not","preview":"Trait to invert a type.\n","type_name":"trait"},{"html_filename":"trait.Eq.html","module_info":["core","ops"],"name":"Eq","preview":"Trait to evaluate if two types are equal.\n","type_name":"trait"},{"html_filename":"trait.Ord.html","module_info":["core","ops"],"name":"Ord","preview":"Trait to evaluate if one value is greater or less than another of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseAnd.html","module_info":["core","ops"],"name":"BitwiseAnd","preview":"Trait to bitwise AND two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseOr.html","module_info":["core","ops"],"name":"BitwiseOr","preview":"Trait to bitwise OR two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.BitwiseXor.html","module_info":["core","ops"],"name":"BitwiseXor","preview":"Trait to bitwise XOR two values of the same type.\n","type_name":"trait"},{"html_filename":"trait.Shift.html","module_info":["core","ops"],"name":"Shift","preview":"Trait to bit shift a value.\n","type_name":"trait"},{"html_filename":"trait.TotalOrd.html","module_info":["core","ops"],"name":"TotalOrd","preview":"Trait to compare values of the same type.\n","type_name":"trait"},{"html_filename":"fn.ok_str_eq.html","module_info":["core","ops"],"name":"ok_str_eq","preview":"","type_name":"function"},{"html_filename":"struct.StorageKey.html","module_info":["core","storage"],"name":"StorageKey","preview":"Describes a location in storage.\n","type_name":"struct"},{"html_filename":"struct.Buffer.html","module_info":["core","codec"],"name":"Buffer","preview":"","type_name":"struct"},{"html_filename":"struct.BufferReader.html","module_info":["core","codec"],"name":"BufferReader","preview":"","type_name":"struct"},{"html_filename":"trait.AbiDecode.html","module_info":["core","codec"],"name":"AbiDecode","preview":"","type_name":"trait"},{"html_filename":"trait.AbiEncode.html","module_info":["core","codec"],"name":"AbiEncode","preview":"","type_name":"trait"},{"html_filename":"fn.encode.html","module_info":["core","codec"],"name":"encode","preview":"","type_name":"function"},{"html_filename":"fn.abi_decode.html","module_info":["core","codec"],"name":"abi_decode","preview":"","type_name":"function"},{"html_filename":"fn.abi_decode_in_place.html","module_info":["core","codec"],"name":"abi_decode_in_place","preview":"","type_name":"function"},{"html_filename":"fn.contract_call.html","module_info":["core","codec"],"name":"contract_call","preview":"","type_name":"function"},{"html_filename":"fn.decode_script_data.html","module_info":["core","codec"],"name":"decode_script_data","preview":"","type_name":"function"},{"html_filename":"fn.decode_predicate_data.html","module_info":["core","codec"],"name":"decode_predicate_data","preview":"","type_name":"function"},{"html_filename":"fn.decode_predicate_data_by_index.html","module_info":["core","codec"],"name":"decode_predicate_data_by_index","preview":"","type_name":"function"},{"html_filename":"fn.decode_first_param.html","module_info":["core","codec"],"name":"decode_first_param","preview":"","type_name":"function"},{"html_filename":"fn.decode_second_param.html","module_info":["core","codec"],"name":"decode_second_param","preview":"","type_name":"function"},{"html_filename":"primitive.u256.html","module_info":["core"],"name":"u256","preview":"256-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.u64.html","module_info":["core"],"name":"u64","preview":"64-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.u32.html","module_info":["core"],"name":"u32","preview":"32-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.u16.html","module_info":["core"],"name":"u16","preview":"16-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.u8.html","module_info":["core"],"name":"u8","preview":"8-bit unsigned integer","type_name":"primitive"},{"html_filename":"primitive.b256.html","module_info":["core"],"name":"b256","preview":"256 bits (32 bytes), i.e. a hash","type_name":"primitive"},{"html_filename":"primitive.str.html","module_info":["core"],"name":"str","preview":"string slice","type_name":"primitive"},{"html_filename":"primitive.bool.html","module_info":["core"],"name":"bool","preview":"Boolean true or false","type_name":"primitive"},{"html_filename":"primitive.str[0].html","module_info":["core"],"name":"str[0]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[1].html","module_info":["core"],"name":"str[1]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[2].html","module_info":["core"],"name":"str[2]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[3].html","module_info":["core"],"name":"str[3]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[4].html","module_info":["core"],"name":"str[4]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[5].html","module_info":["core"],"name":"str[5]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[6].html","module_info":["core"],"name":"str[6]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[7].html","module_info":["core"],"name":"str[7]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[8].html","module_info":["core"],"name":"str[8]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[9].html","module_info":["core"],"name":"str[9]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[10].html","module_info":["core"],"name":"str[10]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[11].html","module_info":["core"],"name":"str[11]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[12].html","module_info":["core"],"name":"str[12]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[13].html","module_info":["core"],"name":"str[13]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[14].html","module_info":["core"],"name":"str[14]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[15].html","module_info":["core"],"name":"str[15]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[16].html","module_info":["core"],"name":"str[16]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[17].html","module_info":["core"],"name":"str[17]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[18].html","module_info":["core"],"name":"str[18]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[19].html","module_info":["core"],"name":"str[19]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[20].html","module_info":["core"],"name":"str[20]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[21].html","module_info":["core"],"name":"str[21]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[22].html","module_info":["core"],"name":"str[22]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[23].html","module_info":["core"],"name":"str[23]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[24].html","module_info":["core"],"name":"str[24]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[25].html","module_info":["core"],"name":"str[25]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[26].html","module_info":["core"],"name":"str[26]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[27].html","module_info":["core"],"name":"str[27]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[28].html","module_info":["core"],"name":"str[28]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[29].html","module_info":["core"],"name":"str[29]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[30].html","module_info":["core"],"name":"str[30]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[31].html","module_info":["core"],"name":"str[31]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[32].html","module_info":["core"],"name":"str[32]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[33].html","module_info":["core"],"name":"str[33]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[34].html","module_info":["core"],"name":"str[34]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[35].html","module_info":["core"],"name":"str[35]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[36].html","module_info":["core"],"name":"str[36]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[37].html","module_info":["core"],"name":"str[37]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[38].html","module_info":["core"],"name":"str[38]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[39].html","module_info":["core"],"name":"str[39]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[40].html","module_info":["core"],"name":"str[40]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[41].html","module_info":["core"],"name":"str[41]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[42].html","module_info":["core"],"name":"str[42]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[43].html","module_info":["core"],"name":"str[43]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[44].html","module_info":["core"],"name":"str[44]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[45].html","module_info":["core"],"name":"str[45]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[46].html","module_info":["core"],"name":"str[46]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[47].html","module_info":["core"],"name":"str[47]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[48].html","module_info":["core"],"name":"str[48]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[49].html","module_info":["core"],"name":"str[49]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[50].html","module_info":["core"],"name":"str[50]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[51].html","module_info":["core"],"name":"str[51]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[52].html","module_info":["core"],"name":"str[52]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[53].html","module_info":["core"],"name":"str[53]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[54].html","module_info":["core"],"name":"str[54]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[55].html","module_info":["core"],"name":"str[55]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[56].html","module_info":["core"],"name":"str[56]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[57].html","module_info":["core"],"name":"str[57]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[58].html","module_info":["core"],"name":"str[58]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[59].html","module_info":["core"],"name":"str[59]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[60].html","module_info":["core"],"name":"str[60]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[61].html","module_info":["core"],"name":"str[61]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[62].html","module_info":["core"],"name":"str[62]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[63].html","module_info":["core"],"name":"str[63]","preview":"fixed-length string","type_name":"primitive"},{"html_filename":"primitive.str[64].html","module_info":["core"],"name":"str[64]","preview":"fixed-length string","type_name":"primitive"}],"impl_traits":[{"html_filename":"trait.Foo.html","module_info":["impl_traits","foo"],"name":"Foo","preview":"","type_name":"trait"},{"html_filename":"trait.Baz.html","module_info":["impl_traits","foo"],"name":"Baz","preview":"","type_name":"trait"},{"html_filename":"struct.Bar.html","module_info":["impl_traits","bar"],"name":"Bar","preview":"","type_name":"struct"}]}; "object"==typeof exports&&"undefined"!=typeof module&&(module.exports=SEARCH_INDEX);"#]], ); assert_file_tree( @@ -154,6 +154,7 @@ fn test_impl_traits_default() { "core/ops/trait.Ord.html", "core/ops/trait.Shift.html", "core/ops/trait.Subtract.html", + "core/ops/trait.TotalOrd.html", "core/raw_slice/index.html", "core/raw_slice/trait.AsRawSlice.html", "core/storage/index.html", From 44580e47800afd3e95fb987a2c120432d6769ca8 Mon Sep 17 00:00:00 2001 From: James Snewin Date: Mon, 21 Oct 2024 14:47:56 +1000 Subject: [PATCH 15/15] fix formatting for oracle outputs --- .../language/totalord/json_abi_oracle.json | 126 +++++++++--------- .../json_abi_oracle_new_encoding.json | 2 +- 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle.json index b6b4a0becda..5d9532112a9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle.json @@ -1,64 +1,64 @@ { - "concreteTypes": [ - { - "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", - "type": "bool" - }, - { - "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", - "type": "u16" - }, - { - "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", - "type": "u256" - }, - { - "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", - "type": "u32" - }, - { - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "type": "u64" - }, - { - "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", - "type": "u8" - } - ], - "configurables": [], - "encodingVersion": "1", - "functions": [ - { - "attributes": null, - "inputs": [], - "name": "main", - "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" - } - ], - "loggedTypes": [ - { - "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", - "logId": "14454674236531057292" - }, - { - "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", - "logId": "2992671284987479467" - }, - { - "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", - "logId": "15520703124961489725" - }, - { - "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", - "logId": "1515152261580153489" - }, - { - "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", - "logId": "1970142151624111756" - } - ], - "messagesTypes": [], - "metadataTypes": [], - "programType": "script", - "specVersion": "1" -} + "concreteTypes": [ + { + "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", + "type": "bool" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "type": "u16" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "type": "u256" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "type": "u32" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "type": "u64" + }, + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "type": "u8" + } + ], + "configurables": [], + "encodingVersion": "1", + "functions": [ + { + "attributes": null, + "inputs": [], + "name": "main", + "output": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903" + } + ], + "loggedTypes": [ + { + "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", + "logId": "14454674236531057292" + }, + { + "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", + "logId": "2992671284987479467" + }, + { + "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", + "logId": "15520703124961489725" + }, + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "logId": "1515152261580153489" + }, + { + "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", + "logId": "1970142151624111756" + } + ], + "messagesTypes": [], + "metadataTypes": [], + "programType": "script", + "specVersion": "1" +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json index b9a0ad5f18f..5d9532112a9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/totalord/json_abi_oracle_new_encoding.json @@ -61,4 +61,4 @@ "metadataTypes": [], "programType": "script", "specVersion": "1" -} +} \ No newline at end of file