From 6780bc0983e732daf57b12a0fffa23d94037d489 Mon Sep 17 00:00:00 2001 From: hunjixin <1084400399@qq.com> Date: Thu, 28 Jul 2022 11:21:34 +0800 Subject: [PATCH] feat: add new command for apply patch --- .github/workflows/go.yml | 11 +- .gitignore | 1 + Cargo.lock | 948 +++++++++++++++++++++++------- specs/quickstart.md | 53 +- tools/ci/src/main.rs | 2 +- tools/sdk_tool/Cargo.toml | 6 +- tools/sdk_tool/src/main.rs | 13 + tools/sdk_tool/src/patch.rs | 103 ++++ tools/sdk_tool/src/utils.rs | 72 ++- tools/sdk_tool/src/wasmprocess.rs | 10 +- 10 files changed, 989 insertions(+), 230 deletions(-) create mode 100644 tools/sdk_tool/src/patch.rs diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 61edaa0..b03a05b 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -51,16 +51,19 @@ jobs: - name: install tinygo run: | - wget -q https://github.com/ipfs-force-community/tinygo/releases/download/fvm%400.0.1/tinygo_ubuntu_20.04_linux.tar.gz - sudo tar -xf tinygo_ubuntu_20.04_linux.tar.gz -C /usr/local - sudo chmod 777 /usr/local/tinygo/bin/* - rm tinygo_ubuntu_20.04_linux.tar.gz + wget https://github.com/tinygo-org/tinygo/releases/download/v0.25.0/tinygo_0.25.0_amd64.deb + sudo dpkg -i tinygo_0.25.0_amd64.deb + rm tinygo_0.25.0_amd64.deb - name: Build run: | make build make install + - name: patch + run: | + sudo go-fvm-sdk-tools patch + - name: Lint run: | curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.46.2 diff --git a/.gitignore b/.gitignore index 710f866..0692c29 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ target .vscode ./tesx *.log +*.patch /bin diff --git a/Cargo.lock b/Cargo.lock index bc33e44..beeadfc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -11,6 +11,12 @@ dependencies = [ "gimli", ] +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "aes" version = "0.6.0" @@ -82,9 +88,12 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb07d2053ccdbe10e2af2995a2f116c1330396493dc1269f6a91d0ae82e19704" +checksum = "c91f1f46651137be86f3a2b9a8359f9ab421d04d941c62b5982e1ca21113adf9" +dependencies = [ + "backtrace", +] [[package]] name = "anymap" @@ -207,15 +216,15 @@ dependencies = [ [[package]] name = "async-task" -version = "4.2.0" +version = "4.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30696a84d817107fc028e049980e09d5e140e8da8f1caeb17e8e950658a3cea9" +checksum = "7a40729d2133846d9ed0ea60a8b9541bccddab49cd30f0715a1da672fe9a2524" [[package]] name = "async-trait" -version = "0.1.56" +version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96cf8829f67d2eab0b2dfa42c5d0ef737e0724e4a82b01b3e292456202b19716" +checksum = "76464446b8bc32758d7e88ee1a804d9914cd9b1cb264c029899680b0be29826f" dependencies = [ "proc-macro2", "quote", @@ -245,11 +254,26 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object 0.29.0", + "rustc-demangle", +] + [[package]] name = "base-x" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc19a4937b4fbd3fe3379793130e42060d10627a360f2127802b10b87e7baf74" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" [[package]] name = "base64" @@ -509,6 +533,12 @@ version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +[[package]] +name = "bytes" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0b3de4a0c5e67e16066a0715723abd91edc2f9001d09c46e1dca929351e130e" + [[package]] name = "cache-padded" version = "1.2.0" @@ -569,9 +599,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.5" +version = "3.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53da17d37dba964b9b3ecb5c5a1f193a2762c700e6829201e645b9381c99dc7" +checksum = "a3dbbb6653e7c55cc8595ad3e1f7be8f32aba4eb7ff7f0fd1163d4f3d137c0a9" dependencies = [ "atty", "bitflags", @@ -586,9 +616,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.2.5" +version = "3.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c11d40217d16aee8508cc8e5fde8b4ff24639758608e5374e731b53f85749fb9" +checksum = "9ba52acd3b0a5c33aeada5cdaa3267cdc7c594a98731d4268cdc1532f4264cb4" dependencies = [ "heck", "proc-macro-error", @@ -599,9 +629,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.2" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5538cd660450ebeb4234cfecf8f2284b844ffc4c50531e66d584ad5b91293613" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" dependencies = [ "os_str_bytes", ] @@ -628,9 +658,9 @@ dependencies = [ [[package]] name = "concurrent-queue" -version = "1.2.2" +version = "1.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed07550be01594c6026cff2a1d7fe9c8f683caa798e12b68694ac9e88286a3" +checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" dependencies = [ "cache-padded", ] @@ -659,6 +689,22 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "core-foundation" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + [[package]] name = "core2" version = "0.4.0" @@ -792,9 +838,9 @@ dependencies = [ [[package]] name = "crossbeam" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae5588f6b3c3cb05239e90bd110f257254aecd01e4635400391aeae07497845" +checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" dependencies = [ "cfg-if", "crossbeam-channel", @@ -806,9 +852,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c02a4d71819009c192cf4872265391563fd6a84c81ff2c0f2a7026ca4c1d85c" +checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" dependencies = [ "cfg-if", "crossbeam-utils", @@ -816,9 +862,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" dependencies = [ "cfg-if", "crossbeam-epoch", @@ -827,9 +873,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07db9d94cbd326813772c968ccd25999e5f8ae22f4f8d1b11effa37ef6ce281d" +checksum = "045ebe27666471bb549370b4b0b3e51b07f56325befa4284db65fc89c02511b1" dependencies = [ "autocfg", "cfg-if", @@ -841,9 +887,9 @@ dependencies = [ [[package]] name = "crossbeam-queue" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f25d8400f4a7a5778f0e4e52384a48cbd9b5c495d110786187fc750075277a2" +checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7" dependencies = [ "cfg-if", "crossbeam-utils", @@ -851,9 +897,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.9" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff1f980957787286a554052d03c7aee98d99cc32e09f6d45f0a814133c87978" +checksum = "51887d4adc7b564537b15adcfb307936f8075dfcd5f00dde9a9f1d29383682bc" dependencies = [ "cfg-if", "once_cell", @@ -867,9 +913,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-common" -version = "0.1.3" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57952ca27b5e3606ff4dd79b0020231aaf9d6aa76dc05fd30137538c50bd3ce8" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ "generic-array", "typenum", @@ -896,9 +942,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f877be4f7c9f246b183111634f75baa039715e3f46ce860677d3b19a69fb229c" +checksum = "cdffe87e1d521a10f9696f833fe502293ea446d7f256c06128293a4119bdf4cb" dependencies = [ "quote", "syn", @@ -1047,9 +1093,18 @@ dependencies = [ [[package]] name = "either" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" +checksum = "3f107b87b6afc2a64fd13cac55fe06d6c8859f12d4b14cbcdd2c67d0976781be" + +[[package]] +name = "encoding_rs" +version = "0.8.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9852635589dc9f9ea1b6fe9f05b50ef208c85c834a562f0c6abb1c475736ec2b" +dependencies = [ + "cfg-if", +] [[package]] name = "errno" @@ -1074,9 +1129,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "2.5.2" +version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77f3309417938f28bf8228fcff79a4a37103981e3e186d2ccd19c74b38f4eb71" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "execute" @@ -1129,9 +1184,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" +checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" dependencies = [ "instant", ] @@ -1158,13 +1213,13 @@ dependencies = [ [[package]] name = "fil_actor_account" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "fil_actors_runtime", "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "num-derive", "num-traits", "serde", @@ -1192,13 +1247,13 @@ dependencies = [ [[package]] name = "fil_actor_cron" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "fil_actors_runtime", "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "log", "num-derive", "num-traits", @@ -1207,8 +1262,8 @@ dependencies = [ [[package]] name = "fil_actor_init" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "anyhow", "cid", @@ -1216,7 +1271,7 @@ dependencies = [ "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", "fvm_ipld_hamt 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "log", "num-derive", "num-traits", @@ -1225,8 +1280,8 @@ dependencies = [ [[package]] name = "fil_actor_market" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "anyhow", "cid", @@ -1235,7 +1290,7 @@ dependencies = [ "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", "fvm_ipld_hamt 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "libipld-core", "log", "num-derive", @@ -1245,8 +1300,8 @@ dependencies = [ [[package]] name = "fil_actor_miner" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "anyhow", "byteorder 1.4.3", @@ -1257,7 +1312,7 @@ dependencies = [ "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", "fvm_ipld_hamt 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "itertools 0.10.3", "lazy_static", "log", @@ -1268,8 +1323,8 @@ dependencies = [ [[package]] name = "fil_actor_multisig" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "anyhow", "cid", @@ -1277,7 +1332,7 @@ dependencies = [ "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", "fvm_ipld_hamt 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "indexmap", "integer-encoding", "num-derive", @@ -1287,15 +1342,15 @@ dependencies = [ [[package]] name = "fil_actor_paych" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "anyhow", "cid", "fil_actors_runtime", "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "num-derive", "num-traits", "serde", @@ -1303,8 +1358,8 @@ dependencies = [ [[package]] name = "fil_actor_power" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "anyhow", "cid", @@ -1312,7 +1367,7 @@ dependencies = [ "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", "fvm_ipld_hamt 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "indexmap", "integer-encoding", "lazy_static", @@ -1324,13 +1379,13 @@ dependencies = [ [[package]] name = "fil_actor_reward" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "fil_actors_runtime", "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "lazy_static", "log", "num-derive", @@ -1340,15 +1395,15 @@ dependencies = [ [[package]] name = "fil_actor_system" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "anyhow", "cid", "fil_actors_runtime", "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "num-derive", "num-traits", "serde", @@ -1356,8 +1411,8 @@ dependencies = [ [[package]] name = "fil_actor_verifreg" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "anyhow", "cid", @@ -1365,7 +1420,7 @@ dependencies = [ "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_ipld_encoding 0.2.2", "fvm_ipld_hamt 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "lazy_static", "num-derive", "num-traits", @@ -1374,8 +1429,8 @@ dependencies = [ [[package]] name = "fil_actors_runtime" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "anyhow", "base64", @@ -1387,16 +1442,18 @@ dependencies = [ "fvm_ipld_encoding 0.2.2", "fvm_ipld_hamt 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "fvm_sdk", - "fvm_shared 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fvm_shared 0.8.0", "getrandom 0.2.7", "indexmap", "integer-encoding", + "itertools 0.10.3", "lazy_static", "log", "multihash", "num-derive", "num-traits", "rand 0.8.5", + "regex", "serde", "serde_repr", "sha2 0.10.2", @@ -1406,8 +1463,8 @@ dependencies = [ [[package]] name = "fil_builtin_actors_bundle" -version = "8.0.0-alpha.1" -source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#a1fc0b2932f8055e41cff35068edfbcf2bf4da1f" +version = "8.0.0-rc.1" +source = "git+https://github.com/filecoin-project/builtin-actors?branch=experimental/fvm-m2#94da29c657d943f850a8ac2c106977a948a638a0" dependencies = [ "cid", "clap", @@ -1423,7 +1480,6 @@ dependencies = [ "fil_actor_reward", "fil_actor_system", "fil_actor_verifreg", - "fil_actors_runtime", ] [[package]] @@ -1537,9 +1593,9 @@ dependencies = [ [[package]] name = "flume" -version = "0.10.13" +version = "0.10.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ceeb589a3157cac0ab8cc585feb749bd2cea5cb55a6ee802ad72d9fd38303da" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" dependencies = [ "spin", ] @@ -1550,6 +1606,21 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + [[package]] name = "forest_hash_utils" version = "0.1.0" @@ -1560,6 +1631,16 @@ dependencies = [ "serde", ] +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + [[package]] name = "fr32" version = "4.1.1" @@ -1720,7 +1801,7 @@ dependencies = [ "fvm_ipld_blockstore 0.1.1 (git+https://github.com/ipfs-force-community/ref-fvm.git?branch=feat/keep_dep_experimental)", "fvm_ipld_encoding 0.2.1", "fvm_ipld_hamt 0.5.1 (git+https://github.com/ipfs-force-community/ref-fvm.git?branch=feat/keep_dep_experimental)", - "fvm_shared 0.7.1 (git+https://github.com/ipfs-force-community/ref-fvm.git?branch=feat/keep_dep_experimental)", + "fvm_shared 0.7.1", "lazy_static", "log", "multihash", @@ -1761,7 +1842,7 @@ dependencies = [ "fvm_ipld_car 0.4.1 (git+https://github.com/ipfs-force-community/ref-fvm.git?branch=feat/keep_dep_experimental)", "fvm_ipld_encoding 0.2.1", "fvm_ipld_hamt 0.5.1 (git+https://github.com/ipfs-force-community/ref-fvm.git?branch=feat/keep_dep_experimental)", - "fvm_shared 0.7.1 (git+https://github.com/ipfs-force-community/ref-fvm.git?branch=feat/keep_dep_experimental)", + "fvm_shared 0.7.1", "lazy_static", "libsecp256k1", "multihash", @@ -1948,9 +2029,9 @@ dependencies = [ [[package]] name = "fvm_sdk" -version = "1.0.0-rc.3" +version = "2.0.0-alpha.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd162cff8cab78c3798762bc6879429ecbd0f5515856bcb3bc31d197208db70" +checksum = "ed39bb3122484d0b675a61934472dd767e24efc2976c60d723032a25bef3aec3" dependencies = [ "cid", "fvm_ipld_encoding 0.2.2", @@ -1961,36 +2042,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "fvm_shared" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282f5fb4f2eb9f916badd253aa4898d7ba20bdda3e76a2f94d42ee67acb6ba2e" -dependencies = [ - "anyhow", - "bimap", - "blake2b_simd 1.0.0", - "byteorder 1.4.3", - "cid", - "cs_serde_bytes", - "data-encoding", - "data-encoding-macro", - "fvm_ipld_blockstore 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "fvm_ipld_encoding 0.2.2", - "lazy_static", - "log", - "multihash", - "num-bigint 0.4.3", - "num-derive", - "num-integer", - "num-traits", - "serde", - "serde_repr", - "serde_tuple", - "thiserror", - "unsigned-varint", -] - [[package]] name = "fvm_shared" version = "0.7.1" @@ -2098,9 +2149,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.1" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4" +checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" dependencies = [ "fallible-iterator", "indexmap", @@ -2146,7 +2197,7 @@ dependencies = [ "fvm_ipld_car 0.4.1 (git+https://github.com/ipfs-force-community/ref-fvm.git?branch=feat/keep_dep_experimental)", "fvm_ipld_encoding 0.2.1", "fvm_ipld_hamt 0.5.1 (git+https://github.com/ipfs-force-community/ref-fvm.git?branch=feat/keep_dep_experimental)", - "fvm_shared 0.7.1 (git+https://github.com/ipfs-force-community/ref-fvm.git?branch=feat/keep_dep_experimental)", + "fvm_shared 0.7.1", "hex", "libsecp256k1", "num-traits", @@ -2154,6 +2205,8 @@ dependencies = [ "path-absolutize", "rand 0.8.5", "rand_chacha 0.3.1", + "regex", + "reqwest", "serde", "serde_json", "wabt", @@ -2179,6 +2232,25 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37a82c6d637fc9515a4694bbf1cb2457b79d81ce52b3108bdeea58b07dd34a57" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -2190,9 +2262,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db0d4cf898abf0081f964436dc980e96670a0f36863e4b83aaacdb65c9d7ccc3" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "heck" @@ -2236,20 +2308,102 @@ dependencies = [ "hmac", ] +[[package]] +name = "http" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "496ce29bb5a52785b44e0f7ca2847ae0bb839c9bd28f69acac9b99d461c0c04c" + +[[package]] +name = "httpdate" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" + +[[package]] +name = "hyper" +version = "0.14.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c929dc5c39e335a03c405292728118860721b10190d98c2a0f0efd5baafbac" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" +dependencies = [ + "bytes", + "hyper", + "native-tls", + "tokio", + "tokio-native-tls", +] + [[package]] name = "ident_case" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "indexmap" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c6392766afd7964e2531940894cffe4bd8d7d17dbc3c1c4857040fd4b33bdb3" +checksum = "10a35a97730320ffe8e2d410b5d3b69279b98d2c14bdb8b70ea89ecf7888d41e" dependencies = [ "autocfg", - "hashbrown 0.12.1", + "hashbrown 0.12.3", "serde", ] @@ -2264,9 +2418,9 @@ dependencies = [ [[package]] name = "integer-encoding" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e85a1509a128c855368e135cffcde7eac17d8e1083f41e2b98c58bc1a5074be" +checksum = "8bb03732005da905c88227371639bf1ad885cc712789c011c31c5fb3ab3ccf02" dependencies = [ "async-trait", "futures-util", @@ -2278,6 +2432,12 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec58677acfea8a15352d42fc87d11d63596ade9239e0a7c9352914417515dbe6" +[[package]] +name = "ipnet" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879d54834c8c76457ef4293a689b2a8c59b076067ad77b15efafbb05f92a592b" + [[package]] name = "itertools" version = "0.8.2" @@ -2313,9 +2473,9 @@ checksum = "112c678d4050afce233f4f2852bb2eb519230b3cf12f33585275537d7e41578d" [[package]] name = "js-sys" -version = "0.3.58" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3fac17f7123a73ca62df411b1bf727ccc805daa070338fda671c86dac1bdc27" +checksum = "258451ab10b34f8af53416d1fdab72c22e805f0c92a1136d59470ec0b11138b2" dependencies = [ "wasm-bindgen", ] @@ -2393,9 +2553,9 @@ dependencies = [ [[package]] name = "libsecp256k1" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0452aac8bab02242429380e9b2f94ea20cea2b37e2c1777a1358799bbe97f37" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", "base64", @@ -2484,6 +2644,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + [[package]] name = "memchr" version = "2.5.0" @@ -2528,6 +2694,33 @@ dependencies = [ "typenum", ] +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + +[[package]] +name = "miniz_oxide" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f5c75688da582b8ffc1f1799e9db273f32133c49e048f614d22ec3256773ccc" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57ee1c23c7c63b0c9250c339ffdc69255f110b298b901b9f6c82547b7b87caaf" +dependencies = [ + "libc", + "log", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys", +] + [[package]] name = "more-asserts" version = "0.2.2" @@ -2578,6 +2771,24 @@ dependencies = [ "synstructure", ] +[[package]] +name = "native-tls" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd7e2f3618557f980e0b17e8856252eee3c97fa12c54dff0ca290fb6266ca4a9" +dependencies = [ + "lazy_static", + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + [[package]] name = "neptune" version = "5.2.0" @@ -2692,11 +2903,20 @@ dependencies = [ "memchr", ] +[[package]] +name = "object" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7709cef83f0c1f58f666e746a08b21e0085f7440fa6a29cc194d68aac97a4225" +checksum = "18a6dbe30758c9f83eb00cbea4ac95966305f5a7772f3f42ebfc7fc7eddbd8e1" [[package]] name = "opaque-debug" @@ -2704,11 +2924,56 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openssl" +version = "0.10.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "618febf65336490dfcf20b73f885f5651a0c89c64c2d4a8c3662585a70bf5bd0" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5f9bd0c2710541a3cda73d6f9ac4f1b240de4ae261065d309dbe73d9dceb42f" +dependencies = [ + "autocfg", + "cc", + "libc", + "pkg-config", + "vcpkg", +] + [[package]] name = "os_str_bytes" -version = "6.1.0" +version = "6.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21326818e99cfe6ce1e524c2a805c189a99b5ae555a35d19f9a284b427d86afa" +checksum = "648001efe5d5c0102d8cea768e348da85d90af8ba91f0bea908f157951493cd4" [[package]] name = "output_vt100" @@ -2737,7 +3002,7 @@ checksum = "be5e13c266502aadf83426d87d81a0f5d1ef45b8027f5a471c360abfe4bfae92" [[package]] name = "parity-wasm" version = "0.45.0" -source = "git+https://github.com/hunjixin/parity-wasm?branch=feat/allow_unparsed_names#b42946ffe567ff1daa61d6d7b10d4a62959575d7" +source = "git+https://github.com/hunjixin/parity-wasm?branch=master#95ef1a8ca96a3ed25b11645e8a17a3827200b882" [[package]] name = "parking" @@ -2769,12 +3034,19 @@ dependencies = [ "once_cell", ] +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + [[package]] name = "pest" -version = "2.1.3" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +checksum = "69486e2b8c2d2aeb9762db7b4e00b0331156393555cff467f4163ff06821eef8" dependencies = [ + "thiserror", "ucd-trie", ] @@ -2790,6 +3062,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkg-config" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae" + [[package]] name = "polling" version = "2.2.0" @@ -2869,18 +3147,18 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.40" +version = "1.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd96a1e8ed2596c337f8eae5f24924ec83f5ad5ab21ea8e455d3566c69fbcaf7" +checksum = "c278e965f1d8cf32d6e0e96de3d3e79712178ae67986d9cf9151f51e95aac89b" dependencies = [ "unicode-ident", ] [[package]] name = "psm" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "871372391786ccec00d3c5d3d6608905b3d4db263639cfe075d3b60a736d115a" +checksum = "f446d0a6efba22928558c4fb4ce0b3fd6c89b0061343e390bf01a703742b8125" dependencies = [ "cc", ] @@ -3049,9 +3327,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f25bc4c7e55e0b0b7a1d43fb893f4fa1361d0abe38b9ce4f323c2adfe6ef42" +checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ "bitflags", ] @@ -3070,9 +3348,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.5.6" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d83f127d94bdbcda4c8cc2e50f6f84f4b611f69c902699ca385a39c3a75f9ff1" +checksum = "4c4eb3267174b8c6c2f654116623910a0fef09c4753f8dd83db29c48a0df988b" dependencies = [ "aho-corasick", "memchr", @@ -3081,9 +3359,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.26" +version = "0.6.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b3de9ec5dc0a3417da371aab17d729997c15010e7fd24ff707773a33bddb64" +checksum = "a3f87b73ce11b1619a3c6332f45341e0047173771e8b8b73f87bfeefb7b56244" [[package]] name = "region" @@ -3112,6 +3390,43 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3a8614ee435691de62bcffcf4a66d91b3594bf1428a5722e79103249a095690" +[[package]] +name = "reqwest" +version = "0.11.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b75aa69a3f06bbcc66ede33af2af253c6f7a86b1ca0033f60c580a27074fbf92" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-tls", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "native-tls", + "percent-encoding", + "pin-project-lite", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-native-tls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "winreg", +] + [[package]] name = "rustc-demangle" version = "0.1.21" @@ -3124,7 +3439,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.10", + "semver 1.0.12", ] [[package]] @@ -3143,9 +3458,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0a5f7c728f5d284929a1cccb5bc19884422bfe6ef4d6c409da2c41838983fcf" +checksum = "24c8ad4f0c00e1eb5bc7614d236a7f1300e3dbd76b68cac8e06fb00b015ad8d8" [[package]] name = "ryu" @@ -3162,12 +3477,45 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "schannel" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +dependencies = [ + "lazy_static", + "windows-sys", +] + [[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "security-framework" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dc14f172faf8a0194a3aded622712b0de276821addc574fa54fc0a1167e10dc" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "semver" version = "0.11.0" @@ -3179,9 +3527,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.10" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a41d061efea015927ac527063765e73601444cdc344ba855bc7bd44578b25e1c" +checksum = "a2333e6df6d6598f2b1974829f853c2b4c5f4a6e503c10af918081aa6f8564e1" [[package]] name = "semver-parser" @@ -3194,9 +3542,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.137" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61ea8d54c77f8315140a05f4c7237403bf38b72704d031543aa1d16abbf517d1" +checksum = "fc855a42c7967b7c369eb5860f7164ef1f6f81c20c7cc1141f2a604e18723b03" dependencies = [ "serde_derive", ] @@ -3221,9 +3569,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.137" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f26faba0c3959972377d3b2d306ee9f71faee9714294e41bb777f83f88578be" +checksum = "6f2122636b9fe3b81f1cb25099fcf2d3f542cdb1d45940d56c713158884a05da" dependencies = [ "proc-macro2", "quote", @@ -3244,9 +3592,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7ce2b32a1aed03c558dc61a5cd328f15aff2dbc17daad8fb8af04d2100e15c" +checksum = "82c2c1fdcd807d1098552c5b9a36e425e42e9fbd7c6a37a8425f390f781f7fa7" dependencies = [ "itoa", "ryu", @@ -3285,6 +3633,18 @@ dependencies = [ "syn", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha2" version = "0.9.9" @@ -3337,9 +3697,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881bf8156c87b6301fc5ca6b27f11eeb2761224c7081e69b409d5a1951a70c86" +checksum = "0a31480366ec990f395a61b7c08122d99bd40544fdb5abcfc1b06bb29994312c" dependencies = [ "digest 0.10.3", "keccak", @@ -3347,9 +3707,12 @@ dependencies = [ [[package]] name = "slab" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb703cfe953bccee95685111adeedb76fabe4e97549a58d16f03ea7b9367bb32" +checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +dependencies = [ + "autocfg", +] [[package]] name = "slice-group-by" @@ -3359,9 +3722,9 @@ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec" [[package]] name = "smallvec" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +checksum = "2fd0db749597d91ff862fd1d55ea87f7855a744a8425a64695b6fca237d1dad1" [[package]] name = "socket2" @@ -3375,9 +3738,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c530c2b0d0bf8b69304b39fe2001993e267461948b890cd037d8ad4293fa1a0d" +checksum = "7f6002a767bff9e83f8eeecf883ecb8011875a21ae8da43bffb817a57e78cc09" dependencies = [ "lock_api", ] @@ -3666,11 +4029,12 @@ dependencies = [ [[package]] name = "time" -version = "0.3.10" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82501a4c1c0330d640a6e176a3d6a204f5ec5237aca029029d21864a902e27b0" +checksum = "74b7cc93fc23ba97fde84f7eea56c55d1ba183f495c6715defdfc7b9cb8c870f" dependencies = [ "itoa", + "js-sys", "libc", "num_threads", "time-macros", @@ -3682,6 +4046,63 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42657b1a6f4d817cda8e7a0ace261fe0cc946cf3a80314390b22cc61ae080792" +[[package]] +name = "tinyvec" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a8325f63a7d4774dd041e363b2409ed1c5cbbd0f867795e661df066b2b0a581" +dependencies = [ + "autocfg", + "bytes", + "libc", + "memchr", + "mio", + "num_cpus", + "once_cell", + "pin-project-lite", + "socket2", + "winapi 0.3.9", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc463cd8deddc3770d20f9852143d50bf6094e640b485cb2e189a2099085ff45" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", + "tracing", +] + [[package]] name = "toml" version = "0.5.9" @@ -3691,6 +4112,38 @@ dependencies = [ "serde", ] +[[package]] +name = "tower-service" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" + +[[package]] +name = "tracing" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a400e31aa60b9d44a52a8ee0343b5b18566b03a8321e0d321f695cf56e940160" +dependencies = [ + "cfg-if", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b7358be39f2f274f322d2aaed611acc57f382e8eb1e5b48cb9ae30933495ce7" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" + [[package]] name = "typenum" version = "1.15.0" @@ -3699,15 +4152,30 @@ checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" [[package]] name = "ucd-trie" -version = "0.1.3" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89570599c4fe5585de2b388aab47e99f7fa4e9238a1399f707a02e356058141c" + +[[package]] +name = "unicode-bidi" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" +checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bd2fe26506023ed7b5e1e315add59d6f584c621d037f9368fea9cfb988f368c" +checksum = "15c61ba63f9235225a22310255a29b806b907c9b8c964bcbd0a2c70f3f2deea7" + +[[package]] +name = "unicode-normalization" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854cbdc4f7bc6ae19c820d44abdc3277ac3e1b2b93db20a636825d9322fb60e6" +dependencies = [ + "tinyvec", +] [[package]] name = "unicode-width" @@ -3727,6 +4195,18 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", +] + [[package]] name = "value-bag" version = "1.0.0-alpha.9" @@ -3737,6 +4217,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version_check" version = "0.9.4" @@ -3783,6 +4269,16 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ + "log", + "try-lock", +] + [[package]] name = "wasi" version = "0.9.0+wasi-snapshot-preview1" @@ -3797,9 +4293,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.81" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c53b543413a17a202f4be280a7e5c62a1c69345f5de525ee64f8cfdbc954994" +checksum = "fc7652e3f6c4706c8d9cd54832c4a4ccb9b5336e2c3bd154d5cccfbf1c1f5f7d" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3807,13 +4303,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.81" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5491a68ab4500fa6b4d726bd67408630c3dbe9c4fe7bda16d5c82a1fd8c7340a" +checksum = "662cd44805586bd52971b9586b1df85cdbbd9112e4ef4d8f41559c334dc6ac3f" dependencies = [ "bumpalo", - "lazy_static", "log", + "once_cell", "proc-macro2", "quote", "syn", @@ -3822,9 +4318,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.31" +version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de9a9cec1733468a8c657e57fa2413d2ae2c0129b95e87c5b72b8ace4d13f31f" +checksum = "fa76fb221a1f8acddf5b54ace85912606980ad661ac7a503b4570ffd3a624dad" dependencies = [ "cfg-if", "js-sys", @@ -3834,9 +4330,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.81" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c441e177922bc58f1e12c022624b6216378e5febc2f0533e41ba443d505b80aa" +checksum = "b260f13d3012071dfb1512849c033b1925038373aea48ced3012c09df952c602" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3844,9 +4340,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.81" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d94ac45fcf608c1f45ef53e748d35660f168490c10b23704c7779ab8f5c3048" +checksum = "5be8e654bdd9b79216c2929ab90721aa82faf65c48cdf08bdc4e7f51357b80da" dependencies = [ "proc-macro2", "quote", @@ -3857,15 +4353,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.81" +version = "0.2.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a89911bd99e5f3659ec4acf9c4d93b0a90fe4a2a11f15328472058edc5261be" +checksum = "6598dd0bd3c7d51095ff6531a5b23e02acdc81804e30d8f07afb77b7215a140a" [[package]] name = "wasm-encoder" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f0c17267a5ffd6ae3d897589460e21db1673c84fb7016b909c9691369a75ea" +checksum = "8905fd25fdadeb0e7e8bf43a9f46f9f972d6291ad0c7a32573b88dd13a6cfa6b" dependencies = [ "leb128", ] @@ -3881,21 +4377,21 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.86.0" +version = "0.88.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcbfe95447da2aa7ff171857fc8427513eb57c75a729bb190e974dc695e8f5c" +checksum = "fb8cf7dd82407fe68161bedcd57fde15596f32ebf6e9b3bdbf3ae1da20e38e5e" dependencies = [ "indexmap", ] [[package]] name = "wasmprinter" -version = "0.2.36" +version = "0.2.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa4cca415278da771add7c9ab7f3391f04b8d98719d2cf28a185d38d5206697e" +checksum = "04f2786f19a25211ddfa331e28b7579a6d6880f5f4b18d21253cd90274aa4c21" dependencies = [ "anyhow", - "wasmparser 0.86.0", + "wasmparser 0.88.0", ] [[package]] @@ -3911,7 +4407,7 @@ dependencies = [ "lazy_static", "libc", "log", - "object", + "object 0.28.4", "once_cell", "paste", "psm", @@ -3942,7 +4438,7 @@ dependencies = [ "gimli", "log", "more-asserts", - "object", + "object 0.28.4", "target-lexicon", "thiserror", "wasmparser 0.84.0", @@ -3961,7 +4457,7 @@ dependencies = [ "indexmap", "log", "more-asserts", - "object", + "object 0.28.4", "serde", "target-lexicon", "thiserror", @@ -3982,7 +4478,7 @@ dependencies = [ "cpp_demangle", "gimli", "log", - "object", + "object 0.28.4", "region", "rustc-demangle", "rustix", @@ -4052,9 +4548,9 @@ dependencies = [ [[package]] name = "wast" -version = "42.0.0" +version = "45.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "badcb03f976f983ff0daf294da9697be659442f61e6b0942bb37a2b6cbfe9dd4" +checksum = "186c474c4f9bb92756b566d592a16591b4526b1a4841171caa3f31d7fe330d96" dependencies = [ "leb128", "memchr", @@ -4064,18 +4560,18 @@ dependencies = [ [[package]] name = "wat" -version = "1.0.44" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b92f20b742ac527066c8414bc0637352661b68cab07ef42586cefaba71c965cf" +checksum = "c2d4bc4724b4f02a482c8cab053dac5ef26410f264c06ce914958f9a42813556" dependencies = [ - "wast 42.0.0", + "wast 45.0.0", ] [[package]] name = "web-sys" -version = "0.3.58" +version = "0.3.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fed94beee57daf8dd7d51f2b15dc2bcde92d7a72304cdf662a4371008b71b90" +checksum = "ed055ab27f941423197eb86b2035720b1a3ce40504df082cac2ecc6ed73335a1" dependencies = [ "js-sys", "wasm-bindgen", @@ -4133,6 +4629,58 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-sys" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +dependencies = [ + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" + +[[package]] +name = "windows_i686_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" + +[[package]] +name = "windows_i686_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" + +[[package]] +name = "winreg" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "wyz" version = "0.4.0" diff --git a/specs/quickstart.md b/specs/quickstart.md index e5003b7..2d68fdd 100644 --- a/specs/quickstart.md +++ b/specs/quickstart.md @@ -4,14 +4,21 @@ 1. Install [git](https://github.com/git-guides/install-git) 2. Install [Go](https://go.dev/doc/install) version 1.16.x/1.17.x -3. Install `TinyGo` - fvm [release](https://github.com/ipfs-force-community/tinygo/tags) +3. Install [TinyGo](https://tinygo.org/getting-started/install/) 4. Install [go-fvm-sdk](https://github.com/ipfs-force-community/go-fvm-sdk/releases); Then rename it to `go-fvm-sdk-tools` -Add above tools to your ```PATH``` environment. +Add go-fvm-sdk-tools tools to your ```PATH``` environment. ```bash -export PATH=$PATH:::/bin +export PATH=$PATH: ``` +## Patch your local environment + +```bash +go-fvm-sdk-tools patch +``` +this command change your local go/tinygo std package, this may cause other code not work properly. more details refer link [patch](https://github.com/ipfs-force-community/go_tinygo_patch) + ## Create an actor project ```sh @@ -42,8 +49,10 @@ go-fvm-sdk-tools build # execute at project root ## Test ```sh +grep -v '#' > test.json << EOF { - "accounts": [ # mock accounts, used for the send test message + # mock accounts, used for the send test message + "accounts": [ { "priv_key": "6c3b9aa767f785b537c0d8ba5fa54677e6a6e281320dfbb27c889b8fa460670f", "address": "f1m674sjwmga36qi3wkowt3wozwpahrkdlvd4tpci", @@ -62,26 +71,38 @@ go-fvm-sdk-tools build # execute at project root ], "contracts":[ { - "name": "counter", # test name - "binary": "../gofvm-counter.wasm", # Path to the binary that is generated during compile step - "constructor": "", # contructor parameters + # test name + "name": "counter", + # Path to the binary that is generated during compile step + "binary": "../gofvm-counter.wasm", + # contructor parameters + "constructor": "", "cases": [ - { # execute specify method that defined in actor - "name": "increase", # test name - "method_num": 2, # which actor method to run - "params": "1832" # actor method parameter - "send_from": 0, # caller of this test message - "expect_code": 0, # expect code if fail - "expect_message": "", # expect message if fail - "return_data": "", # check return_data if any + # execute specify method that defined in actor + { + # test name + "name": "increase", + # which actor method to run + "method_num": 2, + # actor method parameter + "params": "1832" + # caller of this test message + "send_from": 0, + # expect code if fail + "expect_code": 0, + # expect message if fail + "expect_message": "", + # check return_data if any + "return_data": "", }, ] } ] } +EOF ``` Run the test. ```sh -go-fvm-sdk-tools test -- +go-fvm-sdk-tools test ``` diff --git a/tools/ci/src/main.rs b/tools/ci/src/main.rs index 89c3cab..916840a 100644 --- a/tools/ci/src/main.rs +++ b/tools/ci/src/main.rs @@ -76,7 +76,7 @@ fn main() { if what_to_run.contains(Check::COMPILE_EXAMPLE) { // Build examples and check they compile sh.change_dir("./examples/hellocontract"); - cmd!(sh, "../../bin/go-fvm-sdk-tools build") + cmd!(sh, "go-fvm-sdk-tools build") .run() .expect("Please fix hellcontract example."); } diff --git a/tools/sdk_tool/Cargo.toml b/tools/sdk_tool/Cargo.toml index e5ae24a..d3d532e 100644 --- a/tools/sdk_tool/Cargo.toml +++ b/tools/sdk_tool/Cargo.toml @@ -11,8 +11,8 @@ wasmparser = "0.84.0" wast = "40.0.0" wabt = "0.10.0" wat = "1.0" #parse WAT to binary WebAssembly -anyhow ="1.0.57" -parity-wasm = { git="https://github.com/hunjixin/parity-wasm", branch = "feat/allow_unparsed_names"} +anyhow = {version="1.0.47", features = ["backtrace"]} +parity-wasm = { git="https://github.com/hunjixin/parity-wasm", branch = "master", features=["sign_ext","bulk","non_trapping_float_to_int"]} clap = { version = "3.1.15", features = ["derive"] } colored = "2" num-traits = "0.2" @@ -26,6 +26,8 @@ path-absolutize = "3.0.13" cid = { version = "0.8.3", default-features = false, features = ["serde-codec"] } xshell = "0.2" walkdir = "2" +regex = "1" +reqwest = { version = "0.11", features = ["blocking", "json"] } fvm = { git = "https://github.com/ipfs-force-community/ref-fvm.git", branch = "feat/keep_dep_experimental", default-features = false} fvm_shared = { git = "https://github.com/ipfs-force-community/ref-fvm.git", branch = "feat/keep_dep_experimental" } diff --git a/tools/sdk_tool/src/main.rs b/tools/sdk_tool/src/main.rs index 97f7671..e5fc672 100644 --- a/tools/sdk_tool/src/main.rs +++ b/tools/sdk_tool/src/main.rs @@ -1,3 +1,4 @@ +mod patch; mod template; mod testing; mod utils; @@ -22,6 +23,12 @@ enum Commands { Test(testing::TestConfig), /// create new template project by module name New(template::NewTemplateConfig), + /// apply path for go/tinygo + /// if your go and tinygo install in user home directory, just run./go-fvm-sdk-tools patch + /// if you go and tinygo is installed in /usr/local/go, use sudo ./go-fvm-sdk-tools patch + /// if you are in china and need proxy, exec sudo(opt) https_proxy= http_proxy=<> ./go-fvm-sdk-tools patch + /// if want to install manual or know more detail refer https://github.com/ipfs-force-community/go_tinygo_patch + Patch(patch::PatchConfig), } fn main() { @@ -45,5 +52,11 @@ fn main() { std::process::exit(1); } } + Commands::Patch(cfg) => { + if let Err(e) = patch::apply_patch(cfg) { + println!("apply patch command fail {}", e); + std::process::exit(1); + } + } } } diff --git a/tools/sdk_tool/src/patch.rs b/tools/sdk_tool/src/patch.rs new file mode 100644 index 0000000..4f2ea81 --- /dev/null +++ b/tools/sdk_tool/src/patch.rs @@ -0,0 +1,103 @@ +use crate::utils; +use anyhow::{anyhow, Result}; +use clap::Parser; +use regex::Regex; +use std::collections::HashMap; +use std::env; +use std::path::Path; +use xshell::Shell; + +#[derive(Parser, Debug)] +#[clap(author, version, about, long_about = None)] +pub struct PatchConfig {} + +pub fn apply_patch(_: &PatchConfig) -> Result<()> { + utils::check_tinygo_install()?; + utils::check_go_install()?; + let patch_version = utils::get_patch_version()?; + println!("patch version {}", patch_version); + let envs = utils::get_tinygo_env()?; + println!("{:?}", envs); + + let mut go_patch_map: HashMap = HashMap::new(); + go_patch_map.insert("1.17.x".to_string(), "go_v1.17.x.patch".to_string()); + + let mut tinygo_patch_map: HashMap = HashMap::new(); + tinygo_patch_map.insert("0.24.x".to_string(), "tinygo_v0.24.x.patch".to_string()); + tinygo_patch_map.insert("0.25.x".to_string(), "tinygo_v0.25.x.patch".to_string()); + + let version_str = utils::get_tinygo_version()?; + let re = Regex::new(r"\d+\.\d+\.\d+").unwrap(); + let version_arr: Vec = re + .captures_iter(version_str.as_str()) + .map(|c| c[0].to_string()) + .collect(); + let tinygo_version = version_arr.get(0).unwrap(); + let go_version = version_arr.get(1).unwrap(); + println!( + "go version {} tinygo version {}", + go_version, tinygo_version + ); + + let dir = env::current_dir()?; + let current_dir = dir.as_os_str().to_str().unwrap(); + + { + let go_root_path = envs.get("GOROOT").expect("unable to locate GOROOT"); + println!("go root path {}", go_root_path); + let default_patch_name = &format!("go_v{}.patch", default_version(go_version)); + let patch_name = go_patch_map.get(go_version).unwrap_or(default_patch_name); + + let patch_url = format!( + "https://raw.githubusercontent.com/ipfs-force-community/go_tinygo_patch/main/patchs/{}", + patch_name + ); + println!("download go patch from {}", patch_url); + utils::download_file(&patch_url, patch_name)?; + + let sh = Shell::new()?; + sh.change_dir(Path::new(&go_root_path)); + sh.cmd("patch") + .arg("-p1") + .arg("-f") + .arg("-i") + .arg(format!("{}/{}", current_dir, patch_name)) + .run() + .map_err(|e| anyhow!("unable to apply patch for go {}", e))?; + std::fs::remove_file(patch_name)?; + } + { + let tinygo_root_path = envs.get("TINYGOROOT").expect("unable to locate TINYGOROOT"); + println!("tinygo root path {}", tinygo_root_path); + let default_patch_name = &format!("tinygo_v{}.patch", default_version(tinygo_version)); + let patch_name = tinygo_patch_map + .get(tinygo_version) + .unwrap_or(default_patch_name); + let patch_url = format!( + "https://raw.githubusercontent.com/ipfs-force-community/go_tinygo_patch/main/patchs/{}", + patch_name + ); + println!("download tinygo patch from {}", patch_url); + utils::download_file(&patch_url, patch_name)?; + + let sh = Shell::new()?; + sh.change_dir(Path::new(&tinygo_root_path)); + sh.cmd("patch") + .arg("-p1") + .arg("-f") + .arg("-i") + .arg(format!("{}/{}", current_dir, patch_name)) + .run() + .map_err(|e| anyhow!("unable to apply patch for tinygo {}", e))?; + std::fs::remove_file(patch_name)?; + } + + Ok(()) +} + +fn default_version(str: &str) -> String { + let mut version_seq: Vec = str.split('.').map(|s| s.to_string()).collect(); + version_seq.pop().unwrap(); + version_seq.push("x".to_owned()); + version_seq.join(".") +} diff --git a/tools/sdk_tool/src/utils.rs b/tools/sdk_tool/src/utils.rs index e3cb821..7326d2c 100644 --- a/tools/sdk_tool/src/utils.rs +++ b/tools/sdk_tool/src/utils.rs @@ -1,4 +1,7 @@ use anyhow::{anyhow, Result}; +use std::collections::HashMap; +use std::fs::File; +use std::io; use std::io::ErrorKind; use std::process::{Command, Stdio}; @@ -11,9 +14,61 @@ pub fn check_tinygo_install() -> Result<()> { Ok(_) => Ok(()), Err(e) => { if let ErrorKind::NotFound = e.kind() { - Err(anyhow!("unable to found tinygo(fvm), please install this tool in https://github.com/ipfs-force-community/tinygo/releases")) + Err(anyhow!("unable to found tinygo, please install tinygo https://tinygo.org/getting-started/install")) } else { - Err(anyhow!("fvm-tinygo not install, please install err {}", e)) + Err(anyhow!("fail exec tinygo version {}", e)) + } + } + } +} + +pub fn get_tinygo_env() -> Result> { + match Command::new("tinygo").arg("env").output() { + Ok(output) => Ok(HashMap::from_iter( + String::from_utf8(output.stdout)? + .split('\n') + .into_iter() + .map(|v| v.trim()) + .filter(|v| !v.is_empty()) + .map(|v| { + let key_pare: Vec<&str> = v.split('=').collect(); + ( + key_pare[0].to_string(), + key_pare[1].trim_matches('\"').to_string(), + ) + }), + )), + Err(e) => { + if let ErrorKind::NotFound = e.kind() { + Err(anyhow!("unable to found tinygo, please install tinygo https://tinygo.org/getting-started/install")) + } else { + Err(anyhow!("fail exec tinygo env {}", e)) + } + } + } +} + +pub fn get_tinygo_version() -> Result { + match Command::new("tinygo").arg("version").output() { + Ok(output) => Ok(String::from_utf8(output.stdout)?), + Err(e) => { + if let ErrorKind::NotFound = e.kind() { + Err(anyhow!("unable to found tinygo, please install tinygo https://tinygo.org/getting-started/install")) + } else { + Err(anyhow!("fail exec tinygo version {}", e)) + } + } + } +} + +pub fn get_patch_version() -> Result { + match Command::new("patch").arg("-version").output() { + Ok(output) => Ok(String::from_utf8(output.stdout)?), + Err(e) => { + if let ErrorKind::NotFound = e.kind() { + Err(anyhow!("unable to found patch tool")) + } else { + Err(anyhow!("fail exec patch -version {}", e)) } } } @@ -28,7 +83,7 @@ pub fn check_fvm_tool_install() -> Result<()> { Ok(_) => Ok(()), Err(e) => { if let ErrorKind::NotFound = e.kind() { - Err(anyhow!("unable to found go-fvm-sdk-tools(fvm), please install this tool in https://github.com/ipfs-force-community/go-fvm-sdk/releases")) + Err(anyhow!("unable to found go-fvm-sdk-tools, please install this tool in https://github.com/ipfs-force-community/go-fvm-sdk/releases")) } else { Err(anyhow!("check err {}", e)) } @@ -56,10 +111,19 @@ pub fn check_go_install() -> Result { } Err(e) => { if let ErrorKind::NotFound = e.kind() { - Err(anyhow!("unable to found go-fvm-sdk-tools(fvm), please install this tool in https://go.dev/dl")) + Err(anyhow!( + "unable to found go, please install this tool in https://go.dev/dl" + )) } else { Err(anyhow!("check err {}", e)) } } } } + +pub fn download_file(path: &str, file_path: &str) -> Result<()> { + let mut resp = reqwest::blocking::get(path)?; + let mut out = File::create(file_path)?; + io::copy(&mut resp, &mut out)?; + Ok(()) +} diff --git a/tools/sdk_tool/src/wasmprocess.rs b/tools/sdk_tool/src/wasmprocess.rs index ad449c2..76b3faa 100644 --- a/tools/sdk_tool/src/wasmprocess.rs +++ b/tools/sdk_tool/src/wasmprocess.rs @@ -9,8 +9,9 @@ use parity_wasm::elements::{ use path_absolutize::*; use std::collections::HashMap; use std::env; +use std::io::{self, Write}; use std::path::{Path, PathBuf}; -use std::process::{Command, Stdio}; +use std::process::Command; #[derive(Parser, Debug)] #[clap(author, version, about, long_about = None)] @@ -109,6 +110,9 @@ pub fn run_process(cfg: &BuildCLiConfig) -> Result<()> { let mut features = wabt::Features::new(); features.set_annotations_enabled(true); + features.set_bulk_memory_enabled(true); + features.set_sat_float_to_int_enabled(true); + features.set_sign_extension_enabled(true); let wat_bin = wabt::wat2wasm_with_features(wat_str, features)?; std::fs::write(build_opts.output_wasm_path, wat_bin)?; Ok(()) @@ -141,8 +145,6 @@ impl<'a> GoFvmBinProcessor<'a> { &self.build_cfg.output_wasm_path, &self.build_cfg.code_path, ]) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) .spawn()? .wait_with_output() .expect("unable to get output"); @@ -153,6 +155,8 @@ impl<'a> GoFvmBinProcessor<'a> { ))); } + io::stdout().write_all(&output.stdout).unwrap(); + io::stderr().write_all(&output.stderr).unwrap(); let module = parity_wasm::deserialize_file(&self.build_cfg.output_wasm_path)? .parse_names() .map_err(|_| anyhow!("parser names in wasm"))?;