diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa6c9055cdd..a29913d8452 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -405,6 +405,7 @@ jobs: uses: dtolnay/rust-toolchain@master with: toolchain: ${{ env.RUST_VERSION }} + targets: "x86_64-unknown-linux-gnu, wasm32-unknown-unknown" - uses: buildjet/cache@v3 with: path: | diff --git a/Cargo.lock b/Cargo.lock index d394f5c5c2c..b67de59cb8b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2009,7 +2009,7 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "forc" -version = "0.63.3" +version = "0.63.5" dependencies = [ "annotate-snippets", "ansi_term", @@ -2020,7 +2020,7 @@ dependencies = [ "completest-pty", "forc-pkg", "forc-test", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "forc-util", "fs_extra", "fuel-asm", @@ -2045,7 +2045,7 @@ dependencies = [ [[package]] name = "forc-client" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "async-trait", @@ -2055,7 +2055,7 @@ dependencies = [ "dialoguer", "forc", "forc-pkg", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "forc-tx", "forc-util", "forc-wallet", @@ -2087,13 +2087,13 @@ dependencies = [ [[package]] name = "forc-crypto" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "async-trait", "atty", "clap 4.5.16", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "forc-util", "fuel-core-types", "fuel-crypto", @@ -2113,7 +2113,7 @@ dependencies = [ [[package]] name = "forc-debug" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "clap 4.5.16", @@ -2121,7 +2121,7 @@ dependencies = [ "escargot", "forc-pkg", "forc-test", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "fuel-core-client", "fuel-types", "fuel-vm", @@ -2139,7 +2139,7 @@ dependencies = [ [[package]] name = "forc-doc" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "clap 4.5.16", @@ -2147,7 +2147,7 @@ dependencies = [ "dir_indexer", "expect-test", "forc-pkg", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "forc-util", "horrorshow", "include_dir", @@ -2164,12 +2164,12 @@ dependencies = [ [[package]] name = "forc-fmt" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "clap 4.5.16", "forc-pkg", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "forc-util", "prettydiff 0.5.1", "sway-core", @@ -2181,7 +2181,7 @@ dependencies = [ [[package]] name = "forc-lsp" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "clap 4.5.16", @@ -2192,13 +2192,13 @@ dependencies = [ [[package]] name = "forc-pkg" -version = "0.63.3" +version = "0.63.5" dependencies = [ "ansi_term", "anyhow", "byte-unit", "cid", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "forc-util", "fuel-abi-types", "futures", @@ -2229,7 +2229,7 @@ dependencies = [ [[package]] name = "forc-test" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "forc-pkg", @@ -2256,7 +2256,7 @@ dependencies = [ [[package]] name = "forc-tracing" -version = "0.63.3" +version = "0.63.5" dependencies = [ "ansi_term", "tracing", @@ -2266,7 +2266,7 @@ dependencies = [ [[package]] name = "forc-tx" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "clap 4.5.16", @@ -2281,7 +2281,7 @@ dependencies = [ [[package]] name = "forc-util" -version = "0.63.3" +version = "0.63.5" dependencies = [ "annotate-snippets", "ansi_term", @@ -2289,7 +2289,7 @@ dependencies = [ "clap 4.5.16", "dirs 3.0.2", "fd-lock 4.0.2", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "fuel-tx", "hex", "paste", @@ -2402,9 +2402,9 @@ dependencies = [ [[package]] name = "fuel-core-chain-config" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db93098b2f39a7eab8c408eb6beb5b4580883a988b76377414eefe4b405455de" +checksum = "318a5a9733255cffac64a4b5acf6a7f41e438bec3ead506fc9f74730ce956528" dependencies = [ "anyhow", "bech32", @@ -2422,9 +2422,9 @@ dependencies = [ [[package]] name = "fuel-core-client" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeec47aa62e9418a61a9936b6ec30474b918000879e5f556980e0648390b1c10" +checksum = "03ad219bde52b072a2d828f27072982047a77cc02c953ea7e83c23de586d466d" dependencies = [ "anyhow", "cynic", @@ -2446,9 +2446,9 @@ dependencies = [ [[package]] name = "fuel-core-metrics" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f69ff33d722268ab0533a75b260195169a3761e2ca1d13cdd8469a59c2826927" +checksum = "88eb1bd81016b49493181b8bc29526678229350a780d4d04db137415028db179" dependencies = [ "parking_lot 0.12.3", "pin-project-lite", @@ -2459,9 +2459,9 @@ dependencies = [ [[package]] name = "fuel-core-poa" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3444c6b2ed6a7878e1a3b317f9922be41064cfafaf863bc7ab25823bcfbd749" +checksum = "5ef478ff684ee6c2eac57070322ba05525842670576328414da7fd6c40af4e25" dependencies = [ "anyhow", "async-trait", @@ -2469,6 +2469,8 @@ dependencies = [ "fuel-core-services", "fuel-core-storage", "fuel-core-types", + "serde", + "serde_json", "tokio", "tokio-stream", "tracing", @@ -2476,9 +2478,9 @@ dependencies = [ [[package]] name = "fuel-core-services" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e85c2a19cd58cf541409c94ef77ef9b2e742f196b9a0209fb6b9310184cec92f" +checksum = "064b31213ea0b56f6558a0493b264cbd79e060a56de2bd35f8a10d7e78f526fa" dependencies = [ "anyhow", "async-trait", @@ -2491,9 +2493,9 @@ dependencies = [ [[package]] name = "fuel-core-storage" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54f244ffed0818fc7f63ff46ea4087ea2c509876b32e733f22e9b7836aebece4" +checksum = "f06320744b7d53bc7928d1a40a28fd697191a5b6938a353164231a3423ebdcd9" dependencies = [ "anyhow", "derive_more", @@ -2513,9 +2515,9 @@ dependencies = [ [[package]] name = "fuel-core-types" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "044371366fb644733dd0452ced749b0d926d81c1959fad5f19f81a28f13125ee" +checksum = "84fda0c6dc7b3bd24a993b3902f55862b8db0fa6de5b0f1d45f5942bc59792eb" dependencies = [ "anyhow", "bs58", @@ -2526,7 +2528,6 @@ dependencies = [ "secrecy", "serde", "tai64", - "thiserror", "zeroize", ] @@ -2702,9 +2703,9 @@ dependencies = [ [[package]] name = "fuels" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d7156cd37d2c91c4ef35723b343335a49d23f0b34ebbba42d2e934557683b0d" +checksum = "9699101cadc9ad3f1eff2a71532d755ab5526419414b99702e89c1d8b92b5938" dependencies = [ "fuel-core-client", "fuel-crypto", @@ -2718,9 +2719,9 @@ dependencies = [ [[package]] name = "fuels-accounts" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ba20df8b54e1d59e21775f2431dd2b5511de28cb3f44cd76379c96e31aa1ba" +checksum = "a3e97cf3bb16c8b6436dd6e3a6f9cea5c1ffda8daf7cdb335c60b74c31572f57" dependencies = [ "async-trait", "chrono", @@ -2743,9 +2744,9 @@ dependencies = [ [[package]] name = "fuels-code-gen" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3090567fcc71dbe48ddff811d80d08979adfc2140fc57f1f29cce930901348f4" +checksum = "47552a5e8b6935595131ef38b14ef4eee8db870174ea62c8db804dbfa02f57d6" dependencies = [ "Inflector", "fuel-abi-types", @@ -2759,9 +2760,9 @@ dependencies = [ [[package]] name = "fuels-core" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "362f321ab6353ebc7a1a5a22c7ef655607a72468ce5560e18b2ce3e79a9b4916" +checksum = "b687c021466238851b07e2d39f974a614ffafc7e57dc9be00840d74c74c5febd" dependencies = [ "async-trait", "bech32", @@ -2787,9 +2788,9 @@ dependencies = [ [[package]] name = "fuels-macros" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adb2fa8939edd45140a93bdd0fcd1f499e573e4ff338edea8f54b841e57d56c" +checksum = "b9dd9359ca6c0e7ad300d487e59babe03f64c6b7b169a0743d13f5c58837b589" dependencies = [ "fuels-code-gen", "itertools 0.12.1", @@ -2800,9 +2801,9 @@ dependencies = [ [[package]] name = "fuels-programs" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac75384ead8a992a0a27785b5461fcbc22fa6e258ccb81490bb4ce1fd4b2ed91" +checksum = "3288fc4b64e8f93a39b8ffa36fcaef8753232ffda5399662d28e24c172a7d00c" dependencies = [ "async-trait", "fuel-abi-types", @@ -2819,14 +2820,15 @@ dependencies = [ [[package]] name = "fuels-test-helpers" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9a5ddd7590598015c2193e53c0004c4ec5c829bbfcf0f63652658e60e7af9d" +checksum = "11e18f84f11543ab29e787e2170eeed7f390b791f16ef8be363e3700ea21833d" dependencies = [ "fuel-core-chain-config", "fuel-core-client", "fuel-core-poa", "fuel-core-services", + "fuel-core-types", "fuel-crypto", "fuel-tx", "fuel-types", @@ -3270,6 +3272,9 @@ name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] [[package]] name = "hkdf" @@ -6848,7 +6853,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "sway-ast" -version = "0.63.3" +version = "0.63.5" dependencies = [ "extension-trait", "num-bigint", @@ -6860,7 +6865,7 @@ dependencies = [ [[package]] name = "sway-core" -version = "0.63.3" +version = "0.63.5" dependencies = [ "clap 4.5.16", "derivative", @@ -6905,7 +6910,7 @@ dependencies = [ [[package]] name = "sway-error" -version = "0.63.3" +version = "0.63.5" dependencies = [ "either", "in_definite", @@ -6919,7 +6924,7 @@ dependencies = [ [[package]] name = "sway-ir" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "downcast-rs", @@ -6938,7 +6943,7 @@ dependencies = [ [[package]] name = "sway-ir-macros" -version = "0.63.3" +version = "0.63.5" dependencies = [ "itertools 0.10.5", "proc-macro2", @@ -6948,7 +6953,7 @@ dependencies = [ [[package]] name = "sway-lsp" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "assert-json-diff", @@ -6959,7 +6964,7 @@ dependencies = [ "dirs 4.0.0", "fd-lock 4.0.2", "forc-pkg", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "forc-util", "futures", "indexmap 2.4.0", @@ -7013,7 +7018,7 @@ dependencies = [ [[package]] name = "sway-parse" -version = "0.63.3" +version = "0.63.5" dependencies = [ "assert_matches", "extension-trait", @@ -7031,7 +7036,7 @@ dependencies = [ [[package]] name = "sway-types" -version = "0.63.3" +version = "0.63.5" dependencies = [ "bytecount", "fuel-asm", @@ -7050,7 +7055,7 @@ dependencies = [ [[package]] name = "sway-utils" -version = "0.63.3" +version = "0.63.5" dependencies = [ "serde", "walkdir", @@ -7058,11 +7063,11 @@ dependencies = [ [[package]] name = "swayfmt" -version = "0.63.3" +version = "0.63.5" dependencies = [ "anyhow", "difference", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "indoc", "paste", "prettydiff 0.6.4", @@ -7341,7 +7346,7 @@ dependencies = [ "forc-client", "forc-pkg", "forc-test", - "forc-tracing 0.63.3", + "forc-tracing 0.63.5", "fuel-vm", "futures", "gag", diff --git a/Cargo.toml b/Cargo.toml index 474be37baef..b9fe0d0c4ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,8 +34,8 @@ exclude = [ [workspace.dependencies] # Dependencies from the `fuel-core` repository: -fuel-core-client = { version = "0.32.1", default-features = false } -fuel-core-types = { version = "0.32.1", default-features = false } +fuel-core-client = { version = "0.35.0", default-features = false } +fuel-core-types = { version = "0.35.0", default-features = false } # Dependencies from the `fuel-vm` repository: fuel-asm = "0.56.0" @@ -45,9 +45,9 @@ fuel-tx = "0.56.0" fuel-vm = "0.56.0" # Dependencies from the `fuels-rs` repository: -fuels-core = "0.66.1" -fuels-accounts = "0.66.1" -fuels = "0.66.1" +fuels-core = "0.66.4" +fuels-accounts = "0.66.4" +fuels = "0.66.4" # Dependencies from the `forc-wallet` repository: forc-wallet = "0.9.0" diff --git a/forc-pkg/Cargo.toml b/forc-pkg/Cargo.toml index 5d10343a083..e9004882fe6 100644 --- a/forc-pkg/Cargo.toml +++ b/forc-pkg/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-pkg" -version = "0.63.3" +version = "0.63.5" description = "Building, locking, fetching and updating Sway projects as Forc packages." authors.workspace = true edition.workspace = true @@ -13,8 +13,8 @@ ansi_term = "0.12" anyhow = "1" byte-unit = "5.1.4" cid = "0.11" -forc-tracing = { version = "0.63.3", path = "../forc-tracing" } -forc-util = { version = "0.63.3", path = "../forc-util" } +forc-tracing = { version = "0.63.5", path = "../forc-tracing" } +forc-util = { version = "0.63.5", path = "../forc-util" } fuel-abi-types = { workspace = true } futures = "0.3" git2 = { version = "0.19", features = [ @@ -31,10 +31,10 @@ serde = { version = "1.0", features = ["derive"] } serde_ignored = "0.1.9" serde_json = "1.0" serde_with = "3.3.0" -sway-core = { version = "0.63.3", path = "../sway-core" } -sway-error = { version = "0.63.3", path = "../sway-error" } -sway-types = { version = "0.63.3", path = "../sway-types" } -sway-utils = { version = "0.63.3", path = "../sway-utils" } +sway-core = { version = "0.63.5", path = "../sway-core" } +sway-error = { version = "0.63.5", path = "../sway-error" } +sway-types = { version = "0.63.5", path = "../sway-types" } +sway-utils = { version = "0.63.5", path = "../sway-utils" } tar = "0.4.38" toml = { version = "0.8", features = ["parse"] } tracing = "0.1" diff --git a/forc-plugins/forc-client/Cargo.toml b/forc-plugins/forc-client/Cargo.toml index d610548eb08..44b5713fd1e 100644 --- a/forc-plugins/forc-client/Cargo.toml +++ b/forc-plugins/forc-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-client" -version = "0.63.3" +version = "0.63.5" description = "A `forc` plugin for interacting with a Fuel node." authors.workspace = true edition.workspace = true @@ -15,11 +15,11 @@ chrono = { version = "0.4", default-features = false, features = ["std"] } clap = { version = "4.5.4", features = ["derive", "env"] } devault = "0.1" dialoguer = "0.11" -forc = { version = "0.63.3", path = "../../forc" } -forc-pkg = { version = "0.63.3", path = "../../forc-pkg" } -forc-tracing = { version = "0.63.3", path = "../../forc-tracing" } -forc-tx = { version = "0.63.3", path = "../forc-tx" } -forc-util = { version = "0.63.3", path = "../../forc-util" } +forc = { version = "0.63.5", path = "../../forc" } +forc-pkg = { version = "0.63.5", path = "../../forc-pkg" } +forc-tracing = { version = "0.63.5", path = "../../forc-tracing" } +forc-tx = { version = "0.63.5", path = "../forc-tx" } +forc-util = { version = "0.63.5", path = "../../forc-util" } forc-wallet = { workspace = true } fuel-abi-types = { workspace = true } fuel-core-client = { workspace = true, features = ["subscriptions"] } @@ -36,9 +36,9 @@ rand = "0.8" rpassword = "7.2" serde = "1.0" serde_json = "1" -sway-core = { version = "0.63.3", path = "../../sway-core" } -sway-types = { version = "0.63.3", path = "../../sway-types" } -sway-utils = { version = "0.63.3", path = "../../sway-utils" } +sway-core = { version = "0.63.5", path = "../../sway-core" } +sway-types = { version = "0.63.5", path = "../../sway-types" } +sway-utils = { version = "0.63.5", path = "../../sway-utils" } tokio = { version = "1.8", features = ["macros", "rt-multi-thread", "process"] } toml_edit = "0.21.1" tracing = "0.1" diff --git a/forc-plugins/forc-client/test/data/standalone_contract/Forc.lock b/forc-plugins/forc-client/test/data/standalone_contract/Forc.lock new file mode 100644 index 00000000000..7b517045569 --- /dev/null +++ b/forc-plugins/forc-client/test/data/standalone_contract/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = "core" +source = "path+from-root-79BB3EA8498403DE" + +[[package]] +name = "standalone_contract" +source = "member" +dependencies = ["std"] + +[[package]] +name = "std" +source = "path+from-root-79BB3EA8498403DE" +dependencies = ["core"] diff --git a/forc-plugins/forc-client/tests/deploy.rs b/forc-plugins/forc-client/tests/deploy.rs index 2c0c29d3012..93faa96d40e 100644 --- a/forc-plugins/forc-client/tests/deploy.rs +++ b/forc-plugins/forc-client/tests/deploy.rs @@ -341,7 +341,7 @@ async fn test_simple_deploy() { node.kill().unwrap(); let expected = vec![DeployedContract { id: ContractId::from_str( - "ad0bba17e0838ef859abe2693d8a5e3bc4e7cfb901601e30f4dc34999fda6335", + "50fe882cbef5f3da6da82509a66b7e5e0a64a40d70164861c01c908a332198ae", ) .unwrap(), proxy: None, @@ -383,7 +383,7 @@ async fn test_deploy_submit_only() { node.kill().unwrap(); let expected = vec![DeployedContract { id: ContractId::from_str( - "ad0bba17e0838ef859abe2693d8a5e3bc4e7cfb901601e30f4dc34999fda6335", + "50fe882cbef5f3da6da82509a66b7e5e0a64a40d70164861c01c908a332198ae", ) .unwrap(), proxy: None, @@ -428,12 +428,12 @@ async fn test_deploy_fresh_proxy() { node.kill().unwrap(); let impl_contract = DeployedContract { id: ContractId::from_str( - "ad0bba17e0838ef859abe2693d8a5e3bc4e7cfb901601e30f4dc34999fda6335", + "50fe882cbef5f3da6da82509a66b7e5e0a64a40d70164861c01c908a332198ae", ) .unwrap(), proxy: Some( ContractId::from_str( - "f2d67efbd6038c85ddaffdcdc859770d8bd20eeec8e3909911f1446b2ec9f764", + "9c50c6837ba29508ad1b0fb01953892031218b5a08be73925ca5c0148e00a186", ) .unwrap(), ), diff --git a/forc-plugins/forc-crypto/Cargo.toml b/forc-plugins/forc-crypto/Cargo.toml index 018fab03b0f..8423e1e7f3b 100644 --- a/forc-plugins/forc-crypto/Cargo.toml +++ b/forc-plugins/forc-crypto/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-crypto" -version = "0.63.3" +version = "0.63.5" description = "A `forc` plugin for handling various cryptographic operations and conversions." authors.workspace = true edition.workspace = true @@ -13,8 +13,8 @@ anyhow = "1.0.75" async-trait = "0.1.58" atty = "0.2.14" clap = { version = "4.5.4", features = ["derive", "env"] } -forc-tracing = { version = "0.63.3", path = "../../forc-tracing" } -forc-util = { version = "0.63.3", path = "../../forc-util" } +forc-tracing = { version = "0.63.5", path = "../../forc-tracing" } +forc-util = { version = "0.63.5", path = "../../forc-util" } fuel-core-types = { workspace = true } fuel-crypto = { workspace = true, features = ["random"] } fuels-core = { workspace = true } diff --git a/forc-plugins/forc-debug/Cargo.toml b/forc-plugins/forc-debug/Cargo.toml index 8beea740bec..6246a1f279d 100644 --- a/forc-plugins/forc-debug/Cargo.toml +++ b/forc-plugins/forc-debug/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-debug" -version = "0.63.3" +version = "0.63.5" description = "Supports debugging Sway code via CLI and DAP server." authors.workspace = true edition.workspace = true @@ -12,9 +12,9 @@ repository.workspace = true anyhow = "1.0" # Used by the examples and for conversion only clap = { version = "4.5.4", features = ["derive", "env"] } dap = "0.4.1-alpha1" -forc-pkg = { version = "0.63.3", path = "../../forc-pkg" } -forc-test = { version = "0.63.3", path = "../../forc-test" } -forc-tracing = { version = "0.63.3", path = "../../forc-tracing" } +forc-pkg = { version = "0.63.5", path = "../../forc-pkg" } +forc-test = { version = "0.63.5", path = "../../forc-test" } +forc-tracing = { version = "0.63.5", path = "../../forc-tracing" } fuel-core-client = { workspace = true } fuel-types = { workspace = true, features = ["serde"] } fuel-vm = { workspace = true, features = ["serde"] } @@ -22,8 +22,8 @@ rayon = "1.7.0" serde = "1.0" serde_json = "1.0" shellfish = { version = "0.6.0", features = ["rustyline", "async", "tokio"] } -sway-core = { version = "0.63.3", path = "../../sway-core" } -sway-types = { version = "0.63.3", path = "../../sway-types" } +sway-core = { version = "0.63.5", path = "../../sway-core" } +sway-types = { version = "0.63.5", path = "../../sway-types" } thiserror = "1.0" tokio = { version = "1.8", features = [ "net", diff --git a/forc-plugins/forc-doc/Cargo.toml b/forc-plugins/forc-doc/Cargo.toml index 3ef4cf3280b..4c92f0e495b 100644 --- a/forc-plugins/forc-doc/Cargo.toml +++ b/forc-plugins/forc-doc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-doc" -version = "0.63.3" +version = "0.63.5" description = "Build the documentation for the local package and all dependencies. The output is placed in `out/doc` in the same format as the project." authors.workspace = true edition.workspace = true @@ -12,20 +12,20 @@ repository.workspace = true anyhow = "1.0.65" clap = { version = "4.5.4", features = ["derive"] } comrak = "0.16" -forc-pkg = { version = "0.63.3", path = "../../forc-pkg" } -forc-tracing = { version = "0.63.3", path = "../../forc-tracing" } -forc-util = { version = "0.63.3", path = "../../forc-util" } +forc-pkg = { version = "0.63.5", path = "../../forc-pkg" } +forc-tracing = { version = "0.63.5", path = "../../forc-tracing" } +forc-util = { version = "0.63.5", path = "../../forc-util" } horrorshow = "0.8.4" include_dir = "0.7.3" minifier = "0.3.0" opener = "0.5.0" serde = "1.0" serde_json = "1.0" -sway-ast = { version = "0.63.3", path = "../../sway-ast" } -sway-core = { version = "0.63.3", path = "../../sway-core" } -sway-lsp = { version = "0.63.3", path = "../../sway-lsp" } -sway-types = { version = "0.63.3", path = "../../sway-types" } -swayfmt = { version = "0.63.3", path = "../../swayfmt" } +sway-ast = { version = "0.63.5", path = "../../sway-ast" } +sway-core = { version = "0.63.5", path = "../../sway-core" } +sway-lsp = { version = "0.63.5", path = "../../sway-lsp" } +sway-types = { version = "0.63.5", path = "../../sway-types" } +swayfmt = { version = "0.63.5", path = "../../swayfmt" } [dev-dependencies] dir_indexer = "0.0.2" diff --git a/forc-plugins/forc-fmt/Cargo.toml b/forc-plugins/forc-fmt/Cargo.toml index 21f225321c4..24f660bad1a 100644 --- a/forc-plugins/forc-fmt/Cargo.toml +++ b/forc-plugins/forc-fmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-fmt" -version = "0.63.3" +version = "0.63.5" description = "A `forc` plugin for running the Sway code formatter." authors.workspace = true edition.workspace = true @@ -11,12 +11,12 @@ repository.workspace = true [dependencies] anyhow = "1" clap = { version = "4.5.4", features = ["derive"] } -forc-pkg = { version = "0.63.3", path = "../../forc-pkg" } -forc-tracing = { version = "0.63.3", path = "../../forc-tracing" } -forc-util = { version = "0.63.3", path = "../../forc-util" } +forc-pkg = { version = "0.63.5", path = "../../forc-pkg" } +forc-tracing = { version = "0.63.5", path = "../../forc-tracing" } +forc-util = { version = "0.63.5", path = "../../forc-util" } prettydiff = "0.5" -sway-core = { version = "0.63.3", path = "../../sway-core" } -sway-utils = { version = "0.63.3", path = "../../sway-utils" } -swayfmt = { version = "0.63.3", path = "../../swayfmt" } +sway-core = { version = "0.63.5", path = "../../sway-core" } +sway-utils = { version = "0.63.5", path = "../../sway-utils" } +swayfmt = { version = "0.63.5", path = "../../swayfmt" } taplo = "0.7" tracing = "0.1" diff --git a/forc-plugins/forc-lsp/Cargo.toml b/forc-plugins/forc-lsp/Cargo.toml index 2c27d4eabb3..82e2e899bbd 100644 --- a/forc-plugins/forc-lsp/Cargo.toml +++ b/forc-plugins/forc-lsp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-lsp" -version = "0.63.3" +version = "0.63.5" description = "A simple `forc` plugin for starting the sway language server." authors.workspace = true edition.workspace = true @@ -11,6 +11,6 @@ repository.workspace = true [dependencies] anyhow = "1" clap = { version = "4.5.4", features = ["derive"] } -sway-lsp = { version = "0.63.3", path = "../../sway-lsp" } +sway-lsp = { version = "0.63.5", path = "../../sway-lsp" } tikv-jemallocator = "0.5" tokio = { version = "1.8" } diff --git a/forc-plugins/forc-tx/Cargo.toml b/forc-plugins/forc-tx/Cargo.toml index 57c75317bf5..670778e6a07 100644 --- a/forc-plugins/forc-tx/Cargo.toml +++ b/forc-plugins/forc-tx/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-tx" -version = "0.63.3" +version = "0.63.5" description = "A `forc` plugin for constructing transactions." authors.workspace = true edition.workspace = true @@ -19,7 +19,7 @@ path = "src/main.rs" anyhow = "1" clap = { version = "4.5.4", features = ["derive", "env"] } devault = "0.1" -forc-util = { version = "0.63.3", path = "../../forc-util" } +forc-util = { version = "0.63.5", path = "../../forc-util" } fuel-tx = { workspace = true, features = ["serde", "test-helpers", "random"] } fuel-types = { workspace = true, features = ["serde"] } serde = "1.0" diff --git a/forc-test/Cargo.toml b/forc-test/Cargo.toml index cbb65629fe5..4c5f9647e74 100644 --- a/forc-test/Cargo.toml +++ b/forc-test/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-test" -version = "0.63.3" +version = "0.63.5" description = "A library for building and running Sway unit tests within Forc packages." authors.workspace = true edition.workspace = true @@ -10,12 +10,12 @@ repository.workspace = true [dependencies] anyhow = "1" -forc-pkg = { version = "0.63.3", path = "../forc-pkg" } +forc-pkg = { version = "0.63.5", path = "../forc-pkg" } fuel-abi-types = { workspace = true } fuel-tx = { workspace = true, features = ["test-helpers"] } fuel-vm = { workspace = true, features = ["random", "test-helpers"] } fuels-core = { workspace = true } rand = "0.8" rayon = "1.7.0" -sway-core = { version = "0.63.3", path = "../sway-core" } -sway-types = { version = "0.63.3", path = "../sway-types" } +sway-core = { version = "0.63.5", path = "../sway-core" } +sway-types = { version = "0.63.5", path = "../sway-types" } diff --git a/forc-tracing/Cargo.toml b/forc-tracing/Cargo.toml index a0097e93fc8..3a8378cf2e9 100644 --- a/forc-tracing/Cargo.toml +++ b/forc-tracing/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-tracing" -version = "0.63.3" +version = "0.63.5" description = "Tracing utility shared between forc crates." authors.workspace = true edition.workspace = true diff --git a/forc-util/Cargo.toml b/forc-util/Cargo.toml index 51895c32887..f24b56b6701 100644 --- a/forc-util/Cargo.toml +++ b/forc-util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc-util" -version = "0.63.3" +version = "0.63.5" description = "Utility items shared between forc crates." authors.workspace = true edition.workspace = true @@ -15,7 +15,7 @@ anyhow = "1" clap = { version = "4.5.4", features = ["cargo", "derive", "env"] } dirs = "3.0.2" fd-lock = "4.0" -forc-tracing = { version = "0.63.3", path = "../forc-tracing" } +forc-tracing = { version = "0.63.5", path = "../forc-tracing" } fuel-tx = { workspace = true, features = ["serde"], optional = true } hex = "0.4.3" paste = "1.0.14" @@ -23,10 +23,10 @@ regex = "1.10.2" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.73" serial_test = "3.0.0" -sway-core = { version = "0.63.3", path = "../sway-core" } -sway-error = { version = "0.63.3", path = "../sway-error" } -sway-types = { version = "0.63.3", path = "../sway-types" } -sway-utils = { version = "0.63.3", path = "../sway-utils" } +sway-core = { version = "0.63.5", path = "../sway-core" } +sway-error = { version = "0.63.5", path = "../sway-error" } +sway-types = { version = "0.63.5", path = "../sway-types" } +sway-utils = { version = "0.63.5", path = "../sway-utils" } tracing = "0.1" tracing-subscriber = { version = "0.3", features = [ "ansi", diff --git a/forc/Cargo.toml b/forc/Cargo.toml index b220aa77071..665c2630c2c 100644 --- a/forc/Cargo.toml +++ b/forc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "forc" -version = "0.63.3" +version = "0.63.5" description = "Fuel Orchestrator." authors.workspace = true edition.workspace = true @@ -23,20 +23,20 @@ anyhow = "1.0.41" clap = { version = "4.5.4", features = ["cargo", "derive", "env"] } clap_complete = "4.5.2" clap_complete_fig = "4.5.0" -forc-pkg = { version = "0.63.3", path = "../forc-pkg" } -forc-test = { version = "0.63.3", path = "../forc-test" } -forc-tracing = { version = "0.63.3", path = "../forc-tracing" } -forc-util = { version = "0.63.3", path = "../forc-util" } +forc-pkg = { version = "0.63.5", path = "../forc-pkg" } +forc-test = { version = "0.63.5", path = "../forc-test" } +forc-tracing = { version = "0.63.5", path = "../forc-tracing" } +forc-util = { version = "0.63.5", path = "../forc-util" } fs_extra = "1.2" fuel-asm = { workspace = true } hex = "0.4.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.73" -sway-core = { version = "0.63.3", path = "../sway-core" } -sway-error = { version = "0.63.3", path = "../sway-error" } -sway-ir = { version = "0.63.3", path = "../sway-ir" } -sway-types = { version = "0.63.3", path = "../sway-types" } -sway-utils = { version = "0.63.3", path = "../sway-utils" } +sway-core = { version = "0.63.5", path = "../sway-core" } +sway-error = { version = "0.63.5", path = "../sway-error" } +sway-ir = { version = "0.63.5", path = "../sway-ir" } +sway-types = { version = "0.63.5", path = "../sway-types" } +sway-utils = { version = "0.63.5", path = "../sway-utils" } term-table = "1.3" tokio = { version = "1.8.0", features = ["macros", "rt-multi-thread"] } toml = { version = "0.7", features = ["parse"] } diff --git a/sway-ast/Cargo.toml b/sway-ast/Cargo.toml index 391cca5a800..0d073b6ed4a 100644 --- a/sway-ast/Cargo.toml +++ b/sway-ast/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-ast" -version = "0.63.3" +version = "0.63.5" description = "Sway's AST" authors.workspace = true edition.workspace = true @@ -13,8 +13,8 @@ extension-trait = "1.0.1" num-bigint = { version = "0.4.3", features = ["serde"] } num-traits = "0.2.14" serde = { version = "1.0", features = ["derive"] } -sway-error = { version = "0.63.3", path = "../sway-error" } -sway-types = { version = "0.63.3", path = "../sway-types" } +sway-error = { version = "0.63.5", path = "../sway-error" } +sway-types = { version = "0.63.5", path = "../sway-types" } [lints.clippy] iter_over_hash_type = "deny" diff --git a/sway-core/Cargo.toml b/sway-core/Cargo.toml index c92484f3c16..986a1b015b5 100644 --- a/sway-core/Cargo.toml +++ b/sway-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-core" -version = "0.63.3" +version = "0.63.5" description = "Sway core language." authors.workspace = true edition.workspace = true @@ -39,12 +39,12 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.91" sha2 = "0.9" strum = { version = "0.24.1", features = ["derive"] } -sway-ast = { version = "0.63.3", path = "../sway-ast" } -sway-error = { version = "0.63.3", path = "../sway-error" } -sway-ir = { version = "0.63.3", path = "../sway-ir" } -sway-parse = { version = "0.63.3", path = "../sway-parse" } -sway-types = { version = "0.63.3", path = "../sway-types" } -sway-utils = { version = "0.63.3", path = "../sway-utils" } +sway-ast = { version = "0.63.5", path = "../sway-ast" } +sway-error = { version = "0.63.5", path = "../sway-error" } +sway-ir = { version = "0.63.5", path = "../sway-ir" } +sway-parse = { version = "0.63.5", path = "../sway-parse" } +sway-types = { version = "0.63.5", path = "../sway-types" } +sway-utils = { version = "0.63.5", path = "../sway-utils" } thiserror = "1.0" tracing = "0.1" uint = "0.9" diff --git a/sway-core/src/abi_generation/abi_str.rs b/sway-core/src/abi_generation/abi_str.rs index 339a9453f81..2972c9cee0e 100644 --- a/sway-core/src/abi_generation/abi_str.rs +++ b/sway-core/src/abi_generation/abi_str.rs @@ -28,10 +28,12 @@ impl TypeId { &*type_engine.get(resolved_type_id), ) { (TypeInfo::Custom { .. }, TypeInfo::Struct { .. }) - | (TypeInfo::Custom { .. }, TypeInfo::Enum { .. }) - | (TypeInfo::Custom { .. }, TypeInfo::Alias { .. }) => type_engine + | (TypeInfo::Custom { .. }, TypeInfo::Enum { .. }) => type_engine .get(resolved_type_id) .abi_str(ctx, engines, true), + (_, TypeInfo::Alias { ty, .. }) => { + ty.type_id.get_abi_type_str(ctx, engines, ty.type_id) + } (TypeInfo::Tuple(fields), TypeInfo::Tuple(resolved_fields)) => { assert_eq!(fields.len(), resolved_fields.len()); let field_strs = resolved_fields diff --git a/sway-core/src/ir_generation/compile.rs b/sway-core/src/ir_generation/compile.rs index 135b398ca74..a0c2b10ca8e 100644 --- a/sway-core/src/ir_generation/compile.rs +++ b/sway-core/src/ir_generation/compile.rs @@ -635,7 +635,7 @@ fn compile_fn( // recent instruction was a RET. let already_returns = compiler .current_block - .is_terminated_by_ret_or_revert(context); + .is_terminated_by_return_or_revert(context); if !already_returns && (compiler.current_block.num_instructions(context) > 0 || compiler.current_block == compiler.function.get_entry_block(context) diff --git a/sway-core/src/semantic_analysis/ast_node/code_block.rs b/sway-core/src/semantic_analysis/ast_node/code_block.rs index e063566d6f8..731a02457bb 100644 --- a/sway-core/src/semantic_analysis/ast_node/code_block.rs +++ b/sway-core/src/semantic_analysis/ast_node/code_block.rs @@ -56,6 +56,7 @@ impl ty::TyCodeBlock { // This is required to fix the test case numeric_type_propagation and issue #6371 ctx.by_ref() .with_collecting_unifications() + .with_code_block_first_pass(true) .scoped(|mut ctx| { code_block.contents.iter().for_each(|node| { ty::TyAstNode::type_check(&Handler::default(), ctx.by_ref(), node).ok(); diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/configurable.rs b/sway-core/src/semantic_analysis/ast_node/declaration/configurable.rs index a1c2f485af5..7619d1d2f02 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/configurable.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/configurable.rs @@ -50,7 +50,7 @@ impl ty::TyConfigurableDecl { // this subst is required to replace associated types, namely TypeInfo::TraitType. type_ascription.type_id.subst( &ctx.type_subst(), - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); if !is_screaming_snake_case(name.as_str()) { diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/constant.rs b/sway-core/src/semantic_analysis/ast_node/declaration/constant.rs index d911b9b99e3..4a9f903b282 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/constant.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/constant.rs @@ -45,7 +45,7 @@ impl ty::TyConstantDecl { // this subst is required to replace associated types, namely TypeInfo::TraitType. type_ascription.type_id.subst( &ctx.type_subst(), - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); if !is_screaming_snake_case(name.as_str()) { diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/declaration.rs b/sway-core/src/semantic_analysis/ast_node/declaration/declaration.rs index 817a997a9ba..49a2b6a636e 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/declaration.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/declaration.rs @@ -162,7 +162,7 @@ impl TyDecl { }, }; - if !ctx.collecting_unifications() { + if !ctx.code_block_first_pass() { let previous_symbol = ctx .namespace() .module(engines) diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs index 45674a7d95e..15266d2d2a7 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/impl_trait.rs @@ -646,7 +646,7 @@ fn type_check_trait_implementation( let type_engine = ctx.engines.te(); let decl_engine = ctx.engines.de(); let engines = ctx.engines(); - let collecting_unifications = ctx.collecting_unifications(); + let code_block_first_pass = ctx.code_block_first_pass(); // Check to see if the type that we are implementing for implements the // supertraits of this trait. @@ -665,7 +665,7 @@ fn type_check_trait_implementation( block_span, engines, TryInsertingTraitImplOnFailure::Yes, - collecting_unifications.into(), + code_block_first_pass.into(), ) })?; @@ -807,7 +807,7 @@ fn type_check_trait_implementation( type_decl.subst( &trait_type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); // Remove this type from the checklist. @@ -881,7 +881,7 @@ fn type_check_trait_implementation( impl_method.subst( &trait_type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); // Remove this method from the checklist. @@ -907,7 +907,7 @@ fn type_check_trait_implementation( const_decl.subst( &trait_type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); // Remove this constant from the checklist. @@ -980,7 +980,7 @@ fn type_check_trait_implementation( method.replace_decls(&decl_mapping, handler, &mut ctx)?; method.subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); all_items_refs.push(TyImplItem::Fn( decl_engine @@ -996,7 +996,7 @@ fn type_check_trait_implementation( const_decl.replace_decls(&decl_mapping, handler, &mut ctx)?; const_decl.subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); all_items_refs.push(TyImplItem::Constant(decl_engine.insert( const_decl, @@ -1007,7 +1007,7 @@ fn type_check_trait_implementation( let mut type_decl = (*decl_engine.get_type(decl_ref)).clone(); type_decl.subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); all_items_refs.push(TyImplItem::Type(decl_engine.insert( type_decl.clone(), @@ -1153,14 +1153,14 @@ fn type_check_impl_method( let mut impl_method_param_type_id = impl_method_param.type_argument.type_id; impl_method_param_type_id.subst( &ctx.type_subst(), - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); let mut impl_method_signature_param_type_id = impl_method_signature_param.type_argument.type_id; impl_method_signature_param_type_id.subst( &ctx.type_subst(), - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); if !UnifyCheck::non_dynamic_equality(engines).check( @@ -1233,14 +1233,14 @@ fn type_check_impl_method( let mut impl_method_return_type_id = impl_method.return_type.type_id; impl_method_return_type_id.subst( &ctx.type_subst(), - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); let mut impl_method_signature_return_type_type_id = impl_method_signature.return_type.type_id; impl_method_signature_return_type_type_id.subst( &ctx.type_subst(), - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); if !UnifyCheck::non_dynamic_equality(engines).check( @@ -1349,13 +1349,13 @@ fn type_check_const_decl( let mut const_decl_type_id = const_decl.type_ascription.type_id; const_decl_type_id.subst( &ctx.type_subst(), - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); let mut const_decl_signature_type_id = const_decl_signature.type_ascription.type_id; const_decl_signature_type_id.subst( &ctx.type_subst(), - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); // unify the types from the constant with the constant signature diff --git a/sway-core/src/semantic_analysis/ast_node/declaration/trait.rs b/sway-core/src/semantic_analysis/ast_node/declaration/trait.rs index de81f68bb27..552bab4bba8 100644 --- a/sway-core/src/semantic_analysis/ast_node/declaration/trait.rs +++ b/sway-core/src/semantic_analysis/ast_node/declaration/trait.rs @@ -358,7 +358,7 @@ impl TyTraitDecl { let r = if method .subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ) .has_changes() { @@ -380,7 +380,7 @@ impl TyTraitDecl { let r = if const_decl .subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ) .has_changes() { @@ -399,7 +399,7 @@ impl TyTraitDecl { let r = if t .subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ) .has_changes() { @@ -456,7 +456,7 @@ impl TyTraitDecl { let mut method = (*decl_engine.get_trait_fn(decl_ref)).clone(); method.subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); all_items.push(TyImplItem::Fn( decl_engine @@ -487,7 +487,7 @@ impl TyTraitDecl { let mut method = (*decl_engine.get_function(decl_ref)).clone(); method.subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); all_items.push(TyImplItem::Fn( ctx.engines @@ -503,7 +503,7 @@ impl TyTraitDecl { let mut const_decl = (*decl_engine.get_constant(decl_ref)).clone(); const_decl.subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); all_items.push(TyImplItem::Constant(decl_engine.insert( const_decl, @@ -514,7 +514,7 @@ impl TyTraitDecl { let mut type_decl = (*decl_engine.get_type(decl_ref)).clone(); type_decl.subst( &type_mapping, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); all_items.push(TyImplItem::Type(decl_engine.insert( type_decl, diff --git a/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs b/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs index 70c83d9b07a..c220ef33c1e 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/intrinsic_function.rs @@ -1855,14 +1855,7 @@ fn type_check_smo( ); let data = ty::TyExpression::type_check(handler, ctx.by_ref(), &arguments[1])?; - // Type check the third argument which is the output index, so it has to be a `u64`. - let mut ctx = ctx.by_ref().with_type_annotation(type_engine.insert( - engines, - TypeInfo::UnsignedInteger(IntegerBits::SixtyFour), - None, - )); - - // Type check the fourth argument which is the amount of coins to send, so it has to be a `u64`. + // Type check the third argument which is the amount of coins to send, so it has to be a `u64`. let mut ctx = ctx.by_ref().with_type_annotation(type_engine.insert( engines, TypeInfo::UnsignedInteger(IntegerBits::SixtyFour), @@ -1881,20 +1874,37 @@ fn type_check_smo( )) } -/// Signature: `__contract_call()` -/// Description: Calls another contract +/// Signature: `__contract_ret(ptr: raw_ptr, len: u64) -> !` +/// Description: Returns from contract. The returned data is located at the memory location `ptr` and has +/// the length of `len` bytes. /// Constraints: None. fn type_check_contract_ret( handler: &Handler, mut ctx: TypeCheckContext, - _kind: sway_ast::Intrinsic, + kind: sway_ast::Intrinsic, arguments: &[Expression], - _type_arguments: &[TypeArgument], - _span: Span, + type_arguments: &[TypeArgument], + span: Span, ) -> Result<(ty::TyIntrinsicFunctionKind, TypeId), ErrorEmitted> { let type_engine = ctx.engines.te(); let engines = ctx.engines(); + if arguments.len() != 2 { + return Err(handler.emit_err(CompileError::IntrinsicIncorrectNumArgs { + name: kind.to_string(), + expected: 2, + span, + })); + } + + if !type_arguments.is_empty() { + return Err(handler.emit_err(CompileError::IntrinsicIncorrectNumTArgs { + name: kind.to_string(), + expected: 0, + span, + })); + } + let arguments: Vec = arguments .iter() .map(|x| { @@ -1906,17 +1916,14 @@ fn type_check_contract_ret( }) .collect::, _>>()?; - let t = ctx - .engines - .te() - .insert(ctx.engines, TypeInfo::Tuple(vec![]), None); + let t = ctx.engines.te().insert(ctx.engines, TypeInfo::Never, None); Ok(( ty::TyIntrinsicFunctionKind { kind: Intrinsic::ContractRet, arguments, type_arguments: vec![], - span: Span::dummy(), + span, }, t, )) diff --git a/sway-core/src/semantic_analysis/ast_node/expression/match_expression/analysis/usefulness.rs b/sway-core/src/semantic_analysis/ast_node/expression/match_expression/analysis/usefulness.rs index e7fe20110f3..560e90fbdda 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/match_expression/analysis/usefulness.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/match_expression/analysis/usefulness.rs @@ -129,7 +129,7 @@ use super::{ /// `2`, any cases that the pattern `2` covers would previously be caught by the /// catchall pattern. /// -/// Usefulness used in the exhaustivity algorithm. +/// Usefulness is used in the exhaustivity algorithm. /// /// # Witnesses /// @@ -148,11 +148,11 @@ use super::{ /// } /// ``` /// -/// the witness for pattern `1` would be the pattern "1" as the pattern `1` +/// the witness for pattern `1` would be the value "1" as the pattern `1` /// would catch the concrete hypothetical matched value "1" and no other /// previous cases would have caught it. The witness for pattern `_` is an /// or-pattern of all of the remaining integers they wouldn't be caught by `0` -/// and `1`, so "3 | .. | MAX". +/// and `1`, so "2 | .. | MAX". /// /// Given: /// @@ -166,7 +166,7 @@ use super::{ /// } /// ``` /// -/// the pattern `1` (noted with an arrow) would not have any witnesses as there +/// the pattern `1` (noted with an arrow) would not have any witnesses /// that it catches that are not caught by previous patterns. /// /// # Putting it all together @@ -205,7 +205,7 @@ pub(crate) fn check_match_expression_usefulness( let mut matrix = Matrix::empty(); let mut arms_reachability = vec![]; - // If the provided type does has no valid constructor and there are no + // If the provided type does not have a valid constructor and there are no // branches in the match expression (i.e. no scrutinees to check), then // every scrutinee (i.e. 0 scrutinees) are useful! We return early in this // case. @@ -489,7 +489,7 @@ fn is_useful_or( ) -> Result { let (_, q_rest) = q.split_first(handler, span)?; let mut p = p.clone(); - let mut witness_report = WitnessReport::Witnesses(PatStack::empty()); + let mut witness_report = WitnessReport::NoWitnesses; for pat in pats.into_iter() { // 1. For each *k* 0..*a* compute *q'* as \[*rₖ q₂ ... qₙ*\]. let mut v = PatStack::from_pattern(pat); diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs index 7cab1f82a57..f7505d07b0a 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression.rs @@ -1643,10 +1643,14 @@ impl ty::TyExpression { // type check the address and make sure it is let err_span = address.span().clone(); let address_expr = { + // We want to type check the address expression as we do in the second pass, otherwise we get + // mismatched types while comparing TypeInfo::ContractCaller which is the return type of + // TyExpressionVariant::AbiCast. let ctx = ctx .by_ref() .with_help_text("An address that is being ABI cast must be of type b256") - .with_type_annotation(type_engine.insert(engines, TypeInfo::B256, None)); + .with_type_annotation(type_engine.insert(engines, TypeInfo::B256, None)) + .with_code_block_first_pass(false); ty::TyExpression::type_check(handler, ctx, address) .unwrap_or_else(|err| ty::TyExpression::error(err, err_span, engines)) }; diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/function_application.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/function_application.rs index a3f299027b9..b3bfdbcf7ca 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/function_application.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/function_application.rs @@ -61,6 +61,17 @@ pub(crate) fn instantiate_function_application( &function_decl.parameters, )?; + // unify function return type with current ctx.type_annotation(). + engines.te().unify_with_generic( + handler, + engines, + function_decl.return_type.type_id, + ctx.type_annotation(), + &call_path_binding.span(), + "Function return type does not match up with local type annotation.", + None, + ); + let mut function_return_type_id = function_decl.return_type.type_id; let function_ident: IdentUnique = function_decl.name.clone().into(); @@ -73,7 +84,7 @@ pub(crate) fn instantiate_function_application( { cached_fn_ref } else { - if !ctx.collecting_unifications() { + if !ctx.code_block_first_pass() { // Handle the trait constraints. This includes checking to see if the trait // constraints are satisfied and replacing old decl ids based on the // constraint with new decl ids based on the new type. @@ -102,7 +113,7 @@ pub(crate) fn instantiate_function_application( ) .with_parent(decl_engine, (*function_decl_ref.id()).into()); - if !ctx.collecting_unifications() + if !ctx.code_block_first_pass() && method_sig.is_concrete(engines) && function_is_type_check_finalized && !function_is_trait_method_dummy diff --git a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs index 0ae7d765bbd..8dfcd358bfb 100644 --- a/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs +++ b/sway-core/src/semantic_analysis/ast_node/expression/typed_expression/method_application.rs @@ -672,14 +672,14 @@ pub(crate) fn type_check_method_application( ); method.subst( &type_subst, - &SubstTypesContext::new(engines, !ctx.collecting_unifications()), + &SubstTypesContext::new(engines, !ctx.code_block_first_pass()), ); } } } } - if !ctx.collecting_unifications() { + if !ctx.code_block_first_pass() { // Handle the trait constraints. This includes checking to see if the trait // constraints are satisfied and replacing old decl ids based on the // constraint with new decl ids based on the new type. @@ -702,7 +702,7 @@ pub(crate) fn type_check_method_application( method_return_type_id = method.return_type.type_id; decl_engine.replace(*fn_ref.id(), method.clone()); - if !ctx.collecting_unifications() + if !ctx.code_block_first_pass() && method_sig.is_concrete(engines) && method.is_type_check_finalized && !method.is_trait_method_dummy diff --git a/sway-core/src/semantic_analysis/namespace/mod.rs b/sway-core/src/semantic_analysis/namespace/mod.rs index 00802345672..5b723fa193d 100644 --- a/sway-core/src/semantic_analysis/namespace/mod.rs +++ b/sway-core/src/semantic_analysis/namespace/mod.rs @@ -14,7 +14,7 @@ pub use namespace::Namespace; pub use namespace::TryInsertingTraitImplOnFailure; pub use root::ResolvedDeclaration; pub use root::Root; -pub(super) use trait_map::CollectingUnification; +pub(super) use trait_map::CodeBlockFirstPass; pub(super) use trait_map::IsExtendingExistingImpl; pub(super) use trait_map::IsImplSelf; pub(super) use trait_map::ResolvedTraitImplItem; diff --git a/sway-core/src/semantic_analysis/namespace/root.rs b/sway-core/src/semantic_analysis/namespace/root.rs index 591fd5e8ec9..a9da70d1881 100644 --- a/sway-core/src/semantic_analysis/namespace/root.rs +++ b/sway-core/src/semantic_analysis/namespace/root.rs @@ -378,7 +378,7 @@ impl Root { .filter_by_type_item_import( type_id, engines, - super::CollectingUnification::No, + super::CodeBlockFirstPass::No, ), engines, ); diff --git a/sway-core/src/semantic_analysis/namespace/trait_map.rs b/sway-core/src/semantic_analysis/namespace/trait_map.rs index 69aad5db10f..6d1be290b42 100644 --- a/sway-core/src/semantic_analysis/namespace/trait_map.rs +++ b/sway-core/src/semantic_analysis/namespace/trait_map.rs @@ -30,17 +30,17 @@ use crate::{ use super::TryInsertingTraitImplOnFailure; #[derive(Clone)] -pub enum CollectingUnification { +pub enum CodeBlockFirstPass { Yes, No, } -impl From for CollectingUnification { +impl From for CodeBlockFirstPass { fn from(value: bool) -> Self { if value { - CollectingUnification::Yes + CodeBlockFirstPass::Yes } else { - CollectingUnification::No + CodeBlockFirstPass::No } } } @@ -570,10 +570,10 @@ impl TraitMap { &mut self, engines: &Engines, type_id: TypeId, - collecting_unifications: CollectingUnification, + code_block_first_pass: CodeBlockFirstPass, ) { self.extend( - self.filter_by_type(type_id, engines, collecting_unifications), + self.filter_by_type(type_id, engines, code_block_first_pass), engines, ); } @@ -746,7 +746,7 @@ impl TraitMap { &self, type_id: TypeId, engines: &Engines, - collecting_unifications: CollectingUnification, + code_block_first_pass: CodeBlockFirstPass, ) -> TraitMap { let unify_checker = UnifyCheck::constraint_subset(engines); @@ -755,7 +755,7 @@ impl TraitMap { let mut all_types = type_id.extract_inner_types(engines, IncludeSelf::No); all_types.insert(type_id); let all_types = all_types.into_iter().collect::>(); - self.filter_by_type_inner(engines, all_types, decider, collecting_unifications) + self.filter_by_type_inner(engines, all_types, decider, code_block_first_pass) } /// Filters the entries in `self` with the given [TypeId] `type_id` and @@ -820,7 +820,7 @@ impl TraitMap { &self, type_id: TypeId, engines: &Engines, - collecting_unifications: CollectingUnification, + code_block_first_pass: CodeBlockFirstPass, ) -> TraitMap { let unify_checker = UnifyCheck::constraint_subset(engines); let unify_checker_for_item_import = UnifyCheck::non_generic_constraint_subset(engines); @@ -833,7 +833,7 @@ impl TraitMap { engines, vec![type_id], decider, - collecting_unifications.clone(), + code_block_first_pass.clone(), ); let all_types = type_id .extract_inner_types(engines, IncludeSelf::No) @@ -843,7 +843,7 @@ impl TraitMap { let decider2 = |left: TypeId, right: TypeId| unify_checker.check(left, right); trait_map.extend( - self.filter_by_type_inner(engines, all_types, decider2, collecting_unifications), + self.filter_by_type_inner(engines, all_types, decider2, code_block_first_pass), engines, ); trait_map @@ -854,7 +854,7 @@ impl TraitMap { engines: &Engines, mut all_types: Vec, decider: impl Fn(TypeId, TypeId) -> bool, - collecting_unifications: CollectingUnification, + code_block_first_pass: CodeBlockFirstPass, ) -> TraitMap { let type_engine = engines.te(); let decl_engine = engines.de(); @@ -908,7 +908,7 @@ impl TraitMap { &type_mapping, &SubstTypesContext::new( engines, - matches!(collecting_unifications, CollectingUnification::No), + matches!(code_block_first_pass, CodeBlockFirstPass::No), ), ); let trait_items: TraitItems = map_trait_items @@ -927,8 +927,8 @@ impl TraitMap { &SubstTypesContext::new( engines, matches!( - collecting_unifications, - CollectingUnification::No + code_block_first_pass, + CodeBlockFirstPass::No ), ), ); @@ -952,10 +952,7 @@ impl TraitMap { &type_mapping, &SubstTypesContext::new( engines, - matches!( - collecting_unifications, - CollectingUnification::No - ), + matches!(code_block_first_pass, CodeBlockFirstPass::No), ), ); let new_ref = decl_engine.insert( @@ -973,10 +970,7 @@ impl TraitMap { &type_mapping, &SubstTypesContext::new( engines, - matches!( - collecting_unifications, - CollectingUnification::No - ), + matches!(code_block_first_pass, CodeBlockFirstPass::No), ), ); let new_ref = decl_engine.insert( @@ -1342,7 +1336,7 @@ impl TraitMap { access_span: &Span, engines: &Engines, try_inserting_trait_impl_on_failure: TryInsertingTraitImplOnFailure, - collecting_unifications: CollectingUnification, + code_block_first_pass: CodeBlockFirstPass, ) -> Result<(), ErrorEmitted> { let type_engine = engines.te(); @@ -1373,7 +1367,7 @@ impl TraitMap { access_span, engines, try_inserting_trait_impl_on_failure, - collecting_unifications, + code_block_first_pass, ) { Ok(()) => { self.satisfied_cache.insert(hash); @@ -1392,7 +1386,7 @@ impl TraitMap { access_span: &Span, engines: &Engines, try_inserting_trait_impl_on_failure: TryInsertingTraitImplOnFailure, - collecting_unifications: CollectingUnification, + code_block_first_pass: CodeBlockFirstPass, ) -> Result<(), ErrorEmitted> { let type_engine = engines.te(); @@ -1496,7 +1490,7 @@ impl TraitMap { try_inserting_trait_impl_on_failure, TryInsertingTraitImplOnFailure::Yes ) { - self.insert_for_type(engines, type_id, collecting_unifications.clone()); + self.insert_for_type(engines, type_id, code_block_first_pass.clone()); return self.check_if_trait_constraints_are_satisfied_for_type( handler, type_id, @@ -1504,7 +1498,7 @@ impl TraitMap { access_span, engines, TryInsertingTraitImplOnFailure::No, - collecting_unifications.clone(), + code_block_first_pass.clone(), ); } else { let mut type_arguments_string = "".to_string(); diff --git a/sway-core/src/semantic_analysis/type_check_context.rs b/sway-core/src/semantic_analysis/type_check_context.rs index 1ced9fd248c..faf8fa72647 100644 --- a/sway-core/src/semantic_analysis/type_check_context.rs +++ b/sway-core/src/semantic_analysis/type_check_context.rs @@ -95,7 +95,13 @@ pub struct TypeCheckContext<'a> { /// Indicates when semantic analysis is type checking storage declaration. storage_declaration: bool, + // Indicates when we are collecting unifications. collecting_unifications: bool, + + // Indicates when we are doing the first pass of the code block type checking. + // In some nested places of the first pass we want to disable the first pass optimizations + // To disable those optimizations we can set this to false. + code_block_first_pass: bool, } impl<'a> TypeCheckContext<'a> { @@ -122,6 +128,7 @@ impl<'a> TypeCheckContext<'a> { storage_declaration: false, experimental, collecting_unifications: false, + code_block_first_pass: false, } } @@ -162,6 +169,7 @@ impl<'a> TypeCheckContext<'a> { storage_declaration: false, experimental, collecting_unifications: false, + code_block_first_pass: false, } } @@ -191,6 +199,7 @@ impl<'a> TypeCheckContext<'a> { storage_declaration: self.storage_declaration, experimental: self.experimental, collecting_unifications: self.collecting_unifications, + code_block_first_pass: self.code_block_first_pass, } } @@ -217,6 +226,7 @@ impl<'a> TypeCheckContext<'a> { storage_declaration: self.storage_declaration, experimental: self.experimental, collecting_unifications: self.collecting_unifications, + code_block_first_pass: self.code_block_first_pass, }; with_scoped_ctx(ctx) } @@ -244,6 +254,7 @@ impl<'a> TypeCheckContext<'a> { storage_declaration: self.storage_declaration, experimental: self.experimental, collecting_unifications: self.collecting_unifications, + code_block_first_pass: self.code_block_first_pass, }; Ok((with_scoped_ctx(ctx)?, namespace)) } @@ -362,6 +373,13 @@ impl<'a> TypeCheckContext<'a> { } } + pub(crate) fn with_code_block_first_pass(self, value: bool) -> Self { + Self { + code_block_first_pass: value, + ..self + } + } + /// Map this `TypeCheckContext` instance to a new one with /// `disallow_functions` set to `true`. pub(crate) fn disallow_functions(self) -> Self { @@ -437,6 +455,10 @@ impl<'a> TypeCheckContext<'a> { self.collecting_unifications } + pub(crate) fn code_block_first_pass(&self) -> bool { + self.code_block_first_pass + } + // Provide some convenience functions around the inner context. /// Short-hand for calling the `monomorphize` function in the type engine @@ -1439,11 +1461,7 @@ impl<'a> TypeCheckContext<'a> { src_mod .current_items() .implemented_traits - .filter_by_type_item_import( - type_id, - engines, - self.collecting_unifications().into(), - ), + .filter_by_type_item_import(type_id, engines, self.code_block_first_pass().into()), engines, ); @@ -1739,12 +1757,12 @@ impl<'a> TypeCheckContext<'a> { pub(crate) fn insert_trait_implementation_for_type(&mut self, type_id: TypeId) { let engines = self.engines; - let collecting_unifications = self.collecting_unifications(); + let code_block_first_pass = self.code_block_first_pass(); self.namespace_mut() .module_mut(engines) .current_items_mut() .implemented_traits - .insert_for_type(engines, type_id, collecting_unifications.into()); + .insert_for_type(engines, type_id, code_block_first_pass.into()); } pub fn check_type_impls_traits( @@ -1754,7 +1772,7 @@ impl<'a> TypeCheckContext<'a> { ) -> bool { let handler = Handler::default(); let engines = self.engines; - let collecting_unifications = self.collecting_unifications(); + let code_block_first_pass = self.code_block_first_pass(); self.namespace_mut() .module_mut(engines) .current_items_mut() @@ -1766,7 +1784,7 @@ impl<'a> TypeCheckContext<'a> { &Span::dummy(), engines, crate::namespace::TryInsertingTraitImplOnFailure::Yes, - collecting_unifications.into(), + code_block_first_pass.into(), ) .is_ok() } diff --git a/sway-core/src/type_system/ast_elements/type_parameter.rs b/sway-core/src/type_system/ast_elements/type_parameter.rs index bc85cc24247..40cd55f1f50 100644 --- a/sway-core/src/type_system/ast_elements/type_parameter.rs +++ b/sway-core/src/type_system/ast_elements/type_parameter.rs @@ -507,8 +507,8 @@ impl TypeParameter { .. } = type_param; - let collecting_unifications = ctx.collecting_unifications(); - if !collecting_unifications { + let code_block_first_pass = ctx.code_block_first_pass(); + if !code_block_first_pass { // Check to see if the trait constraints are satisfied. match ctx .namespace_mut() @@ -522,7 +522,7 @@ impl TypeParameter { access_span, engines, TryInsertingTraitImplOnFailure::Yes, - collecting_unifications.into(), + code_block_first_pass.into(), ) { Ok(res) => res, Err(_) => continue, diff --git a/sway-core/src/type_system/id.rs b/sway-core/src/type_system/id.rs index d029cc2d772..709a1bf7a23 100644 --- a/sway-core/src/type_system/id.rs +++ b/sway-core/src/type_system/id.rs @@ -519,7 +519,7 @@ impl TypeId { span: &Span, type_param: Option, ) -> Result<(), ErrorEmitted> { - if ctx.collecting_unifications() { + if ctx.code_block_first_pass() { return Ok(()); } diff --git a/sway-core/src/type_system/unify/unify_check.rs b/sway-core/src/type_system/unify/unify_check.rs index 26a0777bdee..7479a4142ac 100644 --- a/sway-core/src/type_system/unify/unify_check.rs +++ b/sway-core/src/type_system/unify/unify_check.rs @@ -471,7 +471,10 @@ impl<'a> UnifyCheck<'a> { parent: _, is_from_type_parameter: _, }, - ) => rtc.eq(ltc, &PartialEqWithEnginesContext::new(self.engines)), + ) => { + matches!(self.mode, NonGenericConstraintSubset) + || rtc.eq(ltc, &PartialEqWithEnginesContext::new(self.engines)) + } // any type can be coerced into a generic, // except if the type already contains the generic diff --git a/sway-error/Cargo.toml b/sway-error/Cargo.toml index 8cc56791be2..1cf2daa2737 100644 --- a/sway-error/Cargo.toml +++ b/sway-error/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-error" -version = "0.63.3" +version = "0.63.5" description = "Sway's error handling" authors.workspace = true edition.workspace = true @@ -14,7 +14,7 @@ in_definite = "1.0.0" num-traits = "0.2.14" smallvec = "1.7" strsim = "0.11.1" -sway-types = { version = "0.63.3", path = "../sway-types" } +sway-types = { version = "0.63.5", path = "../sway-types" } thiserror = "1.0" uwuify = { version = "^0.2", optional = true } diff --git a/sway-ir/Cargo.toml b/sway-ir/Cargo.toml index 60dca0d4629..44ed847ca70 100644 --- a/sway-ir/Cargo.toml +++ b/sway-ir/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-ir" -version = "0.63.3" +version = "0.63.5" description = "Sway intermediate representation." authors.workspace = true edition.workspace = true @@ -19,9 +19,9 @@ peg = "0.7" prettydiff = "0.6.4" rustc-hash = "1.1.0" slotmap = "1.0.7" -sway-ir-macros = { version = "0.63.3", path = "sway-ir-macros" } -sway-types = { version = "0.63.3", path = "../sway-types" } -sway-utils = { version = "0.63.3", path = "../sway-utils" } +sway-ir-macros = { version = "0.63.5", path = "sway-ir-macros" } +sway-types = { version = "0.63.5", path = "../sway-types" } +sway-utils = { version = "0.63.5", path = "../sway-utils" } [lints.clippy] iter_over_hash_type = "deny" diff --git a/sway-ir/src/analysis/dominator.rs b/sway-ir/src/analysis/dominator.rs index 9dfe35a310f..9919cd2f556 100644 --- a/sway-ir/src/analysis/dominator.rs +++ b/sway-ir/src/analysis/dominator.rs @@ -213,10 +213,15 @@ impl DomTree { false } - /// Get an iterator over the childre nodes + /// Get an iterator over the children nodes pub fn children(&self, node: Block) -> impl Iterator + '_ { self.0[&node].children.iter().cloned() } + + /// Get i'th child of a given node + pub fn child(&self, node: Block, i: usize) -> Option { + self.0[&node].children.get(i).cloned() + } } pub const DOM_FRONTS_NAME: &str = "dominance-frontiers"; diff --git a/sway-ir/src/block.rs b/sway-ir/src/block.rs index deea1096d16..fb56b644059 100644 --- a/sway-ir/src/block.rs +++ b/sway-ir/src/block.rs @@ -369,14 +369,21 @@ impl Block { } } - /// Return whether this block is already terminated specifically by a Ret instruction. - pub fn is_terminated_by_ret_or_revert(&self, context: &Context) -> bool { + /// Return whether this block is already terminated by non-branching instructions, + /// means with instructions that cause either revert, or local or context returns. + /// Those instructions are: [InstOp::Ret], [FuelVmInstruction::Retd], + /// [FuelVmInstruction::JmpMem], and [FuelVmInstruction::Revert]). + pub fn is_terminated_by_return_or_revert(&self, context: &Context) -> bool { self.get_terminator(context).map_or(false, |i| { matches!( i, Instruction { op: InstOp::Ret(..) - | InstOp::FuelVm(FuelVmInstruction::Revert(..) | FuelVmInstruction::JmpMem), + | InstOp::FuelVm( + FuelVmInstruction::Revert(..) + | FuelVmInstruction::JmpMem + | FuelVmInstruction::Retd { .. } + ), .. } ) diff --git a/sway-ir/src/instruction.rs b/sway-ir/src/instruction.rs index d53556df29e..9e7b92fb5e0 100644 --- a/sway-ir/src/instruction.rs +++ b/sway-ir/src/instruction.rs @@ -284,7 +284,6 @@ impl InstOp { InstOp::FuelVm(FuelVmInstruction::Log { .. }) => Some(Type::get_unit(context)), InstOp::FuelVm(FuelVmInstruction::ReadRegister(_)) => Some(Type::get_uint64(context)), InstOp::FuelVm(FuelVmInstruction::Smo { .. }) => Some(Type::get_unit(context)), - InstOp::FuelVm(FuelVmInstruction::Retd { .. }) => None, // Load needs to strip the pointer from the source type. InstOp::Load(ptr_val) => match &context.values[ptr_val.0].value { @@ -310,7 +309,11 @@ impl InstOp { // These are all terminators which don't return, essentially. No type. InstOp::Branch(_) | InstOp::ConditionalBranch { .. } - | InstOp::FuelVm(FuelVmInstruction::Revert(..) | FuelVmInstruction::JmpMem) + | InstOp::FuelVm( + FuelVmInstruction::Revert(..) + | FuelVmInstruction::JmpMem + | FuelVmInstruction::Retd { .. }, + ) | InstOp::Ret(..) => None, // No-op is also no-type. @@ -692,7 +695,11 @@ impl InstOp { InstOp::Branch(_) | InstOp::ConditionalBranch { .. } | InstOp::Ret(..) - | InstOp::FuelVm(FuelVmInstruction::Revert(..) | FuelVmInstruction::JmpMem) + | InstOp::FuelVm( + FuelVmInstruction::Revert(..) + | FuelVmInstruction::JmpMem + | FuelVmInstruction::Retd { .. } + ) ) } } diff --git a/sway-ir/src/optimize.rs b/sway-ir/src/optimize.rs index 5b153b18603..564002fff13 100644 --- a/sway-ir/src/optimize.rs +++ b/sway-ir/src/optimize.rs @@ -19,6 +19,8 @@ pub mod const_demotion; pub use const_demotion::*; pub mod constants; pub use constants::*; +pub mod conditional_constprop; +pub use conditional_constprop::*; pub mod cse; pub use cse::*; pub mod dce; diff --git a/sway-ir/src/optimize/conditional_constprop.rs b/sway-ir/src/optimize/conditional_constprop.rs new file mode 100644 index 00000000000..deb5a1b1623 --- /dev/null +++ b/sway-ir/src/optimize/conditional_constprop.rs @@ -0,0 +1,98 @@ +//! When a value is guaranteed to have a constant value in a region of the CFG, +//! this optimization replaces uses of that value with the constant in that region. + +use rustc_hash::FxHashMap; + +use crate::{ + AnalysisResults, Context, DomTree, Function, InstOp, Instruction, IrError, Pass, + PassMutability, Predicate, ScopedPass, DOMINATORS_NAME, +}; + +pub const CCP_NAME: &str = "ccp"; + +pub fn create_ccp_pass() -> Pass { + Pass { + name: CCP_NAME, + descr: "Conditional constant proparagion", + deps: vec![DOMINATORS_NAME], + runner: ScopedPass::FunctionPass(PassMutability::Transform(ccp)), + } +} + +pub fn ccp( + context: &mut Context, + analyses: &AnalysisResults, + function: Function, +) -> Result { + let dom_tree: &DomTree = analyses.get_analysis_result(function); + + // In the set of blocks dominated by `key`, replace all uses of `val.0` with `val.1`. + let mut dom_region_replacements = FxHashMap::default(); + + for block in function.block_iter(context) { + let term = block + .get_terminator(context) + .expect("Malformed block: no terminator"); + if let InstOp::ConditionalBranch { + cond_value, + true_block, + false_block: _, + } = &term.op + { + if let Some(Instruction { + parent: _, + op: InstOp::Cmp(pred, v1, v2), + }) = cond_value.get_instruction(context) + { + if matches!(pred, Predicate::Equal) + && (v1.is_constant(context) ^ v2.is_constant(context) + && true_block.block.num_predecessors(context) == 1) + { + if v1.is_constant(context) { + dom_region_replacements.insert(true_block.block, (*v2, *v1)); + } else { + dom_region_replacements.insert(true_block.block, (*v1, *v2)); + } + } + } + } + } + + // lets walk the dominator tree from the root. + let root_block = function.get_entry_block(context); + + if dom_region_replacements.is_empty() { + return Ok(false); + } + + let mut stack = vec![(root_block, 0)]; + let mut replacements = FxHashMap::default(); + while let Some((block, next_child)) = stack.last().cloned() { + let cur_replacement_opt = dom_region_replacements.get(&block); + + if next_child == 0 { + // Preorder processing + if let Some(cur_replacement) = cur_replacement_opt { + replacements.insert(cur_replacement.0, cur_replacement.1); + } + // walk the current block. + block.replace_values(context, &replacements); + } + + // walk children. + if let Some(child) = dom_tree.child(block, next_child) { + // When we arrive back at "block" next time, we should process the next child. + stack.last_mut().unwrap().1 = next_child + 1; + // Go on to process the child. + stack.push((child, 0)); + } else { + // No children left to process. Start postorder processing. + if let Some(cur_replacement) = cur_replacement_opt { + replacements.remove(&cur_replacement.0); + } + stack.pop(); + } + } + + Ok(true) +} diff --git a/sway-ir/src/pass_manager.rs b/sway-ir/src/pass_manager.rs index 1e2ce28c849..d86b19b9b31 100644 --- a/sway-ir/src/pass_manager.rs +++ b/sway-ir/src/pass_manager.rs @@ -1,14 +1,5 @@ use crate::{ - create_arg_demotion_pass, create_const_demotion_pass, create_const_folding_pass, - create_cse_pass, create_dce_pass, create_dom_fronts_pass, create_dominators_pass, - create_escaped_symbols_pass, create_fn_dce_pass, create_fn_dedup_debug_profile_pass, - create_fn_dedup_release_profile_pass, create_fn_inline_pass, create_mem2reg_pass, - create_memcpyopt_pass, create_misc_demotion_pass, create_module_printer_pass, - create_module_verifier_pass, create_postorder_pass, create_ret_demotion_pass, - create_simplify_cfg_pass, create_sroa_pass, Context, Function, IrError, Module, - ARG_DEMOTION_NAME, CONST_DEMOTION_NAME, CONST_FOLDING_NAME, CSE_NAME, DCE_NAME, FN_DCE_NAME, - FN_DEDUP_DEBUG_PROFILE_NAME, FN_DEDUP_RELEASE_PROFILE_NAME, FN_INLINE_NAME, MEM2REG_NAME, - MEMCPYOPT_NAME, MISC_DEMOTION_NAME, RET_DEMOTION_NAME, SIMPLIFY_CFG_NAME, SROA_NAME, + create_arg_demotion_pass, create_ccp_pass, create_const_demotion_pass, create_const_folding_pass, create_cse_pass, create_dce_pass, create_dom_fronts_pass, create_dominators_pass, create_escaped_symbols_pass, create_fn_dce_pass, create_fn_dedup_debug_profile_pass, create_fn_dedup_release_profile_pass, create_fn_inline_pass, create_mem2reg_pass, create_memcpyopt_pass, create_misc_demotion_pass, create_module_printer_pass, create_module_verifier_pass, create_postorder_pass, create_ret_demotion_pass, create_simplify_cfg_pass, create_sroa_pass, Context, Function, IrError, Module, ARG_DEMOTION_NAME, CCP_NAME, CONST_DEMOTION_NAME, CONST_FOLDING_NAME, CSE_NAME, DCE_NAME, FN_DCE_NAME, FN_DEDUP_DEBUG_PROFILE_NAME, FN_DEDUP_RELEASE_PROFILE_NAME, FN_INLINE_NAME, MEM2REG_NAME, MEMCPYOPT_NAME, MISC_DEMOTION_NAME, RET_DEMOTION_NAME, SIMPLIFY_CFG_NAME, SROA_NAME }; use downcast_rs::{impl_downcast, Downcast}; use rustc_hash::FxHashMap; @@ -396,6 +387,7 @@ pub fn register_known_passes(pm: &mut PassManager) { pm.register(create_sroa_pass()); pm.register(create_fn_inline_pass()); pm.register(create_const_folding_pass()); + pm.register(create_ccp_pass()); pm.register(create_simplify_cfg_pass()); pm.register(create_fn_dce_pass()); pm.register(create_dce_pass()); @@ -408,7 +400,7 @@ pub fn register_known_passes(pm: &mut PassManager) { } pub fn create_o1_pass_group() -> PassGroup { - // Create a configuration to specify which passes we want to run now. + // Create a create_ccp_passo specify which passes we want to run now. let mut o1 = PassGroup::default(); // Configure to run our passes. o1.append_pass(MEM2REG_NAME); @@ -417,6 +409,7 @@ pub fn create_o1_pass_group() -> PassGroup { o1.append_pass(SIMPLIFY_CFG_NAME); o1.append_pass(FN_DCE_NAME); o1.append_pass(FN_INLINE_NAME); + o1.append_pass(CCP_NAME); o1.append_pass(CONST_FOLDING_NAME); o1.append_pass(SIMPLIFY_CFG_NAME); o1.append_pass(CSE_NAME); diff --git a/sway-ir/src/value.rs b/sway-ir/src/value.rs index c7b7af6b6af..42324aca351 100644 --- a/sway-ir/src/value.rs +++ b/sway-ir/src/value.rs @@ -12,7 +12,7 @@ use crate::{ block::BlockArgument, constant::Constant, context::Context, - instruction::{FuelVmInstruction, InstOp}, + instruction::InstOp, irtype::Type, metadata::{combine, MetadataIndex}, pretty::DebugWithContext, @@ -102,13 +102,7 @@ impl Value { /// and is either a branch or return. pub fn is_terminator(&self, context: &Context) -> bool { match &context.values[self.0].value { - ValueDatum::Instruction(Instruction { op, .. }) => matches!( - op, - InstOp::Branch(_) - | InstOp::ConditionalBranch { .. } - | InstOp::Ret(_, _) - | InstOp::FuelVm(FuelVmInstruction::Revert(_) | FuelVmInstruction::JmpMem) - ), + ValueDatum::Instruction(Instruction { op, .. }) => op.is_terminator(), ValueDatum::Argument(..) | ValueDatum::Constant(..) => false, } } diff --git a/sway-ir/sway-ir-macros/Cargo.toml b/sway-ir/sway-ir-macros/Cargo.toml index 63665453f02..ab56ca2eb09 100644 --- a/sway-ir/sway-ir-macros/Cargo.toml +++ b/sway-ir/sway-ir-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-ir-macros" -version = "0.63.3" +version = "0.63.5" description = "Macros for sway's intermediate representation." authors.workspace = true edition.workspace = true diff --git a/sway-ir/tests/ccp/ccp1.ir b/sway-ir/tests/ccp/ccp1.ir new file mode 100644 index 00000000000..ad15ff80e32 --- /dev/null +++ b/sway-ir/tests/ccp/ccp1.ir @@ -0,0 +1,29 @@ +// regex: ID=[[:alpha:]_0-9]+ + +script { + // check: fn $ID($(param=$ID): u64) -> u64 + fn test1(p: u64) -> u64 { + entry(p: u64): + // check: $(c=$ID) = const u64 100 + v0 = const u64 100 + // check: cmp eq $c $param + v2 = cmp eq v0 p + // check: $ID, $(true_block=$ID)(), $(false_block=$ID)() + cbr v2, get_0_block0(), get_0_block1() + + // check: $true_block(): + get_0_block0(): + // check: $(one=$ID) = const u64 1 + v5 = const u64 1 + // check: add $one, $c + v6 = add v5, p + ret u64 v6 + + // check: $false_block(): + get_0_block1(): + v7 = const u64 111 + // check: add $ID, $param + v8 = add v7, p + ret u64 v8 + } +} diff --git a/sway-ir/tests/tests.rs b/sway-ir/tests/tests.rs index efbfc8ba1b0..58bd60e8bbb 100644 --- a/sway-ir/tests/tests.rs +++ b/sway-ir/tests/tests.rs @@ -2,13 +2,7 @@ use std::path::PathBuf; use itertools::Itertools; use sway_ir::{ - create_arg_demotion_pass, create_const_demotion_pass, create_const_folding_pass, - create_cse_pass, create_dce_pass, create_dom_fronts_pass, create_dominators_pass, - create_escaped_symbols_pass, create_mem2reg_pass, create_memcpyopt_pass, - create_misc_demotion_pass, create_postorder_pass, create_ret_demotion_pass, - create_simplify_cfg_pass, metadata_to_inline, optimize as opt, register_known_passes, Context, - ExperimentalFlags, Function, IrError, PassGroup, PassManager, Value, DCE_NAME, FN_DCE_NAME, - FN_DEDUP_DEBUG_PROFILE_NAME, FN_DEDUP_RELEASE_PROFILE_NAME, MEM2REG_NAME, SROA_NAME, + create_arg_demotion_pass, create_ccp_pass, create_const_demotion_pass, create_const_folding_pass, create_cse_pass, create_dce_pass, create_dom_fronts_pass, create_dominators_pass, create_escaped_symbols_pass, create_mem2reg_pass, create_memcpyopt_pass, create_misc_demotion_pass, create_postorder_pass, create_ret_demotion_pass, create_simplify_cfg_pass, metadata_to_inline, optimize as opt, register_known_passes, Context, ExperimentalFlags, Function, IrError, PassGroup, PassManager, Value, DCE_NAME, FN_DCE_NAME, FN_DEDUP_DEBUG_PROFILE_NAME, FN_DEDUP_RELEASE_PROFILE_NAME, MEM2REG_NAME, SROA_NAME }; use sway_types::SourceEngine; @@ -237,6 +231,22 @@ fn constants() { // ------------------------------------------------------------------------------------------------- +#[allow(clippy::needless_collect)] +#[test] +fn ccp() { + run_tests("ccp", |_first_line, ir: &mut Context| { + let mut pass_mgr = PassManager::default(); + let mut pass_group = PassGroup::default(); + pass_mgr.register(create_postorder_pass()); + pass_mgr.register(create_dominators_pass()); + let pass = pass_mgr.register(create_ccp_pass()); + pass_group.append_pass(pass); + pass_mgr.run(ir, &pass_group).unwrap() + }) +} + +// ------------------------------------------------------------------------------------------------- + #[allow(clippy::needless_collect)] #[test] fn simplify_cfg() { diff --git a/sway-lib-std/src/auth.sw b/sway-lib-std/src/auth.sw index e26e2e4c97f..a775cc3ed88 100644 --- a/sway-lib-std/src/auth.sw +++ b/sway-lib-std/src/auth.sw @@ -6,14 +6,7 @@ use ::contract_id::ContractId; use ::identity::Identity; use ::option::Option::{self, *}; use ::result::Result::{self, *}; -use ::inputs::{ - Input, - input_coin_owner, - input_count, - input_message_recipient, - input_message_sender, - input_type, -}; +use ::inputs::{Input, input_coin_owner, input_count, input_message_recipient, input_type,}; use ::revert::revert; /// The error type used when an `Identity` cannot be determined. @@ -163,7 +156,7 @@ pub fn caller_address() -> Result { input_coin_owner(iter) }, Some(Input::Message) => { - input_message_sender(iter) + input_message_recipient(iter) }, _ => { // type != InputCoin or InputMessage, continue looping. diff --git a/sway-lib-std/src/bytes.sw b/sway-lib-std/src/bytes.sw index 1887b46e41c..b1fd11327ad 100644 --- a/sway-lib-std/src/bytes.sw +++ b/sway-lib-std/src/bytes.sw @@ -653,7 +653,12 @@ impl Bytes { (left_bytes, right_bytes) } - /// Moves all elements of `other` into `self`, leaving `other` empty. + /// Copies all elements of `other` into `self` + /// + /// # Additional Information + /// + /// NOTE: Appending `self` to itself will duplicate the `Bytes`. i.e. [0, 1, 2] => [0, 1, 2, 0, 1, 2] + /// This function differs from the rust `append` function in that it does not clear the `other` `Bytes` /// /// # Arguments /// @@ -696,7 +701,6 @@ impl Bytes { // optimization for when starting with empty bytes and appending to it if self.len == 0 { self = other; - other.clear(); return; }; @@ -717,9 +721,6 @@ impl Bytes { // set capacity and length self.len = both_len; - - // clear `other` - other.clear(); } } diff --git a/sway-lib-std/src/primitive_conversions/str.sw b/sway-lib-std/src/primitive_conversions/str.sw index 27f75b41d92..4ace1dd03a6 100644 --- a/sway-lib-std/src/primitive_conversions/str.sw +++ b/sway-lib-std/src/primitive_conversions/str.sw @@ -3,6 +3,20 @@ library; use ::option::Option::{self, *}; impl str { + /// Attempts to convert the string slice into a string array. + /// + /// # Returns + /// + /// * [Option] - `Some(str_array)` if the lengths of the `S` str_array type and the string slice's lengths match. Else `None`. + /// + /// # Examples + /// + /// ```sway + /// fn foo() { + /// let string_slice = "abcd"; + /// let string_array: str[4] = a.try_as_str_array().unwrap(); + /// } + /// ``` pub fn try_as_str_array(self) -> Option { __assert_is_str_array::(); let str_size = __size_of_str_array::(); diff --git a/sway-lib-std/src/primitive_conversions/u16.sw b/sway-lib-std/src/primitive_conversions/u16.sw index bced8a770a5..5a032306332 100644 --- a/sway-lib-std/src/primitive_conversions/u16.sw +++ b/sway-lib-std/src/primitive_conversions/u16.sw @@ -5,6 +5,28 @@ use ::option::Option::{self, *}; use ::u128::U128; impl u16 { + /// Attempts to convert the u16 value into a u8 value. + /// + /// # Additional Information + /// + /// The max value a u8 can represent is 255. + /// + /// # Returns + /// + /// [Option] - `Some(u8)` if the u16 is less than or equal to the max u8 value. Else `None`. + /// + /// # Examples + /// + /// ```sway + /// fn foo() { + /// let val = 255_u16.try_as_u8(); + /// assert(val == Some(255_u8)); + /// + /// // Conversion fails as value is above the max a u8 can represent. + /// let val2 = 256_u16.try_as_u8(); + /// assert(val == None); + /// } + /// ``` pub fn try_as_u8(self) -> Option { if self <= u8::max().as_u16() { Some(asm(input: self) { diff --git a/sway-lib-std/src/primitive_conversions/u32.sw b/sway-lib-std/src/primitive_conversions/u32.sw index ca5a0722680..8ffa2ca2605 100644 --- a/sway-lib-std/src/primitive_conversions/u32.sw +++ b/sway-lib-std/src/primitive_conversions/u32.sw @@ -5,6 +5,28 @@ use ::option::Option::{self, *}; use ::u128::U128; impl u32 { + /// Attempts to convert the u32 value into a u8 value. + /// + /// # Additional Information + /// + /// The max value a u8 can represent is 255. + /// + /// # Returns + /// + /// [Option] - `Some(u8)` if the u32 is less than or equal to the max u8 value. Else `None`. + /// + /// # Examples + /// + /// ```sway + /// fn foo() { + /// let val = 255_u32.try_as_u8(); + /// assert(val == Some(255_u8)); + /// + /// // Conversion fails as value is above the max a u8 can represent. + /// let val2 = 256_u32.try_as_u8(); + /// assert(val == None); + /// } + /// ``` pub fn try_as_u8(self) -> Option { if self <= u8::max().as_u32() { Some(asm(input: self) { @@ -15,6 +37,28 @@ impl u32 { } } + /// Attempts to convert the u32 value into a u16 value. + /// + /// # Additional Information + /// + /// The max value a u16 can represent is 65_535. + /// + /// # Returns + /// + /// [Option] - `Some(u16)` if the u32 is less than or equal to the max u16 value. Else `None`. + /// + /// # Examples + /// + /// ```sway + /// fn foo() { + /// let val = 65_535_u32.try_as_u16(); + /// assert(val == Some(65_535_u16)); + /// + /// // Conversion fails as value is above the max a u16 can represent. + /// let val2 = 65_536_u32.try_as_u16(); + /// assert(val == None); + /// } + /// ``` pub fn try_as_u16(self) -> Option { if self <= u16::max().as_u32() { Some(asm(input: self) { diff --git a/sway-lib-std/src/primitive_conversions/u64.sw b/sway-lib-std/src/primitive_conversions/u64.sw index b373bb85ae9..92267638a1d 100644 --- a/sway-lib-std/src/primitive_conversions/u64.sw +++ b/sway-lib-std/src/primitive_conversions/u64.sw @@ -5,6 +5,28 @@ use ::option::Option::{self, *}; use ::u128::U128; impl u64 { + /// Attempts to convert the u64 value into a u8 value. + /// + /// # Additional Information + /// + /// The max value a u8 can represent is 255. + /// + /// # Returns + /// + /// [Option] - `Some(u8)` if the u64 is less than or equal to the max u8 value. Else `None`. + /// + /// # Examples + /// + /// ```sway + /// fn foo() { + /// let val = 255_u64.try_as_u8(); + /// assert(val == Some(255_u8)); + /// + /// // Conversion fails as value is above the max a u8 can represent. + /// let val2 = 256_u64.try_as_u8(); + /// assert(val == None); + /// } + /// ``` pub fn try_as_u8(self) -> Option { if self <= u8::max().as_u64() { Some(asm(input: self) { @@ -15,6 +37,28 @@ impl u64 { } } + /// Attempts to convert the u64 value into a u16 value. + /// + /// # Additional Information + /// + /// The max value a u16 can represent is 65_535. + /// + /// # Returns + /// + /// [Option] - `Some(u16)` if the u64 is less than or equal to the max u16 value. Else `None`. + /// + /// # Examples + /// + /// ```sway + /// fn foo() { + /// let val = 65_535_u64.try_as_u16(); + /// assert(val == Some(65_535_u16)); + /// + /// // Conversion fails as value is above the max a u16 can represent. + /// let val2 = 65_536_u64.try_as_u16(); + /// assert(val == None); + /// } + /// ``` pub fn try_as_u16(self) -> Option { if self <= u16::max().as_u64() { Some(asm(input: self) { @@ -25,6 +69,28 @@ impl u64 { } } + /// Attempts to convert the u64 value into a u32 value. + /// + /// # Additional Information + /// + /// The max value a u32 can represent is 4_294_967_295. + /// + /// # Returns + /// + /// [Option] - `Some(u32)` if the u64 is less than or equal to the max u32 value. Else `None`. + /// + /// # Examples + /// + /// ```sway + /// fn foo() { + /// let val = 4_294_967_295_u64.try_as_u32(); + /// assert(val == Some(4_294_967_295_u32)); + /// + /// // Conversion fails as value is above the max a u32 can represent. + /// let val2 = 4_294_967_296_u64.try_as_u32(); + /// assert(val == None); + /// } + /// ``` pub fn try_as_u32(self) -> Option { if self <= u32::max().as_u64() { Some(asm(input: self) { diff --git a/sway-lsp/Cargo.toml b/sway-lsp/Cargo.toml index bdd2490d3f5..c0ce8559ad2 100644 --- a/sway-lsp/Cargo.toml +++ b/sway-lsp/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-lsp" -version = "0.63.3" +version = "0.63.5" description = "LSP server for Sway." authors.workspace = true edition.workspace = true @@ -13,9 +13,9 @@ anyhow = "1.0.41" crossbeam-channel = "0.5" dashmap = "5.4" fd-lock = "4.0" -forc-pkg = { version = "0.63.3", path = "../forc-pkg" } -forc-tracing = { version = "0.63.3", path = "../forc-tracing" } -forc-util = { version = "0.63.3", path = "../forc-util" } +forc-pkg = { version = "0.63.5", path = "../forc-pkg" } +forc-tracing = { version = "0.63.5", path = "../forc-tracing" } +forc-util = { version = "0.63.5", path = "../forc-util" } indexmap = { version = "2.0.0", features = ["rayon"] } lsp-types = { version = "0.94", features = ["proposed"] } notify = "5.0.0" @@ -27,13 +27,13 @@ rayon = "1.5.0" rayon-cond = "0.3" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0.60" -sway-ast = { version = "0.63.3", path = "../sway-ast" } -sway-core = { version = "0.63.3", path = "../sway-core" } -sway-error = { version = "0.63.3", path = "../sway-error" } -sway-parse = { version = "0.63.3", path = "../sway-parse" } -sway-types = { version = "0.63.3", path = "../sway-types" } -sway-utils = { version = "0.63.3", path = "../sway-utils" } -swayfmt = { version = "0.63.3", path = "../swayfmt" } +sway-ast = { version = "0.63.5", path = "../sway-ast" } +sway-core = { version = "0.63.5", path = "../sway-core" } +sway-error = { version = "0.63.5", path = "../sway-error" } +sway-parse = { version = "0.63.5", path = "../sway-parse" } +sway-types = { version = "0.63.5", path = "../sway-types" } +sway-utils = { version = "0.63.5", path = "../sway-utils" } +swayfmt = { version = "0.63.5", path = "../swayfmt" } syn = { version = "1.0.73", features = ["full"] } tempfile = "3" thiserror = "1.0.30" diff --git a/sway-parse/Cargo.toml b/sway-parse/Cargo.toml index 5234b668496..d2240288c45 100644 --- a/sway-parse/Cargo.toml +++ b/sway-parse/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-parse" -version = "0.63.3" +version = "0.63.5" description = "Sway's parser" authors.workspace = true edition.workspace = true @@ -13,9 +13,9 @@ extension-trait = "1.0.1" num-bigint = "0.4.3" num-traits = "0.2.14" phf = { version = "0.10.1", features = ["macros"] } -sway-ast = { version = "0.63.3", path = "../sway-ast" } -sway-error = { version = "0.63.3", path = "../sway-error" } -sway-types = { version = "0.63.3", path = "../sway-types" } +sway-ast = { version = "0.63.5", path = "../sway-ast" } +sway-error = { version = "0.63.5", path = "../sway-error" } +sway-types = { version = "0.63.5", path = "../sway-types" } thiserror = "1.0" unicode-bidi = "0.3.13" unicode-xid = "0.2.2" diff --git a/sway-types/Cargo.toml b/sway-types/Cargo.toml index add74a8701c..d6ce305466a 100644 --- a/sway-types/Cargo.toml +++ b/sway-types/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-types" -version = "0.63.3" +version = "0.63.5" description = "Sway core types." authors.workspace = true edition.workspace = true @@ -20,7 +20,7 @@ num-traits = "0.2.16" parking_lot = "0.12" rustc-hash = "1.1.0" serde = { version = "1.0", features = ["derive"] } -sway-utils = { version = "0.63.3", path = "../sway-utils" } +sway-utils = { version = "0.63.5", path = "../sway-utils" } thiserror = "1" [features] diff --git a/sway-utils/Cargo.toml b/sway-utils/Cargo.toml index f08f8f55430..0487b0d6b34 100644 --- a/sway-utils/Cargo.toml +++ b/sway-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sway-utils" -version = "0.63.3" +version = "0.63.5" description = "Sway common utils." authors.workspace = true edition.workspace = true diff --git a/swayfmt/Cargo.toml b/swayfmt/Cargo.toml index b54cc7a0c53..d60c0c49a52 100644 --- a/swayfmt/Cargo.toml +++ b/swayfmt/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "swayfmt" -version = "0.63.3" +version = "0.63.5" description = "Sway language formatter." authors.workspace = true edition.workspace = true @@ -10,17 +10,17 @@ repository.workspace = true [dependencies] anyhow = "1" -forc-tracing = { version = "0.63.3", path = "../forc-tracing" } +forc-tracing = { version = "0.63.5", path = "../forc-tracing" } indoc = "2.0" ropey = "1.5" serde = { version = "1.0", features = ["derive"] } serde_ignored = "0.1.9" -sway-ast = { version = "0.63.3", path = "../sway-ast" } -sway-core = { version = "0.63.3", path = "../sway-core" } -sway-error = { version = "0.63.3", path = "../sway-error" } -sway-parse = { version = "0.63.3", path = "../sway-parse" } -sway-types = { version = "0.63.3", path = "../sway-types" } -sway-utils = { version = "0.63.3", path = "../sway-utils" } +sway-ast = { version = "0.63.5", path = "../sway-ast" } +sway-core = { version = "0.63.5", path = "../sway-core" } +sway-error = { version = "0.63.5", path = "../sway-error" } +sway-parse = { version = "0.63.5", path = "../sway-parse" } +sway-types = { version = "0.63.5", path = "../sway-types" } +sway-utils = { version = "0.63.5", path = "../sway-utils" } thiserror = "1.0.30" toml = { version = "0.7", features = ["parse"] } diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/bad_generic_annotation/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/bad_generic_annotation/test.toml index 2023da0cc3a..e65971dfc6d 100644 --- a/test/src/e2e_vm_tests/test_programs/should_fail/bad_generic_annotation/test.toml +++ b/test/src/e2e_vm_tests/test_programs/should_fail/bad_generic_annotation/test.toml @@ -1,5 +1,11 @@ category = "fail" +# check: let _g: u32 = three_generics(true, "foo", 10); +# nextln: $()Mismatched types. +# nextln: $()expected: u32 +# nextln: $()found: str. +# nextln: $()help: Function return type does not match up with local type annotation. + # check: let _g: u32 = three_generics(true, "foo", 10); # nextln: $()Mismatched types. # nextln: $()expected: u32 diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/Forc.lock new file mode 100644 index 00000000000..3cb45ccbaed --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/Forc.lock @@ -0,0 +1,8 @@ +[[package]] +name = "core" +source = "path+from-root-7EB1B3610F4F66A3" + +[[package]] +name = "impl_self_duplicated" +source = "member" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/Forc.toml new file mode 100644 index 00000000000..7bd047f83cf --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/Forc.toml @@ -0,0 +1,9 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +implicit-std = false +license = "Apache-2.0" +name = "impl_self_duplicated" + +[dependencies] +core = { path = "../../../../../../sway-lib-core" } diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/src/main.sw new file mode 100644 index 00000000000..b51479e89e7 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/src/main.sw @@ -0,0 +1,42 @@ +script; +trait Cat { + fn speak(self) -> u64; +} +trait Dog { + fn speak(self) -> u64; +} +struct S { + x: T, +} +impl S +where + T: Cat, +{ + fn foo(self) -> u64 { + self.x.speak() + 1 + } +} +impl S +where + T: Dog, +{ + fn foo(self) -> u64 { + self.x.speak() + 2 + } +} +impl Dog for u64 { + fn speak(self) -> u64 { + 2 + } +} +impl Cat for u64 { + fn speak(self) -> u64 { + 1 + } +} +fn main() -> u64 { + let s = S:: { x: 1 }; + s.foo(); + + 42 +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/test.toml new file mode 100644 index 00000000000..716219cfde9 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_fail/impl_self_duplicated/test.toml @@ -0,0 +1,6 @@ +category = "fail" +validate_abi = false +expected_warnings = 3 + +# check: fn foo(self) -> u64 { +# nextln: $()Duplicate definitions for the method "foo" for type "S". diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/language/reexport/shadowing_in_reexporting_module/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/language/reexport/shadowing_in_reexporting_module/test.toml index 9ba4d7f4a66..700594e5116 100755 --- a/test/src/e2e_vm_tests/test_programs/should_fail/language/reexport/shadowing_in_reexporting_module/test.toml +++ b/test/src/e2e_vm_tests/test_programs/should_fail/language/reexport/shadowing_in_reexporting_module/test.toml @@ -188,4 +188,4 @@ category = "fail" #check: $()error #check: $()This path must return a value of type "u64" from function "items_2_trait_function", but it does not. -#check: $()Aborting due to 40 errors. +#check: $()Aborting due to 42 errors. diff --git a/test/src/e2e_vm_tests/test_programs/should_fail/recursive_type_unification/test.toml b/test/src/e2e_vm_tests/test_programs/should_fail/recursive_type_unification/test.toml index 48b8108e7a9..a660e53c0ad 100644 --- a/test/src/e2e_vm_tests/test_programs/should_fail/recursive_type_unification/test.toml +++ b/test/src/e2e_vm_tests/test_programs/should_fail/recursive_type_unification/test.toml @@ -1,5 +1,12 @@ category = "fail" +# check: $()error +# check: $()MyOption::Some::(foo::(value)) +# nextln: $()Mismatched types. +# nextln: $()expected: V +# nextln: $()found: MyOption. +# nextln: $()Function return type does not match up with local type annotation. + # check: $()error # check: $()MyOption::Some::(foo::(value)) # nextln: $()Mismatched types. diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts/json_abi_oracle_new_encoding.json index c7ff882e97c..0662cd80d0d 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/configurable_consts/json_abi_oracle_new_encoding.json @@ -62,82 +62,82 @@ { "concreteTypeId": "b760f44fa5965c2474a3b471467a22c43185152129295af588b022ae50b50903", "name": "BOOL", - "offset": 7432 + "offset": 7208 }, { "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", "name": "U8", - "offset": 7624 + "offset": 7400 }, { "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", "name": "ANOTHER_U8", - "offset": 7360 + "offset": 7136 }, { "concreteTypeId": "29881aad8730c5ab11d275376323d8e4ff4179aae8ccb6c13fe4902137e162ef", "name": "U16", - "offset": 7568 + "offset": 7344 }, { "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", "name": "U32", - "offset": 7608 + "offset": 7384 }, { "concreteTypeId": "d7649d428b9ff33d188ecbf38a7e4d8fd167fa01b2e10fe9a8f9308e52f1d7cc", "name": "U64", - "offset": 7616 + "offset": 7392 }, { "concreteTypeId": "1b5759d94094368cfd443019e7ca5ec4074300e544e5ea993a979f5da627261e", "name": "U256", - "offset": 7576 + "offset": 7352 }, { "concreteTypeId": "7c5ee1cecf5f8eacd1284feb5f0bf2bdea533a51e2f0c9aabe9236d335989f3b", "name": "B256", - "offset": 7400 + "offset": 7176 }, { "concreteTypeId": "81fc10c4681a3271cf2d66b2ec6fbc8ed007a442652930844fcf11818c295bff", "name": "CONFIGURABLE_STRUCT", - "offset": 7520 + "offset": 7296 }, { "concreteTypeId": "a2922861f03be8a650595dd76455b95383a61b46dd418f02607fa2e00dc39d5c", "name": "CONFIGURABLE_ENUM_A", - "offset": 7440 + "offset": 7216 }, { "concreteTypeId": "a2922861f03be8a650595dd76455b95383a61b46dd418f02607fa2e00dc39d5c", "name": "CONFIGURABLE_ENUM_B", - "offset": 7480 + "offset": 7256 }, { "concreteTypeId": "4926d35d1a5157936b0a29bc126b8aace6d911209a5c130e9b716b0c73643ea6", "name": "ARRAY_BOOL", - "offset": 7368 + "offset": 7144 }, { "concreteTypeId": "776fb5a3824169d6736138565fdc20aad684d9111266a5ff6d5c675280b7e199", "name": "ARRAY_U64", - "offset": 7376 + "offset": 7152 }, { "concreteTypeId": "c998ca9a5f221fe7b5c66ae70c8a9562b86d964408b00d17f883c906bc1fe4be", "name": "TUPLE_BOOL_U64", - "offset": 7552 + "offset": 7328 }, { "concreteTypeId": "94f0fa95c830be5e4f711963e83259fe7e8bc723278ab6ec34449e791a99b53a", "name": "STR_4", - "offset": 7544 + "offset": 7320 }, { "concreteTypeId": "c89951a24c6ca28c13fd1cfdc646b2b656d69e61a92b91023be7eb58eb914b6b", "name": "NOT_USED", - "offset": 7536 + "offset": 7312 } ], "encodingVersion": "1", diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/Forc.lock new file mode 100644 index 00000000000..1502892f25d --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = "contract_calls_unwrapped_contract_id" +source = "member" +dependencies = ["std"] + +[[package]] +name = "core" +source = "path+from-root-A615F9B9DE584E81" + +[[package]] +name = "std" +source = "path+from-root-A615F9B9DE584E81" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/Forc.toml new file mode 100644 index 00000000000..00360995cb3 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/Forc.toml @@ -0,0 +1,9 @@ +[project] +name = "contract_calls_unwrapped_contract_id" +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +implicit-std = false + +[dependencies] +std = { path = "../../../../../../../sway-lib-std" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/src/main.sw new file mode 100644 index 00000000000..1ca64650c93 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/src/main.sw @@ -0,0 +1,18 @@ +script; + +const ADDRESS: b256 = 0x000000000000000000000000000000000000000000000000000000000000002A; +const IDENTITY: Identity = Identity::ContractId(ContractId::from(ADDRESS)); + +abi MyAbi { + fn abi_method(); +} + +impl MyAbi for Contract { + fn abi_method() { } +} + +fn main() -> u64 { + let caller = abi(MyAbi, IDENTITY.as_contract_id().unwrap().into()); + caller.abi_method(); + 0 +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/test.toml new file mode 100644 index 00000000000..f52915a4c45 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_calls_unwrapped_contract_id/test.toml @@ -0,0 +1,5 @@ +category = "compile" + +validate_abi = false +validate_storage_slots = false +expected_warnings = 2 diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/Forc.lock new file mode 100644 index 00000000000..b5acd0aa565 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/Forc.lock @@ -0,0 +1,13 @@ +[[package]] +name = "contract_ret_intrinsic" +source = "member" +dependencies = ["std"] + +[[package]] +name = "core" +source = "path+from-root-793618C6A3B48D0B" + +[[package]] +name = "std" +source = "path+from-root-793618C6A3B48D0B" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/Forc.toml new file mode 100644 index 00000000000..45d67307b35 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/Forc.toml @@ -0,0 +1,9 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" +name = "contract_ret_intrinsic" +implicit-std = false + +[dependencies] +std = { path = "../../../../reduced_std_libs/sway-lib-std-assert" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/json_abi_oracle.json new file mode 100644 index 00000000000..ad50b55d54c --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/json_abi_oracle.json @@ -0,0 +1,25 @@ +{ + "configurables": [], + "functions": [ + { + "attributes": null, + "inputs": [], + "name": "main", + "output": { + "name": "", + "type": 0, + "typeArguments": null + } + } + ], + "loggedTypes": [], + "messagesTypes": [], + "types": [ + { + "components": null, + "type": "u64", + "typeId": 0, + "typeParameters": null + } + ] +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/json_abi_oracle_new_encoding.json new file mode 100644 index 00000000000..05b0f04b2d3 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/json_abi_oracle_new_encoding.json @@ -0,0 +1,23 @@ +{ + "concreteTypes": [ + { + "concreteTypeId": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0", + "type": "u64" + } + ], + "configurables": [], + "encodingVersion": "1", + "functions": [ + { + "attributes": null, + "inputs": [], + "name": "main", + "output": "1506e6f44c1d6291cdf46395a8e573276a4fa79e8ace3fc891e092ef32d1b0a0" + } + ], + "loggedTypes": [], + "messagesTypes": [], + "metadataTypes": [], + "programType": "script", + "specVersion": "1" +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/src/main.sw new file mode 100644 index 00000000000..6db6e3ed434 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/src/main.sw @@ -0,0 +1,34 @@ +contract; + +abi Abi { + fn return_via_contract_ret(x: u8) -> u64; +} + +impl Abi for Contract { + fn return_via_contract_ret(x: u8) -> u64 { + match x { + 1 => { + let ret: raw_slice = encode::(100); + __contract_ret(ret.ptr(), ret.len::()); + __revert(100); + }, + 2 => { + let ret: raw_slice = encode::(200); + __contract_ret(ret.ptr(), ret.len::()); + __revert(200); + }, + _ => __revert(0xaaa), + } + } +} + +#[test] +fn test() { + let caller = abi(Abi, CONTRACT_ID); + + let res = caller.return_via_contract_ret(1); + assert_eq(100, res); + + let res = caller.return_via_contract_ret(2); + assert_eq(200, res); +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/test.toml new file mode 100644 index 00000000000..f1958c1b086 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/contract_ret_intrinsic/test.toml @@ -0,0 +1 @@ +category = "unit_tests_pass" \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/Forc.lock new file mode 100644 index 00000000000..fe603fe62ef --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/Forc.lock @@ -0,0 +1,8 @@ +[[package]] +name = "core" +source = "path+from-root-D73E65B1F4E48513" + +[[package]] +name = "function_return_type_unification" +source = "member" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/Forc.toml new file mode 100644 index 00000000000..ebe0edcfda3 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/Forc.toml @@ -0,0 +1,8 @@ +[project] +name = "function_return_type_unification" +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" + +[dependencies] +core = { path = "../../../../../../../sway-lib-core" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/src/main.sw new file mode 100644 index 00000000000..761b788e150 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/src/main.sw @@ -0,0 +1,28 @@ +script; + +trait Build { + fn build() -> Self; +} + +impl Build for u32 { + fn build() -> Self { + 31 + } +} + +impl Build for u64 { + fn build() -> Self { + 63 + } +} + +fn produce() -> T +where T: Build, +{ + T::build() +} + +fn main() -> u32 { + let x: u32 = produce(); + x +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/test.toml new file mode 100644 index 00000000000..bdd8e5d330a --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/function_return_type_unification/test.toml @@ -0,0 +1,4 @@ +category = "run" +expected_result = { action = "return", value = 31 } +expected_result_new_encoding = { action = "return_data", value = "0000001f" } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle_new_encoding.json index 6d485af4964..64d80ab9878 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle_new_encoding.json +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/main_args/main_args_generics/json_abi_oracle_new_encoding.json @@ -52,7 +52,7 @@ } ], "metadataTypeId": 0, - "type": "(struct TwoGenerics, struct OneGeneric)" + "type": "(_, _)" }, { "metadataTypeId": 1, diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/Forc.lock new file mode 100644 index 00000000000..076f72c0d0a --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/Forc.lock @@ -0,0 +1,8 @@ +[[package]] +name = "core" +source = "path+from-root-7FA7C6C8132DFBE7" + +[[package]] +name = "match_expressions_unreachable_or" +source = "member" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/Forc.toml new file mode 100644 index 00000000000..5f7f5b9d3f4 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/Forc.toml @@ -0,0 +1,8 @@ +[project] +authors = ["Fuel Labs "] +license = "Apache-2.0" +name = "match_expressions_unreachable_or" +entry = "main.sw" + +[dependencies] +core = { path = "../../../../../../../sway-lib-core" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/src/main.sw new file mode 100644 index 00000000000..74fb30415ba --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/src/main.sw @@ -0,0 +1,42 @@ +// This test proves that https://github.com/FuelLabs/sway/issues/6388 is fixed. +script; + +struct S { + x: bool +} + +fn main() { + let v = 0u64; + // We want to have only one error in the case below, + // for the whole or-pattern elements and not for individual + // parts. + match v { + 1 => (), + 1 | 1 => (), + _ => (), + }; + + match v { + 1 => (), + 2 => (), + 1 | 2 => (), + _ => (), + }; + + // TODO: Once https://github.com/FuelLabs/sway/issues/5097 is fixed, the below examples + // will also emit warnings for unreacahbility of individual or-pattern elements. + // Extend filecheck checks to cover those warning. + + match v { + 1 => (), + 2 => (), + 1 | 3 => (), + 2 | 4 => (), + _ => (), + }; + + let s = S { x: false }; + let _x = match s { + S { x } | S { x } => { x }, + }; +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/test.toml new file mode 100644 index 00000000000..c80a619ffe5 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/match_expressions_unreachable_or/test.toml @@ -0,0 +1,16 @@ +category = "compile" +expected_warnings = 2 + +#check: $()warning +#sameln: $()Match arm is unreachable +#check: $()1 => (), +#nextln: $()Preceding match arms already match all the values that `1 | 1` can match. +#check: $()1 | 1 => (), +#nextln: $()Match arm `1 | 1` is unreachable. + +#check: $()warning +#sameln: $()Match arm is unreachable +#check: $()2 => (), +#nextln: $()Preceding match arms already match all the values that `1 | 2` can match. +#check: $()1 | 2 => (), +#nextln: $()Match arm `1 | 2` is unreachable. diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/slice/slice_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/slice/slice_contract/src/main.sw index fd5bdad8837..c86ce974d88 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/slice/slice_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/slice/slice_contract/src/main.sw @@ -12,8 +12,7 @@ impl MyContract for Contract { #[test] fn test_success() { - let contract_id = 0x4269c55d899c258109d170019aa45b1fd3acf6eb8c50e6139887a07ea6df1ae7; // AUTO-CONTRACT-ID . - let caller = abi(MyContract, contract_id); + let caller = abi(MyContract, CONTRACT_ID); let data = 1u64; let slice = raw_slice::from_parts::(__addr_of(&data), 1); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/string_slice/string_slice_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/string_slice/string_slice_contract/src/main.sw index bcce12c6b0f..70cb24b5ef9 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/language/string_slice/string_slice_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/string_slice/string_slice_contract/src/main.sw @@ -12,8 +12,7 @@ impl MyContract for Contract { #[test] fn test_success() { - let contract_id = 0x573a7901ce5a722d0b80a4ad49296f8e6a23e4f6282555a561ed5118e5890ec2; // AUTO-CONTRACT-ID . - let caller = abi(MyContract, contract_id); + let caller = abi(MyContract, CONTRACT_ID); let result = caller.test_function("a"); assert(result == "a") } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/Forc.lock new file mode 100644 index 00000000000..c6f5f7c1b5c --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/Forc.lock @@ -0,0 +1,8 @@ +[[package]] +name = "core" +source = "path+from-root-9D1294DAC07670CA" + +[[package]] +name = "type_inference_propagation_of_type_constraints" +source = "member" +dependencies = ["core"] diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/Forc.toml new file mode 100644 index 00000000000..c3320e028d2 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/Forc.toml @@ -0,0 +1,8 @@ +[project] +name = "type_inference_propagation_of_type_constraints" +authors = ["Fuel Labs "] +entry = "main.sw" +license = "Apache-2.0" + +[dependencies] +core = { path = "../../../../../../../sway-lib-core" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/src/main.sw new file mode 100644 index 00000000000..4d2413c6d49 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/src/main.sw @@ -0,0 +1,64 @@ +// This tests proves that https://github.com/FuelLabs/sway/issues/6379 is fixed. + +script; + +trait Build { + fn build() -> Self; +} + +fn produce() -> T where T: Build { + T::build() +} + +impl Build for u8 { + fn build() -> Self { + 7 + } +} + +impl Build for u32 { + fn build() -> Self { + 31 + } +} + +impl Build for u64 { + fn build() -> Self { + 63 + } +} + +fn consume_u8(a: u8) -> u8 { + a +} + +fn consume_u32(a: u32) -> u32 { + a +} + +fn consume_u64(a: u64) -> u64 { + a +} + +fn main() -> (u8, u32, u64) { + let a = produce_consume_u8(); + let b = produce_consume_u32(); + let c = produce_consume_u64(); + + (a, b, c) +} + +fn produce_consume_u8() -> u8 { + let x = produce(); + consume_u8(x) +} + +fn produce_consume_u32() -> u32 { + let x = produce(); + consume_u32(x) +} + +fn produce_consume_u64() -> u64 { + let x = produce(); + consume_u64(x) +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/test.toml new file mode 100644 index 00000000000..17578590d9b --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/language/type_inference_propagation_of_type_constraints/test.toml @@ -0,0 +1,4 @@ +category = "run" +expected_result = { action = "return_data", value = "0700000000000000 000000000000001f 000000000000003f" } +expected_result_new_encoding = { action = "return_data", value = "07 0000001f 000000000000003f" } +validate_abi = false diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/array_of_structs_caller/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/array_of_structs_caller/src/main.sw index d16ed81dab5..575ca323135 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/array_of_structs_caller/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/array_of_structs_caller/src/main.sw @@ -6,10 +6,15 @@ use std::hash::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0x14ed3cd06c2947248f69d54bfa681fe40d26267be84df7e19e253622b7921bbe; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x81b89cefe7c81dcf74a1723930b6ab76e484a59eda14c937eb3dcc3853ddebe1; // AUTO-CONTRACT-ID ../../test_contracts/array_of_structs_contract --release +const CONTRACT_ID = 0xbbda20fb25bdb4b18451501418b06324376c61cb984e75fcbc983fc0a047f85b; // AUTO-CONTRACT-ID ../../test_contracts/array_of_structs_contract --release + +fn get_address() -> Option { + Some(CONTRACT_ID.into()) +} fn main() -> u64 { - let addr = abi(TestContract, CONTRACT_ID); + // Test address being a complex expression + let addr = abi(TestContract, get_address().unwrap().into()); let input = [Wrapper { id: Id { diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/asset_ops_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/asset_ops_test/src/main.sw index 3ab89e5beea..932acc37dee 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/asset_ops_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/asset_ops_test/src/main.sw @@ -9,12 +9,12 @@ use test_fuel_coin_abi::*; #[cfg(experimental_new_encoding = false)] const FUEL_COIN_CONTRACT_ID = 0xec2277ebe007ade87e3d797c3b1e070dcd542d5ef8f038b471f262ef9cebc87c; #[cfg(experimental_new_encoding = true)] -const FUEL_COIN_CONTRACT_ID = 0xf5d8dc006c7686b126c6a8d4e8aa5ec53e73f23c367d2427f930cb3783c4dbb2; +const FUEL_COIN_CONTRACT_ID = 0xf8c7b4d09f9964ab4c437ac7f5cbd6dbad7e1f218fce452c5807aac3c67afa6f; #[cfg(experimental_new_encoding = false)] const BALANCE_CONTRACT_ID = 0xf6cd545152ac83225e8e7df2efb5c6fa6e37bc9b9e977b5ea8103d28668925df; #[cfg(experimental_new_encoding = true)] -const BALANCE_CONTRACT_ID = 0x0f5c045cc0b1dc371e0513fd0173a90aeb386629ae0511d90e400c57d65d6328; // AUTO-CONTRACT-ID ../../test_contracts/balance_test_contract --release +const BALANCE_CONTRACT_ID = 0xebe7a84ed5198e9d7d3e002a571058dc24d56f61f2526ca30328f519528f98eb; // AUTO-CONTRACT-ID ../../test_contracts/balance_test_contract --release fn main() -> bool { let default_gas = 1_000_000_000_000; diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/src/main.sw index 096e15715f4..3afdbe1afc2 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/bal_opcode/src/main.sw @@ -5,7 +5,7 @@ use balance_test_abi::BalanceTest; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0xf6cd545152ac83225e8e7df2efb5c6fa6e37bc9b9e977b5ea8103d28668925df; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x0f5c045cc0b1dc371e0513fd0173a90aeb386629ae0511d90e400c57d65d6328; // AUTO-CONTRACT-ID ../../test_contracts/balance_test_contract --release +const CONTRACT_ID = 0xebe7a84ed5198e9d7d3e002a571058dc24d56f61f2526ca30328f519528f98eb; // AUTO-CONTRACT-ID ../../test_contracts/balance_test_contract --release fn main() -> bool { let balance_test_contract = abi(BalanceTest, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_abi_with_tuples/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_abi_with_tuples/src/main.sw index 9b14628c890..49d7c83bf80 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_abi_with_tuples/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_abi_with_tuples/src/main.sw @@ -6,7 +6,7 @@ use abi_with_tuples::{MyContract, Location, Person}; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0xfdc14550c8aee742cd556d0ab7f378b7be0d3b1e6e086c097352e94590d4ed02; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x30903a83b7d3a0bd30255ebe37fb0dba7a577f7ae643b026853cdddc687bdced; // AUTO-CONTRACT-ID ../../test_contracts/abi_with_tuples_contract --release +const CONTRACT_ID = 0x95bff8249257356f042d500e9f7db1a964ab5739a1b156eafaca3c7a4efc8aaa; // AUTO-CONTRACT-ID ../../test_contracts/abi_with_tuples_contract --release fn main() -> bool { let the_abi = abi(MyContract, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw index 3a8defaa994..b1166cfb9fb 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_basic_storage/src/main.sw @@ -4,7 +4,7 @@ use basic_storage_abi::{BasicStorage, Quad}; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0x94db39f409a31b9f2ebcadeea44378e419208c20de90f5d8e1e33dc1523754cb; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0xfe5fa530ffc9ae7032a272fd6acf4553277c05c98f3794e1b146c0c73d72cf45; // AUTO-CONTRACT-ID ../../test_contracts/basic_storage --release +const CONTRACT_ID = 0xd8e3576d2f7b2ed2d5f8935aef4837e6ff32b1c092d8ae369ad0fdd955a52169; // AUTO-CONTRACT-ID ../../test_contracts/basic_storage --release fn main() -> u64 { let addr = abi(BasicStorage, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_contract_with_type_aliases/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_contract_with_type_aliases/src/main.sw index 83bcd021787..bc2f5881cd6 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_contract_with_type_aliases/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_contract_with_type_aliases/src/main.sw @@ -5,7 +5,7 @@ use contract_with_type_aliases_abi::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0x0cbeb6efe3104b460be769bdc4ea101ebf16ccc16f2d7b667ec3e1c7f5ce35b5; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x5a356b106a82c6633232b69bcb7f4fa5de310d78d182818bb00f34b88e0bf38a; // AUTO-CONTRACT-ID ../../test_contracts/contract_with_type_aliases --release +const CONTRACT_ID = 0x514dae6ddad19623646033458f970d1286ef111806145daf80d06ca679604a96; // AUTO-CONTRACT-ID ../../test_contracts/contract_with_type_aliases --release fn main() { let caller = abi(MyContract, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_increment_contract/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_increment_contract/src/main.sw index 2f752cb409f..f518c022f5b 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_increment_contract/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_increment_contract/src/main.sw @@ -6,7 +6,7 @@ use dynamic_contract_call::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0xd1b4047af7ef111c023ab71069e01dc2abfde487c0a0ce1268e4f447e6c6e4c2; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x23016d14b7f86f92b2aa143042c5008ee14f6be4f9092251d588911c1fc7712f; // AUTO-CONTRACT-ID ../../test_contracts/increment_contract --release +const CONTRACT_ID = 0xc906accda9e1e516ee3122770217d913edca1ae6e3b8bad15c2c1a53ebf5e13e; // AUTO-CONTRACT-ID ../../test_contracts/increment_contract --release fn main() -> bool { let the_abi = abi(Incrementor, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_storage_enum/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_storage_enum/src/main.sw index c921bb869fd..c3e736cb17f 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_storage_enum/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/call_storage_enum/src/main.sw @@ -5,7 +5,7 @@ use storage_enum_abi::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0xc601d11767195485a6654d566c67774134668863d8c797a8c69e8778fb1f89e9; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0xbc289e1984d110a8f0845ccf6dc9072cc961de7be230cc745b26263b9306c89a; // AUTO-CONTRACT-ID ../../test_contracts/storage_enum_contract --release +const CONTRACT_ID = 0xaa4e990e0796764624423b63c1bb14fdc02918294fab87682c1ee768de745a7e; // AUTO-CONTRACT-ID ../../test_contracts/storage_enum_contract --release fn main() -> u64 { let caller = abi(StorageEnum, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw index bcd2fe6e757..931e9f010df 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/caller_auth_test/src/main.sw @@ -5,7 +5,7 @@ use auth_testing_abi::AuthTesting; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0xc2eec20491b53aab7232cbd27c31d15417b4e9daf0b89c74cc242ef1295f681f; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0xd4529187df29ad2f22bdefec7b9d3bebb81ade2d67ddef8f263da80c4f2b6fe8; // AUTO-CONTRACT-ID ../../test_contracts/auth_testing_contract --release +const CONTRACT_ID = 0x57892f3d8bd8c58137b35d177a8c03121193d51138ad2218e814af505e90a7f2; // AUTO-CONTRACT-ID ../../test_contracts/auth_testing_contract --release // should be false in the case of a script fn main() -> bool { 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 69e3722d157..0f6ed8007b6 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 @@ -6,7 +6,7 @@ use context_testing_abi::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0x6054c11cda000f5990373a4d61929396165be4dfdd61d5b7bd26da60ab0d8577; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0xd0bb4e98494165bf0f359fe236cc312b4a4abf711f8bb55b616292c2286c0975; // AUTO-CONTRACT-ID ../../test_contracts/context_testing_contract --release +const CONTRACT_ID = 0x6c159e40368c6a37b8c479cd63f5462832d5dbdc8d872c4b30edc38e230b7e51; // AUTO-CONTRACT-ID ../../test_contracts/context_testing_contract --release fn main() -> bool { let gas: u64 = u64::max(); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/nested_struct_args_caller/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/nested_struct_args_caller/src/main.sw index 269804bff75..8410b0175e8 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/nested_struct_args_caller/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/nested_struct_args_caller/src/main.sw @@ -5,7 +5,7 @@ use nested_struct_args_abi::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0xe63d33a1b3a6903808b379f6a41a72fa8a370e8b76626775e7d9d2f9c4c5da40; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0x731fa1cef62c890acf064059c9a79c74c681dff72f7c2b443d71e2251a9e103c; // AUTO-CONTRACT-ID ../../test_contracts/nested_struct_args_contract --release +const CONTRACT_ID = 0xc26e4f54f9bca811be460d07aaedfa12d46477378573947ae95653affba962be; // AUTO-CONTRACT-ID ../../test_contracts/nested_struct_args_contract --release fn main() -> bool { let caller = abi(NestedStructArgs, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw index c6af170a0e5..13dd55fec91 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/require_contract_deployment/storage_access_caller/src/main.sw @@ -6,7 +6,7 @@ use std::hash::*; #[cfg(experimental_new_encoding = false)] const CONTRACT_ID = 0x3bc28acd66d327b8c1b9624c1fabfc07e9ffa1b5d71c2832c3bfaaf8f4b805e9; #[cfg(experimental_new_encoding = true)] -const CONTRACT_ID = 0xc7021105e8134e46faa3af92dd8c220618fbec7bac8de560853848ada5c9e36f; // AUTO-CONTRACT-ID ../../test_contracts/storage_access_contract --release +const CONTRACT_ID = 0x83ec366b3623ee28ec09d3d92dcc2e113cc7427adb194fb42608103b0188fb83; // AUTO-CONTRACT-ID ../../test_contracts/storage_access_contract --release fn main() -> bool { let caller = abi(StorageAccess, CONTRACT_ID); diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/Forc.lock b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/Forc.lock new file mode 100644 index 00000000000..e85a8258d1c --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/Forc.lock @@ -0,0 +1,8 @@ +[[package]] +name = "abi_with_alias" +source = "member" +dependencies = ["core"] + +[[package]] +name = "core" +source = "path+from-root-DE4DCECD674C309C" diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/Forc.toml b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/Forc.toml new file mode 100644 index 00000000000..402ce909bea --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/Forc.toml @@ -0,0 +1,9 @@ +[project] +authors = ["Fuel Labs "] +entry = "main.sw" +implicit-std = false +license = "Apache-2.0" +name = "abi_with_alias" + +[dependencies] +core = { path = "../../../../../../../sway-lib-core" } diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/json_abi_oracle.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/json_abi_oracle.json new file mode 100644 index 00000000000..acc54cf39b3 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/json_abi_oracle.json @@ -0,0 +1,63 @@ +{ + "concreteTypes": [ + { + "concreteTypeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "type": "()" + }, + { + "concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0", + "metadataTypeId": 0, + "type": "(u64, u64)" + } + ], + "configurables": [], + "encodingVersion": "1", + "functions": [ + { + "attributes": null, + "inputs": [ + { + "concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0", + "name": "arg1" + } + ], + "name": "aliased_tuple", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "attributes": null, + "inputs": [ + { + "concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0", + "name": "_arg1" + } + ], + "name": "tuple", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ], + "loggedTypes": [], + "messagesTypes": [], + "metadataTypes": [ + { + "components": [ + { + "name": "__tuple_element", + "typeId": 1 + }, + { + "name": "__tuple_element", + "typeId": 1 + } + ], + "metadataTypeId": 0, + "type": "(_, _)" + }, + { + "metadataTypeId": 1, + "type": "u64" + } + ], + "programType": "contract", + "specVersion": "1" +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/json_abi_oracle_new_encoding.json b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/json_abi_oracle_new_encoding.json new file mode 100644 index 00000000000..acc54cf39b3 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/json_abi_oracle_new_encoding.json @@ -0,0 +1,63 @@ +{ + "concreteTypes": [ + { + "concreteTypeId": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d", + "type": "()" + }, + { + "concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0", + "metadataTypeId": 0, + "type": "(u64, u64)" + } + ], + "configurables": [], + "encodingVersion": "1", + "functions": [ + { + "attributes": null, + "inputs": [ + { + "concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0", + "name": "arg1" + } + ], + "name": "aliased_tuple", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + }, + { + "attributes": null, + "inputs": [ + { + "concreteTypeId": "41bd1a98f0a59642d8f824c805b798a5f268d1f7d05808eb05c4189c493f1be0", + "name": "_arg1" + } + ], + "name": "tuple", + "output": "2e38e77b22c314a449e91fafed92a43826ac6aa403ae6a8acb6cf58239fbaf5d" + } + ], + "loggedTypes": [], + "messagesTypes": [], + "metadataTypes": [ + { + "components": [ + { + "name": "__tuple_element", + "typeId": 1 + }, + { + "name": "__tuple_element", + "typeId": 1 + } + ], + "metadataTypeId": 0, + "type": "(_, _)" + }, + { + "metadataTypeId": 1, + "type": "u64" + } + ], + "programType": "contract", + "specVersion": "1" +} \ No newline at end of file diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/src/main.sw new file mode 100644 index 00000000000..c75439d8e82 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/src/main.sw @@ -0,0 +1,15 @@ +contract; + +type AliasedTuple = (u64, u64); + +abi MyContract { + fn tuple(arg1: (u64, u64)); // Inline + fn aliased_tuple(arg1: AliasedTuple); // Alias +} + +impl MyContract for Contract { + fn tuple(_arg1: (u64, u64)) { + } + fn aliased_tuple(arg1: AliasedTuple) { + } +} diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/test.toml b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/test.toml new file mode 100644 index 00000000000..2bad8b530a0 --- /dev/null +++ b/test/src/e2e_vm_tests/test_programs/should_pass/test_contracts/abi_with_alias/test.toml @@ -0,0 +1,3 @@ +category = "compile" +validate_abi = true +expected_warnings = 1 diff --git a/test/src/e2e_vm_tests/test_programs/should_pass/unit_tests/workspace_test/contract_multi_test/src/main.sw b/test/src/e2e_vm_tests/test_programs/should_pass/unit_tests/workspace_test/contract_multi_test/src/main.sw index c0e3a1b9067..61e416f17bd 100644 --- a/test/src/e2e_vm_tests/test_programs/should_pass/unit_tests/workspace_test/contract_multi_test/src/main.sw +++ b/test/src/e2e_vm_tests/test_programs/should_pass/unit_tests/workspace_test/contract_multi_test/src/main.sw @@ -17,16 +17,14 @@ fn test_foo() { #[test(should_revert)] fn test_fail() { - let contract_id = 0xad0bba17e0838ef859abe2693d8a5e3bc4e7cfb901601e30f4dc34999fda6335; // AUTO-CONTRACT-ID . - let caller = abi(MyContract, contract_id); + let caller = abi(MyContract, CONTRACT_ID); let result = caller.test_function {}(); assert(result == false) } #[test] fn test_success() { - let contract_id = 0xad0bba17e0838ef859abe2693d8a5e3bc4e7cfb901601e30f4dc34999fda6335; // AUTO-CONTRACT-ID . - let caller = abi(MyContract, contract_id); + let caller = abi(MyContract, CONTRACT_ID); let result = caller.test_function {}(); assert(result == true) } diff --git a/test/src/in_language_tests/test_programs/bytes_inline_tests/src/main.sw b/test/src/in_language_tests/test_programs/bytes_inline_tests/src/main.sw index d5107addd94..9a0b0eae392 100644 --- a/test/src/in_language_tests/test_programs/bytes_inline_tests/src/main.sw +++ b/test/src/in_language_tests/test_programs/bytes_inline_tests/src/main.sw @@ -713,7 +713,14 @@ fn bytes_append() { bytes.append(bytes2); assert(bytes.len() == first_length + second_length); assert(bytes.capacity() == first_length + first_length); - assert(bytes2.is_empty()); + + assert(bytes2.len() == second_length); + assert(!bytes2.is_empty()); + + assert(bytes2.get(0).unwrap() == d); + assert(bytes2.get(1).unwrap() == e); + assert(bytes2.get(2).unwrap() == f); + let values = [a, b, c, d, e, f]; let mut i = 0; while i < 6 { @@ -757,7 +764,12 @@ fn bytes_append_to_empty() { empty_bytes.append(bytes); assert(empty_bytes.len() == bytes_length); assert(empty_bytes.capacity() == bytes_original_capacity); - assert(bytes.is_empty()); + + assert(bytes.len() == bytes_length); + assert(!bytes.is_empty()); + assert(bytes.get(0).unwrap() == a); + assert(bytes.get(1).unwrap() == b); + assert(bytes.get(2).unwrap() == c); let values = [a, b, c]; let mut i = 0; @@ -767,6 +779,32 @@ fn bytes_append_to_empty() { }; } +fn bytes_append_self() { + let (mut bytes, a, b, c) = setup(); + assert(bytes.len() == 3); + assert(bytes.get(0).unwrap() == a); + assert(bytes.get(1).unwrap() == b); + assert(bytes.get(2).unwrap() == c); + + bytes.append(bytes); + + assert(bytes.len() == 6); + assert(bytes.get(0).unwrap() == a); + assert(bytes.get(1).unwrap() == b); + assert(bytes.get(2).unwrap() == c); + assert(bytes.get(3).unwrap() == a); + assert(bytes.get(4).unwrap() == b); + assert(bytes.get(5).unwrap() == c); +} + +fn bytes_append_empty_self() { + let mut empty_bytes = Bytes::new(); + + empty_bytes.append(empty_bytes); + + assert(empty_bytes.len() == 0); +} + #[test()] fn bytes_eq() { let (mut bytes, _a, _b, _c) = setup(); diff --git a/test/src/sdk-harness/Cargo.lock b/test/src/sdk-harness/Cargo.lock index 62f3edbe507..bbf2ab01abb 100644 --- a/test/src/sdk-harness/Cargo.lock +++ b/test/src/sdk-harness/Cargo.lock @@ -159,6 +159,12 @@ version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" + [[package]] name = "arrayref" version = "0.3.7" @@ -474,7 +480,7 @@ dependencies = [ "cfg-if", "libc", "miniz_oxide", - "object", + "object 0.32.2", "rustc-demangle", "serde", ] @@ -626,6 +632,11 @@ name = "cc" version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" +dependencies = [ + "jobserver", + "libc", + "once_cell", +] [[package]] name = "cfg-if" @@ -905,6 +916,137 @@ dependencies = [ "libc", ] +[[package]] +name = "cranelift-bforest" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "305d51c180ebdc46ef61bc60c54ae6512db3bc9a05842a1f1e762e45977019ab" +dependencies = [ + "cranelift-entity", +] + +[[package]] +name = "cranelift-bitset" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3247afacd9b13d620033f3190d9e49d1beefc1acb33d5604a249956c9c13709" +dependencies = [ + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-codegen" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd7ca95e831c18d1356da783765c344207cbdffea91e13e47fa9327dbb2e0719" +dependencies = [ + "bumpalo", + "cranelift-bforest", + "cranelift-bitset", + "cranelift-codegen-meta", + "cranelift-codegen-shared", + "cranelift-control", + "cranelift-entity", + "cranelift-isle", + "gimli", + "hashbrown 0.14.5", + "log", + "regalloc2", + "rustc-hash", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-codegen-meta" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "450c105fa1e51bfba4e95a86e926504a867ad5639d63f31d43fe3b7ec1f1c9ef" +dependencies = [ + "cranelift-codegen-shared", +] + +[[package]] +name = "cranelift-codegen-shared" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5479117cd1266881479908d383086561cee37e49affbea9b1e6b594cc21cc220" + +[[package]] +name = "cranelift-control" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34378804f0abfdd22c068a741cfeed86938b92375b2a96fb0b42c878e0141bfb" +dependencies = [ + "arbitrary", +] + +[[package]] +name = "cranelift-entity" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a48cb0a194c9ba82fec35a1e492055388d89b2e3c03dee9dcf2488892be8004d" +dependencies = [ + "cranelift-bitset", + "serde", + "serde_derive", +] + +[[package]] +name = "cranelift-frontend" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8327afc6c1c05f4be62fefce5b439fa83521c65363a322e86ea32c85e7ceaf64" +dependencies = [ + "cranelift-codegen", + "log", + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cranelift-isle" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56b08621c00321efcfa3eee6a3179adc009e21ea8d24ca7adc3c326184bc3f48" + +[[package]] +name = "cranelift-native" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51180b147c8557c1196c77b098f04140c91962e135ea152cd2fcabf40cf365c" +dependencies = [ + "cranelift-codegen", + "libc", + "target-lexicon", +] + +[[package]] +name = "cranelift-wasm" +version = "0.110.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "019e3dccb7f15e0bc14f0ddc034ec608a66df8e05c9e1e16f75a7716f8461799" +dependencies = [ + "cranelift-codegen", + "cranelift-entity", + "cranelift-frontend", + "itertools 0.12.1", + "log", + "smallvec", + "wasmparser", + "wasmtime-types", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "critical-section" version = "1.1.2" @@ -1239,6 +1381,27 @@ dependencies = [ "subtle", ] +[[package]] +name = "directories-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc" +dependencies = [ + "cfg-if", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "displaydoc" version = "0.2.4" @@ -1460,6 +1623,12 @@ dependencies = [ "tokio", ] +[[package]] +name = "fallible-iterator" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" + [[package]] name = "fastrand" version = "2.1.0" @@ -1552,9 +1721,9 @@ dependencies = [ [[package]] name = "fuel-core" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce6cfa410a9a45a691e30b23098b550749a24bcbbde1f81057d85ab6b81cfb3" +checksum = "023265fe375de17c0ad26ae5d01feb4841653524deab82cbc70979ea5d346b94" dependencies = [ "anyhow", "async-graphql", @@ -1601,9 +1770,9 @@ dependencies = [ [[package]] name = "fuel-core-chain-config" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db93098b2f39a7eab8c408eb6beb5b4580883a988b76377414eefe4b405455de" +checksum = "318a5a9733255cffac64a4b5acf6a7f41e438bec3ead506fc9f74730ce956528" dependencies = [ "anyhow", "bech32", @@ -1621,9 +1790,9 @@ dependencies = [ [[package]] name = "fuel-core-client" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeec47aa62e9418a61a9936b6ec30474b918000879e5f556980e0648390b1c10" +checksum = "03ad219bde52b072a2d828f27072982047a77cc02c953ea7e83c23de586d466d" dependencies = [ "anyhow", "cynic", @@ -1645,9 +1814,9 @@ dependencies = [ [[package]] name = "fuel-core-consensus-module" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dea31560d3d499a11ec1022b4eb625a26d86547c95519d1be66c6e232424069" +checksum = "e43c7a168ee26efee5fa2fc54e4ba003b386f8f6d1f407db3e5c98bcdec6d0a2" dependencies = [ "anyhow", "fuel-core-chain-config", @@ -1658,9 +1827,9 @@ dependencies = [ [[package]] name = "fuel-core-database" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1380dc6f68a2e5658e730ef4815e21861305dfc319b5f9695f5661a5ee6fca" +checksum = "8e7c0e04807ec39d71910ee1cab9c1f9eb27ee9bf05a3d8788c3db6801c6ac27" dependencies = [ "anyhow", "derive_more", @@ -1670,9 +1839,9 @@ dependencies = [ [[package]] name = "fuel-core-executor" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bccb069b9f8a9c8df9826b0ded1104a87492939e59646c1981679db3c57ead" +checksum = "061f43f469181ac6991e83458147e3d07a503a23f48e1cedc10ea83e8700d6d8" dependencies = [ "anyhow", "fuel-core-storage", @@ -1685,9 +1854,9 @@ dependencies = [ [[package]] name = "fuel-core-gas-price-service" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43359fb62763f2c7f6449c9a9d48f872b87b0a4f1bb674cf6ed7313b988500a1" +checksum = "50015fb2a24f21c441a59e4e81e2a5eee3626285784119cf9346be6e37bfe199" dependencies = [ "anyhow", "async-trait", @@ -1709,9 +1878,9 @@ dependencies = [ [[package]] name = "fuel-core-importer" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a47d3ae71a4995899f5427e0179811bae2809ecb0a8c43ee1fad2c667fc27a" +checksum = "69fd6d1c72316511bd7c00084f2d8684a736dd57f97f912564d9af8ea13929c9" dependencies = [ "anyhow", "derive_more", @@ -1726,9 +1895,9 @@ dependencies = [ [[package]] name = "fuel-core-metrics" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f69ff33d722268ab0533a75b260195169a3761e2ca1d13cdd8469a59c2826927" +checksum = "88eb1bd81016b49493181b8bc29526678229350a780d4d04db137415028db179" dependencies = [ "parking_lot", "pin-project-lite", @@ -1739,9 +1908,9 @@ dependencies = [ [[package]] name = "fuel-core-p2p" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c71c01bc15433956791000b9256db6b8065eabe401e91be99d6157326dbe358" +checksum = "fd4d69e535e914be87cb92843d4ac6b7b8b60110364f88efe8e509052368aaa3" dependencies = [ "anyhow", "async-trait", @@ -1772,9 +1941,9 @@ dependencies = [ [[package]] name = "fuel-core-poa" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3444c6b2ed6a7878e1a3b317f9922be41064cfafaf863bc7ab25823bcfbd749" +checksum = "5ef478ff684ee6c2eac57070322ba05525842670576328414da7fd6c40af4e25" dependencies = [ "anyhow", "async-trait", @@ -1782,6 +1951,8 @@ dependencies = [ "fuel-core-services", "fuel-core-storage", "fuel-core-types", + "serde", + "serde_json", "tokio", "tokio-stream", "tracing", @@ -1789,9 +1960,9 @@ dependencies = [ [[package]] name = "fuel-core-producer" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b73e24d506698afd4cae5421d3df3083ce26eb2efee672eaf54fa12b01aef924" +checksum = "43d09fa42cdfe3c72fe325043e6b7860586d7f34c60baaef9f4a18a13bdcc6f4" dependencies = [ "anyhow", "async-trait", @@ -1805,9 +1976,9 @@ dependencies = [ [[package]] name = "fuel-core-services" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e85c2a19cd58cf541409c94ef77ef9b2e742f196b9a0209fb6b9310184cec92f" +checksum = "064b31213ea0b56f6558a0493b264cbd79e060a56de2bd35f8a10d7e78f526fa" dependencies = [ "anyhow", "async-trait", @@ -1820,9 +1991,9 @@ dependencies = [ [[package]] name = "fuel-core-storage" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54f244ffed0818fc7f63ff46ea4087ea2c509876b32e733f22e9b7836aebece4" +checksum = "f06320744b7d53bc7928d1a40a28fd697191a5b6938a353164231a3423ebdcd9" dependencies = [ "anyhow", "derive_more", @@ -1844,12 +2015,13 @@ dependencies = [ [[package]] name = "fuel-core-txpool" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db5b1fdb43167b38acdf6732c45e1d406b5b36ee6d58fb7721aa1efa781123bb" +checksum = "9deaa3a9b5a2d49bf12fba5af16cc29142d58318eeb5ec8e67258d2dc1ec66ff" dependencies = [ "anyhow", "async-trait", + "derive_more", "fuel-core-metrics", "fuel-core-services", "fuel-core-storage", @@ -1865,9 +2037,9 @@ dependencies = [ [[package]] name = "fuel-core-types" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "044371366fb644733dd0452ced749b0d926d81c1959fad5f19f81a28f13125ee" +checksum = "84fda0c6dc7b3bd24a993b3902f55862b8db0fa6de5b0f1d45f5942bc59792eb" dependencies = [ "anyhow", "bs58", @@ -1878,19 +2050,39 @@ dependencies = [ "secrecy", "serde", "tai64", - "thiserror", "zeroize", ] [[package]] name = "fuel-core-upgradable-executor" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72101a6ce5cafbdfaf7cd9d142c9e7626b5f7e87bfe6cde177c5f0d3acd07c7e" +checksum = "5c104eb427f63ab720ffa2cd08e35df3064753648ff5dace9853a68f7ae98e1b" dependencies = [ + "anyhow", + "derive_more", "fuel-core-executor", "fuel-core-storage", "fuel-core-types", + "fuel-core-wasm-executor", + "parking_lot", + "postcard", + "tracing", + "wasmtime", +] + +[[package]] +name = "fuel-core-wasm-executor" +version = "0.35.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2277ef1637329cb879d9cf370dae9fa3b23f28031eb59800f39e552b81aefe" +dependencies = [ + "anyhow", + "fuel-core-executor", + "fuel-core-storage", + "fuel-core-types", + "postcard", + "serde", ] [[package]] @@ -1928,9 +2120,9 @@ dependencies = [ [[package]] name = "fuel-gas-price-algorithm" -version = "0.32.1" +version = "0.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "675c0ced6dbab8d2184c4caa966169594ba1e80e3abdeaecc5c73dcf86b4f03a" +checksum = "9cca4572eaa61de46ba3e78c90b27bc16d13af2da165273bee66e3ac034513e2" dependencies = [ "proptest", "serde", @@ -2029,11 +2221,10 @@ dependencies = [ [[package]] name = "fuels" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d7156cd37d2c91c4ef35723b343335a49d23f0b34ebbba42d2e934557683b0d" +checksum = "9699101cadc9ad3f1eff2a71532d755ab5526419414b99702e89c1d8b92b5938" dependencies = [ - "fuel-core", "fuel-core-client", "fuel-crypto", "fuel-tx", @@ -2046,9 +2237,9 @@ dependencies = [ [[package]] name = "fuels-accounts" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ba20df8b54e1d59e21775f2431dd2b5511de28cb3f44cd76379c96e31aa1ba" +checksum = "a3e97cf3bb16c8b6436dd6e3a6f9cea5c1ffda8daf7cdb335c60b74c31572f57" dependencies = [ "async-trait", "chrono", @@ -2071,9 +2262,9 @@ dependencies = [ [[package]] name = "fuels-code-gen" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3090567fcc71dbe48ddff811d80d08979adfc2140fc57f1f29cce930901348f4" +checksum = "47552a5e8b6935595131ef38b14ef4eee8db870174ea62c8db804dbfa02f57d6" dependencies = [ "Inflector", "fuel-abi-types", @@ -2087,9 +2278,9 @@ dependencies = [ [[package]] name = "fuels-core" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "362f321ab6353ebc7a1a5a22c7ef655607a72468ce5560e18b2ce3e79a9b4916" +checksum = "b687c021466238851b07e2d39f974a614ffafc7e57dc9be00840d74c74c5febd" dependencies = [ "async-trait", "bech32", @@ -2115,9 +2306,9 @@ dependencies = [ [[package]] name = "fuels-macros" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adb2fa8939edd45140a93bdd0fcd1f499e573e4ff338edea8f54b841e57d56c" +checksum = "b9dd9359ca6c0e7ad300d487e59babe03f64c6b7b169a0743d13f5c58837b589" dependencies = [ "fuels-code-gen", "itertools 0.12.1", @@ -2128,9 +2319,9 @@ dependencies = [ [[package]] name = "fuels-programs" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac75384ead8a992a0a27785b5461fcbc22fa6e258ccb81490bb4ce1fd4b2ed91" +checksum = "3288fc4b64e8f93a39b8ffa36fcaef8753232ffda5399662d28e24c172a7d00c" dependencies = [ "async-trait", "fuel-abi-types", @@ -2147,15 +2338,16 @@ dependencies = [ [[package]] name = "fuels-test-helpers" -version = "0.66.1" +version = "0.66.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b9a5ddd7590598015c2193e53c0004c4ec5c829bbfcf0f63652658e60e7af9d" +checksum = "11e18f84f11543ab29e787e2170eeed7f390b791f16ef8be363e3700ea21833d" dependencies = [ "fuel-core", "fuel-core-chain-config", "fuel-core-client", "fuel-core-poa", "fuel-core-services", + "fuel-core-types", "fuel-crypto", "fuel-tx", "fuel-types", @@ -2349,6 +2541,11 @@ name = "gimli" version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +dependencies = [ + "fallible-iterator", + "indexmap 2.2.6", + "stable_deref_trait", +] [[package]] name = "graphql-parser" @@ -2704,6 +2901,12 @@ dependencies = [ "cc", ] +[[package]] +name = "id-arena" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25a2bc672d1148e28034f176e01fffebb08b35768468cc954630da77a1449005" + [[package]] name = "ident_case" version = "1.0.1" @@ -2919,6 +3122,15 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" +[[package]] +name = "jobserver" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.69" @@ -2957,6 +3169,12 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +[[package]] +name = "leb128" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" + [[package]] name = "libc" version = "0.2.154" @@ -3427,6 +3645,16 @@ dependencies = [ "yamux 0.13.2", ] +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.5.0", + "libc", +] + [[package]] name = "libsecp256k1" version = "0.7.1" @@ -3521,6 +3749,15 @@ dependencies = [ "linked-hash-map", ] +[[package]] +name = "mach2" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b955cdeb2a02b9117f121ce63aa52d08ade45de53e48fe6a38b39c10f6f709" +dependencies = [ + "libc", +] + [[package]] name = "match_cfg" version = "0.1.0" @@ -3539,6 +3776,15 @@ version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +[[package]] +name = "memfd" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2cffa4ad52c6f791f4f8b15f0c05f9824b2ced1160e88cc393d64fff9a8ac64" +dependencies = [ + "rustix", +] + [[package]] name = "mime" version = "0.3.17" @@ -3860,6 +4106,18 @@ dependencies = [ "memchr", ] +[[package]] +name = "object" +version = "0.36.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +dependencies = [ + "crc32fast", + "hashbrown 0.14.5", + "indexmap 2.2.6", + "memchr", +] + [[package]] name = "oid-registry" version = "0.6.1" @@ -4022,6 +4280,12 @@ dependencies = [ "spki", ] +[[package]] +name = "pkg-config" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" + [[package]] name = "platforms" version = "3.4.0" @@ -4170,7 +4434,7 @@ version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit", + "toml_edit 0.21.1", ] [[package]] @@ -4254,6 +4518,15 @@ version = "2.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33cb294fe86a74cbcf50d4445b37da762029549ebeea341421c7c70370f86cac" +[[package]] +name = "psm" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa37f80ca58604976033fae9515a8a2989fc13797d953f7c04fb8fa36a11f205" +dependencies = [ + "cc", +] + [[package]] name = "publicsuffix" version = "2.2.3" @@ -4435,6 +4708,30 @@ dependencies = [ "bitflags 2.5.0", ] +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regalloc2" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad156d539c879b7a24a363a2016d77961786e71f48f2e2fc8302a92abd2429a6" +dependencies = [ + "hashbrown 0.13.2", + "log", + "rustc-hash", + "slice-group-by", + "smallvec", +] + [[package]] name = "regex" version = "1.10.4" @@ -4876,6 +5173,15 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_spanned" +version = "0.6.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +dependencies = [ + "serde", +] + [[package]] name = "serde_urlencoded" version = "0.7.1" @@ -4993,11 +5299,20 @@ dependencies = [ "autocfg", ] +[[package]] +name = "slice-group-by" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "826167069c09b99d56f31e9ae5c99049e932a98c9dc2dac47645b08dbbf76ba7" + [[package]] name = "smallvec" version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +dependencies = [ + "serde", +] [[package]] name = "snow" @@ -5066,6 +5381,12 @@ dependencies = [ "der", ] +[[package]] +name = "sptr" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b9b39299b249ad65f3b7e96443bad61c02ca5cd3589f46cb6d610a0fd6c0d6a" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -5255,6 +5576,12 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + [[package]] name = "tempfile" version = "3.10.1" @@ -5267,6 +5594,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "termtree" version = "0.4.1" @@ -5443,11 +5779,26 @@ dependencies = [ "tokio", ] +[[package]] +name = "toml" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.22.12", +] + [[package]] name = "toml_datetime" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +dependencies = [ + "serde", +] [[package]] name = "toml_edit" @@ -5457,7 +5808,20 @@ checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ "indexmap 2.2.6", "toml_datetime", - "winnow", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.22.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3328d4f68a705b2a4498da1d580585d39a6510f98318a2cec3018a7ec61ddef" +dependencies = [ + "indexmap 2.2.6", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.6.18", ] [[package]] @@ -5807,6 +6171,234 @@ version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +[[package]] +name = "wasm-encoder" +version = "0.212.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501940df4418b8929eb6d52f1aade1fdd15a5b86c92453cb696e3c906bd3fc33" +dependencies = [ + "leb128", +] + +[[package]] +name = "wasmparser" +version = "0.212.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d28bc49ba1e5c5b61ffa7a2eace10820443c4b7d1c0b144109261d14570fdf8" +dependencies = [ + "ahash", + "bitflags 2.5.0", + "hashbrown 0.14.5", + "indexmap 2.2.6", + "semver", + "serde", +] + +[[package]] +name = "wasmprinter" +version = "0.212.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfac65326cc561112af88c3028f6dfdb140acff67ede33a8e86be2dc6b8956f7" +dependencies = [ + "anyhow", + "termcolor", + "wasmparser", +] + +[[package]] +name = "wasmtime" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07232e0b473af36112da7348f51e73fa8b11047a6cb546096da3812930b7c93a" +dependencies = [ + "anyhow", + "bitflags 2.5.0", + "bumpalo", + "cc", + "cfg-if", + "hashbrown 0.14.5", + "indexmap 2.2.6", + "libc", + "libm", + "log", + "mach2", + "memfd", + "object 0.36.4", + "once_cell", + "paste", + "postcard", + "psm", + "rayon", + "rustix", + "serde", + "serde_derive", + "smallvec", + "sptr", + "target-lexicon", + "wasmparser", + "wasmtime-asm-macros", + "wasmtime-cache", + "wasmtime-component-macro", + "wasmtime-cranelift", + "wasmtime-environ", + "wasmtime-jit-icache-coherence", + "wasmtime-slab", + "wasmtime-versioned-export-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-asm-macros" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a9c42562d879c749288d9a26acc0d95d2ca069e30c2ec2efce84461c4d62b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "wasmtime-cache" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38d5d5aac98c8ae87cf5244495da7722e3fa022aa6f3f4fcd5e3d6e5699ce422" +dependencies = [ + "anyhow", + "base64 0.21.7", + "directories-next", + "log", + "postcard", + "rustix", + "serde", + "serde_derive", + "sha2 0.10.8", + "toml", + "windows-sys 0.52.0", + "zstd", +] + +[[package]] +name = "wasmtime-component-macro" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0c3f57c4bc96f9b4a6ff4d6cb6e837913eff32e98d09e2b6d79b5c4647b415b" +dependencies = [ + "anyhow", + "proc-macro2", + "quote", + "syn 2.0.63", + "wasmtime-component-util", + "wasmtime-wit-bindgen", + "wit-parser", +] + +[[package]] +name = "wasmtime-component-util" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1da707969bc31a565da9b32d087eb2370c95c6f2087c5539a15f2e3b27e77203" + +[[package]] +name = "wasmtime-cranelift" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62cb6135ec46994299be711b78b03acaa9480de3715f827d450f0c947a84977c" +dependencies = [ + "anyhow", + "cfg-if", + "cranelift-codegen", + "cranelift-control", + "cranelift-entity", + "cranelift-frontend", + "cranelift-native", + "cranelift-wasm", + "gimli", + "log", + "object 0.36.4", + "target-lexicon", + "thiserror", + "wasmparser", + "wasmtime-environ", + "wasmtime-versioned-export-macros", +] + +[[package]] +name = "wasmtime-environ" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bcaa3b42a0718e9123da7fb75e8e13fc95df7db2a7e32e2f2f4f0d3333b7d6f" +dependencies = [ + "anyhow", + "cranelift-bitset", + "cranelift-entity", + "gimli", + "indexmap 2.2.6", + "log", + "object 0.36.4", + "postcard", + "serde", + "serde_derive", + "target-lexicon", + "wasm-encoder", + "wasmparser", + "wasmprinter", + "wasmtime-types", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cfee42dac5148fc2664ab1f5cb8d7fa77a28d1a2cf1d9483abc2c3d751a58b9" +dependencies = [ + "anyhow", + "cfg-if", + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "wasmtime-slab" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42eb8f6515708ec67974998c3e644101db4186308985f5ef7c2ef324ff33c948" + +[[package]] +name = "wasmtime-types" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "046873fb8fb3e9652f3fd76fe99c8c8129007695c3d73b2e307fdae40f6e324c" +dependencies = [ + "anyhow", + "cranelift-entity", + "serde", + "serde_derive", + "smallvec", + "wasmparser", +] + +[[package]] +name = "wasmtime-versioned-export-macros" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99c02af2e9dbeb427304d1a08787d70ed0dbfec1af2236616f84c9f1f03e7969" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.63", +] + +[[package]] +name = "wasmtime-wit-bindgen" +version = "23.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f528f8b8a2376a3dacaf497d960216dd466d324425361e1e00e26de0a7705c" +dependencies = [ + "anyhow", + "heck 0.4.1", + "indexmap 2.2.6", + "wit-parser", +] + [[package]] name = "web-sys" version = "0.3.69" @@ -5857,6 +6449,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +[[package]] +name = "winapi-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -6039,6 +6640,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.50.0" @@ -6055,6 +6665,24 @@ version = "0.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" +[[package]] +name = "wit-parser" +version = "0.212.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ceeb0424aa8679f3fcf2d6e3cfa381f3d6fa6179976a2c05a6249dd2bb426716" +dependencies = [ + "anyhow", + "id-arena", + "indexmap 2.2.6", + "log", + "semver", + "serde", + "serde_derive", + "serde_json", + "unicode-xid", + "wasmparser", +] + [[package]] name = "wyz" version = "0.5.1" @@ -6193,3 +6821,31 @@ dependencies = [ "quote", "syn 2.0.63", ] + +[[package]] +name = "zstd" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "7.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" +dependencies = [ + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "2.0.13+zstd.1.5.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" +dependencies = [ + "cc", + "pkg-config", +] diff --git a/test/src/sdk-harness/Cargo.toml b/test/src/sdk-harness/Cargo.toml index ba8c43e9dc7..d6e74f9ad9f 100644 --- a/test/src/sdk-harness/Cargo.toml +++ b/test/src/sdk-harness/Cargo.toml @@ -10,14 +10,14 @@ publish = false assert_matches = "1.5.0" # Dependencies from the `fuel-core` repository: -fuel-core = { version = "0.32.1", default-features = false } -fuel-core-client = { version = "0.32.1", default-features = false } +fuel-core = { version = "0.35.0", default-features = false } +fuel-core-client = { version = "0.35.0", default-features = false } # Dependencies from the `fuel-vm` repository: fuel-vm = { version = "0.56.0", features = ["random"] } # Dependencies from the `fuels-rs` repository: -fuels = { version = "0.66.1", features = ["fuel-core-lib"] } +fuels = { version = "0.66.4", features = ["fuel-core-lib"] } hex = "0.4.3" paste = "1.0.14" diff --git a/test/src/sdk-harness/test_projects/auth/mod.rs b/test/src/sdk-harness/test_projects/auth/mod.rs index 5072b1c1a86..df2eb3954d2 100644 --- a/test/src/sdk-harness/test_projects/auth/mod.rs +++ b/test/src/sdk-harness/test_projects/auth/mod.rs @@ -108,7 +108,7 @@ async fn input_message_msg_sender_from_contract() { // Start building transactions let call_handler = instance .methods() - .returns_msg_sender_address(Address::from(*msg.sender.hash())); + .returns_msg_sender_address(Address::from(*msg.recipient.hash())); let mut tb = call_handler.transaction_builder().await.unwrap(); // Inputs