From 53d8cc96578c3f0863a8ec9ea1386c5089911442 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 15 Aug 2023 21:19:58 +0530 Subject: [PATCH 01/49] init --- Cargo.lock | 578 +++++++++++++++++------------------ sway-lib-std/src/alias.sw | 2 - sway-lib-std/src/asset_id.sw | 114 ++++++- sway-lib-std/src/prelude.sw | 1 + sway-lib-std/src/token.sw | 3 +- 5 files changed, 391 insertions(+), 307 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ac823b75faf..effc9e660a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,6 +38,17 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom 0.2.10", + "once_cell", + "version_check", +] + [[package]] name = "ahash" version = "0.8.3" @@ -51,9 +62,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b8f9420f797f2d9e935edf629310eb938a0d839f984e25327f3c7eed22300c" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] @@ -154,9 +165,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -164,9 +175,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.72" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "arrayref" @@ -210,13 +221,13 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] @@ -352,9 +363,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" [[package]] name = "bitmaps" @@ -422,15 +433,15 @@ dependencies = [ [[package]] name = "blake3" -version = "1.4.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" +checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" dependencies = [ "arrayref", "arrayvec 0.7.4", "cc", "cfg-if", - "constant_time_eq 0.3.0", + "constant_time_eq 0.2.6", "digest 0.10.7", ] @@ -495,7 +506,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", - "regex-automata 0.3.6", + "regex-automata 0.3.0", "serde", ] @@ -534,12 +545,11 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.82" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" dependencies = [ "jobserver", - "libc", ] [[package]] @@ -647,20 +657,20 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.21" +version = "4.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" +checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" dependencies = [ "clap_builder", - "clap_derive 4.3.12", + "clap_derive 4.3.2", "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.21" +version = "4.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" dependencies = [ "anstream", "anstyle", @@ -685,7 +695,7 @@ version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce" dependencies = [ - "clap 4.3.21", + "clap 4.3.11", ] [[package]] @@ -703,14 +713,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.12" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" +checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] @@ -764,7 +774,7 @@ dependencies = [ "getrandom 0.2.10", "hmac", "once_cell", - "pbkdf2 0.12.2", + "pbkdf2 0.12.1", "rand", "sha2 0.10.7", "thiserror", @@ -842,7 +852,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784836d0812dade01579cc0cc9b1684847044e716fd7aa6bffbc172e42199500" dependencies = [ - "clap 4.3.21", + "clap 4.3.11", "entities", "memchr", "once_cell", @@ -871,9 +881,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "6340df57935414636969091153f35f68d9f00bbc8fb4a9c6054706c213e6c6bc" [[package]] name = "constant_time_eq" @@ -887,12 +897,6 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - [[package]] name = "convert_case" version = "0.4.0" @@ -906,7 +910,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.25", + "time 0.3.22", "version_check", ] @@ -923,7 +927,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "time 0.3.25", + "time 0.3.22", "url", ] @@ -994,7 +998,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.3.21", + "clap 4.3.11", "criterion-plot", "is-terminal", "itertools", @@ -1023,9 +1027,9 @@ dependencies = [ [[package]] name = "critical-section" -version = "1.1.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" +checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" [[package]] name = "crossbeam-channel" @@ -1227,12 +1231,12 @@ dependencies = [ [[package]] name = "dashmap" -version = "5.5.0" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6943ae99c34386c84a470c499d3414f66502a41340aa895406e0d2e4a207b91d" +checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" dependencies = [ "cfg-if", - "hashbrown 0.14.0", + "hashbrown 0.12.3", "lock_api", "once_cell", "parking_lot_core 0.9.8", @@ -1266,20 +1270,14 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" dependencies = [ "const-oid", "zeroize", ] -[[package]] -name = "deranged" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" - [[package]] name = "derivative" version = "2.2.0" @@ -1306,9 +1304,9 @@ dependencies = [ [[package]] name = "deunicode" -version = "0.4.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d95203a6a50906215a502507c0f879a0ce7ff205a6111e2db2a5ef8e4bb92e43" +checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690" [[package]] name = "devault" @@ -1417,9 +1415,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" dependencies = [ "der", "digest 0.10.7", @@ -1464,9 +1462,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" @@ -1524,7 +1522,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] @@ -1542,15 +1540,15 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" [[package]] name = "errno" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", @@ -1645,14 +1643,14 @@ checksum = "dd65f1b59dd22d680c7a626cc4a000c1e03d241c51c3e034d2bc9f1e90734f9b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] name = "fancy-regex" -version = "0.11.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" +checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf" dependencies = [ "bit-set", "regex", @@ -1660,9 +1658,12 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] [[package]] name = "fd-lock" @@ -1671,7 +1672,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ "cfg-if", - "rustix 0.38.8", + "rustix 0.38.3", "windows-sys 0.48.0", ] @@ -1708,13 +1709,13 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", + "redox_syscall 0.2.16", "windows-sys 0.48.0", ] @@ -1825,14 +1826,14 @@ name = "forc-doc" version = "0.44.0" dependencies = [ "anyhow", - "clap 4.3.21", + "clap 4.3.11", "colored", "comrak", "forc-pkg", "forc-util", "horrorshow", "include_dir", - "opener 0.5.2", + "opener", "sway-ast", "sway-core", "sway-lsp", @@ -1972,7 +1973,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8df9ef0ea688621e659a30aee08a3f67df3de0ab9340203736eabc074e223af2" dependencies = [ "anyhow", - "clap 4.3.21", + "clap 4.3.11", "eth-keystore", "fuel-crypto", "fuel-types", @@ -2065,7 +2066,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.28", + "syn 2.0.23", "thiserror", ] @@ -2322,9 +2323,9 @@ dependencies = [ [[package]] name = "fuels" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0a24ee9d2eee78b933bea2ca275e00a558111ffa37e32dc4dce060dc89b70b6" +checksum = "aa0d9fe01b4f234c07ef7d9e619ccb8d17e4a502af63f30a30a2097acab0dfdf" dependencies = [ "fuel-core-client", "fuel-tx", @@ -2337,9 +2338,9 @@ dependencies = [ [[package]] name = "fuels-accounts" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9556ba92649eda5e1a37d0b3f846e4ab03cc3f0b11106b371f48cf01799d1b95" +checksum = "5b8d03d520ea383743f78af6909ac5a04c805ad4eb1f03d99c80b0d4679a44f6" dependencies = [ "async-trait", "bytes", @@ -2364,9 +2365,9 @@ dependencies = [ [[package]] name = "fuels-code-gen" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac588c4ab7e8ff614c82e065f7fa42c972ee7114bd51619af28e827ee8d113a" +checksum = "a18b307990519c78c5c7661666a912c05915d1deed7bf4b577b50987fe97ae31" dependencies = [ "Inflector", "fuel-abi-types 0.3.0", @@ -2375,14 +2376,14 @@ dependencies = [ "quote", "regex", "serde_json", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] name = "fuels-core" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba9ed2470f4554a4ef46637589cfec5994826174e0541982d098d9e8339fd337" +checksum = "79566b388d8822c4c06aac60d9647dbb9393807cd5e6653cfa0c1630644da196" dependencies = [ "bech32 0.9.1", "chrono", @@ -2409,9 +2410,9 @@ dependencies = [ [[package]] name = "fuels-macros" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a45842e7d90d899aaa282ea4b154c6fd385759e30b7df6a533a30772a55d33a" +checksum = "8c92232ef42b254a1649c6a6bfddd35b2c50f358b15e98e953eb82d69b397c57" dependencies = [ "Inflector", "fuel-abi-types 0.3.0", @@ -2422,14 +2423,14 @@ dependencies = [ "rand", "regex", "serde_json", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] name = "fuels-programs" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6815775e3a9cd9fbfd80f3b53a6a3338510eef4f31e3f6885d45b5603496b00b" +checksum = "e1e4250bb73ff44cfdcd39f86c0e3163c11753e16583013fae698e9132400280" dependencies = [ "async-trait", "bytes", @@ -2455,9 +2456,9 @@ dependencies = [ [[package]] name = "fuels-test-helpers" -version = "0.45.0" +version = "0.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32910f7aeed5fd5f8293aef233100e8224c992096f0310fe7ba8df0a1069a56e" +checksum = "4df1a046adf1862f5b1844800abed842c6748abb2dc94c8e0df43473e96c3f4d" dependencies = [ "fuel-core-chain-config", "fuel-core-client", @@ -2540,7 +2541,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] @@ -2779,6 +2780,9 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash 0.7.6", +] [[package]] name = "hashbrown" @@ -2786,7 +2790,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash", + "ahash 0.8.3", ] [[package]] @@ -2902,9 +2906,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "humantime" @@ -2929,7 +2933,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2", "tokio", "tower-service", "tracing", @@ -2976,7 +2980,7 @@ dependencies = [ "http", "hyper", "log", - "rustls 0.21.6", + "rustls 0.21.3", "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.24.1", @@ -3191,9 +3195,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.31.0" +version = "1.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0770b0a3d4c70567f0d58331f3088b0e4c4f56c9b8d764efe654b4a5d46de3a" +checksum = "28491f7753051e5704d4d0ae7860d45fae3238d7d235bc4289dcd45c48d3cec3" dependencies = [ "console", "lazy_static", @@ -3275,12 +3279,12 @@ checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" dependencies = [ "hermit-abi 0.3.2", - "rustix 0.38.8", + "rustix 0.38.3", "windows-sys 0.48.0", ] @@ -3295,9 +3299,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" [[package]] name = "jobserver" @@ -3342,9 +3346,9 @@ dependencies = [ [[package]] name = "kqueue" -version = "1.0.8" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" +checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98" dependencies = [ "kqueue-sys", "libc", @@ -3352,9 +3356,9 @@ dependencies = [ [[package]] name = "kqueue-sys" -version = "1.0.4" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" +checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" dependencies = [ "bitflags 1.3.2", "libc", @@ -3405,9 +3409,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" dependencies = [ "cc", "libc", @@ -3438,9 +3442,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.5" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" [[package]] name = "lock_api" @@ -3454,9 +3458,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "logos" @@ -3483,9 +3487,9 @@ dependencies = [ [[package]] name = "lsp-types" -version = "0.94.1" +version = "0.94.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" +checksum = "0b63735a13a1f9cd4f4835223d828ed9c2e35c8c5e61837774399f558b6a1237" dependencies = [ "bitflags 1.3.2", "serde", @@ -3511,20 +3515,20 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "mdbook" -version = "0.4.34" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55eb7c4dad20cc5bc15181c2aaf43d5689d5c3e0b80b50cc4cf0b7fe72a26d9" +checksum = "7b67ee4a744f36e6280792016c17e69921b51df357181d1eb17d620fcc3609f3" dependencies = [ "anyhow", "chrono", - "clap 4.3.21", + "clap 4.3.11", "clap_complete 4.3.2", "env_logger", "handlebars", "log", "memchr", "once_cell", - "opener 0.6.1", + "opener", "pulldown-cmark", "regex", "serde", @@ -3792,15 +3796,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "normpath" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5" -dependencies = [ - "windows-sys 0.48.0", -] - [[package]] name = "notify" version = "5.2.0" @@ -3850,9 +3845,9 @@ dependencies = [ [[package]] name = "num" -version = "0.4.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" +checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ "num-bigint", "num-complex", @@ -3876,9 +3871,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.4" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" +checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" dependencies = [ "num-traits", ] @@ -3918,9 +3913,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", ] @@ -4021,22 +4016,11 @@ dependencies = [ "winapi", ] -[[package]] -name = "opener" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788" -dependencies = [ - "bstr", - "normpath", - "winapi", -] - [[package]] name = "openssl" -version = "0.10.56" +version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ "bitflags 1.3.2", "cfg-if", @@ -4055,7 +4039,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] @@ -4066,18 +4050,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.27.0+1.1.1v" +version = "111.26.0+1.1.1u" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e8f197c82d7511c5b014030c9b1efeda40d7d5f99d23b4ceed3524a5e63f02" +checksum = "efc62c9f12b22b8f5208c23a7200a442b2e5999f8bdf80233852122b5a4f6f37" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.91" +version = "0.9.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" dependencies = [ "cc", "libc", @@ -4127,9 +4111,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.4" +version = "3.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" +checksum = "756d439303e94fae44f288ba881ad29670c65b0c4b0e05674ca81061bb65f2c5" dependencies = [ "arrayvec 0.7.4", "bitvec 1.0.1", @@ -4141,9 +4125,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.4" +version = "3.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" +checksum = "9d884d78fcf214d70b1e239fcd1c6e5e95aa3be1881918da2e488cc946c7a476" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4201,9 +4185,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" [[package]] name = "pbkdf2" @@ -4216,9 +4200,9 @@ dependencies = [ [[package]] name = "pbkdf2" -version = "0.12.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" +checksum = "f0ca0b5a68607598bf3bad68f32227a8164f6254833f84eafaac409cd6746c31" dependencies = [ "digest 0.10.7", "hmac", @@ -4259,9 +4243,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.2" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" +checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" dependencies = [ "thiserror", "ucd-trie", @@ -4269,9 +4253,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.2" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" +checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" dependencies = [ "pest", "pest_generator", @@ -4279,22 +4263,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.2" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" +checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] name = "pest_meta" -version = "2.7.2" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" +checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" dependencies = [ "once_cell", "pest", @@ -4359,29 +4343,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -4407,16 +4391,16 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "plist" -version = "1.5.0" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" +checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" dependencies = [ "base64 0.21.2", "indexmap 1.9.3", "line-wrap", "quick-xml", "serde", - "time 0.3.25", + "time 0.3.22", ] [[package]] @@ -4458,9 +4442,9 @@ dependencies = [ [[package]] name = "postcard" -version = "1.0.6" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9ee729232311d3cd113749948b689627618133b1c5012b77342c1950b25eaeb" +checksum = "cfa512cd0d087cc9f99ad30a1bf64795b67871edbead083ffc3a4dfafa59aa00" dependencies = [ "cobs", "heapless", @@ -4588,9 +4572,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] @@ -4624,18 +4608,18 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.29.0" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" +checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.32" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ "proc-macro2", ] @@ -4776,14 +4760,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "89089e897c013b3deb627116ae56a6955a72b8bed395c9526af31c9fe528b484" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.6", - "regex-syntax 0.7.4", + "regex-automata 0.3.0", + "regex-syntax 0.7.3", ] [[package]] @@ -4797,13 +4781,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "fa250384981ea14565685dea16a9ccc4d1c541a13f82b9c168572264d1df8c56" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.7.3", ] [[package]] @@ -4814,9 +4798,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846" [[package]] name = "reqwest" @@ -4845,7 +4829,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.6", + "rustls 0.21.3", "rustls-pemfile", "serde", "serde_json", @@ -5051,14 +5035,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "ac5ffa1efe7548069688cd7028f32591853cd7b5b756d41bcffd2353e4fc75b4" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.3.3", "errno", "libc", - "linux-raw-sys 0.4.5", + "linux-raw-sys 0.4.3", "windows-sys 0.48.0", ] @@ -5077,13 +5061,13 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.6" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +checksum = "b19faa85ecb5197342b54f987b142fb3e30d0c90da40f80ef4fa9a726e6676ed" dependencies = [ "log", "ring", - "rustls-webpki 0.101.3", + "rustls-webpki 0.101.1", "sct 0.7.0", ] @@ -5132,9 +5116,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.3" +version = "0.101.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" +checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" dependencies = [ "ring", "untrusted", @@ -5142,15 +5126,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" [[package]] name = "safemem" @@ -5187,9 +5171,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.2.0" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scrypt" @@ -5225,9 +5209,9 @@ dependencies = [ [[package]] name = "sec1" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" dependencies = [ "base16ct", "der", @@ -5285,9 +5269,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.2" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -5298,9 +5282,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" dependencies = [ "core-foundation-sys", "libc", @@ -5308,47 +5292,47 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.183" +version = "1.0.166" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" +checksum = "d01b7404f9d441d3ad40e6a636a7782c377d2abdbe4fa2440e2edcc2f4f10db8" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.183" +version = "1.0.166" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" +checksum = "5dd83d6dde2b6b2d466e14d9d1acce8816dedee94f735eac6395808b3483c6d6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] name = "serde_ignored" -version = "0.1.9" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80c31d5c53fd39f208e770f5a20a0bb214dee2a8d0d8adba18e19ad95a482ca5" +checksum = "6de9d103529a9ba50008099785839df1e6f40b4576ed4c000cbfdb051182b827" dependencies = [ "serde", ] [[package]] name = "serde_json" -version = "1.0.104" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" +checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" dependencies = [ "itoa", "ryu", @@ -5357,13 +5341,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.16" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" +checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] @@ -5543,9 +5527,9 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" [[package]] name = "snafu" -version = "0.7.5" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" +checksum = "cb0656e7e3ffb70f6c39b3c2a86332bb74aa3c679da781642590f3c1118c5045" dependencies = [ "backtrace", "doc-comment", @@ -5554,9 +5538,9 @@ dependencies = [ [[package]] name = "snafu-derive" -version = "0.7.5" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" +checksum = "475b3bbe5245c26f2d8a6f62d67c1f30eb9fffeccee721c45d162c3ebbdf81b2" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -5574,16 +5558,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "socket2" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "spin" version = "0.5.2" @@ -5931,9 +5905,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.28" +version = "2.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" +checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" dependencies = [ "proc-macro2", "quote", @@ -5954,20 +5928,22 @@ dependencies = [ [[package]] name = "syntect" -version = "5.1.0" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e02b4b303bf8d08bfeb0445cba5068a3d306b6baece1d5582171a9bf49188f91" +checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8" dependencies = [ "bincode", "bitflags 1.3.2", "fancy-regex", "flate2", "fnv", + "lazy_static", "once_cell", "onig", "plist", - "regex-syntax 0.7.4", + "regex-syntax 0.6.29", "serde", + "serde_derive", "serde_json", "thiserror", "walkdir", @@ -5976,9 +5952,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.29.8" +version = "0.29.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d10ed79c22663a35a255d289a7fdcb43559fc77ff15df5ce6c341809e7867528" +checksum = "751e810399bba86e9326f5762b7f32ac5a085542df78da6a78d94e07d14d7c11" dependencies = [ "cfg-if", "core-foundation-sys", @@ -6023,9 +5999,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.40" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" +checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" dependencies = [ "filetime", "libc", @@ -6034,14 +6010,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.7.1" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.38.8", + "rustix 0.37.23", "windows-sys 0.48.0", ] @@ -6116,7 +6093,7 @@ dependencies = [ "anyhow", "assert_matches", "bytes", - "clap 4.3.21", + "clap 4.3.11", "colored", "filecheck", "forc", @@ -6181,22 +6158,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.44" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" +checksum = "c16a64ba9387ef3fdae4f9c1a7f07a0997fce91985c0336f1ddc1822b3b37802" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.44" +version = "1.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" +checksum = "d14928354b01c4d6a4f0e549069adef399a284e7995c7ccca94e8a07a5346c59" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] @@ -6222,11 +6199,10 @@ dependencies = [ [[package]] name = "time" -version = "0.3.25" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" +checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" dependencies = [ - "deranged", "itoa", "serde", "time-core", @@ -6241,9 +6217,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.11" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" +checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" dependencies = [ "time-core", ] @@ -6303,10 +6279,11 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.31.0" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40de3a2ba249dcb097e01be5e67a5ff53cf250397715a071a81543e8a832a920" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ + "autocfg", "backtrace", "bytes", "libc", @@ -6315,7 +6292,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2 0.5.3", + "socket2", "tokio-macros", "windows-sys 0.48.0", ] @@ -6338,7 +6315,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] @@ -6368,7 +6345,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.6", + "rustls 0.21.3", "tokio", ] @@ -6403,9 +6380,9 @@ checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.14" +version = "0.19.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" +checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" dependencies = [ "indexmap 2.0.0", "toml_datetime", @@ -6498,7 +6475,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] [[package]] @@ -6584,9 +6561,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" [[package]] name = "uint" @@ -6617,15 +6594,19 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" [[package]] name = "unicode-linebreak" -version = "0.1.5" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" +checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" +dependencies = [ + "hashbrown 0.12.3", + "regex", +] [[package]] name = "unicode-normalization" @@ -6695,9 +6676,9 @@ dependencies = [ [[package]] name = "urlencoding" -version = "2.1.3" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" [[package]] name = "utf8parse" @@ -6823,7 +6804,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", "wasm-bindgen-shared", ] @@ -6857,7 +6838,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7111,9 +7092,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.5.10" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5504cc7644f4b593cbc05c4a55bf9bd4e94b867c3c0bd440934174d50482427d" +checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" dependencies = [ "memchr", ] @@ -7215,18 +7196,21 @@ dependencies = [ [[package]] name = "xattr" -version = "1.0.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" +checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" dependencies = [ "libc", ] [[package]] name = "xdg" -version = "2.5.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" +checksum = "688597db5a750e9cad4511cb94729a078e274308099a0382b5b8203bbc767fee" +dependencies = [ + "home", +] [[package]] name = "yaml-rust" @@ -7263,5 +7247,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.28", + "syn 2.0.23", ] diff --git a/sway-lib-std/src/alias.sw b/sway-lib-std/src/alias.sw index 3998f059d65..53066566465 100644 --- a/sway-lib-std/src/alias.sw +++ b/sway-lib-std/src/alias.sw @@ -1,6 +1,4 @@ library; -/// The `AssetId` type is simply an alias for `b256` that represents the ID of a native asset. -pub type AssetId = b256; /// The `SubId` type is simply an alias for `b256` that represents the sub identifier of a native asset. pub type SubId = b256; diff --git a/sway-lib-std/src/asset_id.sw b/sway-lib-std/src/asset_id.sw index 0066d2c6e1a..bc58a15a6f8 100644 --- a/sway-lib-std/src/asset_id.sw +++ b/sway-lib-std/src/asset_id.sw @@ -6,12 +6,112 @@ use ::constants::ZERO_B256; use ::contract_id::ContractId; use ::hash::sha256; -/// Construct an AssetId from a ContractId and SubId by hashing them together with sha256. -pub fn construct_asset_id(contract_id: ContractId, sub_id: SubId) -> AssetId { - sha256((contract_id, sub_id)) +/// An AssetId is used for interacting with an asset on the network. +/// +/// # Additional Information +/// +/// It is calculated by taking the sha256 hash of the originating ContractId and a SubId. +/// ie. sha256((contract_id, sub_id)). +/// +/// The SubId is used to differentiate between different assets that are created by the same contract. +pub struct AssetId { + value: b256, } -/// Construct an AssetId from a ContractId using the default SubId (ZERO_B256). -pub fn construct_default_asset_id(contract_id: ContractId) -> AssetId { - sha256((contract_id, ZERO_B256)) -} +impl AssetId { + /// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. + pub const BASE_ASSET_ID: AssetId = AssetId { + /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. + value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, + }; + + /// Creates a new AssetId from a ContractId and SubId. + /// + /// # Arguments + /// + /// * `contract_id`: [ContractId] - The ContractId of the contract that created the asset. + /// * `sub_id`: [SubId] - The SubId of the asset. + /// + /// # Returns + /// + /// * [AssetId] - The AssetId of the asset. Computed by hashing the ContractId and SubId. + /// + /// # Examples + /// + /// ```sway + /// use std::{callframes::contract_id, constants::ZERO_B256}; + /// + /// fn foo() { + /// let contract_id = contract_id(); + /// let sub_id = ZERO_B256; + /// + /// let asset_id = AssetId::new(contract_id, sub_id); + /// } + /// ``` + pub fn new(contract_id: ContractId, sub_id: SubId) -> Self { + let value = sha256((contract_id, sub_id)) + Self { value } + } + + /// Creates a new AssetId from a ContractId and the zero SubId. + /// + /// # Arguments + /// + /// * `contract_id`: [ContractId] - The ContractId of the contract that created the asset. + /// + /// # Returns + /// + /// * [AssetId] - The AssetId of the asset. Computed by hashing the ContractId and the zero SubId. + /// + /// # Examples + /// + /// ```sway + /// use std::{callframes::contract_id, constants::ZERO_B256}; + /// + /// fn foo() { + /// let contract_id = contract_id(); + /// let sub_id = ZERO_B256; + /// + /// let asset_id = AssetId::standard(contract_id); + /// + /// assert(asset_id == AssetId::new(contract_id, sub_id)); + /// } + /// ``` + pub fn standard(contract_id: ContractId) -> Self { + let value = sha256((contract_id, ZERO_B256)) + Self { value } + } + + /// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. + /// + /// # Additional Information + /// + /// The base asset id is minted from the zero ContractId with the zero SubId. + /// It is computed as sha256((ZERO_B256, ZERO_B256))). + /// + /// NOT equal to ZERO_B256. + /// + /// # Returns + /// + /// * [AssetId] - The AssetId of the asset. Computed by hashing the zero ContractId and the zero SubId. + /// + /// # Examples + /// + /// ```sway + /// use std::token::transfer; + /// + /// fn foo() { + /// let asset_id = AssetId::base_asset_id(); + /// let amount = 100; + /// let recipient = Identity::ContractId(ContractId::from(ZERO_B256)); + /// + /// transfer(recipient, asset_id, amount); + /// ``` + pub fn base_asset_id() -> Self { + Self { + /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. + value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, + } + + } +} \ No newline at end of file diff --git a/sway-lib-std/src/prelude.sw b/sway-lib-std/src/prelude.sw index e554a449810..cc90b1bca98 100644 --- a/sway-lib-std/src/prelude.sw +++ b/sway-lib-std/src/prelude.sw @@ -6,6 +6,7 @@ library; // Blockchain types use ::address::Address; use ::alias::{AssetId, SubId}; +use ::asset_id::AssetId; use ::contract_id::ContractId; use ::identity::Identity; diff --git a/sway-lib-std/src/token.sw b/sway-lib-std/src/token.sw index 83ec7b5033e..4215ccfb70c 100644 --- a/sway-lib-std/src/token.sw +++ b/sway-lib-std/src/token.sw @@ -2,7 +2,8 @@ library; use ::address::Address; -use ::alias::{AssetId, SubId}; +use ::alias::SubId; +use ::asset_id::AssetId use ::call_frames::contract_id; use ::contract_id::ContractId; use ::error_signals::FAILED_TRANSFER_TO_ADDRESS_SIGNAL; From bcc2b9a9fd7fac274bbfa0bbe2fb22fd97c77587 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 15 Aug 2023 21:34:32 +0530 Subject: [PATCH 02/49] move const out of impl --- sway-lib-std/src/address.sw | 3 ++- sway-lib-std/src/asset_id.sw | 14 +++++++------- sway-lib-std/src/contract_id.sw | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/sway-lib-std/src/address.sw b/sway-lib-std/src/address.sw index 5708c143576..bdaf68f9815 100644 --- a/sway-lib-std/src/address.sw +++ b/sway-lib-std/src/address.sw @@ -1,7 +1,8 @@ //! A wrapper around the `b256` type to help enhance type-safety. library; -use ::alias::{AssetId, SubId}; +use ::alias::SubId; +use ::asset::AssetId; use ::call_frames::contract_id; use ::convert::From; use ::error_signals::FAILED_TRANSFER_TO_ADDRESS_SIGNAL; diff --git a/sway-lib-std/src/asset_id.sw b/sway-lib-std/src/asset_id.sw index bc58a15a6f8..fd204067d40 100644 --- a/sway-lib-std/src/asset_id.sw +++ b/sway-lib-std/src/asset_id.sw @@ -19,12 +19,6 @@ pub struct AssetId { } impl AssetId { - /// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. - pub const BASE_ASSET_ID: AssetId = AssetId { - /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. - value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, - }; - /// Creates a new AssetId from a ContractId and SubId. /// /// # Arguments @@ -114,4 +108,10 @@ impl AssetId { } } -} \ No newline at end of file +} + +/// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. +pub const BASE_ASSET_ID: AssetId = AssetId { + /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. + value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, +}; diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 464b242a431..088bf8fa00a 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -1,7 +1,8 @@ //! A wrapper around the `b256` type to help enhance type-safety. library; -use ::alias::{AssetId, SubId}; +use ::alias::SubId; +use ::asset::AssetId; use ::convert::From; use ::hash::sha256; From f2f69cbc7ad8bbe44f78f4a82f11bfe173419f8e Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 15 Aug 2023 21:38:35 +0530 Subject: [PATCH 03/49] convert b256 to AssetId in tests --- test/src/sdk-harness/test_projects/token_ops/src/main.sw | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/src/sdk-harness/test_projects/token_ops/src/main.sw b/test/src/sdk-harness/test_projects/token_ops/src/main.sw index 7932e350afb..8b018c7184b 100644 --- a/test/src/sdk-harness/test_projects/token_ops/src/main.sw +++ b/test/src/sdk-harness/test_projects/token_ops/src/main.sw @@ -1,6 +1,6 @@ contract; -use std::{bytes::Bytes, constants::ZERO_B256, context::balance_of, message::send_message, token::*}; +use std::{asset_id::AssetId, bytes::Bytes, constants::ZERO_B256, context::balance_of, message::send_message, token::*}; abi TestFuelCoin { fn mint_coins(mint_amount: u64, sub_id: b256); @@ -32,14 +32,17 @@ impl TestFuelCoin for Contract { } fn force_transfer_coins(coins: u64, asset_id: b256, target: ContractId) { + let asset_id = AssetId { value: asset_id }; force_transfer_to_contract(target, asset_id, coins); } fn transfer_coins_to_address(coins: u64, asset_id: b256, to: Address) { + let asset_id = AssetId { value: asset_id }; transfer_to_address(to, asset_id, coins); } fn get_balance(asset_id: b256, target: ContractId) -> u64 { + let asset_id = AssetId { value: asset_id }; balance_of(target, asset_id) } @@ -56,6 +59,7 @@ impl TestFuelCoin for Contract { } fn generic_transfer(amount: u64, asset_id: b256, to: Identity) { + let asset_id = AssetId { value: asset_id }; transfer(to, asset_id, amount) } @@ -75,6 +79,7 @@ impl TestFuelCoin for Contract { } fn address_transfer(recipient: Address, asset_id: b256, amount: u64) { + let asset_id = AssetId { value: asset_id }; recipient.transfer(asset_id, amount); } @@ -83,6 +88,7 @@ impl TestFuelCoin for Contract { } fn contract_transfer(recipient: ContractId, asset_id: b256, amount: u64) { + let asset_id = AssetId { value: asset_id }; recipient.transfer(asset_id, amount); } @@ -91,6 +97,7 @@ impl TestFuelCoin for Contract { } fn identity_transfer(recipient: Identity, asset_id: b256, amount: u64) { + let asset_id = AssetId { value: asset_id }; recipient.transfer(asset_id, amount); } } From 1a9ff2440c4628f871a29566eb991d38c4ac29a9 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 15 Aug 2023 21:55:40 +0530 Subject: [PATCH 04/49] fix downstream changes --- sway-lib-std/src/address.sw | 4 ++-- sway-lib-std/src/asset_id.sw | 9 ++++----- sway-lib-std/src/call_frames.sw | 12 ++++++++---- sway-lib-std/src/context.sw | 4 ++-- sway-lib-std/src/contract_id.sw | 4 ++-- sway-lib-std/src/identity.sw | 3 ++- sway-lib-std/src/outputs.sw | 4 ++-- sway-lib-std/src/token.sw | 2 +- 8 files changed, 23 insertions(+), 19 deletions(-) diff --git a/sway-lib-std/src/address.sw b/sway-lib-std/src/address.sw index bdaf68f9815..f6560081cba 100644 --- a/sway-lib-std/src/address.sw +++ b/sway-lib-std/src/address.sw @@ -2,7 +2,7 @@ library; use ::alias::SubId; -use ::asset::AssetId; +use ::asset_id::AssetId; use ::call_frames::contract_id; use ::convert::From; use ::error_signals::FAILED_TRANSFER_TO_ADDRESS_SIGNAL; @@ -67,7 +67,7 @@ impl Address { while index < number_of_outputs { if let Output::Variable = output_type(index) { if output_amount(index) == 0 { - asm(r1: self.value, r2: index, r3: amount, r4: asset_id) { + asm(r1: self.value, r2: index, r3: amount, r4: asset_id.value) { tro r1 r2 r3 r4; }; return; diff --git a/sway-lib-std/src/asset_id.sw b/sway-lib-std/src/asset_id.sw index fd204067d40..007cacd2e8e 100644 --- a/sway-lib-std/src/asset_id.sw +++ b/sway-lib-std/src/asset_id.sw @@ -15,7 +15,7 @@ use ::hash::sha256; /// /// The SubId is used to differentiate between different assets that are created by the same contract. pub struct AssetId { - value: b256, + pub value: b256, } impl AssetId { @@ -43,7 +43,7 @@ impl AssetId { /// } /// ``` pub fn new(contract_id: ContractId, sub_id: SubId) -> Self { - let value = sha256((contract_id, sub_id)) + let value = sha256((contract_id, sub_id)); Self { value } } @@ -72,7 +72,7 @@ impl AssetId { /// } /// ``` pub fn standard(contract_id: ContractId) -> Self { - let value = sha256((contract_id, ZERO_B256)) + let value = sha256((contract_id, ZERO_B256)); Self { value } } @@ -102,11 +102,10 @@ impl AssetId { /// transfer(recipient, asset_id, amount); /// ``` pub fn base_asset_id() -> Self { + /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. Self { - /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, } - } } diff --git a/sway-lib-std/src/call_frames.sw b/sway-lib-std/src/call_frames.sw index 478258f9e17..636f81b6625 100644 --- a/sway-lib-std/src/call_frames.sw +++ b/sway-lib-std/src/call_frames.sw @@ -2,7 +2,7 @@ //! [Call frames](https://fuellabs.github.io/fuel-specs/master/vm#call-frames) store metadata across untrusted inter-contract calls. library; -use ::alias::AssetId; +use ::asset_id::AssetId; use ::registers::frame_ptr; use ::contract_id::ContractId; use ::intrinsics::is_reference_type; @@ -29,9 +29,13 @@ pub fn contract_id() -> ContractId { /// Get the `asset_id` of coins being sent from the current call frame. pub fn msg_asset_id() -> AssetId { - asm(asset_id) { - addi asset_id fp i32; - asset_id: b256 + AssetId { + value: { + asm(asset_id) { + addi asset_id fp i32; + asset_id: b256 + } + } } } diff --git a/sway-lib-std/src/context.sw b/sway-lib-std/src/context.sw index 6456c05404b..ffcbb6b5c12 100644 --- a/sway-lib-std/src/context.sw +++ b/sway-lib-std/src/context.sw @@ -1,7 +1,7 @@ //! Functionality for accessing context-specific information about the current contract or message. library; -use ::alias::AssetId; +use ::asset_id::AssetId; use ::contract_id::ContractId; use ::call_frames::contract_id; use ::registers::balance; @@ -13,7 +13,7 @@ pub fn this_balance(asset_id: AssetId) -> u64 { /// Get the balance of coin `asset_id` for the contract at 'target'. pub fn balance_of(target: ContractId, asset_id: AssetId) -> u64 { - asm(balance, token: asset_id, id: target.value) { + asm(balance, token: asset_id.value, id: target.value) { bal balance token id; balance: u64 } diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 088bf8fa00a..f1e9192cbab 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -2,7 +2,7 @@ library; use ::alias::SubId; -use ::asset::AssetId; +use ::asset_id::AssetId; use ::convert::From; use ::hash::sha256; @@ -58,7 +58,7 @@ impl ContractId { /// contract_id.transfer(BASE_ASSET_ID, 500); /// ``` pub fn transfer(self, asset_id: AssetId, amount: u64) { - asm(r1: amount, r2: asset_id, r3: self.value) { + asm(r1: amount, r2: asset_id.value, r3: self.value) { tr r3 r1 r2; } } diff --git a/sway-lib-std/src/identity.sw b/sway-lib-std/src/identity.sw index 8293d6136a0..ddfa25533ab 100644 --- a/sway-lib-std/src/identity.sw +++ b/sway-lib-std/src/identity.sw @@ -4,7 +4,8 @@ library; use ::assert::assert; use ::address::Address; -use ::alias::{AssetId, SubId}; +use ::alias::SubId; +use ::asset_id::AssetId; use ::call_frames::contract_id; use ::constants::{ZERO_B256, BASE_ASSET_ID}; use ::contract_id::ContractId; diff --git a/sway-lib-std/src/outputs.sw b/sway-lib-std/src/outputs.sw index c5ccbb9346b..6501b81bb68 100644 --- a/sway-lib-std/src/outputs.sw +++ b/sway-lib-std/src/outputs.sw @@ -2,7 +2,7 @@ //! This includes `Output::Coins`, `Input::Messages` and `Input::Contracts`. library; -use ::alias::AssetId; +use ::asset_id::AssetId; use ::contract_id::ContractId; use ::revert::revert; use ::tx::{ @@ -95,7 +95,7 @@ pub fn output_amount(index: u64) -> u64 { /// Otherwise, returns `None`. pub fn output_asset_id(index: u64) -> Option { match output_type(index) { - Output::Coin => Option::Some(__gtf::(index, GTF_OUTPUT_COIN_ASSET_ID)), + Output::Coin => Option::Some(AssetId { value: __gtf::(index, GTF_OUTPUT_COIN_ASSET_ID) }), _ => Option::None, } } diff --git a/sway-lib-std/src/token.sw b/sway-lib-std/src/token.sw index 4215ccfb70c..1e91e12da2b 100644 --- a/sway-lib-std/src/token.sw +++ b/sway-lib-std/src/token.sw @@ -3,7 +3,7 @@ library; use ::address::Address; use ::alias::SubId; -use ::asset_id::AssetId +use ::asset_id::AssetId; use ::call_frames::contract_id; use ::contract_id::ContractId; use ::error_signals::FAILED_TRANSFER_TO_ADDRESS_SIGNAL; From d94ef6f8f68b4b9f0580b518ab3d68e7c17f519e Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 15 Aug 2023 22:00:36 +0530 Subject: [PATCH 05/49] remove pub --- sway-lib-std/src/asset_id.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lib-std/src/asset_id.sw b/sway-lib-std/src/asset_id.sw index 007cacd2e8e..f5eeb1922e4 100644 --- a/sway-lib-std/src/asset_id.sw +++ b/sway-lib-std/src/asset_id.sw @@ -15,7 +15,7 @@ use ::hash::sha256; /// /// The SubId is used to differentiate between different assets that are created by the same contract. pub struct AssetId { - pub value: b256, + value: b256, } impl AssetId { From 9889fb689206bb49169d09ecef38f2f82cd26fe9 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 15 Aug 2023 22:08:50 +0530 Subject: [PATCH 06/49] change docs to comments inside code --- sway-lib-std/src/asset_id.sw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sway-lib-std/src/asset_id.sw b/sway-lib-std/src/asset_id.sw index f5eeb1922e4..93ff9c05836 100644 --- a/sway-lib-std/src/asset_id.sw +++ b/sway-lib-std/src/asset_id.sw @@ -102,8 +102,8 @@ impl AssetId { /// transfer(recipient, asset_id, amount); /// ``` pub fn base_asset_id() -> Self { - /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. Self { + // sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, } } @@ -111,6 +111,6 @@ impl AssetId { /// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. pub const BASE_ASSET_ID: AssetId = AssetId { - /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. + // sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, }; From 58e116b97f2ad7611c1e19285777d9bfd03728a6 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 15 Aug 2023 22:24:31 +0530 Subject: [PATCH 07/49] move asset_id up in lib.sw --- sway-lib-std/src/lib.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lib-std/src/lib.sw b/sway-lib-std/src/lib.sw index 25f71c8e974..9e742aec830 100644 --- a/sway-lib-std/src/lib.sw +++ b/sway-lib-std/src/lib.sw @@ -12,9 +12,9 @@ pub mod assert; pub mod alloc; pub mod alias; pub mod hash; +pub mod asset_id; pub mod contract_id; pub mod constants; -pub mod asset_id; pub mod external; pub mod registers; pub mod call_frames; From aba1d1e3e1815e491c01a331ab9b8d88f90556d5 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 15 Aug 2023 23:35:06 +0530 Subject: [PATCH 08/49] remove import assetid --- sway-lib-std/src/asset_id.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lib-std/src/asset_id.sw b/sway-lib-std/src/asset_id.sw index 93ff9c05836..26cc11d65c6 100644 --- a/sway-lib-std/src/asset_id.sw +++ b/sway-lib-std/src/asset_id.sw @@ -1,7 +1,7 @@ //! Helper functions for generating an AssetId library; -use ::alias::{AssetId, SubId}; +use ::alias::SubId; use ::constants::ZERO_B256; use ::contract_id::ContractId; use ::hash::sha256; From 84dd12ad300afbdf43c1f19e5392eaecc60debfd Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Mon, 21 Aug 2023 16:56:40 +0530 Subject: [PATCH 09/49] move assetid to contract_id.sw --- sway-lib-std/src/address.sw | 2 +- sway-lib-std/src/asset_id.sw | 116 ----------------------------- sway-lib-std/src/call_frames.sw | 5 +- sway-lib-std/src/context.sw | 3 +- sway-lib-std/src/contract_id.sw | 109 ++++++++++++++++++++++++++- sway-lib-std/src/identity.sw | 3 +- sway-lib-std/src/inputs.sw | 3 +- sway-lib-std/src/lib.sw | 1 - sway-lib-std/src/low_level_call.sw | 3 +- sway-lib-std/src/outputs.sw | 3 +- sway-lib-std/src/prelude.sw | 5 +- sway-lib-std/src/token.sw | 3 +- 12 files changed, 119 insertions(+), 137 deletions(-) delete mode 100644 sway-lib-std/src/asset_id.sw diff --git a/sway-lib-std/src/address.sw b/sway-lib-std/src/address.sw index f6560081cba..4a216e3393f 100644 --- a/sway-lib-std/src/address.sw +++ b/sway-lib-std/src/address.sw @@ -2,8 +2,8 @@ library; use ::alias::SubId; -use ::asset_id::AssetId; use ::call_frames::contract_id; +use ::contract_id::AssetId; use ::convert::From; use ::error_signals::FAILED_TRANSFER_TO_ADDRESS_SIGNAL; use ::hash::sha256; diff --git a/sway-lib-std/src/asset_id.sw b/sway-lib-std/src/asset_id.sw deleted file mode 100644 index 26cc11d65c6..00000000000 --- a/sway-lib-std/src/asset_id.sw +++ /dev/null @@ -1,116 +0,0 @@ -//! Helper functions for generating an AssetId -library; - -use ::alias::SubId; -use ::constants::ZERO_B256; -use ::contract_id::ContractId; -use ::hash::sha256; - -/// An AssetId is used for interacting with an asset on the network. -/// -/// # Additional Information -/// -/// It is calculated by taking the sha256 hash of the originating ContractId and a SubId. -/// ie. sha256((contract_id, sub_id)). -/// -/// The SubId is used to differentiate between different assets that are created by the same contract. -pub struct AssetId { - value: b256, -} - -impl AssetId { - /// Creates a new AssetId from a ContractId and SubId. - /// - /// # Arguments - /// - /// * `contract_id`: [ContractId] - The ContractId of the contract that created the asset. - /// * `sub_id`: [SubId] - The SubId of the asset. - /// - /// # Returns - /// - /// * [AssetId] - The AssetId of the asset. Computed by hashing the ContractId and SubId. - /// - /// # Examples - /// - /// ```sway - /// use std::{callframes::contract_id, constants::ZERO_B256}; - /// - /// fn foo() { - /// let contract_id = contract_id(); - /// let sub_id = ZERO_B256; - /// - /// let asset_id = AssetId::new(contract_id, sub_id); - /// } - /// ``` - pub fn new(contract_id: ContractId, sub_id: SubId) -> Self { - let value = sha256((contract_id, sub_id)); - Self { value } - } - - /// Creates a new AssetId from a ContractId and the zero SubId. - /// - /// # Arguments - /// - /// * `contract_id`: [ContractId] - The ContractId of the contract that created the asset. - /// - /// # Returns - /// - /// * [AssetId] - The AssetId of the asset. Computed by hashing the ContractId and the zero SubId. - /// - /// # Examples - /// - /// ```sway - /// use std::{callframes::contract_id, constants::ZERO_B256}; - /// - /// fn foo() { - /// let contract_id = contract_id(); - /// let sub_id = ZERO_B256; - /// - /// let asset_id = AssetId::standard(contract_id); - /// - /// assert(asset_id == AssetId::new(contract_id, sub_id)); - /// } - /// ``` - pub fn standard(contract_id: ContractId) -> Self { - let value = sha256((contract_id, ZERO_B256)); - Self { value } - } - - /// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. - /// - /// # Additional Information - /// - /// The base asset id is minted from the zero ContractId with the zero SubId. - /// It is computed as sha256((ZERO_B256, ZERO_B256))). - /// - /// NOT equal to ZERO_B256. - /// - /// # Returns - /// - /// * [AssetId] - The AssetId of the asset. Computed by hashing the zero ContractId and the zero SubId. - /// - /// # Examples - /// - /// ```sway - /// use std::token::transfer; - /// - /// fn foo() { - /// let asset_id = AssetId::base_asset_id(); - /// let amount = 100; - /// let recipient = Identity::ContractId(ContractId::from(ZERO_B256)); - /// - /// transfer(recipient, asset_id, amount); - /// ``` - pub fn base_asset_id() -> Self { - Self { - // sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. - value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, - } - } -} - -/// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. -pub const BASE_ASSET_ID: AssetId = AssetId { - // sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. - value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, -}; diff --git a/sway-lib-std/src/call_frames.sw b/sway-lib-std/src/call_frames.sw index 636f81b6625..d0f1c4e67e0 100644 --- a/sway-lib-std/src/call_frames.sw +++ b/sway-lib-std/src/call_frames.sw @@ -2,10 +2,9 @@ //! [Call frames](https://fuellabs.github.io/fuel-specs/master/vm#call-frames) store metadata across untrusted inter-contract calls. library; -use ::asset_id::AssetId; -use ::registers::frame_ptr; -use ::contract_id::ContractId; +use ::contract_id::{AssetId, ContractId}; use ::intrinsics::is_reference_type; +use ::registers::frame_ptr; // Note that everything when serialized is padded to word length. // diff --git a/sway-lib-std/src/context.sw b/sway-lib-std/src/context.sw index ffcbb6b5c12..7ac74c271be 100644 --- a/sway-lib-std/src/context.sw +++ b/sway-lib-std/src/context.sw @@ -1,9 +1,8 @@ //! Functionality for accessing context-specific information about the current contract or message. library; -use ::asset_id::AssetId; -use ::contract_id::ContractId; use ::call_frames::contract_id; +use ::contract_id::{AssetId, ContractId}; use ::registers::balance; /// Get the balance of coin `asset_id` for the current contract. diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index f1e9192cbab..5460f6bff2e 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -2,7 +2,7 @@ library; use ::alias::SubId; -use ::asset_id::AssetId; +use ::constants::ZERO_B256; use ::convert::From; use ::hash::sha256; @@ -94,3 +94,110 @@ impl ContractId { self.transfer(sha256((ContractId::from(asm() { fp: b256 }), sub_id)), amount); } } + + +/// An AssetId is used for interacting with an asset on the network. +/// +/// # Additional Information +/// +/// It is calculated by taking the sha256 hash of the originating ContractId and a SubId. +/// ie. sha256((contract_id, sub_id)). +/// +/// An exception is the Base Asset, which is just the ZERO_B256 AssetId. +/// +/// The SubId is used to differentiate between different assets that are created by the same contract. +pub struct AssetId { + value: b256, +} + +impl AssetId { + /// Creates a new AssetId from a ContractId and SubId. + /// + /// # Arguments + /// + /// * `contract_id`: [ContractId] - The ContractId of the contract that created the asset. + /// * `sub_id`: [SubId] - The SubId of the asset. + /// + /// # Returns + /// + /// * [AssetId] - The AssetId of the asset. Computed by hashing the ContractId and SubId. + /// + /// # Examples + /// + /// ```sway + /// use std::{callframes::contract_id, constants::ZERO_B256}; + /// + /// fn foo() { + /// let contract_id = contract_id(); + /// let sub_id = ZERO_B256; + /// + /// let asset_id = AssetId::new(contract_id, sub_id); + /// } + /// ``` + pub fn new(contract_id: ContractId, sub_id: SubId) -> Self { + let value = sha256((contract_id, sub_id)); + Self { value } + } + + /// Creates a new AssetId from a ContractId and the zero SubId. + /// + /// # Arguments + /// + /// * `contract_id`: [ContractId] - The ContractId of the contract that created the asset. + /// + /// # Returns + /// + /// * [AssetId] - The AssetId of the asset. Computed by hashing the ContractId and the zero SubId. + /// + /// # Examples + /// + /// ```sway + /// use std::{callframes::contract_id, constants::ZERO_B256}; + /// + /// fn foo() { + /// let contract_id = contract_id(); + /// let sub_id = ZERO_B256; + /// + /// let asset_id = AssetId::standard(contract_id); + /// + /// assert(asset_id == AssetId::new(contract_id, sub_id)); + /// } + /// ``` + pub fn standard(contract_id: ContractId) -> Self { + let value = sha256((contract_id, ZERO_B256)); + Self { value } + } + + /// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. + /// + /// # Additional Information + /// + /// It is hard coded to be ZERO_B256. + /// + /// # Returns + /// + /// * [AssetId] - The AssetId of the asset. Computed by hashing the zero ContractId and the zero SubId. + /// + /// # Examples + /// + /// ```sway + /// use std::token::transfer; + /// + /// fn foo() { + /// let asset_id = AssetId::base_asset_id(); + /// let amount = 100; + /// let recipient = Identity::ContractId(ContractId::from(ZERO_B256)); + /// + /// transfer(recipient, asset_id, amount); + /// ``` + pub fn base_asset_id() -> Self { + Self { + value: ZERO_B256, + } + } +} + +/// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. +pub const BASE_ASSET_ID: AssetId = AssetId { + value: ZERO_B256, +}; diff --git a/sway-lib-std/src/identity.sw b/sway-lib-std/src/identity.sw index ddfa25533ab..14b780634aa 100644 --- a/sway-lib-std/src/identity.sw +++ b/sway-lib-std/src/identity.sw @@ -5,10 +5,9 @@ library; use ::assert::assert; use ::address::Address; use ::alias::SubId; -use ::asset_id::AssetId; use ::call_frames::contract_id; use ::constants::{ZERO_B256, BASE_ASSET_ID}; -use ::contract_id::ContractId; +use ::contract_id::{AssetId, ContractId}; use ::hash::sha256; use ::option::Option; diff --git a/sway-lib-std/src/inputs.sw b/sway-lib-std/src/inputs.sw index 21b44cd1b83..9bd9d034031 100644 --- a/sway-lib-std/src/inputs.sw +++ b/sway-lib-std/src/inputs.sw @@ -3,11 +3,10 @@ library; use ::address::Address; -use ::alias::AssetId; use ::assert::assert; use ::bytes::Bytes; use ::constants::BASE_ASSET_ID; -use ::contract_id::ContractId; +use ::contract_id::{AssetId, ContractId}; use ::option::Option::{self, *}; use ::revert::revert; use ::tx::{ diff --git a/sway-lib-std/src/lib.sw b/sway-lib-std/src/lib.sw index 9e742aec830..15c3f996b7d 100644 --- a/sway-lib-std/src/lib.sw +++ b/sway-lib-std/src/lib.sw @@ -12,7 +12,6 @@ pub mod assert; pub mod alloc; pub mod alias; pub mod hash; -pub mod asset_id; pub mod contract_id; pub mod constants; pub mod external; diff --git a/sway-lib-std/src/low_level_call.sw b/sway-lib-std/src/low_level_call.sw index 4c4e0ebe901..519d832948d 100644 --- a/sway-lib-std/src/low_level_call.sw +++ b/sway-lib-std/src/low_level_call.sw @@ -1,10 +1,9 @@ //! Utilities to help with low level calls. library; -use ::alias::AssetId; use ::assert::assert; use ::bytes::Bytes; -use ::contract_id::ContractId; +use ::contract_id::{AssetId, ContractId}; use ::option::Option; use ::revert::require; use ::vec::Vec; diff --git a/sway-lib-std/src/outputs.sw b/sway-lib-std/src/outputs.sw index 6501b81bb68..03aad443f9c 100644 --- a/sway-lib-std/src/outputs.sw +++ b/sway-lib-std/src/outputs.sw @@ -2,8 +2,7 @@ //! This includes `Output::Coins`, `Input::Messages` and `Input::Contracts`. library; -use ::asset_id::AssetId; -use ::contract_id::ContractId; +use ::contract_id::{AssetId, ContractId}; use ::revert::revert; use ::tx::{ GTF_CREATE_OUTPUT_AT_INDEX, diff --git a/sway-lib-std/src/prelude.sw b/sway-lib-std/src/prelude.sw index cc90b1bca98..b96483e7d6e 100644 --- a/sway-lib-std/src/prelude.sw +++ b/sway-lib-std/src/prelude.sw @@ -5,9 +5,8 @@ library; // Blockchain types use ::address::Address; -use ::alias::{AssetId, SubId}; -use ::asset_id::AssetId; -use ::contract_id::ContractId; +use ::alias::SubId; +use ::contract_id::{AssetId, ContractId}; use ::identity::Identity; // `StorageKey` API diff --git a/sway-lib-std/src/token.sw b/sway-lib-std/src/token.sw index 1e91e12da2b..565982cb645 100644 --- a/sway-lib-std/src/token.sw +++ b/sway-lib-std/src/token.sw @@ -3,9 +3,8 @@ library; use ::address::Address; use ::alias::SubId; -use ::asset_id::AssetId; use ::call_frames::contract_id; -use ::contract_id::ContractId; +use ::contract_id::{AssetId, ContractId}; use ::error_signals::FAILED_TRANSFER_TO_ADDRESS_SIGNAL; use ::hash::sha256; use ::identity::Identity; From 26ebdba8845eb502438d7d4d1fb66de670a652de Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Mon, 21 Aug 2023 19:26:53 +0530 Subject: [PATCH 10/49] removve double external --- sway-lib-std/src/lib.sw | 2 -- 1 file changed, 2 deletions(-) diff --git a/sway-lib-std/src/lib.sw b/sway-lib-std/src/lib.sw index d79cc74d4d5..be8f7487b11 100644 --- a/sway-lib-std/src/lib.sw +++ b/sway-lib-std/src/lib.sw @@ -21,8 +21,6 @@ pub mod alias; pub mod hash; pub mod contract_id; pub mod constants; -pub mod external; -pub mod registers; pub mod call_frames; pub mod context; pub mod external; From 437ca3e9c31a49303bedde7be0c0221551c7bcbc Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Mon, 21 Aug 2023 22:12:21 +0530 Subject: [PATCH 11/49] move base_asset_id constant into constants.sw --- sway-lib-std/src/constants.sw | 8 ++++++-- sway-lib-std/src/contract_id.sw | 7 +------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sway-lib-std/src/constants.sw b/sway-lib-std/src/constants.sw index e74d5cf4d01..3cd7ebf3670 100644 --- a/sway-lib-std/src/constants.sw +++ b/sway-lib-std/src/constants.sw @@ -1,10 +1,14 @@ //! Base asset and zero address constants. library; -use ::contract_id::ContractId; +use ::contract_id::{AssetId, ContractId}; /// The `BASE_ASSET_ID` represents the base asset of a chain. /// This is currently hard coded as a zero address, but will be configurable in the future. -pub const BASE_ASSET_ID = ZERO_B256; +pub const BASE_ASSET_ID: AssetId = AssetId { + value: ZERO_B256, +}; /// A B256 type zero address. pub const ZERO_B256 = 0x0000000000000000000000000000000000000000000000000000000000000000; + + diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 2bb9cfb3ef0..d1ce4433f94 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -2,7 +2,6 @@ library; use ::alias::SubId; -use ::constants::ZERO_B256; use ::convert::From; use ::hash::*; @@ -198,12 +197,8 @@ impl AssetId { /// ``` pub fn base_asset_id() -> Self { Self { - value: ZERO_B256, + value: 0x0000000000000000000000000000000000000000000000000000000000000000, } } } -/// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. -pub const BASE_ASSET_ID: AssetId = AssetId { - value: ZERO_B256, -}; From cf80c649defd4c4f6c9a567f88893a502c50c5ab Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Mon, 21 Aug 2023 23:34:43 +0530 Subject: [PATCH 12/49] fix ci errors --- sway-lib-std/src/address.sw | 2 +- sway-lib-std/src/contract_id.sw | 4 ++-- sway-lib-std/src/identity.sw | 6 +++--- sway-lib-std/src/inputs.sw | 2 +- sway-lib-std/src/token.sw | 7 +++---- 5 files changed, 10 insertions(+), 11 deletions(-) diff --git a/sway-lib-std/src/address.sw b/sway-lib-std/src/address.sw index efce4e65f5b..4d0b737ae8e 100644 --- a/sway-lib-std/src/address.sw +++ b/sway-lib-std/src/address.sw @@ -102,7 +102,7 @@ impl Address { asm(r1: amount, r2: sub_id) { mint r1 r2; }; - self.transfer(sha256((contract_id(), sub_id)), amount); + self.transfer(AssetId::new((contract_id(), sub_id), amount); } } diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index d1ce4433f94..84fa8948639 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -97,7 +97,7 @@ impl ContractId { asm(r1: amount, r2: sub_id) { mint r1 r2; }; - self.transfer(sha256((ContractId::from(asm() { fp: b256 }), sub_id)), amount); + self.transfer(AssetId::new(ContractId::from(asm() { fp: b256 }), sub_id), amount); } } @@ -169,7 +169,7 @@ impl AssetId { /// } /// ``` pub fn standard(contract_id: ContractId) -> Self { - let value = sha256((contract_id, ZERO_B256)); + let value = sha256((contract_id, 0x0000000000000000000000000000000000000000000000000000000000000000)); Self { value } } diff --git a/sway-lib-std/src/identity.sw b/sway-lib-std/src/identity.sw index 20cbd38e66b..c9f7705a69b 100644 --- a/sway-lib-std/src/identity.sw +++ b/sway-lib-std/src/identity.sw @@ -126,7 +126,7 @@ impl Identity { asm(r1: amount, r2: sub_id) { mint r1 r2; }; - self.transfer(sha256((contract_id(), sub_id)), amount); + self.transfer(AssetId::new(contract_id(), sub_id), amount); } } @@ -142,8 +142,8 @@ fn test_address() { #[test] fn test_contract_id() { - let id = BASE_ASSET_ID; - let identity = Identity::ContractId(ContractId::from(id)); + let id = ZERO_B256; + let identity = Identity::ContractId(ContractId::from(ZERO_B256)); assert(!identity.is_address()); assert(identity.is_contract_id()); assert(identity.as_contract_id().unwrap().value == id); diff --git a/sway-lib-std/src/inputs.sw b/sway-lib-std/src/inputs.sw index 9bd9d034031..97122ef8ae2 100644 --- a/sway-lib-std/src/inputs.sw +++ b/sway-lib-std/src/inputs.sw @@ -154,7 +154,7 @@ pub fn input_predicate_data(index: u64) -> T { /// Otherwise, returns `None`. pub fn input_asset_id(index: u64) -> Option { match input_type(index) { - Input::Coin => Some(__gtf::(index, GTF_INPUT_COIN_ASSET_ID)), + Input::Coin => Some(AssetId { value: __gtf::(index, GTF_INPUT_COIN_ASSET_ID) }), Input::Message => Some(BASE_ASSET_ID), Input::Contract => None, } diff --git a/sway-lib-std/src/token.sw b/sway-lib-std/src/token.sw index 33bc9ee3c31..95527bd72cf 100644 --- a/sway-lib-std/src/token.sw +++ b/sway-lib-std/src/token.sw @@ -6,7 +6,6 @@ use ::alias::SubId; use ::call_frames::contract_id; use ::contract_id::{AssetId, ContractId}; use ::error_signals::FAILED_TRANSFER_TO_ADDRESS_SIGNAL; -use ::hash::*; use ::identity::Identity; use ::revert::revert; use ::outputs::{Output, output_amount, output_count, output_type}; @@ -40,7 +39,7 @@ use ::outputs::{Output, output_amount, output_count, output_type}; /// ``` pub fn mint_to(to: Identity, sub_id: SubId, amount: u64) { mint(sub_id, amount); - transfer(to, sha256((contract_id(), sub_id)), amount); + transfer(to, AssetId::new(contract_id(), sub_id), amount); } /// Mint `amount` coins of the current contract's `asset_id` and send them @@ -69,7 +68,7 @@ pub fn mint_to(to: Identity, sub_id: SubId, amount: u64) { /// ``` pub fn mint_to_contract(to: ContractId, sub_id: SubId, amount: u64) { mint(sub_id, amount); - force_transfer_to_contract(to, sha256((contract_id(), sub_id)), amount); + force_transfer_to_contract(to, AssetId::new(contract_id(), sub_id), amount); } /// Mint `amount` coins of the current contract's `asset_id` and send them to @@ -92,7 +91,7 @@ pub fn mint_to_contract(to: ContractId, sub_id: SubId, amount: u64) { /// ``` pub fn mint_to_address(to: Address, sub_id: SubId, amount: u64) { mint(sub_id, amount); - transfer_to_address(to, sha256((contract_id(), sub_id)), amount); + transfer_to_address(to, AssetId::new(contract_id(), sub_id), amount); } /// Mint `amount` coins of the current contract's `sub_id`. The newly minted tokens are owned by the current contract. From a69dab2bc37786ea13ff823d7824355113cd094e Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Mon, 21 Aug 2023 23:39:18 +0530 Subject: [PATCH 13/49] remove extra bracket --- sway-lib-std/src/address.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lib-std/src/address.sw b/sway-lib-std/src/address.sw index 4d0b737ae8e..b86f2ee16f6 100644 --- a/sway-lib-std/src/address.sw +++ b/sway-lib-std/src/address.sw @@ -102,7 +102,7 @@ impl Address { asm(r1: amount, r2: sub_id) { mint r1 r2; }; - self.transfer(AssetId::new((contract_id(), sub_id), amount); + self.transfer(AssetId::new(contract_id(), sub_id), amount); } } From 1a843c31e22f6e4c44ad3564b6aaa41ad865cf0a Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 00:41:12 +0530 Subject: [PATCH 14/49] move assetid above contractid impl --- sway-lib-std/src/contract_id.sw | 147 ++++++++++++++++---------------- 1 file changed, 73 insertions(+), 74 deletions(-) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 84fa8948639..370cef45e8a 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -27,80 +27,6 @@ impl From for ContractId { } } -impl ContractId { - /// UNCONDITIONAL transfer of `amount` coins of type `asset_id` to - /// the ContractId. - /// - /// > **_WARNING:_** - /// > - /// > This will transfer coins to a contract even with no way to retrieve them - /// > (i.e. no withdrawal functionality on receiving contract), possibly leading - /// > to the **_PERMANENT LOSS OF COINS_** if not used with care. - /// - /// ### Arguments - /// - /// * `asset_id` - The `AssetId` of the token to transfer. - /// * `amount` - The amount of tokens to transfer. - /// - /// ### Reverts - /// - /// * If `amount` is greater than the contract balance for `asset_id`. - /// * If `amount` is equal to zero. - /// - /// ### Examples - /// - /// ```sway - /// use std::constants::{BASE_ASSET_ID, ZERO_B256}; - /// - /// // replace the zero ContractId with your desired ContractId - /// let contract_id = ContractId::from(ZERO_B256); - /// contract_id.transfer(BASE_ASSET_ID, 500); - /// ``` - pub fn transfer(self, asset_id: AssetId, amount: u64) { - asm(r1: amount, r2: asset_id.value, r3: self.value) { - tr r3 r1 r2; - } - } -} - -impl Hash for ContractId { - fn hash(self, ref mut state: Hasher) { - let ContractId { value } = self; - value.hash(state); - } -} - -impl ContractId { - /// Mint `amount` coins of `sub_id` and send them UNCONDITIONALLY to the contract at `to`. - /// - /// > **_WARNING:_** - /// > - /// > This will transfer coins to a contract even with no way to retrieve them - /// > (i.e: no withdrawal functionality on the receiving contract), possibly leading to - /// > the **_PERMANENT LOSS OF COINS_** if not used with care. - /// - /// ### Arguments - /// - /// * `sub_id` - The sub identfier of the asset which to mint. - /// * `amount` - The amount of tokens to mint. - /// - /// ### Examples - /// - /// ```sway - /// use std::constants::ZERO_B256; - /// - /// // replace the zero ContractId with your desired ContractId - /// let contract_id = ContractId::from(ZERO_B256); - /// contract_id.mint_to(ZERO_B256, 500); - /// ``` - pub fn mint_to(self, sub_id: SubId, amount: u64) { - asm(r1: amount, r2: sub_id) { - mint r1 r2; - }; - self.transfer(AssetId::new(ContractId::from(asm() { fp: b256 }), sub_id), amount); - } -} - /// An AssetId is used for interacting with an asset on the network. /// /// # Additional Information @@ -202,3 +128,76 @@ impl AssetId { } } +impl ContractId { + /// UNCONDITIONAL transfer of `amount` coins of type `asset_id` to + /// the ContractId. + /// + /// > **_WARNING:_** + /// > + /// > This will transfer coins to a contract even with no way to retrieve them + /// > (i.e. no withdrawal functionality on receiving contract), possibly leading + /// > to the **_PERMANENT LOSS OF COINS_** if not used with care. + /// + /// ### Arguments + /// + /// * `asset_id` - The `AssetId` of the token to transfer. + /// * `amount` - The amount of tokens to transfer. + /// + /// ### Reverts + /// + /// * If `amount` is greater than the contract balance for `asset_id`. + /// * If `amount` is equal to zero. + /// + /// ### Examples + /// + /// ```sway + /// use std::constants::{BASE_ASSET_ID, ZERO_B256}; + /// + /// // replace the zero ContractId with your desired ContractId + /// let contract_id = ContractId::from(ZERO_B256); + /// contract_id.transfer(BASE_ASSET_ID, 500); + /// ``` + pub fn transfer(self, asset_id: AssetId, amount: u64) { + asm(r1: amount, r2: asset_id.value, r3: self.value) { + tr r3 r1 r2; + } + } +} + +impl Hash for ContractId { + fn hash(self, ref mut state: Hasher) { + let ContractId { value } = self; + value.hash(state); + } +} + +impl ContractId { + /// Mint `amount` coins of `sub_id` and send them UNCONDITIONALLY to the contract at `to`. + /// + /// > **_WARNING:_** + /// > + /// > This will transfer coins to a contract even with no way to retrieve them + /// > (i.e: no withdrawal functionality on the receiving contract), possibly leading to + /// > the **_PERMANENT LOSS OF COINS_** if not used with care. + /// + /// ### Arguments + /// + /// * `sub_id` - The sub identfier of the asset which to mint. + /// * `amount` - The amount of tokens to mint. + /// + /// ### Examples + /// + /// ```sway + /// use std::constants::ZERO_B256; + /// + /// // replace the zero ContractId with your desired ContractId + /// let contract_id = ContractId::from(ZERO_B256); + /// contract_id.mint_to(ZERO_B256, 500); + /// ``` + pub fn mint_to(self, sub_id: SubId, amount: u64) { + asm(r1: amount, r2: sub_id) { + mint r1 r2; + }; + self.transfer(AssetId::new(ContractId::from(asm() { fp: b256 }), sub_id), amount); + } +} From 58c3408735ffebe35fd48663363c1effb14ef80d Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 00:47:55 +0530 Subject: [PATCH 15/49] move up impl hash --- sway-lib-std/src/contract_id.sw | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 370cef45e8a..34e64d3364e 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -27,6 +27,13 @@ impl From for ContractId { } } +impl Hash for ContractId { + fn hash(self, ref mut state: Hasher) { + let ContractId { value } = self; + value.hash(state); + } +} + /// An AssetId is used for interacting with an asset on the network. /// /// # Additional Information @@ -164,13 +171,6 @@ impl ContractId { } } -impl Hash for ContractId { - fn hash(self, ref mut state: Hasher) { - let ContractId { value } = self; - value.hash(state); - } -} - impl ContractId { /// Mint `amount` coins of `sub_id` and send them UNCONDITIONALLY to the contract at `to`. /// From 84d26c3cb4ec1e7985d593e09037a8565efe2436 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 01:16:06 +0530 Subject: [PATCH 16/49] impl eq for assetid --- sway-lib-std/src/contract_id.sw | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 34e64d3364e..a895a902388 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -48,6 +48,12 @@ pub struct AssetId { value: b256, } +impl core::ops::Eq for AssetId { + fn eq(self, other: Self) -> bool { + self.value == other.value + } +} + impl AssetId { /// Creates a new AssetId from a ContractId and SubId. /// From ced270ae8f457ff89b57312c397fed686d592b1d Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 20:08:28 +0530 Subject: [PATCH 17/49] update example --- examples/native_token/src/main.sw | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/native_token/src/main.sw b/examples/native_token/src/main.sw index 5d1a75a6c66..ed87af750b2 100644 --- a/examples/native_token/src/main.sw +++ b/examples/native_token/src/main.sw @@ -1,6 +1,6 @@ contract; -use std::{constants::ZERO_B256, context::*, token::*}; +use std::{constants::BASE_ASSET_ID, context::*, token::*}; abi NativeAssetToken { fn mint_coins(mint_amount: u64); @@ -16,26 +16,26 @@ abi NativeAssetToken { impl NativeAssetToken for Contract { /// Mint an amount of this contracts native asset to the contracts balance. fn mint_coins(mint_amount: u64) { - mint(ZERO_B256, mint_amount); + mint(BASE_ASSET_ID, mint_amount); } /// Burn an amount of this contracts native asset. fn burn_coins(burn_amount: u64) { - burn(ZERO_B256, burn_amount); + burn(BASE_ASSET_ID, burn_amount); } /// Transfer coins to a target contract. - fn force_transfer_coins(coins: u64, asset_id: b256, target: ContractId) { + fn force_transfer_coins(coins: u64, asset_id: AssetId, target: ContractId) { force_transfer_to_contract(target, asset_id, coins); } /// Transfer coins to a transaction output to be spent later. - fn transfer_coins_to_output(coins: u64, asset_id: b256, recipient: Address) { + fn transfer_coins_to_output(coins: u64, asset_id: AssetId, recipient: Address) { transfer_to_address(recipient, asset_id, coins); } /// Get the internal balance of a specific coin at a specific contract. - fn get_balance(target: ContractId, asset_id: b256) -> u64 { + fn get_balance(target: ContractId, asset_id: AssetId) -> u64 { balance_of(target, asset_id) } @@ -46,11 +46,11 @@ impl NativeAssetToken for Contract { /// Mint and send this contracts native token to a destination contract. fn mint_and_send_to_contract(amount: u64, destination: ContractId) { - mint_to_contract(destination, ZERO_B256, amount); + mint_to_contract(destination, BASE_ASSET_ID, amount); } /// Mind and send this contracts native token to a destination address. fn mint_and_send_to_address(amount: u64, recipient: Address) { - mint_to_address(recipient, ZERO_B256, amount); + mint_to_address(recipient, BASE_ASSET_ID, amount); } } From dd73bf83bb08eb0e8380ce7dbc3a964e8077ee4c Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 20:08:44 +0530 Subject: [PATCH 18/49] update example 2 electric boogaloo --- examples/native_token/src/main.sw | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/native_token/src/main.sw b/examples/native_token/src/main.sw index ed87af750b2..4e366a35716 100644 --- a/examples/native_token/src/main.sw +++ b/examples/native_token/src/main.sw @@ -5,10 +5,10 @@ use std::{constants::BASE_ASSET_ID, context::*, token::*}; abi NativeAssetToken { fn mint_coins(mint_amount: u64); fn burn_coins(burn_amount: u64); - fn force_transfer_coins(coins: u64, asset_id: b256, target: ContractId); - fn transfer_coins_to_output(coins: u64, asset_id: b256, recipient: Address); + fn force_transfer_coins(coins: u64, asset_id: AssetId, target: ContractId); + fn transfer_coins_to_output(coins: u64, asset_id: AssetId, recipient: Address); fn deposit(); - fn get_balance(target: ContractId, asset_id: b256) -> u64; + fn get_balance(target: ContractId, asset_id: AssetId) -> u64; fn mint_and_send_to_contract(amount: u64, destination: ContractId); fn mint_and_send_to_address(amount: u64, recipient: Address); } From ec67da9f5ee6f5eddf735bef887aa9fb080e483f Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 20:18:36 +0530 Subject: [PATCH 19/49] undo conflict mistake --- sway-lib-std/src/constants.sw | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sway-lib-std/src/constants.sw b/sway-lib-std/src/constants.sw index 46a09f37e1d..ade145c8043 100644 --- a/sway-lib-std/src/constants.sw +++ b/sway-lib-std/src/constants.sw @@ -3,7 +3,7 @@ library; use ::contract_id::{AssetId, ContractId}; -/// A B256 type zero address. +/// The `BASE_ASSET_ID` represents the base asset of a chain. /// /// # Additional Information /// @@ -34,5 +34,3 @@ pub const BASE_ASSET_ID: AssetId = AssetId { /// } /// ``` pub const ZERO_B256 = 0x0000000000000000000000000000000000000000000000000000000000000000; - - From 92d9e4745c7e580816331aad29f1e892a6505819 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 20:51:07 +0530 Subject: [PATCH 20/49] update example 3 --- examples/native_token/src/main.sw | 10 +++++----- sway-lib-std/src/constants.sw | 16 ++++++++++++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/examples/native_token/src/main.sw b/examples/native_token/src/main.sw index 4e366a35716..04f9cbe0ec8 100644 --- a/examples/native_token/src/main.sw +++ b/examples/native_token/src/main.sw @@ -1,6 +1,6 @@ contract; -use std::{constants::BASE_ASSET_ID, context::*, token::*}; +use std::{constants::ZERO_SUB_ID, context::*, token::*}; abi NativeAssetToken { fn mint_coins(mint_amount: u64); @@ -16,12 +16,12 @@ abi NativeAssetToken { impl NativeAssetToken for Contract { /// Mint an amount of this contracts native asset to the contracts balance. fn mint_coins(mint_amount: u64) { - mint(BASE_ASSET_ID, mint_amount); + mint(ZERO_SUB_ID, mint_amount); } /// Burn an amount of this contracts native asset. fn burn_coins(burn_amount: u64) { - burn(BASE_ASSET_ID, burn_amount); + burn(ZERO_SUB_ID, burn_amount); } /// Transfer coins to a target contract. @@ -46,11 +46,11 @@ impl NativeAssetToken for Contract { /// Mint and send this contracts native token to a destination contract. fn mint_and_send_to_contract(amount: u64, destination: ContractId) { - mint_to_contract(destination, BASE_ASSET_ID, amount); + mint_to_contract(destination, ZERO_SUB_ID, amount); } /// Mind and send this contracts native token to a destination address. fn mint_and_send_to_address(amount: u64, recipient: Address) { - mint_to_address(recipient, BASE_ASSET_ID, amount); + mint_to_address(recipient, ZERO_SUB_ID, amount); } } diff --git a/sway-lib-std/src/constants.sw b/sway-lib-std/src/constants.sw index ade145c8043..58fdfe53593 100644 --- a/sway-lib-std/src/constants.sw +++ b/sway-lib-std/src/constants.sw @@ -1,6 +1,7 @@ //! Base asset and zero address constants. library; +use ::alias::SubId; use ::contract_id::{AssetId, ContractId}; /// The `BASE_ASSET_ID` represents the base asset of a chain. @@ -34,3 +35,18 @@ pub const BASE_ASSET_ID: AssetId = AssetId { /// } /// ``` pub const ZERO_B256 = 0x0000000000000000000000000000000000000000000000000000000000000000; + +/// A SubId of zero value. +/// +/// # Examples +/// +/// ```sway +/// use std::{token::mint, constants::ZERO_SUB_ID}; +/// +/// fn foo() { +/// mint(ZERO_SUB_ID, 50); // Mint 50 tokens with a zero sub id. +/// } +/// ``` +pub const ZERO_SUB_ID: SubId = SubId { + value: ZERO_B256, +}; \ No newline at end of file From 53fb9beda8af81a257b40df0cf7f0ff1a990b9a7 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 20:57:38 +0530 Subject: [PATCH 21/49] example 4 --- examples/native_token/src/main.sw | 10 +++++----- sway-lib-std/src/constants.sw | 15 --------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/examples/native_token/src/main.sw b/examples/native_token/src/main.sw index 04f9cbe0ec8..efcdd948f50 100644 --- a/examples/native_token/src/main.sw +++ b/examples/native_token/src/main.sw @@ -1,6 +1,6 @@ contract; -use std::{constants::ZERO_SUB_ID, context::*, token::*}; +use std::{constants::ZERO_B256, context::*, token::*}; abi NativeAssetToken { fn mint_coins(mint_amount: u64); @@ -16,12 +16,12 @@ abi NativeAssetToken { impl NativeAssetToken for Contract { /// Mint an amount of this contracts native asset to the contracts balance. fn mint_coins(mint_amount: u64) { - mint(ZERO_SUB_ID, mint_amount); + mint(ZERO_B256, mint_amount); } /// Burn an amount of this contracts native asset. fn burn_coins(burn_amount: u64) { - burn(ZERO_SUB_ID, burn_amount); + burn(ZERO_B256, burn_amount); } /// Transfer coins to a target contract. @@ -46,11 +46,11 @@ impl NativeAssetToken for Contract { /// Mint and send this contracts native token to a destination contract. fn mint_and_send_to_contract(amount: u64, destination: ContractId) { - mint_to_contract(destination, ZERO_SUB_ID, amount); + mint_to_contract(destination, ZERO_B256, amount); } /// Mind and send this contracts native token to a destination address. fn mint_and_send_to_address(amount: u64, recipient: Address) { - mint_to_address(recipient, ZERO_SUB_ID, amount); + mint_to_address(recipient, ZERO_B256, amount); } } diff --git a/sway-lib-std/src/constants.sw b/sway-lib-std/src/constants.sw index 58fdfe53593..26387e59e09 100644 --- a/sway-lib-std/src/constants.sw +++ b/sway-lib-std/src/constants.sw @@ -35,18 +35,3 @@ pub const BASE_ASSET_ID: AssetId = AssetId { /// } /// ``` pub const ZERO_B256 = 0x0000000000000000000000000000000000000000000000000000000000000000; - -/// A SubId of zero value. -/// -/// # Examples -/// -/// ```sway -/// use std::{token::mint, constants::ZERO_SUB_ID}; -/// -/// fn foo() { -/// mint(ZERO_SUB_ID, 50); // Mint 50 tokens with a zero sub id. -/// } -/// ``` -pub const ZERO_SUB_ID: SubId = SubId { - value: ZERO_B256, -}; \ No newline at end of file From 27364c0ec160e0c1aaefad8c325635c3ad702ec7 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 21:08:42 +0530 Subject: [PATCH 22/49] update other examples --- examples/liquidity_pool/src/main.sw | 2 +- .../sdk-harness/test_artifacts/tx_output_predicate/src/main.sw | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/liquidity_pool/src/main.sw b/examples/liquidity_pool/src/main.sw index 54e55ab92b7..a0660f26d72 100644 --- a/examples/liquidity_pool/src/main.sw +++ b/examples/liquidity_pool/src/main.sw @@ -19,7 +19,7 @@ abi LiquidityPool { fn withdraw(recipient: Address); } -const BASE_TOKEN = 0x9ae5b658754e096e4d681c548daf46354495a437cc61492599e33fc64dcdc30c; +const BASE_TOKEN: AssetId = AssetId { value: 0x9ae5b658754e096e4d681c548daf46354495a437cc61492599e33fc64dcdc30c }; impl LiquidityPool for Contract { fn deposit(recipient: Address) { diff --git a/test/src/sdk-harness/test_artifacts/tx_output_predicate/src/main.sw b/test/src/sdk-harness/test_artifacts/tx_output_predicate/src/main.sw index 5ddc441a949..3d0779c0162 100644 --- a/test/src/sdk-harness/test_artifacts/tx_output_predicate/src/main.sw +++ b/test/src/sdk-harness/test_artifacts/tx_output_predicate/src/main.sw @@ -7,7 +7,7 @@ fn main(index: u64, asset_id: b256, to: b256) -> bool { let tx_asset_id = output_asset_id(index); let tx_to = output_asset_to(index); - assert(tx_asset_id.is_some() && tx_asset_id.unwrap() == asset_id); + assert(tx_asset_id.is_some() && tx_asset_id.unwrap().value == asset_id); assert(tx_to.is_some() && tx_to.unwrap() == to); true From 5019ef2aaa9dc302467d926028a0cc2f6483813c Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 21:10:23 +0530 Subject: [PATCH 23/49] update reference docs --- .../src/code/operations/asset_operations/src/lib.sw | 8 ++++---- examples/liquidity_pool/src/main.sw | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/reference/src/code/operations/asset_operations/src/lib.sw b/docs/reference/src/code/operations/asset_operations/src/lib.sw index 372b45769ce..3c2a4280246 100644 --- a/docs/reference/src/code/operations/asset_operations/src/lib.sw +++ b/docs/reference/src/code/operations/asset_operations/src/lib.sw @@ -25,7 +25,7 @@ use std::token::transfer_to_address; use std::token::force_transfer_to_contract; // ANCHOR_END: force_transfer_to_contract_import -use std::constants::ZERO_B256; +use std::constants::{BASE_ASSET_ID, ZERO_B256}; fn minting() { // ANCHOR: mint @@ -77,7 +77,7 @@ fn transferring_to_address() { // ANCHOR: transfer_to_address let amount = 10; let address = 0x0000000000000000000000000000000000000000000000000000000000000001; - let asset = ZERO_B256; + let asset = BASE_ASSET_ID; let user = Address::from(address); transfer_to_address(user, asset, amount); @@ -88,7 +88,7 @@ fn transferring_to_contract() { // ANCHOR: force_transfer_to_contract let amount = 10; let address = 0x0000000000000000000000000000000000000000000000000000000000000001; - let asset = ZERO_B256; + let asset = BASE_ASSET_ID; let pool = ContractId::from(address); force_transfer_to_contract(pool, asset, amount); @@ -99,7 +99,7 @@ fn transferring_to() { // ANCHOR: transfer let amount = 10; let address = 0x0000000000000000000000000000000000000000000000000000000000000001; - let asset = ZERO_B256; + let asset = BASE_ASSET_ID; let user = Identity::Address(Address::from(address)); let pool = Identity::ContractId(ContractId::from(address)); diff --git a/examples/liquidity_pool/src/main.sw b/examples/liquidity_pool/src/main.sw index a0660f26d72..b92e4c31711 100644 --- a/examples/liquidity_pool/src/main.sw +++ b/examples/liquidity_pool/src/main.sw @@ -22,7 +22,7 @@ abi LiquidityPool { const BASE_TOKEN: AssetId = AssetId { value: 0x9ae5b658754e096e4d681c548daf46354495a437cc61492599e33fc64dcdc30c }; impl LiquidityPool for Contract { - fn deposit(recipient: Address) { + fn deposit(recipient: Address) {https://github.com/FuelLabs/sway/actions/runs/5940891602/job/16110501662 assert(msg_asset_id() == BASE_TOKEN); assert(msg_amount() > 0); From cfde26e94fca81f5909d2109358fbed10635c0e8 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 21:18:14 +0530 Subject: [PATCH 24/49] fix test import --- examples/liquidity_pool/src/main.sw | 4 ++-- test/src/sdk-harness/test_projects/token_ops/src/main.sw | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/liquidity_pool/src/main.sw b/examples/liquidity_pool/src/main.sw index b92e4c31711..13d7dc25ce5 100644 --- a/examples/liquidity_pool/src/main.sw +++ b/examples/liquidity_pool/src/main.sw @@ -22,7 +22,7 @@ abi LiquidityPool { const BASE_TOKEN: AssetId = AssetId { value: 0x9ae5b658754e096e4d681c548daf46354495a437cc61492599e33fc64dcdc30c }; impl LiquidityPool for Contract { - fn deposit(recipient: Address) {https://github.com/FuelLabs/sway/actions/runs/5940891602/job/16110501662 + fn deposit(recipient: Address) { assert(msg_asset_id() == BASE_TOKEN); assert(msg_amount() > 0); @@ -34,7 +34,7 @@ impl LiquidityPool for Contract { } fn withdraw(recipient: Address) { - let asset_id = sha256((contract_id(), ZERO_B256)); + let asset_id = AssetId::standard(contract_id()); assert(msg_asset_id() == asset_id); assert(msg_amount() > 0); diff --git a/test/src/sdk-harness/test_projects/token_ops/src/main.sw b/test/src/sdk-harness/test_projects/token_ops/src/main.sw index 8b018c7184b..56c51676a65 100644 --- a/test/src/sdk-harness/test_projects/token_ops/src/main.sw +++ b/test/src/sdk-harness/test_projects/token_ops/src/main.sw @@ -1,6 +1,6 @@ contract; -use std::{asset_id::AssetId, bytes::Bytes, constants::ZERO_B256, context::balance_of, message::send_message, token::*}; +use std::{contract_id::AssetId, bytes::Bytes, constants::ZERO_B256, context::balance_of, message::send_message, token::*}; abi TestFuelCoin { fn mint_coins(mint_amount: u64, sub_id: b256); From daa3202415f6e55f6240de1b9dfa369c4fec48ed Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 21:57:38 +0530 Subject: [PATCH 25/49] formater and lsp error --- examples/liquidity_pool/src/main.sw | 4 +++- sway-lsp/tests/lib.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/liquidity_pool/src/main.sw b/examples/liquidity_pool/src/main.sw index 13d7dc25ce5..58089c59ad8 100644 --- a/examples/liquidity_pool/src/main.sw +++ b/examples/liquidity_pool/src/main.sw @@ -19,7 +19,9 @@ abi LiquidityPool { fn withdraw(recipient: Address); } -const BASE_TOKEN: AssetId = AssetId { value: 0x9ae5b658754e096e4d681c548daf46354495a437cc61492599e33fc64dcdc30c }; +const BASE_TOKEN: AssetId = AssetId { + value: 0x9ae5b658754e096e4d681c548daf46354495a437cc61492599e33fc64dcdc30c, +}; impl LiquidityPool for Contract { fn deposit(recipient: Address) { diff --git a/sway-lsp/tests/lib.rs b/sway-lsp/tests/lib.rs index 9836c628be0..6fe95054fa0 100644 --- a/sway-lsp/tests/lib.rs +++ b/sway-lsp/tests/lib.rs @@ -722,7 +722,7 @@ async fn go_to_definition_for_paths() { req_uri: &uri, req_line: 24, req_char: 31, - def_line: 33, + def_line: 36, def_start_char: 10, def_end_char: 19, def_path: "sway-lib-std/src/constants.sw", From 03ff24d78f37fb84a6e44fea3d006d946308bdb1 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 22 Aug 2023 22:16:34 +0530 Subject: [PATCH 26/49] fix e2e tests --- .../language/const_decl_with_call_path/src/main.sw | 2 +- .../should_pass/language/type_alias/src/main.sw | 12 ++++++------ .../caller_context_test/src/main.sw | 6 +++--- .../token_ops_test/src/main.sw | 4 ++-- .../src/main.sw | 2 +- .../src/main.sw | 2 +- .../contract_with_type_aliases_abi/src/main.sw | 4 ++-- .../test_abis/test_fuel_coin_abi/src/main.sw | 2 +- .../context_testing_contract/src/main.sw | 8 +++++++- .../contract_with_type_aliases/src/main.sw | 6 +++--- .../test_fuel_coin_contract/src/main.sw | 2 +- 11 files changed, 28 insertions(+), 22 deletions(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/const_decl_with_call_path/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/const_decl_with_call_path/src/main.sw index 9e77c1858e3..6af62302486 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/const_decl_with_call_path/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/const_decl_with_call_path/src/main.sw @@ -7,6 +7,6 @@ fn main() -> u64 { let zero = std::constants::ZERO_B256; let base_asset_id = std::constants::BASE_ASSET_ID; assert(zero == 0x0000000000000000000000000000000000000000000000000000000000000000); - assert(base_asset_id == zero); + assert(base_asset_id.value == zero); x } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/type_alias/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_alias/src/main.sw index 36dd7183e55..2078be83e30 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/type_alias/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_alias/src/main.sw @@ -3,7 +3,7 @@ script; mod lib; struct MyType { - x: std::alias::AssetId, + x: std::alias::SubId, } type MyTypeAlias1 = MyType; type MyTypeAlias2 = MyTypeAlias1; @@ -45,14 +45,14 @@ struct GenericStruct { x: T, } -fn foo(x: AssetId) -> AssetId { +fn foo(x: SubId) -> SubId { x } fn struct_tests() { /* Structs */ let x = 0x0000000000000000000000000000000000000000000000000000000000000001; - let y: AssetId = x; - let z: AssetId = 0x0000000000000000000000000000000000000000000000000000000000000001; + let y: SubId = x; + let z: SubId = 0x0000000000000000000000000000000000000000000000000000000000000001; let _ = foo(x); let t = MyTypeAlias2 { x: 0x0000000000000000000000000000000000000000000000000000000000000001, @@ -92,7 +92,7 @@ fn noop2(x: lib::MyIdentity2) -> Identity { } enum MyEnumType { - X: std::alias::AssetId, + X: std::alias::SubId, } type MyEnumTypeAlias1 = MyEnumType; type MyEnumTypeAlias2 = MyEnumTypeAlias1; @@ -134,7 +134,7 @@ fn enum_tests() { let x = ContractId { value: 0x0000000000000000000000000000000000000000000000000000000000000001, }; - let z: AssetId = 0x0000000000000000000000000000000000000000000000000000000000000001; + let z: SubId = 0x0000000000000000000000000000000000000000000000000000000000000001; let o = Some(x); if let Some(ContractId { value }) = o { assert(value == z); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw index c55c1cdc093..deb73cfa9b5 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw @@ -16,7 +16,7 @@ fn main() -> bool { let returned_contract_id = test_contract.get_id { gas: gas, coins: 0, - asset_id: BASE_ASSET_ID, + asset_id: BASE_ASSET_ID.value, }(); assert(returned_contract_id.into() == other_contract_id.into()); @@ -25,7 +25,7 @@ fn main() -> bool { let returned_this_balance = test_contract.get_this_balance { gas: gas, coins: 0, - asset_id: BASE_ASSET_ID, + asset_id: BASE_ASSET_ID.value, }(base_asset_id); assert(returned_this_balance == 0); @@ -33,7 +33,7 @@ fn main() -> bool { let returned_contract_balance = test_contract.get_balance_of_contract { gas: gas, coins: 0, - asset_id: BASE_ASSET_ID, + asset_id: BASE_ASSET_ID.value, }(base_asset_id, other_contract_id); assert(returned_contract_balance == 0); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw index 4a98c8730c4..1d1f4562c1a 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw @@ -2,7 +2,7 @@ script; use std::context::balance_of; use std::token::*; -use std::asset_id::*; +use std::contract_id::*; use test_fuel_coin_abi::*; struct Opts { @@ -16,7 +16,7 @@ fn main() -> bool { // the deployed fuel_coin Contract_Id: let fuelcoin_id = ContractId::from(0xd97252cce794750e8124447a6071cf26c7a889f0d53d8b2d14c4d8326242d543); - let fuelcoin_asset_id = construct_default_asset_id(fuelcoin_id); + let fuelcoin_asset_id = AssetId::standard(fuelcoin_id); // contract ID for sway/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/ let balance_test_id = ContractId::from(0x4a00baa517980432b9274a0e2f03c88735bdb483730816679c6eb37b4046d060); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tr/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tr/src/main.sw index 31848ebf688..bf91e2b017b 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tr/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tr/src/main.sw @@ -15,7 +15,7 @@ impl TestAbi for Contract { // effect -- therefore violation of CEI where effect should go before interaction let amount = 10; let address = 0x0000000000000000000000000000000000000000000000000000000000000001; - let asset = address; + let asset = AssetId { value: address }; let pool = ContractId::from(address); // `force_transfer_to_contract` uses `tr` asm instruction force_transfer_to_contract(pool, asset, amount); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tro/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tro/src/main.sw index bdb454c3ae4..225fb657de4 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tro/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tro/src/main.sw @@ -15,7 +15,7 @@ impl TestAbi for Contract { // effect -- therefore violation of CEI where effect should go before interaction let amount = 10; let address = 0x0000000000000000000000000000000000000000000000000000000000000001; - let asset = address; + let asset = AssetId { value: address }; let user = Address::from(address); // `transfer_to_address` uses `tro` asm instruction transfer_to_address(user, asset, amount); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/contract_with_type_aliases_abi/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/contract_with_type_aliases_abi/src/main.sw index 01fea90aaf0..e24e260a5e3 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/contract_with_type_aliases_abi/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/contract_with_type_aliases_abi/src/main.sw @@ -15,7 +15,7 @@ impl core::ops::Eq for Array { } } -pub type Tuple = (AssetId, AssetId); +pub type Tuple = (SubId, SubId); impl core::ops::Eq for Tuple { fn eq(self, other: Self) -> bool { self.0 == other.0 && self.1 == other.1 @@ -47,5 +47,5 @@ pub struct Generic { } abi MyContract { - fn foo(x: AssetId, y: [IdentityAlias; 2], z: IdentityAliasWrapperAlias, w: Generic, u: (AssetId, AssetId), s: StringTy) -> (AssetId, [IdentityAlias; 2], IdentityAliasWrapperAlias, Generic, (AssetId, AssetId), StringTy); + fn foo(x: SubId, y: [IdentityAlias; 2], z: IdentityAliasWrapperAlias, w: Generic, u: (SubId, SubId), s: StringTy) -> (SubId, [IdentityAlias; 2], IdentityAliasWrapperAlias, Generic, (SubId, SubId), StringTy); } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/src/main.sw index bc26b7c8a5f..6df870c3160 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/test_fuel_coin_abi/src/main.sw @@ -3,5 +3,5 @@ library; abi TestFuelCoin { fn mint(mint_amount: u64); fn burn(burn_amount: u64); - fn force_transfer(coins: u64, asset_id: b256, c_id: ContractId); + fn force_transfer(coins: u64, asset_id: AssetId, c_id: ContractId); } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw index 466cb284055..d8516a934f2 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw @@ -9,10 +9,16 @@ impl ContextTesting for Contract { } fn get_this_balance(asset_id: b256) -> u64 { + let asset_id = AssetId { + value: asset_id + }; this_balance(asset_id) } fn get_balance_of_contract(asset_id: b256, cid: ContractId) -> u64 { + let asset_id = AssetId { + value: asset_id + }; balance_of(cid, asset_id) } @@ -21,7 +27,7 @@ impl ContextTesting for Contract { } fn get_asset_id() -> b256 { - msg_asset_id() + msg_asset_id().value } fn get_gas() -> u64 { diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_with_type_aliases/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_with_type_aliases/src/main.sw index 8ac2457fab3..e2e7f45da6f 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_with_type_aliases/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/contract_with_type_aliases/src/main.sw @@ -4,13 +4,13 @@ use contract_with_type_aliases_abi::*; impl MyContract for Contract { fn foo( - x: AssetId, + x: SubId, y: [IdentityAlias; 2], z: IdentityAliasWrapperAlias, w: Generic, - u: (AssetId, AssetId), + u: (SubId, SubId), s: StringTy, - ) -> (AssetId, [IdentityAlias; 2], IdentityAliasWrapperAlias, Generic, (AssetId, AssetId), StringTy) { + ) -> (SubId, [IdentityAlias; 2], IdentityAliasWrapperAlias, Generic, (SubId, SubId), StringTy) { (x, y, z, w, u, s) } } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/src/main.sw index 84548981c23..b3939b4eca3 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/src/main.sw @@ -13,7 +13,7 @@ impl TestFuelCoin for Contract { burn(ZERO_B256, burn_amount); } - fn force_transfer(coins: u64, asset_id: b256, c_id: ContractId) { + fn force_transfer(coins: u64, asset_id: AssetId, c_id: ContractId) { force_transfer_to_contract(c_id, asset_id, coins) } } From b0975a9580c6d3273f5d3e3dce00778eb84db0a3 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 23 Aug 2023 00:16:34 +0530 Subject: [PATCH 27/49] fix inconsistent representation --- .../test_abis/context_testing_abi/src/main.sw | 6 +++--- .../context_testing_contract/src/main.sw | 14 ++++---------- .../sdk-harness/test_projects/context/src/main.sw | 4 +++- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/context_testing_abi/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/context_testing_abi/src/main.sw index 6775494cb4b..c50e86e7506 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/context_testing_abi/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_abis/context_testing_abi/src/main.sw @@ -2,10 +2,10 @@ library; abi ContextTesting { fn get_id() -> ContractId; - fn get_this_balance(asset_id: b256) -> u64; - fn get_balance_of_contract(asset_id: b256, contract_id: ContractId) -> u64; + fn get_this_balance(asset_id: AssetId) -> u64; + fn get_balance_of_contract(asset_id: AssetId, contract_id: ContractId) -> u64; fn get_amount() -> u64; - fn get_asset_id() -> b256; + fn get_asset_id() -> AssetId; fn get_gas() -> u64; fn get_global_gas() -> u64; } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw index d8516a934f2..19f9e7a8838 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/src/main.sw @@ -8,17 +8,11 @@ impl ContextTesting for Contract { contract_id() } - fn get_this_balance(asset_id: b256) -> u64 { - let asset_id = AssetId { - value: asset_id - }; + fn get_this_balance(asset_id: AssetId) -> u64 { this_balance(asset_id) } - fn get_balance_of_contract(asset_id: b256, cid: ContractId) -> u64 { - let asset_id = AssetId { - value: asset_id - }; + fn get_balance_of_contract(asset_id: AssetId, cid: ContractId) -> u64 { balance_of(cid, asset_id) } @@ -26,8 +20,8 @@ impl ContextTesting for Contract { msg_amount() } - fn get_asset_id() -> b256 { - msg_asset_id().value + fn get_asset_id() -> AssetId { + msg_asset_id() } fn get_gas() -> u64 { diff --git a/test/src/sdk-harness/test_projects/context/src/main.sw b/test/src/sdk-harness/test_projects/context/src/main.sw index 26e201a8588..365c5ca2b09 100644 --- a/test/src/sdk-harness/test_projects/context/src/main.sw +++ b/test/src/sdk-harness/test_projects/context/src/main.sw @@ -6,11 +6,13 @@ use context_testing_abi::*; impl ContextTesting for Contract { #[payable] fn get_this_balance(asset: b256) -> u64 { + let asset = AssetId { value: asset }; this_balance(asset) } #[payable] fn get_balance_of_contract(asset: b256, r#contract: ContractId) -> u64 { + let asset = AssetId { value: asset }; balance_of(r#contract, asset) } @@ -21,7 +23,7 @@ impl ContextTesting for Contract { #[payable] fn get_asset_id() -> b256 { - msg_asset_id() + msg_asset_id().value } #[payable] From 6a1672811aad2a70875a7779a693badfef53464e Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 23 Aug 2023 00:26:54 +0530 Subject: [PATCH 28/49] sdk harness update return type --- test/src/sdk-harness/test_projects/call_frames/src/main.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/sdk-harness/test_projects/call_frames/src/main.sw b/test/src/sdk-harness/test_projects/call_frames/src/main.sw index e190f6b4a36..350fffddaef 100644 --- a/test/src/sdk-harness/test_projects/call_frames/src/main.sw +++ b/test/src/sdk-harness/test_projects/call_frames/src/main.sw @@ -8,7 +8,7 @@ impl CallFramesTest for Contract { contract_id() } - fn get_asset_id() -> b256 { + fn get_asset_id() -> AssetId { msg_asset_id() } From a7b0ce9a93a627aad8f5571ebc7143d1ca688fcf Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 23 Aug 2023 00:32:08 +0530 Subject: [PATCH 29/49] update abi aswell --- .../sdk-harness/test_artifacts/call_frames_test_abi/src/main.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/sdk-harness/test_artifacts/call_frames_test_abi/src/main.sw b/test/src/sdk-harness/test_artifacts/call_frames_test_abi/src/main.sw index 69fba91e846..166f54b03c2 100644 --- a/test/src/sdk-harness/test_artifacts/call_frames_test_abi/src/main.sw +++ b/test/src/sdk-harness/test_artifacts/call_frames_test_abi/src/main.sw @@ -11,7 +11,7 @@ pub struct TestStruct2 { abi CallFramesTest { fn get_id() -> ContractId; - fn get_asset_id() -> b256; + fn get_asset_id() -> AssetId; fn get_code_size() -> u64; fn get_first_param() -> u64; fn get_second_param_u64(arg0: u64) -> u64; From efa69c471a42ca80f40b0ba16d3d9950436ec44b Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 23 Aug 2023 00:51:12 +0530 Subject: [PATCH 30/49] change aid to sid --- .../sdk-harness/test_projects/type_aliases/src/main.sw | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/src/sdk-harness/test_projects/type_aliases/src/main.sw b/test/src/sdk-harness/test_projects/type_aliases/src/main.sw index 48d6b4956f1..66a1b54b84c 100644 --- a/test/src/sdk-harness/test_projects/type_aliases/src/main.sw +++ b/test/src/sdk-harness/test_projects/type_aliases/src/main.sw @@ -7,7 +7,7 @@ struct IdentityAliasWrapper { } type Array = [IdentityAlias; 2]; -type Tuple = (AssetId, AssetId); +type Tuple = (SubId, SubId); type StringTy = str[9]; type IdentityAliasWrapperAlias = IdentityAliasWrapper; struct Generic { @@ -15,18 +15,18 @@ struct Generic { } abi MyContract { - fn foo(x: AssetId, y: [IdentityAlias; 2], z: IdentityAliasWrapperAlias, w: Generic, u: (AssetId, AssetId), s: StringTy) -> (AssetId, [IdentityAlias; 2], IdentityAliasWrapperAlias, Generic, (AssetId, AssetId), StringTy); + fn foo(x: SubId, y: [IdentityAlias; 2], z: IdentityAliasWrapperAlias, w: Generic, u: (SubId, SubId), s: StringTy) -> (SubId, [IdentityAlias; 2], IdentityAliasWrapperAlias, Generic, (SubId, SubId), StringTy); } impl MyContract for Contract { fn foo( - x: AssetId, + x: SubId, y: [IdentityAlias; 2], z: IdentityAliasWrapperAlias, w: Generic, - u: (AssetId, AssetId), + u: (SubId, SubId), s: StringTy, - ) -> (AssetId, [IdentityAlias; 2], IdentityAliasWrapperAlias, Generic, (AssetId, AssetId), StringTy) { + ) -> (SubId, [IdentityAlias; 2], IdentityAliasWrapperAlias, Generic, (SubId, SubId), StringTy) { (x, y, z, w, u, s) } } From a9083b177f1f8b88c3be676f8c4b9eeeb9481d03 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 23 Aug 2023 01:42:16 +0530 Subject: [PATCH 31/49] update contract address --- .../require_contract_deployment/caller_context_test/src/main.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw index deb73cfa9b5..b4df689794d 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_context_test/src/main.sw @@ -7,7 +7,7 @@ fn main() -> bool { let zero = b256::min(); let gas: u64 = u64::max(); let amount: u64 = 11; - let other_contract_id = ContractId::from(0xbf9b0e9214422dd2c43342f9755dd00e16eb44131efa00d7dff3bf422dc0a99e); + let other_contract_id = ContractId::from(0xa38576787f8900d66e6620548b6da8142b8bb4d129b2338609acd121ca126c10); let base_asset_id = BASE_ASSET_ID; let test_contract = abi(ContextTesting, other_contract_id.into()); From ff762e99c9c6f0a5e29204736ac0c1b4bd51adc8 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 23 Aug 2023 02:12:13 +0530 Subject: [PATCH 32/49] update contractid tokenops --- .../require_contract_deployment/token_ops_test/src/main.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw index 1d1f4562c1a..0fd49073edf 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw @@ -15,7 +15,7 @@ fn main() -> bool { let default_gas = 1_000_000_000_000; // the deployed fuel_coin Contract_Id: - let fuelcoin_id = ContractId::from(0xd97252cce794750e8124447a6071cf26c7a889f0d53d8b2d14c4d8326242d543); + let fuelcoin_id = ContractId::from(0x5d10689c7eecb405937a3f35fab7baf05a3f6189f9a2993ee70e21ccc1212460); let fuelcoin_asset_id = AssetId::standard(fuelcoin_id); // contract ID for sway/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/ From fb095bb4343209f9071a15d41119a4a02b4c179d Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 23 Aug 2023 20:44:58 +0530 Subject: [PATCH 33/49] update oracle.json --- .../json_abi_oracle.json | 36 ++++++++++++------- .../json_abi_oracle.json | 26 ++++++++++---- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/json_abi_oracle.json index 0d70f746b3d..a9ac1fcfefd 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/context_testing_contract/json_abi_oracle.json @@ -7,7 +7,7 @@ "name": "get_amount", "output": { "name": "", - "type": 2, + "type": 3, "typeArguments": null } }, @@ -17,7 +17,7 @@ "name": "get_asset_id", "output": { "name": "", - "type": 0, + "type": 1, "typeArguments": null } }, @@ -26,19 +26,19 @@ "inputs": [ { "name": "asset_id", - "type": 0, + "type": 1, "typeArguments": null }, { "name": "cid", - "type": 1, + "type": 2, "typeArguments": null } ], "name": "get_balance_of_contract", "output": { "name": "", - "type": 2, + "type": 3, "typeArguments": null } }, @@ -48,7 +48,7 @@ "name": "get_gas", "output": { "name": "", - "type": 2, + "type": 3, "typeArguments": null } }, @@ -58,7 +58,7 @@ "name": "get_global_gas", "output": { "name": "", - "type": 2, + "type": 3, "typeArguments": null } }, @@ -68,7 +68,7 @@ "name": "get_id", "output": { "name": "", - "type": 1, + "type": 2, "typeArguments": null } }, @@ -77,14 +77,14 @@ "inputs": [ { "name": "asset_id", - "type": 0, + "type": 1, "typeArguments": null } ], "name": "get_this_balance", "output": { "name": "", - "type": 2, + "type": 3, "typeArguments": null } } @@ -106,14 +106,26 @@ "typeArguments": null } ], - "type": "struct std::contract_id::ContractId", + "type": "struct std::contract_id::AssetId", "typeId": 1, "typeParameters": null }, + { + "components": [ + { + "name": "value", + "type": 0, + "typeArguments": null + } + ], + "type": "struct std::contract_id::ContractId", + "typeId": 2, + "typeParameters": null + }, { "components": null, "type": "u64", - "typeId": 2, + "typeId": 3, "typeParameters": null } ] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/json_abi_oracle.json index ef4684a5859..f3183c61135 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/json_abi_oracle.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/test_fuel_coin_contract/json_abi_oracle.json @@ -6,7 +6,7 @@ "inputs": [ { "name": "burn_amount", - "type": 3, + "type": 4, "typeArguments": null } ], @@ -22,17 +22,17 @@ "inputs": [ { "name": "coins", - "type": 3, + "type": 4, "typeArguments": null }, { "name": "asset_id", - "type": 1, + "type": 2, "typeArguments": null }, { "name": "c_id", - "type": 2, + "type": 3, "typeArguments": null } ], @@ -48,7 +48,7 @@ "inputs": [ { "name": "mint_amount", - "type": 3, + "type": 4, "typeArguments": null } ], @@ -83,14 +83,26 @@ "typeArguments": null } ], - "type": "struct std::contract_id::ContractId", + "type": "struct std::contract_id::AssetId", "typeId": 2, "typeParameters": null }, + { + "components": [ + { + "name": "value", + "type": 1, + "typeArguments": null + } + ], + "type": "struct std::contract_id::ContractId", + "typeId": 3, + "typeParameters": null + }, { "components": null, "type": "u64", - "typeId": 3, + "typeId": 4, "typeParameters": null } ] From 720913daa60618c6da93b579932b2efaba218ef1 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 23 Aug 2023 21:23:22 +0530 Subject: [PATCH 34/49] revert changes to cargo lok --- Cargo.lock | 578 +++++++++++++++++++++++++++-------------------------- 1 file changed, 297 insertions(+), 281 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d0bb174b499..5b9f76c3032 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -38,17 +38,6 @@ dependencies = [ "cpufeatures", ] -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom 0.2.10", - "once_cell", - "version_check", -] - [[package]] name = "ahash" version = "0.8.3" @@ -62,9 +51,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" +checksum = "86b8f9420f797f2d9e935edf629310eb938a0d839f984e25327f3c7eed22300c" dependencies = [ "memchr", ] @@ -165,9 +154,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -175,9 +164,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "3b13c32d80ecc7ab747b80c3784bce54ee8a7a0cc4fbda9bf4cda2cf6fe90854" [[package]] name = "arrayref" @@ -221,13 +210,13 @@ checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" [[package]] name = "async-trait" -version = "0.1.71" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -363,9 +352,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "bitmaps" @@ -433,15 +422,15 @@ dependencies = [ [[package]] name = "blake3" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b71f35bd3fa1a4c86b85d32c8b9069ea7fe14f7a53cfabb65f62d4265b888" +checksum = "199c42ab6972d92c9f8995f086273d25c42fc0f7b2a1fcefba465c1352d25ba5" dependencies = [ "arrayref", "arrayvec 0.7.4", "cc", "cfg-if", - "constant_time_eq 0.2.6", + "constant_time_eq 0.3.0", "digest 0.10.7", ] @@ -506,7 +495,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", - "regex-automata 0.3.0", + "regex-automata 0.3.6", "serde", ] @@ -545,11 +534,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -657,20 +647,20 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.11" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1640e5cc7fb47dbb8338fd471b105e7ed6c3cb2aeb00c2e067127ffd3764a05d" +checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" dependencies = [ "clap_builder", - "clap_derive 4.3.2", + "clap_derive 4.3.12", "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.11" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98c59138d527eeaf9b53f35a77fcc1fad9d883116070c63d5de1c7dc7b00c72b" +checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" dependencies = [ "anstream", "anstyle", @@ -695,7 +685,7 @@ version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce" dependencies = [ - "clap 4.3.11", + "clap 4.3.21", ] [[package]] @@ -713,14 +703,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.3.2" +version = "4.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" +checksum = "54a9bb5758fc5dfe728d1019941681eccaf0cf8a4189b692a0ee2f2ecf90a050" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -774,7 +764,7 @@ dependencies = [ "getrandom 0.2.10", "hmac", "once_cell", - "pbkdf2 0.12.1", + "pbkdf2 0.12.2", "rand", "sha2 0.10.7", "thiserror", @@ -852,7 +842,7 @@ version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784836d0812dade01579cc0cc9b1684847044e716fd7aa6bffbc172e42199500" dependencies = [ - "clap 4.3.11", + "clap 4.3.21", "entities", "memchr", "once_cell", @@ -881,9 +871,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.3" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6340df57935414636969091153f35f68d9f00bbc8fb4a9c6054706c213e6c6bc" +checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" [[package]] name = "constant_time_eq" @@ -897,6 +887,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" +[[package]] +name = "constant_time_eq" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" + [[package]] name = "convert_case" version = "0.4.0" @@ -910,7 +906,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e859cd57d0710d9e06c381b550c06e76992472a8c6d527aecd2fc673dcc231fb" dependencies = [ "percent-encoding", - "time 0.3.22", + "time 0.3.25", "version_check", ] @@ -927,7 +923,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "time 0.3.22", + "time 0.3.25", "url", ] @@ -998,7 +994,7 @@ dependencies = [ "anes", "cast", "ciborium", - "clap 4.3.11", + "clap 4.3.21", "criterion-plot", "is-terminal", "itertools", @@ -1027,9 +1023,9 @@ dependencies = [ [[package]] name = "critical-section" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" +checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216" [[package]] name = "crossbeam-channel" @@ -1231,12 +1227,12 @@ dependencies = [ [[package]] name = "dashmap" -version = "5.4.0" +version = "5.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +checksum = "6943ae99c34386c84a470c499d3414f66502a41340aa895406e0d2e4a207b91d" dependencies = [ "cfg-if", - "hashbrown 0.12.3", + "hashbrown 0.14.0", "lock_api", "once_cell", "parking_lot_core 0.9.8", @@ -1270,14 +1266,20 @@ dependencies = [ [[package]] name = "der" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", "zeroize", ] +[[package]] +name = "deranged" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" + [[package]] name = "derivative" version = "2.2.0" @@ -1304,9 +1306,9 @@ dependencies = [ [[package]] name = "deunicode" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "850878694b7933ca4c9569d30a34b55031b9b139ee1fc7b94a527c4ef960d690" +checksum = "d95203a6a50906215a502507c0f879a0ce7ff205a6111e2db2a5ef8e4bb92e43" [[package]] name = "devault" @@ -1415,9 +1417,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "ecdsa" -version = "0.16.7" +version = "0.16.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" dependencies = [ "der", "digest 0.10.7", @@ -1462,9 +1464,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "elliptic-curve" @@ -1522,7 +1524,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -1540,15 +1542,15 @@ dependencies = [ [[package]] name = "equivalent" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" dependencies = [ "errno-dragonfly", "libc", @@ -1643,14 +1645,14 @@ checksum = "dd65f1b59dd22d680c7a626cc4a000c1e03d241c51c3e034d2bc9f1e90734f9b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] name = "fancy-regex" -version = "0.7.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d6b8560a05112eb52f04b00e5d3790c0dd75d9d980eb8a122fb23b92a623ccf" +checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2" dependencies = [ "bit-set", "regex", @@ -1658,12 +1660,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.9.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "fd-lock" @@ -1672,7 +1671,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ "cfg-if", - "rustix 0.38.3", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -1709,13 +1708,13 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.2.16", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] @@ -1826,14 +1825,14 @@ name = "forc-doc" version = "0.44.1" dependencies = [ "anyhow", - "clap 4.3.11", + "clap 4.3.21", "colored", "comrak", "forc-pkg", "forc-util", "horrorshow", "include_dir", - "opener", + "opener 0.5.2", "sway-ast", "sway-core", "sway-lsp", @@ -1973,7 +1972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8df9ef0ea688621e659a30aee08a3f67df3de0ab9340203736eabc074e223af2" dependencies = [ "anyhow", - "clap 4.3.11", + "clap 4.3.21", "eth-keystore", "fuel-crypto", "fuel-types", @@ -2066,7 +2065,7 @@ dependencies = [ "regex", "serde", "serde_json", - "syn 2.0.23", + "syn 2.0.28", "thiserror", ] @@ -2323,9 +2322,9 @@ dependencies = [ [[package]] name = "fuels" -version = "0.45.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa0d9fe01b4f234c07ef7d9e619ccb8d17e4a502af63f30a30a2097acab0dfdf" +checksum = "c0a24ee9d2eee78b933bea2ca275e00a558111ffa37e32dc4dce060dc89b70b6" dependencies = [ "fuel-core-client", "fuel-tx", @@ -2338,9 +2337,9 @@ dependencies = [ [[package]] name = "fuels-accounts" -version = "0.45.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8d03d520ea383743f78af6909ac5a04c805ad4eb1f03d99c80b0d4679a44f6" +checksum = "9556ba92649eda5e1a37d0b3f846e4ab03cc3f0b11106b371f48cf01799d1b95" dependencies = [ "async-trait", "bytes", @@ -2365,9 +2364,9 @@ dependencies = [ [[package]] name = "fuels-code-gen" -version = "0.45.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18b307990519c78c5c7661666a912c05915d1deed7bf4b577b50987fe97ae31" +checksum = "6ac588c4ab7e8ff614c82e065f7fa42c972ee7114bd51619af28e827ee8d113a" dependencies = [ "Inflector", "fuel-abi-types 0.3.0", @@ -2376,14 +2375,14 @@ dependencies = [ "quote", "regex", "serde_json", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] name = "fuels-core" -version = "0.45.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79566b388d8822c4c06aac60d9647dbb9393807cd5e6653cfa0c1630644da196" +checksum = "ba9ed2470f4554a4ef46637589cfec5994826174e0541982d098d9e8339fd337" dependencies = [ "bech32 0.9.1", "chrono", @@ -2410,9 +2409,9 @@ dependencies = [ [[package]] name = "fuels-macros" -version = "0.45.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c92232ef42b254a1649c6a6bfddd35b2c50f358b15e98e953eb82d69b397c57" +checksum = "3a45842e7d90d899aaa282ea4b154c6fd385759e30b7df6a533a30772a55d33a" dependencies = [ "Inflector", "fuel-abi-types 0.3.0", @@ -2423,14 +2422,14 @@ dependencies = [ "rand", "regex", "serde_json", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] name = "fuels-programs" -version = "0.45.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e4250bb73ff44cfdcd39f86c0e3163c11753e16583013fae698e9132400280" +checksum = "6815775e3a9cd9fbfd80f3b53a6a3338510eef4f31e3f6885d45b5603496b00b" dependencies = [ "async-trait", "bytes", @@ -2456,9 +2455,9 @@ dependencies = [ [[package]] name = "fuels-test-helpers" -version = "0.45.1" +version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df1a046adf1862f5b1844800abed842c6748abb2dc94c8e0df43473e96c3f4d" +checksum = "32910f7aeed5fd5f8293aef233100e8224c992096f0310fe7ba8df0a1069a56e" dependencies = [ "fuel-core-chain-config", "fuel-core-client", @@ -2541,7 +2540,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -2780,9 +2779,6 @@ name = "hashbrown" version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.6", -] [[package]] name = "hashbrown" @@ -2790,7 +2786,7 @@ version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" dependencies = [ - "ahash 0.8.3", + "ahash", ] [[package]] @@ -2906,9 +2902,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -2933,7 +2929,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -2980,7 +2976,7 @@ dependencies = [ "http", "hyper", "log", - "rustls 0.21.3", + "rustls 0.21.6", "rustls-native-certs 0.6.3", "tokio", "tokio-rustls 0.24.1", @@ -3195,9 +3191,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.30.0" +version = "1.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28491f7753051e5704d4d0ae7860d45fae3238d7d235bc4289dcd45c48d3cec3" +checksum = "a0770b0a3d4c70567f0d58331f3088b0e4c4f56c9b8d764efe654b4a5d46de3a" dependencies = [ "console", "lazy_static", @@ -3279,12 +3275,12 @@ checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ "hermit-abi 0.3.2", - "rustix 0.38.3", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -3299,9 +3295,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -3346,9 +3342,9 @@ dependencies = [ [[package]] name = "kqueue" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8fc60ba15bf51257aa9807a48a61013db043fcf3a78cb0d916e8e396dcad98" +checksum = "7447f1ca1b7b563588a205fe93dea8df60fd981423a768bc1c0ded35ed147d0c" dependencies = [ "kqueue-sys", "libc", @@ -3356,9 +3352,9 @@ dependencies = [ [[package]] name = "kqueue-sys" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8367585489f01bc55dd27404dcf56b95e6da061a256a666ab23be9ba96a2e587" +checksum = "ed9625ffda8729b85e45cf04090035ac368927b8cebc34898e7c120f52e4838b" dependencies = [ "bitflags 1.3.2", "libc", @@ -3409,9 +3405,9 @@ dependencies = [ [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "libc", @@ -3442,9 +3438,9 @@ checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "linux-raw-sys" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" [[package]] name = "lock_api" @@ -3458,9 +3454,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.19" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "logos" @@ -3487,9 +3483,9 @@ dependencies = [ [[package]] name = "lsp-types" -version = "0.94.0" +version = "0.94.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b63735a13a1f9cd4f4835223d828ed9c2e35c8c5e61837774399f558b6a1237" +checksum = "c66bfd44a06ae10647fe3f8214762e9369fd4248df1350924b4ef9e770a85ea1" dependencies = [ "bitflags 1.3.2", "serde", @@ -3515,20 +3511,20 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "mdbook" -version = "0.4.31" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b67ee4a744f36e6280792016c17e69921b51df357181d1eb17d620fcc3609f3" +checksum = "c55eb7c4dad20cc5bc15181c2aaf43d5689d5c3e0b80b50cc4cf0b7fe72a26d9" dependencies = [ "anyhow", "chrono", - "clap 4.3.11", + "clap 4.3.21", "clap_complete 4.3.2", "env_logger", "handlebars", "log", "memchr", "once_cell", - "opener", + "opener 0.6.1", "pulldown-cmark", "regex", "serde", @@ -3796,6 +3792,15 @@ dependencies = [ "tempfile", ] +[[package]] +name = "normpath" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "notify" version = "5.2.0" @@ -3845,9 +3850,9 @@ dependencies = [ [[package]] name = "num" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" +checksum = "b05180d69e3da0e530ba2a1dae5110317e49e3b7f3d41be227dc5f92e49ee7af" dependencies = [ "num-bigint", "num-complex", @@ -3871,9 +3876,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e0d21255c828d6f128a1e41534206671e8c3ea0c62f32291e808dc82cff17d" +checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" dependencies = [ "num-traits", ] @@ -3913,9 +3918,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", ] @@ -4016,11 +4021,22 @@ dependencies = [ "winapi", ] +[[package]] +name = "opener" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788" +dependencies = [ + "bstr", + "normpath", + "winapi", +] + [[package]] name = "openssl" -version = "0.10.55" +version = "0.10.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" dependencies = [ "bitflags 1.3.2", "cfg-if", @@ -4039,7 +4055,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -4050,18 +4066,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.26.0+1.1.1u" +version = "111.27.0+1.1.1v" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efc62c9f12b22b8f5208c23a7200a442b2e5999f8bdf80233852122b5a4f6f37" +checksum = "06e8f197c82d7511c5b014030c9b1efeda40d7d5f99d23b4ceed3524a5e63f02" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.90" +version = "0.9.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" dependencies = [ "cc", "libc", @@ -4111,9 +4127,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.3" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "756d439303e94fae44f288ba881ad29670c65b0c4b0e05674ca81061bb65f2c5" +checksum = "dd8e946cc0cc711189c0b0249fb8b599cbeeab9784d83c415719368bb8d4ac64" dependencies = [ "arrayvec 0.7.4", "bitvec 1.0.1", @@ -4125,9 +4141,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.3" +version = "3.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d884d78fcf214d70b1e239fcd1c6e5e95aa3be1881918da2e488cc946c7a476" +checksum = "2a296c3079b5fefbc499e1de58dc26c09b1b9a5952d26694ee89f04a43ebbb3e" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4185,9 +4201,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b27ab7be369122c218afc2079489cdcb4b517c0a3fc386ff11e1fedfcc2b35" +checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" [[package]] name = "pbkdf2" @@ -4200,9 +4216,9 @@ dependencies = [ [[package]] name = "pbkdf2" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0ca0b5a68607598bf3bad68f32227a8164f6254833f84eafaac409cd6746c31" +checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2" dependencies = [ "digest 0.10.7", "hmac", @@ -4243,9 +4259,9 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pest" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73935e4d55e2abf7f130186537b19e7a4abc886a0252380b59248af473a3fc9" +checksum = "1acb4a4365a13f749a93f1a094a7805e5cfa0955373a9de860d962eaa3a5fe5a" dependencies = [ "thiserror", "ucd-trie", @@ -4253,9 +4269,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aef623c9bbfa0eedf5a0efba11a5ee83209c326653ca31ff019bec3a95bfff2b" +checksum = "666d00490d4ac815001da55838c500eafb0320019bbaa44444137c48b443a853" dependencies = [ "pest", "pest_generator", @@ -4263,22 +4279,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3e8cba4ec22bada7fc55ffe51e2deb6a0e0db2d0b7ab0b103acc80d2510c190" +checksum = "68ca01446f50dbda87c1786af8770d535423fa8a53aec03b8f4e3d7eb10e0929" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] name = "pest_meta" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01f71cb40bd8bb94232df14b946909e14660e33fc05db3e50ae2a82d7ea0ca0" +checksum = "56af0a30af74d0445c0bf6d9d051c979b516a1a5af790d251daee76005420a48" dependencies = [ "once_cell", "pest", @@ -4343,29 +4359,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] name = "pin-project-lite" -version = "0.2.10" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" [[package]] name = "pin-utils" @@ -4391,16 +4407,16 @@ checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "plist" -version = "1.4.3" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bd9647b268a3d3e14ff09c23201133a62589c658db02bb7388c7246aafe0590" +checksum = "bdc0001cfea3db57a2e24bc0d818e9e20e554b5f97fabb9bc231dc240269ae06" dependencies = [ "base64 0.21.2", "indexmap 1.9.3", "line-wrap", "quick-xml", "serde", - "time 0.3.22", + "time 0.3.25", ] [[package]] @@ -4442,9 +4458,9 @@ dependencies = [ [[package]] name = "postcard" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa512cd0d087cc9f99ad30a1bf64795b67871edbead083ffc3a4dfafa59aa00" +checksum = "c9ee729232311d3cd113749948b689627618133b1c5012b77342c1950b25eaeb" dependencies = [ "cobs", "heapless", @@ -4572,9 +4588,9 @@ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068" [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] @@ -4608,18 +4624,18 @@ dependencies = [ [[package]] name = "quick-xml" -version = "0.28.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce5e73202a820a31f8a0ee32ada5e21029c81fd9e3ebf668a40832e4219d9d1" +checksum = "81b9228215d82c7b61490fec1de287136b5de6f5700f6e58ea9ad61a7964ca51" dependencies = [ "memchr", ] [[package]] name = "quote" -version = "1.0.29" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" +checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" dependencies = [ "proc-macro2", ] @@ -4760,14 +4776,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.0" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89089e897c013b3deb627116ae56a6955a72b8bed395c9526af31c9fe528b484" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.0", - "regex-syntax 0.7.3", + "regex-automata 0.3.6", + "regex-syntax 0.7.4", ] [[package]] @@ -4781,13 +4797,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.0" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa250384981ea14565685dea16a9ccc4d1c541a13f82b9c168572264d1df8c56" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.3", + "regex-syntax 0.7.4", ] [[package]] @@ -4798,9 +4814,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab07dc67230e4a4718e70fd5c20055a4334b121f1f9db8fe63ef39ce9b8c846" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "reqwest" @@ -4829,7 +4845,7 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.21.3", + "rustls 0.21.6", "rustls-pemfile", "serde", "serde_json", @@ -5035,14 +5051,14 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.3" +version = "0.38.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac5ffa1efe7548069688cd7028f32591853cd7b5b756d41bcffd2353e4fc75b4" +checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys 0.4.3", + "linux-raw-sys 0.4.5", "windows-sys 0.48.0", ] @@ -5061,13 +5077,13 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.3" +version = "0.21.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b19faa85ecb5197342b54f987b142fb3e30d0c90da40f80ef4fa9a726e6676ed" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" dependencies = [ "log", "ring", - "rustls-webpki 0.101.1", + "rustls-webpki 0.101.3", "sct 0.7.0", ] @@ -5116,9 +5132,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.1" +version = "0.101.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f36a6828982f422756984e47912a7a51dcbc2a197aa791158f8ca61cd8204e" +checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" dependencies = [ "ring", "untrusted", @@ -5126,15 +5142,15 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc31bd9b61a32c31f9650d18add92aa83a49ba979c143eefd27fe7177b05bd5f" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "safemem" @@ -5171,9 +5187,9 @@ dependencies = [ [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "scrypt" @@ -5209,9 +5225,9 @@ dependencies = [ [[package]] name = "sec1" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", "der", @@ -5269,9 +5285,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.9.1" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fc758eb7bffce5b308734e9b0c1468893cae9ff70ebf13e7090be8dcbcc83a8" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -5282,9 +5298,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51d0c0d83bec45f16480d0ce0058397a69e48fcdc52d1dc8855fb68acbd31a7" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -5292,47 +5308,47 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.166" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01b7404f9d441d3ad40e6a636a7782c377d2abdbe4fa2440e2edcc2f4f10db8" +checksum = "32ac8da02677876d532745a130fc9d8e6edfa81a269b107c5b00829b91d8eb3c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.166" +version = "1.0.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dd83d6dde2b6b2d466e14d9d1acce8816dedee94f735eac6395808b3483c6d6" +checksum = "aafe972d60b0b9bee71a91b92fee2d4fb3c9d7e8f6b179aa99f27203d99a4816" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] name = "serde_ignored" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6de9d103529a9ba50008099785839df1e6f40b4576ed4c000cbfdb051182b827" +checksum = "80c31d5c53fd39f208e770f5a20a0bb214dee2a8d0d8adba18e19ad95a482ca5" dependencies = [ "serde", ] [[package]] name = "serde_json" -version = "1.0.100" +version = "1.0.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f1e14e89be7aa4c4b78bdbdc9eb5bf8517829a600ae8eaa39a6e1d960b5185c" +checksum = "076066c5f1078eac5b722a31827a8832fe108bed65dfa75e233c89f8206e976c" dependencies = [ "itoa", "ryu", @@ -5341,13 +5357,13 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.14" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d89a8107374290037607734c0b73a85db7ed80cae314b3c5791f192a496e731" +checksum = "8725e1dfadb3a50f7e5ce0b1a540466f6ed3fe7a0fca2ac2b8b831d31316bd00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -5527,9 +5543,9 @@ checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" [[package]] name = "snafu" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0656e7e3ffb70f6c39b3c2a86332bb74aa3c679da781642590f3c1118c5045" +checksum = "e4de37ad025c587a29e8f3f5605c00f70b98715ef90b9061a815b9e59e9042d6" dependencies = [ "backtrace", "doc-comment", @@ -5538,9 +5554,9 @@ dependencies = [ [[package]] name = "snafu-derive" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475b3bbe5245c26f2d8a6f62d67c1f30eb9fffeccee721c45d162c3ebbdf81b2" +checksum = "990079665f075b699031e9c08fd3ab99be5029b96f3b78dc0709e8f77e4efebf" dependencies = [ "heck 0.4.1", "proc-macro2", @@ -5558,6 +5574,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "spin" version = "0.5.2" @@ -5906,9 +5932,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.23" +version = "2.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" +checksum = "04361975b3f5e348b2189d8dc55bc942f278b2d482a6a0365de5bdd62d351567" dependencies = [ "proc-macro2", "quote", @@ -5929,22 +5955,20 @@ dependencies = [ [[package]] name = "syntect" -version = "5.0.0" +version = "5.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8" +checksum = "e02b4b303bf8d08bfeb0445cba5068a3d306b6baece1d5582171a9bf49188f91" dependencies = [ "bincode", "bitflags 1.3.2", "fancy-regex", "flate2", "fnv", - "lazy_static", "once_cell", "onig", "plist", - "regex-syntax 0.6.29", + "regex-syntax 0.7.4", "serde", - "serde_derive", "serde_json", "thiserror", "walkdir", @@ -5953,9 +5977,9 @@ dependencies = [ [[package]] name = "sysinfo" -version = "0.29.4" +version = "0.29.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "751e810399bba86e9326f5762b7f32ac5a085542df78da6a78d94e07d14d7c11" +checksum = "d10ed79c22663a35a255d289a7fdcb43559fc77ff15df5ce6c341809e7867528" dependencies = [ "cfg-if", "core-foundation-sys", @@ -6000,9 +6024,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.38" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" dependencies = [ "filetime", "libc", @@ -6011,15 +6035,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ - "autocfg", "cfg-if", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.23", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -6094,7 +6117,7 @@ dependencies = [ "anyhow", "assert_matches", "bytes", - "clap 4.3.11", + "clap 4.3.21", "colored", "filecheck", "forc", @@ -6159,22 +6182,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.41" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c16a64ba9387ef3fdae4f9c1a7f07a0997fce91985c0336f1ddc1822b3b37802" +checksum = "611040a08a0439f8248d1990b111c95baa9c704c805fa1f62104b39655fd7f90" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.41" +version = "1.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d14928354b01c4d6a4f0e549069adef399a284e7995c7ccca94e8a07a5346c59" +checksum = "090198534930841fab3a5d1bb637cde49e339654e606195f8d9c76eeb081dc96" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -6200,10 +6223,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.22" +version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9e1b3cf1243ae005d9e74085d4d542f3125458f3a81af210d901dcd7411efd" +checksum = "b0fdd63d58b18d663fbdf70e049f00a22c8e42be082203be7f26589213cd75ea" dependencies = [ + "deranged", "itoa", "serde", "time-core", @@ -6218,9 +6242,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372950940a5f07bf38dbe211d7283c9e6d7327df53794992d293e534c733d09b" +checksum = "eb71511c991639bb078fd5bf97757e03914361c48100d52878b8e52b46fb92cd" dependencies = [ "time-core", ] @@ -6280,11 +6304,10 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.29.1" +version = "1.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" +checksum = "40de3a2ba249dcb097e01be5e67a5ff53cf250397715a071a81543e8a832a920" dependencies = [ - "autocfg", "backtrace", "bytes", "libc", @@ -6293,7 +6316,7 @@ dependencies = [ "parking_lot 0.12.1", "pin-project-lite", "signal-hook-registry", - "socket2", + "socket2 0.5.3", "tokio-macros", "windows-sys 0.48.0", ] @@ -6316,7 +6339,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -6346,7 +6369,7 @@ version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.21.3", + "rustls 0.21.6", "tokio", ] @@ -6381,9 +6404,9 @@ checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.12" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c500344a19072298cd05a7224b3c0c629348b78692bf48466c5238656e315a78" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ "indexmap 2.0.0", "toml_datetime", @@ -6476,7 +6499,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] [[package]] @@ -6562,9 +6585,9 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "ucd-trie" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e79c4d996edb816c91e4308506774452e55e95c3c9de07b6729e17e15a5ef81" +checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" [[package]] name = "uint" @@ -6595,19 +6618,15 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-linebreak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5faade31a542b8b35855fff6e8def199853b2da8da256da52f52f1316ee3137" -dependencies = [ - "hashbrown 0.12.3", - "regex", -] +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" [[package]] name = "unicode-normalization" @@ -6677,9 +6696,9 @@ dependencies = [ [[package]] name = "urlencoding" -version = "2.1.2" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8db7427f936968176eaa7cdf81b7f98b980b18495ec28f1b5791ac3bfe3eea9" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] name = "utf8parse" @@ -6805,7 +6824,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", "wasm-bindgen-shared", ] @@ -6839,7 +6858,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7093,9 +7112,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.7" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" +checksum = "5504cc7644f4b593cbc05c4a55bf9bd4e94b867c3c0bd440934174d50482427d" dependencies = [ "memchr", ] @@ -7197,21 +7216,18 @@ dependencies = [ [[package]] name = "xattr" -version = "0.2.3" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" dependencies = [ "libc", ] [[package]] name = "xdg" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688597db5a750e9cad4511cb94729a078e274308099a0382b5b8203bbc767fee" -dependencies = [ - "home", -] +checksum = "213b7324336b53d2414b2db8537e56544d981803139155afa84f76eeebb7a546" [[package]] name = "yaml-rust" @@ -7248,5 +7264,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.23", + "syn 2.0.28", ] From c11a008ba7080f10acb185a71aec7c06228bcefb Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Fri, 25 Aug 2023 23:05:39 +0530 Subject: [PATCH 35/49] remove old assetid file --- sway-lib-std/src/asset_id.sw | 117 ----------------------------------- 1 file changed, 117 deletions(-) delete mode 100644 sway-lib-std/src/asset_id.sw diff --git a/sway-lib-std/src/asset_id.sw b/sway-lib-std/src/asset_id.sw deleted file mode 100644 index db4dfb2ba88..00000000000 --- a/sway-lib-std/src/asset_id.sw +++ /dev/null @@ -1,117 +0,0 @@ -//! Helper functions for generating an AssetId -library; - -use ::alias::{AssetId, SubId}; -use ::constants::ZERO_B256; -use ::contract_id::ContractId; -use ::hash::*; - -/// An AssetId is used for interacting with an asset on the network. -/// -/// # Additional Information -/// -/// It is calculated by taking the sha256 hash of the originating ContractId and a SubId. -/// ie. sha256((contract_id, sub_id)). -/// -/// The SubId is used to differentiate between different assets that are created by the same contract. -pub struct AssetId { - value: b256, -} - -impl AssetId { - /// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. - pub const BASE_ASSET_ID: AssetId = AssetId { - /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. - value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, - }; - - /// Creates a new AssetId from a ContractId and SubId. - /// - /// # Arguments - /// - /// * `contract_id`: [ContractId] - The ContractId of the contract that created the asset. - /// * `sub_id`: [SubId] - The SubId of the asset. - /// - /// # Returns - /// - /// * [AssetId] - The AssetId of the asset. Computed by hashing the ContractId and SubId. - /// - /// # Examples - /// - /// ```sway - /// use std::{callframes::contract_id, constants::ZERO_B256}; - /// - /// fn foo() { - /// let contract_id = contract_id(); - /// let sub_id = ZERO_B256; - /// - /// let asset_id = AssetId::new(contract_id, sub_id); - /// } - /// ``` - pub fn new(contract_id: ContractId, sub_id: SubId) -> Self { - let value = sha256((contract_id, sub_id)) - Self { value } - } - - /// Creates a new AssetId from a ContractId and the zero SubId. - /// - /// # Arguments - /// - /// * `contract_id`: [ContractId] - The ContractId of the contract that created the asset. - /// - /// # Returns - /// - /// * [AssetId] - The AssetId of the asset. Computed by hashing the ContractId and the zero SubId. - /// - /// # Examples - /// - /// ```sway - /// use std::{callframes::contract_id, constants::ZERO_B256}; - /// - /// fn foo() { - /// let contract_id = contract_id(); - /// let sub_id = ZERO_B256; - /// - /// let asset_id = AssetId::standard(contract_id); - /// - /// assert(asset_id == AssetId::new(contract_id, sub_id)); - /// } - /// ``` - pub fn standard(contract_id: ContractId) -> Self { - let value = sha256((contract_id, ZERO_B256)) - Self { value } - } - - /// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. - /// - /// # Additional Information - /// - /// The base asset id is minted from the zero ContractId with the zero SubId. - /// It is computed as sha256((ZERO_B256, ZERO_B256))). - /// - /// NOT equal to ZERO_B256. - /// - /// # Returns - /// - /// * [AssetId] - The AssetId of the asset. Computed by hashing the zero ContractId and the zero SubId. - /// - /// # Examples - /// - /// ```sway - /// use std::token::transfer; - /// - /// fn foo() { - /// let asset_id = AssetId::base_asset_id(); - /// let amount = 100; - /// let recipient = Identity::ContractId(ContractId::from(ZERO_B256)); - /// - /// transfer(recipient, asset_id, amount); - /// ``` - pub fn base_asset_id() -> Self { - Self { - /// sha256((ZERO_B256, ZERO_B256))). Prehashed to save gas. - value: 0xf5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb4b, - } - - } -} From 45acfb956a13b27f8eca3377f26d9b78edaa52e7 Mon Sep 17 00:00:00 2001 From: SwayStar123 <46050679+SwayStar123@users.noreply.github.com> Date: Fri, 25 Aug 2023 23:06:42 +0530 Subject: [PATCH 36/49] Update sway-lib-std/src/contract_id.sw Co-authored-by: Cameron Carstens <54727135+bitzoic@users.noreply.github.com> --- sway-lib-std/src/contract_id.sw | 1 + 1 file changed, 1 insertion(+) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 229b4a62e84..e14f70020fb 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -249,3 +249,4 @@ impl ContractId { self.transfer(AssetId::new(ContractId::from(asm() { fp: b256 }), sub_id), amount); } } + From 851aa103e3e2d490adbde891c7b47b47cc938605 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Sat, 26 Aug 2023 12:01:19 +0530 Subject: [PATCH 37/49] impl from --- sway-lib-std/src/contract_id.sw | 59 +++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 7 deletions(-) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index e14f70020fb..6bfda15a6eb 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -92,6 +92,52 @@ impl core::ops::Eq for AssetId { } } +impl From for AssetId { + /// Casts raw `b256` data to an `AssetId`. + /// + /// # Arguments + /// + /// * `bits`: [b256] - The raw `b256` data to be casted. + /// + /// # Returns + /// + /// * [AssetId] - The newly created `AssetId` from the raw `b256`. + /// + /// # Examples + /// + /// ```sway + /// use std::constants::ZERO_B256; + /// + /// fn foo() { + /// let asset_id = AssetId::from(ZERO_B256); + /// } + /// ``` + fn from(bits: b256) -> Self { + Self { value: bits } + } + + /// Casts an `AssetId` to raw `b256` data. + /// + /// # Returns + /// + /// * [b256] - The underlying raw `b256` data of the `AssetId`. + /// + /// # Examples + /// + /// ```sway + /// use std::constants::ZERO_B256; + /// + /// fn foo() { + /// let asset_id = AssetId::from(ZERO_B256); + /// let b256_data = asset_id.into(); + /// assert(b256_data == ZERO_B256); + /// } + /// ``` + fn into(self) -> b256 { + self.value + } +} + impl AssetId { /// Creates a new AssetId from a ContractId and SubId. /// @@ -140,30 +186,30 @@ impl AssetId { /// let contract_id = contract_id(); /// let sub_id = ZERO_B256; /// - /// let asset_id = AssetId::standard(contract_id); + /// let asset_id = AssetId::default(contract_id); /// /// assert(asset_id == AssetId::new(contract_id, sub_id)); /// } /// ``` - pub fn standard(contract_id: ContractId) -> Self { + pub fn default(contract_id: ContractId) -> Self { let value = sha256((contract_id, 0x0000000000000000000000000000000000000000000000000000000000000000)); Self { value } } - /// Represents bridged Ether on the main Fuel Network. Can be configured to represent another asset on another instance of the Fuel network. + /// The base_asset_id represents the base asset of a chain. /// /// # Additional Information /// - /// It is hard coded to be ZERO_B256. + /// On the Fuel network, the base asset is Ether. It is hardcoded as the 0x00..00 AssetId. /// /// # Returns /// - /// * [AssetId] - The AssetId of the asset. Computed by hashing the zero ContractId and the zero SubId. + /// * [AssetId] - The AssetId of the base asset. /// /// # Examples /// /// ```sway - /// use std::token::transfer; + /// use std::{constants::ZERO_B256, token::transfer}; /// /// fn foo() { /// let asset_id = AssetId::base_asset_id(); @@ -249,4 +295,3 @@ impl ContractId { self.transfer(AssetId::new(ContractId::from(asm() { fp: b256 }), sub_id), amount); } } - From d7022eab6a213a46cf94e09caea5fa56442a7240 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Sat, 26 Aug 2023 13:46:03 +0530 Subject: [PATCH 38/49] Req changes --- examples/liquidity_pool/src/main.sw | 2 +- .../should_pass/language/const_decl_with_call_path/src/main.sw | 2 +- .../require_contract_deployment/token_ops_test/src/main.sw | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/liquidity_pool/src/main.sw b/examples/liquidity_pool/src/main.sw index 58089c59ad8..112b9356eda 100644 --- a/examples/liquidity_pool/src/main.sw +++ b/examples/liquidity_pool/src/main.sw @@ -36,7 +36,7 @@ impl LiquidityPool for Contract { } fn withdraw(recipient: Address) { - let asset_id = AssetId::standard(contract_id()); + let asset_id = AssetId::default(contract_id()); assert(msg_asset_id() == asset_id); assert(msg_amount() > 0); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/const_decl_with_call_path/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/const_decl_with_call_path/src/main.sw index 6af62302486..6dc3e655566 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/const_decl_with_call_path/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/const_decl_with_call_path/src/main.sw @@ -7,6 +7,6 @@ fn main() -> u64 { let zero = std::constants::ZERO_B256; let base_asset_id = std::constants::BASE_ASSET_ID; assert(zero == 0x0000000000000000000000000000000000000000000000000000000000000000); - assert(base_asset_id.value == zero); + assert(base_asset_id.into() == zero); x } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw index 0fd49073edf..f5a63eea46d 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/token_ops_test/src/main.sw @@ -16,7 +16,7 @@ fn main() -> bool { // the deployed fuel_coin Contract_Id: let fuelcoin_id = ContractId::from(0x5d10689c7eecb405937a3f35fab7baf05a3f6189f9a2993ee70e21ccc1212460); - let fuelcoin_asset_id = AssetId::standard(fuelcoin_id); + let fuelcoin_asset_id = AssetId::default(fuelcoin_id); // contract ID for sway/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/balance_test_contract/ let balance_test_id = ContractId::from(0x4a00baa517980432b9274a0e2f03c88735bdb483730816679c6eb37b4046d060); From 1d61262b72ed06db3d3cf863a07b2d097511a65c Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 30 Aug 2023 10:40:21 +0530 Subject: [PATCH 39/49] remove unnecessary imports in consta.sw --- sway-lib-std/src/constants.sw | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sway-lib-std/src/constants.sw b/sway-lib-std/src/constants.sw index 26387e59e09..2102b73f92f 100644 --- a/sway-lib-std/src/constants.sw +++ b/sway-lib-std/src/constants.sw @@ -1,8 +1,7 @@ //! Base asset and zero address constants. library; -use ::alias::SubId; -use ::contract_id::{AssetId, ContractId}; +use ::contract_id::AssetId; /// The `BASE_ASSET_ID` represents the base asset of a chain. /// From fdc258fc522a8d10d1727b5d1784c0f5b20d357f Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 30 Aug 2023 17:24:03 +0530 Subject: [PATCH 40/49] fix test --- sway-lsp/tests/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lsp/tests/lib.rs b/sway-lsp/tests/lib.rs index 878999a2f48..08370b0dd5b 100644 --- a/sway-lsp/tests/lib.rs +++ b/sway-lsp/tests/lib.rs @@ -722,7 +722,7 @@ async fn go_to_definition_for_paths() { req_uri: &uri, req_line: 24, req_char: 31, - def_line: 36, + def_line: 35, def_start_char: 10, def_end_char: 19, def_path: "sway-lib-std/src/constants.sw", From 7caec158d146a96ad5686547f22e8f1ff9b02794 Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 5 Sep 2023 23:19:33 +0530 Subject: [PATCH 41/49] impl hash and use f rom --- sway-lib-std/src/constants.sw | 4 +--- sway-lib-std/src/contract_id.sw | 7 +++++++ sway-lib-std/src/inputs.sw | 2 +- sway-lib-std/src/outputs.sw | 2 +- .../cei_pattern_violation_in_asm_block_tr/src/main.sw | 2 +- .../cei_pattern_violation_in_asm_block_tro/src/main.sw | 2 +- 6 files changed, 12 insertions(+), 7 deletions(-) diff --git a/sway-lib-std/src/constants.sw b/sway-lib-std/src/constants.sw index 2102b73f92f..2bbcc85047e 100644 --- a/sway-lib-std/src/constants.sw +++ b/sway-lib-std/src/constants.sw @@ -18,9 +18,7 @@ use ::contract_id::AssetId; /// assert(BASE_ASSET_ID == msg_asset_id()); /// } /// ``` -pub const BASE_ASSET_ID: AssetId = AssetId { - value: ZERO_B256, -}; +pub const BASE_ASSET_ID: AssetId = AssetId::from(ZERO_B256); /// A B256 of zero value. /// diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 6bfda15a6eb..d164bca1f06 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -86,6 +86,13 @@ pub struct AssetId { value: b256, } +impl Hash for AssetId { + fn hash(self, ref mut state: Hasher) { + let AssetId { value } = self; + value.hash(state); + } +} + impl core::ops::Eq for AssetId { fn eq(self, other: Self) -> bool { self.value == other.value diff --git a/sway-lib-std/src/inputs.sw b/sway-lib-std/src/inputs.sw index a80203087ae..f017d6042b4 100644 --- a/sway-lib-std/src/inputs.sw +++ b/sway-lib-std/src/inputs.sw @@ -295,7 +295,7 @@ pub fn input_predicate_data(index: u64) -> T { /// ``` pub fn input_asset_id(index: u64) -> Option { match input_type(index) { - Input::Coin => Some(AssetId { value: __gtf::(index, GTF_INPUT_COIN_ASSET_ID) }), + Input::Coin => Some(AssetId::from(__gtf::(index, GTF_INPUT_COIN_ASSET_ID))), Input::Message => Some(BASE_ASSET_ID), Input::Contract => None, } diff --git a/sway-lib-std/src/outputs.sw b/sway-lib-std/src/outputs.sw index be0bd6c12ee..b874cc6979a 100644 --- a/sway-lib-std/src/outputs.sw +++ b/sway-lib-std/src/outputs.sw @@ -220,7 +220,7 @@ pub fn output_amount(index: u64) -> u64 { /// ``` pub fn output_asset_id(index: u64) -> Option { match output_type(index) { - Output::Coin => Option::Some(AssetId { value: __gtf::(index, GTF_OUTPUT_COIN_ASSET_ID) }), + Output::Coin => Option::Some(AssetId::from(__gtf::(index, GTF_OUTPUT_COIN_ASSET_ID))), _ => Option::None, } } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tr/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tr/src/main.sw index bf91e2b017b..f93885a0526 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tr/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tr/src/main.sw @@ -15,7 +15,7 @@ impl TestAbi for Contract { // effect -- therefore violation of CEI where effect should go before interaction let amount = 10; let address = 0x0000000000000000000000000000000000000000000000000000000000000001; - let asset = AssetId { value: address }; + let asset = AssetId::from(address); let pool = ContractId::from(address); // `force_transfer_to_contract` uses `tr` asm instruction force_transfer_to_contract(pool, asset, amount); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tro/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tro/src/main.sw index 225fb657de4..db57e9d6e56 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tro/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/static_analysis/cei_pattern_violation_in_asm_block_tro/src/main.sw @@ -15,7 +15,7 @@ impl TestAbi for Contract { // effect -- therefore violation of CEI where effect should go before interaction let amount = 10; let address = 0x0000000000000000000000000000000000000000000000000000000000000001; - let asset = AssetId { value: address }; + let asset = AssetId::from(address); let user = Address::from(address); // `transfer_to_address` uses `tro` asm instruction transfer_to_address(user, asset, amount); From 0cdaf7694a8d9877d93738945e78ba2b27868ec1 Mon Sep 17 00:00:00 2001 From: SwayStar123 <46050679+SwayStar123@users.noreply.github.com> Date: Tue, 5 Sep 2023 23:49:53 +0530 Subject: [PATCH 42/49] Update sway-lib-std/src/contract_id.sw Co-authored-by: Braqzen <103777923+Braqzen@users.noreply.github.com> --- sway-lib-std/src/contract_id.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index d164bca1f06..ddc32216cc8 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -67,7 +67,7 @@ impl From for ContractId { impl Hash for ContractId { fn hash(self, ref mut state: Hasher) { - let ContractId { value } = self; + let Self { value } = self; value.hash(state); } } From e4b0db80de838ce88cbcda7f45d4c4c673fe78c7 Mon Sep 17 00:00:00 2001 From: SwayStar123 <46050679+SwayStar123@users.noreply.github.com> Date: Tue, 5 Sep 2023 23:50:06 +0530 Subject: [PATCH 43/49] Update sway-lib-std/src/contract_id.sw Co-authored-by: Braqzen <103777923+Braqzen@users.noreply.github.com> --- sway-lib-std/src/contract_id.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index ddc32216cc8..0947c1edd48 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -88,7 +88,7 @@ pub struct AssetId { impl Hash for AssetId { fn hash(self, ref mut state: Hasher) { - let AssetId { value } = self; + let Self { value } = self; value.hash(state); } } From f1727ea59170ac336cf96360f97b47e04b27b8a8 Mon Sep 17 00:00:00 2001 From: SwayStar123 <46050679+SwayStar123@users.noreply.github.com> Date: Tue, 5 Sep 2023 23:50:16 +0530 Subject: [PATCH 44/49] Update sway-lib-std/src/contract_id.sw Co-authored-by: Braqzen <103777923+Braqzen@users.noreply.github.com> --- sway-lib-std/src/contract_id.sw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 0947c1edd48..02e33bf35e6 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -77,7 +77,7 @@ impl Hash for ContractId { /// # Additional Information /// /// It is calculated by taking the sha256 hash of the originating ContractId and a SubId. -/// ie. sha256((contract_id, sub_id)). +/// i.e. sha256((contract_id, sub_id)). /// /// An exception is the Base Asset, which is just the ZERO_B256 AssetId. /// From 632bc00b79644aa5be69b891f23731ba2490e9ca Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Tue, 5 Sep 2023 23:51:33 +0530 Subject: [PATCH 45/49] lsp tets --- sway-lsp/tests/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sway-lsp/tests/lib.rs b/sway-lsp/tests/lib.rs index 08370b0dd5b..4a796c7a482 100644 --- a/sway-lsp/tests/lib.rs +++ b/sway-lsp/tests/lib.rs @@ -722,7 +722,7 @@ async fn go_to_definition_for_paths() { req_uri: &uri, req_line: 24, req_char: 31, - def_line: 35, + def_line: 33, def_start_char: 10, def_end_char: 19, def_path: "sway-lib-std/src/constants.sw", From 881fd7c585044103e337cc96c6f01111dc0432bd Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 6 Sep 2023 13:34:01 +0530 Subject: [PATCH 46/49] add contract_id and asset_id tests --- sway-lib-std/src/contract_id.sw | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 02e33bf35e6..5385b64be8c 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -302,3 +302,31 @@ impl ContractId { self.transfer(AssetId::new(ContractId::from(asm() { fp: b256 }), sub_id), amount); } } + +#[test()] +fn test_hasher_sha256_asset_id() { + use ::assert::assert; + let mut hasher = Hasher::new(); + AssetId::from(0x0000000000000000000000000000000000000000000000000000000000000000).hash(hasher); + let sha256 = hasher.sha256(); + assert(sha256 == 0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925); + + let mut hasher = Hasher::new(); + AssetId::from(0x0000000000000000000000000000000000000000000000000000000000000001).hash(hasher); + let sha256 = hasher.sha256(); + assert(sha256 == 0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5); +} + +#[test()] +fn test_hasher_sha256_contract_id() { + use ::assert::assert; + let mut hasher = Hasher::new(); + ContractId::from(0x0000000000000000000000000000000000000000000000000000000000000000).hash(hasher); + let sha256 = hasher.sha256(); + assert(sha256 == 0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925); + + let mut hasher = Hasher::new(); + ContractId::from(0x0000000000000000000000000000000000000000000000000000000000000001).hash(hasher); + let sha256 = hasher.sha256(); + assert(sha256 == 0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5); +} \ No newline at end of file From f1a002249af4966bf62a90d921afae806fe8ef0c Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 6 Sep 2023 14:50:09 +0530 Subject: [PATCH 47/49] rename variables in test --- sway-lib-std/src/contract_id.sw | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 5385b64be8c..3d733a42e17 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -308,13 +308,13 @@ fn test_hasher_sha256_asset_id() { use ::assert::assert; let mut hasher = Hasher::new(); AssetId::from(0x0000000000000000000000000000000000000000000000000000000000000000).hash(hasher); - let sha256 = hasher.sha256(); - assert(sha256 == 0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925); + let s256 = hasher.sha256(); + assert(s256 == 0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925); let mut hasher = Hasher::new(); AssetId::from(0x0000000000000000000000000000000000000000000000000000000000000001).hash(hasher); - let sha256 = hasher.sha256(); - assert(sha256 == 0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5); + let s256 = hasher.sha256(); + assert(s256 == 0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5); } #[test()] @@ -322,11 +322,11 @@ fn test_hasher_sha256_contract_id() { use ::assert::assert; let mut hasher = Hasher::new(); ContractId::from(0x0000000000000000000000000000000000000000000000000000000000000000).hash(hasher); - let sha256 = hasher.sha256(); - assert(sha256 == 0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925); + let s256 = hasher.sha256(); + assert(s256 == 0x66687aadf862bd776c8fc18b8e9f8e20089714856ee233b3902a591d0d5f2925); let mut hasher = Hasher::new(); ContractId::from(0x0000000000000000000000000000000000000000000000000000000000000001).hash(hasher); - let sha256 = hasher.sha256(); - assert(sha256 == 0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5); + let s256 = hasher.sha256(); + assert(s256 == 0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5); } \ No newline at end of file From bcbf69cf615c3c0c66b39c948b675085cc47c8be Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 6 Sep 2023 16:11:01 +0530 Subject: [PATCH 48/49] add line and use method in test --- sway-lib-std/src/contract_id.sw | 2 +- .../context_caller_contract/src/main.sw | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/sway-lib-std/src/contract_id.sw b/sway-lib-std/src/contract_id.sw index 3d733a42e17..5039f020be8 100644 --- a/sway-lib-std/src/contract_id.sw +++ b/sway-lib-std/src/contract_id.sw @@ -329,4 +329,4 @@ fn test_hasher_sha256_contract_id() { ContractId::from(0x0000000000000000000000000000000000000000000000000000000000000001).hash(hasher); let s256 = hasher.sha256(); assert(s256 == 0xec4916dd28fc4c10d78e287ca5d9cc51ee1ae73cbfde08c6b37324cbfaac8bc5); -} \ No newline at end of file +} diff --git a/test/src/sdk-harness/test_artifacts/context_caller_contract/src/main.sw b/test/src/sdk-harness/test_artifacts/context_caller_contract/src/main.sw index 40480a942d2..4ed538b67b9 100644 --- a/test/src/sdk-harness/test_artifacts/context_caller_contract/src/main.sw +++ b/test/src/sdk-harness/test_artifacts/context_caller_contract/src/main.sw @@ -18,84 +18,84 @@ impl ContextCaller for Contract { fn call_get_this_balance_with_coins(send_amount: u64, target: ContractId) -> u64 { let id = target.value; let context_contract = abi(ContextTesting, id); - let asset_id = sha256((contract_id(), ZERO_B256)); + let asset_id = AssetId::default(contract_id()); context_contract.get_this_balance { gas: 500_000, coins: send_amount, - asset_id: asset_id, + asset_id: asset_id.into(), }(asset_id) } fn call_get_balance_of_contract_with_coins(send_amount: u64, target: ContractId) -> u64 { let id = target.value; let context_contract = abi(ContextTesting, id); - let asset_id = sha256((contract_id(), ZERO_B256)); + let asset_id = AssetId::default(contract_id()); context_contract.get_balance_of_contract { gas: 500_000, coins: send_amount, - asset_id: asset_id, + asset_id: asset_id.into(), }(asset_id, target) } fn call_get_amount_with_coins(send_amount: u64, target: ContractId) -> u64 { let id = target.value; let context_contract = abi(ContextTesting, id); - let asset_id = sha256((contract_id(), ZERO_B256)); + let asset_id = AssetId::default(contract_id()); context_contract.get_amount { gas: 500_000, coins: send_amount, - asset_id: asset_id, + asset_id: asset_id.into(), }() } fn call_get_asset_id_with_coins(send_amount: u64, target: ContractId) -> b256 { let id = target.value; let context_contract = abi(ContextTesting, id); - let asset_id = sha256((contract_id(), ZERO_B256)); + let asset_id = AssetId::default(contract_id()); context_contract.get_asset_id { gas: 500_000, coins: send_amount, - asset_id: asset_id, + asset_id: asset_id.into(), }() } fn call_get_gas_with_coins(send_amount: u64, target: ContractId) -> u64 { let id = target.value; let context_contract = abi(ContextTesting, id); - let asset_id = sha256((contract_id(), ZERO_B256)); + let asset_id = AssetId::default(contract_id()); context_contract.get_gas { gas: 500_000, coins: send_amount, - asset_id: asset_id, + asset_id: asset_id.into(), }() } fn call_get_global_gas_with_coins(send_amount: u64, target: ContractId) -> u64 { let id = target.value; let context_contract = abi(ContextTesting, id); - let asset_id = sha256((contract_id(), ZERO_B256)); + let asset_id = AssetId::default(contract_id()); context_contract.get_global_gas { gas: 500_000, coins: send_amount, - asset_id: asset_id, + asset_id: asset_id.into(), }() } fn call_receive_coins(send_amount: u64, target: ContractId) { let id = target.value; let context_contract = abi(ContextTesting, id); - let asset_id = sha256((contract_id(), ZERO_B256)); + let asset_id = AssetId::default(contract_id()); context_contract.receive_coins { gas: 500_000, coins: send_amount, - asset_id: asset_id, + asset_id: asset_id.into(), }(); } From 24e27a5d82f01c482b9eac941d99c7f17e6ad61d Mon Sep 17 00:00:00 2001 From: SwayStar123 Date: Wed, 6 Sep 2023 16:21:49 +0530 Subject: [PATCH 49/49] into b256 for assetid --- .../test_artifacts/context_caller_contract/src/main.sw | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/src/sdk-harness/test_artifacts/context_caller_contract/src/main.sw b/test/src/sdk-harness/test_artifacts/context_caller_contract/src/main.sw index 4ed538b67b9..652c7292884 100644 --- a/test/src/sdk-harness/test_artifacts/context_caller_contract/src/main.sw +++ b/test/src/sdk-harness/test_artifacts/context_caller_contract/src/main.sw @@ -24,7 +24,7 @@ impl ContextCaller for Contract { gas: 500_000, coins: send_amount, asset_id: asset_id.into(), - }(asset_id) + }(asset_id.into()) } fn call_get_balance_of_contract_with_coins(send_amount: u64, target: ContractId) -> u64 { @@ -36,7 +36,7 @@ impl ContextCaller for Contract { gas: 500_000, coins: send_amount, asset_id: asset_id.into(), - }(asset_id, target) + }(asset_id.into(), target) } fn call_get_amount_with_coins(send_amount: u64, target: ContractId) -> u64 {