From 2312226effb0cdb1bfe9efdddac10f3025fdeb40 Mon Sep 17 00:00:00 2001 From: Alexander Koz <888526+fzzr-@users.noreply.github.com> Date: Tue, 8 Dec 2020 13:49:20 +0300 Subject: [PATCH] Add resource viewer tool (#150) * add move resource viewer * add json schema output * update dependencies * add common/dnode-rest-client * CI: add move-resource-viewer into the release workflow --- .github/workflows/release-tools.yml | 23 +- Cargo.lock | 709 ++++++++++++++--------- Cargo.toml | 2 + common/dnode-rest-client/Cargo.toml | 25 + common/dnode-rest-client/src/blocking.rs | 79 +++ common/dnode-rest-client/src/ds.rs | 26 + common/dnode-rest-client/src/lib.rs | 7 + dove/src/index/resolver/chain/loader.rs | 7 +- resource-viewer/Cargo.toml | 32 + resource-viewer/src/main.rs | 162 ++++++ resource-viewer/src/ser.rs | 170 ++++++ resource-viewer/src/tte.rs | 165 ++++++ 12 files changed, 1136 insertions(+), 271 deletions(-) create mode 100644 common/dnode-rest-client/Cargo.toml create mode 100644 common/dnode-rest-client/src/blocking.rs create mode 100644 common/dnode-rest-client/src/ds.rs create mode 100644 common/dnode-rest-client/src/lib.rs create mode 100644 resource-viewer/Cargo.toml create mode 100644 resource-viewer/src/main.rs create mode 100644 resource-viewer/src/ser.rs create mode 100644 resource-viewer/src/tte.rs diff --git a/.github/workflows/release-tools.yml b/.github/workflows/release-tools.yml index 0579b013..a5a88bf3 100644 --- a/.github/workflows/release-tools.yml +++ b/.github/workflows/release-tools.yml @@ -85,6 +85,11 @@ jobs: uses: ./.github/actions/crate-version with: { crate: disassembler } + - id: mrv + name: get version of resource-viewer + uses: ./.github/actions/crate-version + with: { crate: move-resource-viewer } + - if: ${{ matrix.platform == 'win' }} name: set up standard executable ext for ${{ matrix.platform }} run: echo "OS_BIN_EXT=.exe" >> $GITHUB_ENV @@ -119,8 +124,9 @@ jobs: PKG_DIR=$DIST_DIR/$PKG_NAME PKG_BIN_DIR=$PKG_DIR/bin - MLS_NAME=move-language-server$OS_BIN_EXT DOVE_NAME=dove$OS_BIN_EXT + MLS_NAME=move-language-server$OS_BIN_EXT + MRV_NAME=move-resource-viewer$OS_BIN_EXT EXECUTOR_NAME=move-executor$OS_BIN_EXT TESTRUNNER_NAME=move-testrunner$OS_BIN_EXT DISASSEMBLER_NAME=move-disassembler$OS_BIN_EXT @@ -132,6 +138,7 @@ jobs: cp $RELEASE_DIR/testrunner$OS_BIN_EXT $PKG_BIN_DIR/$TESTRUNNER_NAME cp $RELEASE_DIR/disassembler$OS_BIN_EXT $PKG_BIN_DIR/$DISASSEMBLER_NAME cp $RELEASE_DIR/move-language-server$OS_BIN_EXT $PKG_BIN_DIR/$MLS_NAME + cp $RELEASE_DIR/move-resource-viewer$OS_BIN_EXT $PKG_BIN_DIR/$MRV_NAME cp $RELEASE_DIR/dove$OS_BIN_EXT $PKG_BIN_DIR/$DOVE_NAME echo "::set-output name=name::$PKG_NAME" @@ -151,6 +158,7 @@ jobs: RELEASE_DIR=${{ steps.dist.outputs.build }} MLS_NAME=move-language-server-${{ steps.mls.outputs.version }}-${{ matrix.platform }}-$ARCH$OS_BIN_EXT + MRV_NAME=move-resource-viewer-${{ steps.mrv.outputs.version }}-${{ matrix.platform }}-$ARCH$OS_BIN_EXT DOVE_NAME=dove-${{ steps.dove.outputs.version }}-${{ matrix.platform }}-$ARCH$OS_BIN_EXT EXECUTOR_NAME=move-executor-${{ steps.executor.outputs.version }}-${{ matrix.platform }}-$ARCH$OS_BIN_EXT TESTRUNNER_NAME=move-testrunner-${{ steps.executor.outputs.version }}-${{ matrix.platform }}-$ARCH$OS_BIN_EXT @@ -161,14 +169,17 @@ jobs: mv testrunner$OS_BIN_EXT $TESTRUNNER_NAME mv disassembler$OS_BIN_EXT $DISASSEMBLER_NAME mv move-language-server$OS_BIN_EXT $MLS_NAME + mv move-resource-viewer$OS_BIN_EXT $MRV_NAME mv dove$OS_BIN_EXT $DOVE_NAME echo "::set-output name=mls::$MLS_NAME" + echo "::set-output name=mrv::$MRV_NAME" echo "::set-output name=dove::$DOVE_NAME" echo "::set-output name=executor::$EXECUTOR_NAME" echo "::set-output name=testrunner::$TESTRUNNER_NAME" echo "::set-output name=disassembler::$DISASSEMBLER_NAME" echo "::set-output name=mls_path::$RELEASE_DIR/$MLS_NAME" + echo "::set-output name=mrv_path::$RELEASE_DIR/$MRV_NAME" echo "::set-output name=dove_path::$RELEASE_DIR/$DOVE_NAME" echo "::set-output name=executor_path::$RELEASE_DIR/$EXECUTOR_NAME" echo "::set-output name=testrunner_path::$RELEASE_DIR/$TESTRUNNER_NAME" @@ -194,6 +205,16 @@ jobs: asset_name: ${{ steps.artifact.outputs.mls }} asset_content_type: application/gzip + - name: upload MRV + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.release.outputs.upload_url }} + asset_path: ${{ steps.artifact.outputs.mrv_path }} + asset_name: ${{ steps.artifact.outputs.mrv }} + asset_content_type: application/gzip + - name: upload dove uses: actions/upload-release-asset@v1 env: diff --git a/Cargo.lock b/Cargo.lock index 8390c428..964450df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3,7 +3,7 @@ [[package]] name = "abigen" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "heck", @@ -117,9 +117,9 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.14" +version = "0.7.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b476ce7103678b0c6d3d395dbbae31d48ff910bd28be979ba5d48c6351131d0d" +checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" dependencies = [ "memchr", ] @@ -135,9 +135,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fd36ffbb1fb7c834eac128ea8d0e310c5aeb635548f9d58861e1308d46e71c" +checksum = "2c0df63cb2955042487fad3aefd2c6e3ae7389ac5dc1beb28921de0b69f779d4" [[package]] name = "arrayvec" @@ -156,9 +156,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "async-trait" -version = "0.1.41" +version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b246867b8b3b6ae56035f1eb1ed557c1d8eae97f0d53696138a50fa0e3a3b8c0" +checksum = "8d3a45e77e34375a7923b1e8febb049bb011f064714a8e17a1a616fef01da13d" dependencies = [ "proc-macro2", "quote", @@ -257,7 +257,7 @@ dependencies = [ [[package]] name = "borrow-graph" version = "0.0.1" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "mirai-annotations", @@ -278,7 +278,7 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "bytecode" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "borrow-graph", "bytecode-verifier", @@ -296,7 +296,7 @@ dependencies = [ [[package]] name = "bytecode-source-map" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "codespan 0.8.0", @@ -313,7 +313,7 @@ dependencies = [ [[package]] name = "bytecode-verifier" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "borrow-graph", @@ -348,9 +348,9 @@ checksum = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" [[package]] name = "cc" -version = "1.0.61" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed67cbde08356238e75fc4656be4749481eeffb09e19f320a25237d5221c985d" +checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" dependencies = [ "jobserver", ] @@ -433,15 +433,6 @@ dependencies = [ "syn", ] -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - [[package]] name = "codespan" version = "0.8.0" @@ -496,7 +487,7 @@ dependencies = [ [[package]] name = "compiled-stdlib" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "bytecode-verifier", @@ -506,7 +497,7 @@ dependencies = [ "libra-types", "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "once_cell", - "sha2 0.9.1", + "sha2 0.9.2", "stdlib", "vm", ] @@ -514,7 +505,7 @@ dependencies = [ [[package]] name = "compiler" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "bytecode-source-map", @@ -533,7 +524,7 @@ dependencies = [ [[package]] name = "consensus-types" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "executor-types", @@ -547,17 +538,27 @@ dependencies = [ "serde", ] +[[package]] +name = "console_error_panic_hook" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8d976903543e0c48546a91908f21588a680a8c8f984df9a5d69feccb2b2a211" +dependencies = [ + "cfg-if 0.1.10", + "wasm-bindgen", +] + [[package]] name = "const_fn" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce90df4c658c62f12d78f7508cf92f9173e5184a539c10bfe54a3107b3ffd0f2" +checksum = "c478836e029dcef17fb47c89023448c64f781a046e0300e257ad8225ae59afab" [[package]] name = "core-foundation" -version = "0.7.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +checksum = "0a89e2ae426ea83155dccf10c0fa6b1463ef6d5fcb44cee0b224a408fa640a62" dependencies = [ "core-foundation-sys", "libc", @@ -565,9 +566,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.7.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" +checksum = "ea221b5284a47e40033bf9b66f35f984ec0ea2931eb03505246cd27a963f981b" [[package]] name = "cpuid-bool" @@ -592,7 +593,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dca26ee1f8d361640700bde38b2c37d8c22b3ce2d360e1fc1c74ea4b0aa7d775" dependencies = [ "cfg-if 1.0.0", - "crossbeam-utils 0.8.0", + "crossbeam-utils 0.8.1", ] [[package]] @@ -603,18 +604,18 @@ checksum = "94af6efb46fef72616855b036a624cf27ba656ffc9be1b9a3c931cfc7749a9a9" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", - "crossbeam-utils 0.8.0", + "crossbeam-utils 0.8.1", ] [[package]] name = "crossbeam-epoch" -version = "0.9.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0f606a85340376eef0d6d8fec399e6d4a544d648386c6645eb6d0653b27d9f" +checksum = "a1aaa739f95311c2c7887a76863f500026092fb1dce0161dab577e559ef3569d" dependencies = [ "cfg-if 1.0.0", "const_fn", - "crossbeam-utils 0.8.0", + "crossbeam-utils 0.8.1", "lazy_static", "memoffset", "scopeguard", @@ -633,13 +634,12 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec91540d98355f690a86367e566ecad2e9e579f230230eb7c21398372be73ea5" +checksum = "02d96d1e189ef58269ebe5b97953da3274d83a93af647c2ddd6f9dab28cedb8d" dependencies = [ "autocfg", "cfg-if 1.0.0", - "const_fn", "lazy_static", ] @@ -688,7 +688,7 @@ dependencies = [ [[package]] name = "datatest-stable" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "regex", @@ -700,7 +700,7 @@ dependencies = [ [[package]] name = "dfibra" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "bytecode-source-map", "bytecode-verifier", @@ -765,10 +765,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "dnode-rest-client" +version = "0.1.0" +dependencies = [ + "anyhow", + "dfibra", + "hex", + "http", + "log", + "reqwest", + "serde", + "serde_json", +] + [[package]] name = "docgen" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "bytecode", @@ -822,6 +836,12 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "134951f4028bdadb9b84baf4232681efbf277da25144b9b0ad65df75946c422b" +[[package]] +name = "dyn-clone" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d55796afa1b20c2945ca8eabfc421839f2b766619209f1ede813cf2484f31804" + [[package]] name = "ed25519" version = "1.0.3" @@ -854,7 +874,7 @@ dependencies = [ "ed25519", "rand", "serde", - "sha2 0.9.1", + "sha2 0.9.2", "zeroize", ] @@ -866,11 +886,11 @@ checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" [[package]] name = "encoding_rs" -version = "0.8.24" +version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a51b8cf747471cb9499b6d59e59b0444f4c90eba8968c4e44874e92b5b64ace2" +checksum = "801bbab217d7f79c0062f4f7205b5d4427c6d1a7bd7aafdd1475f7c59d62b283" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] [[package]] @@ -918,7 +938,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44533bbbb3bb3c1fa17d9f2e4e38bbbaf8396ba82193c4cb1b6445d711445d36" dependencies = [ "atty", - "humantime", + "humantime 1.3.0", + "log", + "regex", + "termcolor", +] + +[[package]] +name = "env_logger" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e" +dependencies = [ + "atty", + "humantime 2.0.1", "log", "regex", "termcolor", @@ -936,7 +969,7 @@ dependencies = [ [[package]] name = "errmapgen" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "libra-canonical-serialization 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -951,7 +984,7 @@ dependencies = [ [[package]] name = "executor-types" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "libra-canonical-serialization 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -1015,6 +1048,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" +[[package]] +name = "form_urlencoded" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00" +dependencies = [ + "matches", + "percent-encoding", +] + [[package]] name = "fuchsia-zircon" version = "0.3.3" @@ -1033,9 +1076,9 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95314d38584ffbfda215621d723e0a3906f032e03ae5551e650058dac83d4797" +checksum = "9b3b0c040a1fe6529d30b3c5944b280c7f0dcb2930d2c3062bca967b602583d0" dependencies = [ "futures-channel", "futures-core", @@ -1048,9 +1091,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0448174b01148032eed37ac4aed28963aaaa8cfa93569a08e5b479bbc6c2c151" +checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64" dependencies = [ "futures-core", "futures-sink", @@ -1058,15 +1101,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18eaa56102984bed2c88ea39026cff3ce3b4c7f508ca970cedf2450ea10d4e46" +checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" [[package]] name = "futures-executor" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5f8e0c9258abaea85e78ebdda17ef9666d390e987f006be6080dfe354b708cb" +checksum = "4caa2b2b68b880003057c1dd49f1ed937e38f22fcf6c212188a121f08cf40a65" dependencies = [ "futures-core", "futures-task", @@ -1075,15 +1118,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1798854a4727ff944a7b12aa999f58ce7aa81db80d2dfaaf2ba06f065ddd2b" +checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" [[package]] name = "futures-macro" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36fccf3fc58563b4a14d265027c627c3b665d7fed489427e88e7cc929559efe" +checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -1093,24 +1136,24 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e3ca3f17d6e8804ae5d3df7a7d35b2b3a6fe89dac84b31872720fc3060a0b11" +checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d" [[package]] name = "futures-task" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d502af37186c4fef99453df03e374683f8a1eec9dcc1e66b3b82dc8278ce3c" +checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d" dependencies = [ "once_cell", ] [[package]] name = "futures-util" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abcb44342f62e6f3e8ac427b8aa815f724fd705dfad060b18ac7866c15bb8e34" +checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2" dependencies = [ "futures-channel", "futures-core", @@ -1119,7 +1162,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project 1.0.1", + "pin-project 1.0.2", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1355,11 +1398,17 @@ dependencies = [ "quick-error 1.2.3", ] +[[package]] +name = "humantime" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" + [[package]] name = "hyper" -version = "0.13.8" +version = "0.13.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f3afcfae8af5ad0576a31e768415edb627824129e8e5a29b8bfccb2f234e835" +checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf" dependencies = [ "bytes", "futures-channel", @@ -1371,7 +1420,7 @@ dependencies = [ "httparse", "httpdate", "itoa", - "pin-project 0.4.27", + "pin-project 1.0.2", "socket2", "tokio", "tower-service", @@ -1435,13 +1484,14 @@ checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2" dependencies = [ "autocfg", "hashbrown", + "serde", ] [[package]] name = "instant" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb1fc4429a33e1f80d41dc9fea4d108a88bec1de8053878898ae448a0b52f613" +checksum = "61124eeebbd69b8190558df225adf7e4caafce0d743919e5d6b19652314ec5ec" dependencies = [ "cfg-if 1.0.0", ] @@ -1464,7 +1514,7 @@ checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135" [[package]] name = "ir-to-bytecode" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "bytecode-source-map", @@ -1483,7 +1533,7 @@ dependencies = [ [[package]] name = "ir-to-bytecode-syntax" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "codespan 0.8.0", @@ -1520,9 +1570,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca059e81d9486668f12d455a4ea6daa600bd408134cd17e3d3fb5a32d1f016f8" +checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" dependencies = [ "wasm-bindgen", ] @@ -1549,7 +1599,7 @@ dependencies = [ "codespan-reporting 0.9.5", "dfibra", "disassembler", - "env_logger", + "env_logger 0.7.1", "hex", "include_dir", "itertools", @@ -1581,9 +1631,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.80" +version = "0.2.81" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58d1b70b004888f764dfbf6a26a3b0342a1632d33968e4a179d8011c760614" +checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb" [[package]] name = "libgit2-sys" @@ -1602,7 +1652,7 @@ dependencies = [ [[package]] name = "libra-canonical-serialization" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" +source = "git+https://github.com/dfinance/libra.git?branch=master#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git)", "serde", @@ -1612,7 +1662,7 @@ dependencies = [ [[package]] name = "libra-canonical-serialization" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "serde", @@ -1622,7 +1672,7 @@ dependencies = [ [[package]] name = "libra-config" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "get_if_addrs", "libra-canonical-serialization 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -1647,7 +1697,7 @@ dependencies = [ [[package]] name = "libra-crypto" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" +source = "git+https://github.com/dfinance/libra.git?branch=master#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" dependencies = [ "aes-gcm 0.6.0", "anyhow", @@ -1668,7 +1718,7 @@ dependencies = [ "serde", "serde-name", "serde_bytes", - "sha2 0.9.1", + "sha2 0.9.2", "static_assertions", "thiserror", "tiny-keccak", @@ -1678,7 +1728,7 @@ dependencies = [ [[package]] name = "libra-crypto" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "aes-gcm 0.7.0", "anyhow", @@ -1699,7 +1749,7 @@ dependencies = [ "serde", "serde-name", "serde_bytes", - "sha2 0.9.1", + "sha2 0.9.2", "short-hex-str", "static_assertions", "thiserror", @@ -1710,7 +1760,7 @@ dependencies = [ [[package]] name = "libra-crypto-derive" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" +source = "git+https://github.com/dfinance/libra.git?branch=master#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git)", "proc-macro2", @@ -1721,7 +1771,7 @@ dependencies = [ [[package]] name = "libra-crypto-derive" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "proc-macro2", @@ -1732,7 +1782,7 @@ dependencies = [ [[package]] name = "libra-github-client" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-crypto 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -1745,12 +1795,12 @@ dependencies = [ [[package]] name = "libra-global-constants" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" [[package]] name = "libra-infallible" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", ] @@ -1758,7 +1808,7 @@ dependencies = [ [[package]] name = "libra-log-derive" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "proc-macro2", @@ -1769,7 +1819,7 @@ dependencies = [ [[package]] name = "libra-logger" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "chrono", "erased-serde", @@ -1787,7 +1837,7 @@ dependencies = [ [[package]] name = "libra-metrics" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "futures", @@ -1804,7 +1854,7 @@ dependencies = [ [[package]] name = "libra-metrics-core" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "prometheus", @@ -1813,7 +1863,7 @@ dependencies = [ [[package]] name = "libra-network-address" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "aes-gcm 0.7.0", "libra-canonical-serialization 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -1829,7 +1879,7 @@ dependencies = [ [[package]] name = "libra-network-address-encryption" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "base64 0.13.0", "libra-canonical-serialization 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -1847,7 +1897,7 @@ dependencies = [ [[package]] name = "libra-nibble" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" +source = "git+https://github.com/dfinance/libra.git?branch=master#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git)", "serde", @@ -1856,7 +1906,7 @@ dependencies = [ [[package]] name = "libra-nibble" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "serde", @@ -1865,7 +1915,7 @@ dependencies = [ [[package]] name = "libra-secure-net" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-logger", "libra-secure-push-metrics", @@ -1878,7 +1928,7 @@ dependencies = [ [[package]] name = "libra-secure-push-metrics" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-logger", "libra-metrics-core", @@ -1889,7 +1939,7 @@ dependencies = [ [[package]] name = "libra-secure-storage" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "base64 0.13.0", "chrono", @@ -1915,7 +1965,7 @@ dependencies = [ [[package]] name = "libra-secure-time" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-infallible", "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -1924,7 +1974,7 @@ dependencies = [ [[package]] name = "libra-state-view" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "libra-crypto 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -1935,7 +1985,7 @@ dependencies = [ [[package]] name = "libra-temppath" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "hex", "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -1945,7 +1995,7 @@ dependencies = [ [[package]] name = "libra-trace" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "chrono", @@ -1963,7 +2013,7 @@ dependencies = [ [[package]] name = "libra-types" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "bytes", @@ -1992,7 +2042,7 @@ dependencies = [ [[package]] name = "libra-vault-client" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "base64 0.13.0", "chrono", @@ -2009,7 +2059,7 @@ dependencies = [ [[package]] name = "libra-vm" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "fail", @@ -2035,7 +2085,7 @@ dependencies = [ [[package]] name = "libra-workspace-hack" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" +source = "git+https://github.com/dfinance/libra.git?branch=master#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" dependencies = [ "bytes", "cc", @@ -2044,7 +2094,7 @@ dependencies = [ "num-traits", "petgraph", "serde", - "sha-1 0.9.1", + "sha-1 0.9.2", "subtle", "syn", ] @@ -2052,7 +2102,7 @@ dependencies = [ [[package]] name = "libra-workspace-hack" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "bytes", "cc", @@ -2061,16 +2111,16 @@ dependencies = [ "num-traits", "petgraph", "serde", - "sha-1 0.9.1", + "sha-1 0.9.2", "subtle", "syn", ] [[package]] name = "libssh2-sys" -version = "0.2.19" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca46220853ba1c512fc82826d0834d87b06bcd3c2a42241b7de72f3d2fe17056" +checksum = "df40b13fe7ea1be9b9dffa365a51273816c345fc1811478b57ed7d964fbfc4ce" dependencies = [ "cc", "libc", @@ -2100,9 +2150,9 @@ checksum = "8dd5a6d5999d9907cda8ed67bbd137d3af8085216c2ac62de5be860bd41f304a" [[package]] name = "lock_api" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c" +checksum = "dd96ffd135b2fd7b973ac026d28085defbe8983df057ced3eb4f2130b0831312" dependencies = [ "scopeguard", ] @@ -2175,9 +2225,9 @@ checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" -version = "0.5.6" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +checksum = "157b4208e3059a8f9e78d559edc658e13df41410cb3ae03979c83130067fdd87" dependencies = [ "autocfg", ] @@ -2200,9 +2250,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.22" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" dependencies = [ "cfg-if 0.1.10", "fuchsia-zircon", @@ -2211,7 +2261,7 @@ dependencies = [ "kernel32-sys", "libc", "log", - "miow 0.2.1", + "miow 0.2.2", "net2", "slab", "winapi 0.2.8", @@ -2225,7 +2275,7 @@ checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ "log", "mio", - "miow 0.3.5", + "miow 0.3.6", "winapi 0.3.9", ] @@ -2242,9 +2292,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" dependencies = [ "kernel32-sys", "net2", @@ -2254,9 +2304,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ "socket2", "winapi 0.3.9", @@ -2282,7 +2332,7 @@ dependencies = [ [[package]] name = "move-core-types" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" +source = "git+https://github.com/dfinance/libra.git?branch=master#c46b32d73087ed2afc6c1ac3e78535cac37e3fa9" dependencies = [ "anyhow", "hex", @@ -2302,7 +2352,7 @@ dependencies = [ [[package]] name = "move-core-types" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "enum-iterator", @@ -2325,7 +2375,7 @@ dependencies = [ [[package]] name = "move-coverage" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "bytecode-source-map", @@ -2373,7 +2423,7 @@ dependencies = [ [[package]] name = "move-ir-types" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "codespan 0.8.0", @@ -2388,7 +2438,7 @@ dependencies = [ [[package]] name = "move-lang" version = "0.0.1" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "borrow-graph", @@ -2423,7 +2473,7 @@ dependencies = [ "codespan-reporting 0.8.0", "codespan-reporting 0.9.5", "crossbeam-channel 0.4.4", - "env_logger", + "env_logger 0.7.1", "hex", "lang", "log", @@ -2441,7 +2491,7 @@ dependencies = [ [[package]] name = "move-prover" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "abigen", "anyhow", @@ -2477,10 +2527,31 @@ dependencies = [ "vm", ] +[[package]] +name = "move-resource-viewer" +version = "0.1.1" +dependencies = [ + "anyhow", + "clap 3.0.0-beta.2", + "dfibra", + "dnode-rest-client", + "env_logger 0.8.2", + "git-hash", + "hex", + "http", + "lang", + "log", + "move-compat", + "resource-viewer", + "schemars", + "serde", + "serde_json", +] + [[package]] name = "move-vm-natives" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "byteorder", "libra-crypto 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -2491,7 +2562,7 @@ dependencies = [ "move-vm-types", "once_cell", "rand", - "sha2 0.9.1", + "sha2 0.9.2", "twox-hash", "uint", "vm", @@ -2500,7 +2571,7 @@ dependencies = [ [[package]] name = "move-vm-runtime" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "bytecode-verifier", "fail", @@ -2520,7 +2591,7 @@ dependencies = [ [[package]] name = "move-vm-types" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-canonical-serialization 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "libra-crypto 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -2530,15 +2601,15 @@ dependencies = [ "move-core-types 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "once_cell", "serde", - "sha2 0.9.1", + "sha2 0.9.2", "vm", ] [[package]] name = "native-tls" -version = "0.2.4" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b0d88c06fe90d5ee94048ba40409ef1d9315d86f6f38c2efdaad4fb50c58b2d" +checksum = "6fcc7939b5edc4e4f86b1b4a04bb1498afaaf871b1a6691838ed06fcb48d3a3f" dependencies = [ "lazy_static", "libc", @@ -2554,9 +2625,9 @@ dependencies = [ [[package]] name = "net2" -version = "0.2.35" +version = "0.2.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ebc3ec692ed7c9a255596c67808dee269f64655d8baf7b4f0638e51ba1d6853" +checksum = "d7cf75f38f16cb05ea017784dc6dbfd354f76c223dba37701734c4f5a9337d02" dependencies = [ "cfg-if 0.1.10", "libc", @@ -2580,9 +2651,9 @@ checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" [[package]] name = "num" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3e176191bc4faad357e3122c4747aa098ac880e88b168f106386128736cf4a" +checksum = "8b7a8e9be5e039e2ff869df49155f1c06bd01ade2117ec783e56ab0932b67a8f" dependencies = [ "num-bigint", "num-complex", @@ -2594,9 +2665,9 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f3fc75e3697059fb1bc465e3d8cca6cf92f56854f201158b3f9c77d5a3cfa0" +checksum = "5e9a41747ae4633fce5adffb4d2e81ffc5e89593cb19917f8fb2cc5ff76507bf" dependencies = [ "autocfg", "num-integer", @@ -2645,9 +2716,9 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5fa6d5f418879385b213d905f7cf5bf4aa553d4c380f0152d1d4f2749186fa9" +checksum = "12ac428b1cb17fce6f731001d307d351ec70a6d202fc2e60f7d4c5e42d8f4f07" dependencies = [ "autocfg", "num-bigint", @@ -2667,7 +2738,7 @@ dependencies = [ [[package]] name = "num-variants" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "proc-macro2", @@ -2687,9 +2758,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.4.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad" +checksum = "13bd41f508810a131401606d54ac32a467c97172d74ba7662562ebba5ad07fa0" [[package]] name = "opaque-debug" @@ -2738,15 +2809,15 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "2.3.2" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ac6fe3538f701e339953a3ebbe4f39941aababa8a3f6964635b24ab526daeac" +checksum = "afb2e1c3ee07430c2cf76151675e583e0f19985fa6efae47d6848a3e2c824f85" [[package]] name = "parking_lot" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733" +checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", "lock_api", @@ -2755,12 +2826,11 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +checksum = "d7c6d9b8427445284a09c55be860a15855ab580a417ccad9da88f5a06787ced0" dependencies = [ - "cfg-if 0.1.10", - "cloudabi", + "cfg-if 1.0.0", "instant", "libc", "redox_syscall", @@ -2838,11 +2908,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee41d838744f60d959d7074e3afb6b35c7456d0f61cad38a24e35e6553f73841" +checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7" dependencies = [ - "pin-project-internal 1.0.1", + "pin-project-internal 1.0.2", ] [[package]] @@ -2858,9 +2928,9 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81a4ffa594b66bff340084d4081df649a7dc049ac8d7fc458d8e628bfbbb2f86" +checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" dependencies = [ "proc-macro2", "quote", @@ -2873,6 +2943,12 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" +[[package]] +name = "pin-project-lite" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c" + [[package]] name = "pin-utils" version = "0.1.0" @@ -2887,19 +2963,19 @@ checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "polyval" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5884790f1ce3553ad55fec37b5aaac5882e0e845a2612df744d6c85c9bf046c" +checksum = "b3fd900a291ceb8b99799cc8cd3d1d3403a51721e015bc533528b2ceafcc443c" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "universal-hash", ] [[package]] name = "ppv-lite86" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "pretty" @@ -3071,7 +3147,7 @@ checksum = "9ab346ac5921dc62ffa9f89b7a773907511cdfa5490c572ae9be1be33e8afa4a" dependencies = [ "crossbeam-channel 0.5.0", "crossbeam-deque", - "crossbeam-utils 0.8.0", + "crossbeam-utils 0.8.1", "lazy_static", "num_cpus", ] @@ -3104,9 +3180,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8963b85b8ce3074fecffde43b4b0dded83ce2f367dc8d363afc56679f3ee820b" +checksum = "38cf2c13ed4745de91a5eb834e11c00bcc3709e773173b2ce4c56c9fbde04b9c" dependencies = [ "aho-corasick", "memchr", @@ -3116,9 +3192,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.20" +version = "0.6.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cab7a364d15cde1e505267766a2d3c4e22a843e1a601f0fa7564c0f82ced11c" +checksum = "3b181ba2dcf07aaccad5448e8ead58db5b742cf85dfe035e2227f137a539a189" [[package]] name = "remove_dir_all" @@ -3131,11 +3207,11 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.10.8" +version = "0.10.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9eaa17ac5d7b838b7503d118fa16ad88f440498bf9ffe5424e621f93190d61e" +checksum = "fb15d6255c792356a0f578d8a645c677904dc02e862bebe2ecc18e0c01b9a0ce" dependencies = [ - "base64 0.12.3", + "base64 0.13.0", "bytes", "encoding_rs", "futures-core", @@ -3152,7 +3228,7 @@ dependencies = [ "mime_guess", "native-tls", "percent-encoding", - "pin-project-lite", + "pin-project-lite 0.2.0", "serde", "serde_json", "serde_urlencoded", @@ -3161,10 +3237,33 @@ dependencies = [ "url", "wasm-bindgen", "wasm-bindgen-futures", + "wasm-bindgen-test", "web-sys", "winreg", ] +[[package]] +name = "resource-viewer" +version = "0.1.0" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" +dependencies = [ + "anyhow", + "compiled-stdlib", + "hex", + "libra-canonical-serialization 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", + "libra-state-view", + "libra-types", + "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", + "move-core-types 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", + "move-vm-runtime", + "move-vm-types", + "once_cell", + "serde", + "serde_json", + "vm", + "vm-genesis", +] + [[package]] name = "resources" version = "0.1.0" @@ -3203,6 +3302,37 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "schemars" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "763f667253711994847f7e73befe859d6fff7bea2b7a7f01669d2c5b60765c37" +dependencies = [ + "dyn-clone", + "indexmap", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1d457e2e37415f32b7628ddc5a7fea06ef63bd029ed180d65166e87ca25ce21" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn", +] + +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + [[package]] name = "scopeguard" version = "1.1.0" @@ -3212,7 +3342,7 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratchpad" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "itertools", "libra-crypto 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -3223,9 +3353,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "0.4.4" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64808902d7d99f78eaddd2b4e2509713babc3dc3c85ad6f4c447680f3c01e535" +checksum = "c1759c2e3c8580017a484a7ac56d3abc5a6c1feadf88db2f3633f12ae4268c69" dependencies = [ "bitflags", "core-foundation", @@ -3236,9 +3366,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "0.4.3" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17bf11d99252f512695eb468de5516e5cf75455521e69dfe343f3b74e4748405" +checksum = "f99b9d5e26d2a71633cc4f2ebae7cc9f874044e0c351a27e17892d76dce5678b" dependencies = [ "core-foundation-sys", "libc", @@ -3246,18 +3376,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.117" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88fa983de7720629c9387e9f517353ed404164b1e482c970a90c1a4aaf7dc1a" +checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" dependencies = [ "serde_derive", ] [[package]] name = "serde-generate" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dbbd5f23fb6261d94e4364f4904b881a44f3f6900005d120684036dc7d5239b" +checksum = "550cc56a46476ce825b48af012f4015d4fbc961eb786035ac627d740a516fe80" dependencies = [ "heck", "include_dir", @@ -3301,9 +3431,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.117" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbd1ae72adb44aab48f325a02444a5fc079349a8d804c1fc922aed3f7454c74e" +checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_derive_internals" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dbab34ca63057a1f15280bdf3c39f2b1eb1b54c17e98360e511637aef7418c6" dependencies = [ "proc-macro2", "quote", @@ -3312,9 +3453,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcac07dbffa1c65e7f816ab9eba78eb142c6d44410f4eeba1e26e4f5dfa56b95" +checksum = "1500e84d27fe482ed1dc791a56eddc2f230046a040fa908c08bda1d9fb615779" dependencies = [ "itoa", "ryu", @@ -3334,14 +3475,14 @@ dependencies = [ [[package]] name = "serde_urlencoded" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" dependencies = [ - "dtoa", + "form_urlencoded", "itoa", + "ryu", "serde", - "url", ] [[package]] @@ -3370,12 +3511,12 @@ dependencies = [ [[package]] name = "sha-1" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170a36ea86c864a3f16dd2687712dd6646f7019f301e57537c7f4dc9f5916770" +checksum = "ce3cdf1b5e620a498ee6f2a171885ac7e22f0e12089ec4b3d22b84921792507c" dependencies = [ "block-buffer 0.9.0", - "cfg-if 0.1.10", + "cfg-if 1.0.0", "cpuid-bool", "digest 0.9.0", "opaque-debug 0.3.0", @@ -3395,12 +3536,12 @@ dependencies = [ [[package]] name = "sha2" -version = "0.9.1" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1" +checksum = "6e7aab86fe2149bad8c507606bdb3f4ef5e7b2380eb92350f56122cca72a42a8" dependencies = [ "block-buffer 0.9.0", - "cfg-if 0.1.10", + "cfg-if 1.0.0", "cpuid-bool", "digest 0.9.0", "opaque-debug 0.3.0", @@ -3409,7 +3550,7 @@ dependencies = [ [[package]] name = "short-hex-str" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "mirai-annotations", @@ -3451,17 +3592,17 @@ checksum = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" [[package]] name = "smallvec" -version = "1.4.2" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252" +checksum = "ae524f056d7d770e174287294f562e95044c68e88dec909a00d2094805db9d75" [[package]] name = "socket2" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fa70dc5c8104ec096f4fe7ede7a221d35ae13dcd19ba1ad9a81d2cab9a1c44" +checksum = "2c29947abdee2a218277abeca306f25789c938e500ea5a9d4b12a5a504466902" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", "redox_syscall", "winapi 0.3.9", @@ -3470,7 +3611,7 @@ dependencies = [ [[package]] name = "spec-lang" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "bytecode-source-map", @@ -3500,7 +3641,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stdlib" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "bytecode-verifier", @@ -3514,7 +3655,7 @@ dependencies = [ "move-lang", "move-prover", "rayon", - "sha2 0.9.1", + "sha2 0.9.2", "transaction-builder-generator", "vm", ] @@ -3522,7 +3663,7 @@ dependencies = [ [[package]] name = "storage-interface" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "itertools", @@ -3552,9 +3693,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "structopt" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126d630294ec449fae0b16f964e35bf3c74f940da9dca17ee9b905f7b3112eb8" +checksum = "5277acd7ee46e63e5168a80734c9f6ee81b1367a7d8772a2d765df2a3705d28c" dependencies = [ "clap 2.33.3", "lazy_static", @@ -3563,9 +3704,9 @@ dependencies = [ [[package]] name = "structopt-derive" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e51c492f9e23a220534971ff5afc14037289de430e3c83f9daf6a1b6ae91e8" +checksum = "5ba9cdfda491b814720b6b06e0cac513d922fc407582032e8706e9f137976f90" dependencies = [ "heck", "proc-macro-error", @@ -3582,9 +3723,9 @@ checksum = "343f3f510c2915908f155e94f17220b19ccfacf2a64a2a5d8004f2c3e311e7fd" [[package]] name = "syn" -version = "1.0.48" +version = "1.0.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc371affeffc477f42a221a1e4297aedcea33d47d19b61455588bd9d8f6b19ac" +checksum = "9a2af957a63d6bd42255c359c93d9bfdb97076bd3b820897ce55ffbfbf107f44" dependencies = [ "proc-macro2", "quote", @@ -3619,9 +3760,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ "winapi-util", ] @@ -3646,18 +3787,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42" +checksum = "0e9ae34b84616eedaaf1e9dd6026dbe00dcafa92aa0c8077cb69df1fcfe5e53e" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab" +checksum = "9ba20f23e85b10754cd195504aebf6a27e2e6cbe28c17778a0c930724628dd56" dependencies = [ "proc-macro2", "quote", @@ -3704,15 +3845,24 @@ dependencies = [ [[package]] name = "tinyvec" -version = "0.3.4" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238ce071d267c5710f9d31451efec16c5ee22de34df17cc05e56cbc92e967117" +checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f" +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 = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d34ca54d84bf2b5b4d7d31e901a8464f7b60ac145a284fba25ceb801f2ddccd" +checksum = "a6d7ad61edd59bfcc7e80dababf0f4aed2e6d5e0ba1659356ae889752dfc12ff" dependencies = [ "bytes", "fnv", @@ -3725,7 +3875,7 @@ dependencies = [ "mio-named-pipes", "mio-uds", "num_cpus", - "pin-project-lite", + "pin-project-lite 0.1.11", "signal-hook-registry", "slab", "tokio-macros", @@ -3734,9 +3884,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +checksum = "e44da00bfc73a25f814cd8d7e57a68a5c31b74b3152a0a1d1f590c97ed06265a" dependencies = [ "proc-macro2", "quote", @@ -3763,7 +3913,7 @@ dependencies = [ "futures-core", "futures-sink", "log", - "pin-project-lite", + "pin-project-lite 0.1.11", "tokio", ] @@ -3784,13 +3934,13 @@ checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" [[package]] name = "tracing" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27" +checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "log", - "pin-project-lite", + "pin-project-lite 0.2.0", "tracing-core", ] @@ -3816,7 +3966,7 @@ dependencies = [ [[package]] name = "transaction-builder" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "libra-workspace-hack 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", "mirai-annotations", @@ -3826,7 +3976,7 @@ dependencies = [ [[package]] name = "transaction-builder-generated" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "compiled-stdlib", "libra-canonical-serialization 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -3840,7 +3990,7 @@ dependencies = [ [[package]] name = "transaction-builder-generator" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "heck", @@ -3923,18 +4073,18 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.13" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" +checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796" [[package]] name = "unicode-width" @@ -3960,9 +4110,9 @@ dependencies = [ [[package]] name = "ureq" -version = "1.5.1" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed21e32e4e3ff89891022affaa7091c3a164d5049cb3872f1cf0fd6ccd9fc8f7" +checksum = "294b85ef5dbc3670a72e82a89971608a1fcc4ed5c7c5a2895230d31a95f0569b" dependencies = [ "base64 0.13.0", "chunked_transfer", @@ -3977,10 +4127,11 @@ dependencies = [ [[package]] name = "url" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829d4a8476c35c9bf0bbce5a3b23f4106f79728039b726d292bb93bc106787cb" +checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" dependencies = [ + "form_urlencoded", "idna", "matches", "percent-encoding", @@ -4008,7 +4159,7 @@ checksum = "b5a972e5669d67ba988ce3dc826706fb0a8b01471c088cb0b6110b805cc36aed" [[package]] name = "vm" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "libra-crypto 0.1.0 (git+https://github.com/dfinance/libra.git?branch=release-1.0)", @@ -4023,7 +4174,7 @@ dependencies = [ [[package]] name = "vm-genesis" version = "0.1.0" -source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#898e93c4bfa41732800920136dc8b0f13403df01" +source = "git+https://github.com/dfinance/libra.git?branch=release-1.0#6c97f98a43d72eaa0ce06788b1466ac085525447" dependencies = [ "anyhow", "bytecode-verifier", @@ -4080,11 +4231,11 @@ checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" [[package]] name = "wasm-bindgen" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" +checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "serde", "serde_json", "wasm-bindgen-macro", @@ -4092,9 +4243,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f22b422e2a757c35a73774860af8e112bff612ce6cb604224e8e47641a9e4f68" +checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" dependencies = [ "bumpalo", "lazy_static", @@ -4107,11 +4258,11 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.18" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7866cab0aa01de1edf8b5d7936938a7e397ee50ce24119aef3e1eaa3b6171da" +checksum = "1fe9756085a84584ee9457a002b7cdfe0bfff169f45d2591d8be1345a6780e35" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "js-sys", "wasm-bindgen", "web-sys", @@ -4119,9 +4270,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b13312a745c08c469f0b292dd2fcd6411dba5f7160f593da6ef69b64e407038" +checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4129,9 +4280,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.68" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f249f06ef7ee334cc3b8ff031bfc11ec99d00f34d86da7498396dc1e3b1498fe" +checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" dependencies = [ "proc-macro2", "quote", @@ -4142,15 +4293,39 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.68" +version = "0.2.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" + +[[package]] +name = "wasm-bindgen-test" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0355fa0c1f9b792a09b6dcb6a8be24d51e71e6d74972f9eb4a44c4c004d24a25" +dependencies = [ + "console_error_panic_hook", + "js-sys", + "scoped-tls", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-test-macro", +] + +[[package]] +name = "wasm-bindgen-test-macro" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d649a3145108d7d3fbcde896a468d1bd636791823c9921135218ad89be08307" +checksum = "27e07b46b98024c2ba2f9e83a10c2ef0515f057f2da299c1762a2017de80438b" +dependencies = [ + "proc-macro2", + "quote", +] [[package]] name = "web-sys" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bf6ef87ad7ae8008e15a355ce696bed26012b7caa21605188cfd8214ab51e2d" +checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/Cargo.toml b/Cargo.toml index 467498a3..0e299b56 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,8 +6,10 @@ members = [ "lang", "lang/compat", "lang/disassembler", + "resource-viewer", "resources", "common/git-hash", + "common/dnode-rest-client", ] [profile.release] diff --git a/common/dnode-rest-client/Cargo.toml b/common/dnode-rest-client/Cargo.toml new file mode 100644 index 00000000..b11df361 --- /dev/null +++ b/common/dnode-rest-client/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "dnode-rest-client" +version = "0.1.0" +authors = ["Alex Koz. "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +log = "0.4" +http = "0.2" +reqwest = { version = "0.10", features = ["blocking", "json"] } +serde = { version = "1.0", features = ["derive", "rc"] } +serde_json = "1.0" +hex = "0.4" + +# move-lang deps: +libra = { package = "dfibra", git = "https://github.com/dfinance/libra.git", branch = "release-1.0" } + + +anyhow = { version = "1.0", default-features = false } + + +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +anyhow = { version = "1.0", default-features = true } diff --git a/common/dnode-rest-client/src/blocking.rs b/common/dnode-rest-client/src/blocking.rs new file mode 100644 index 00000000..4e6b37d7 --- /dev/null +++ b/common/dnode-rest-client/src/blocking.rs @@ -0,0 +1,79 @@ +use http::Uri; +use anyhow::Result; +use libra::prelude::*; +use crate::ds::*; + +pub fn get_module<'a, T: Into<&'a Uri>>(module_id: &ModuleId, url: T) -> Result> { + let path = AccessPath::code_access_path(module_id); + data_request(&path, url) +} + +pub fn get_resource<'a, T: Into<&'a Uri>>(res: &ResourceKey, url: T) -> Result> { + let path = AccessPath::resource_access_path(res); + data_request(&path, url) +} + +pub fn data_request<'a, T: Into<&'a Uri>>(path: &AccessPath, url: T) -> Result> { + let url = format!( + "{base_url}vm/data/{address}/{path}", + base_url = url.into(), + address = hex::encode(&path.address), + path = hex::encode(&path.path) + ); + + trace!("req: {} : {}", url, &path); + + let resp = reqwest::blocking::get(&url)?; + let status = resp.status(); + let res: Response = resp.json()?; + + trace!("res: ({}) {:#?}", status, res); + + match res.body { + ResponseBody::Result { value } => Ok(hex::decode(&value)?), + ResponseBody::Error { message } => Err(anyhow!( + "Failed to load:'{}' ({}) [{}]", + url, + status, + message + )), + } +} + +pub mod client { + use super::*; + use libra::vm::StructTag; + + pub struct DnodeRestClient { + uri: Uri, + } + + impl DnodeRestClient { + pub fn new>(uri: T) -> Self { + Self { uri: uri.into() } + } + } + + impl RemoteCache for DnodeRestClient { + fn get_module(&self, id: &ModuleId) -> VMResult>> { + let res = get_module(id, &self.uri).ok(); + if res.is_some() && res.as_ref().unwrap().is_empty() { + error!("Err: empty module for {}", id); + } + Ok(res) + } + + fn get_resource( + &self, + addr: &AccountAddress, + tag: &StructTag, + ) -> PartialVMResult>> { + let key = ResourceKey::new(*addr, tag.to_owned()); + let res = get_resource(&key, &self.uri).ok(); + if res.is_some() && res.as_ref().unwrap().is_empty() { + error!("Err: empty resource for {:?}", key); + } + Ok(res) + } + } +} diff --git a/common/dnode-rest-client/src/ds.rs b/common/dnode-rest-client/src/ds.rs new file mode 100644 index 00000000..1b674779 --- /dev/null +++ b/common/dnode-rest-client/src/ds.rs @@ -0,0 +1,26 @@ +use serde::{Serialize, Deserialize}; + +/// Data Api response +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct Response { + /// Current block number + pub height: String, + #[serde(flatten)] + pub body: ResponseBody, +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +#[serde(rename_all = "lowercase")] +pub enum ResponseBody { + /// Success response + Result { + /// Hex encoded bytecode + value: String, + }, + + ///Error response + Error { + #[serde(rename = "error")] + message: String, + }, +} diff --git a/common/dnode-rest-client/src/lib.rs b/common/dnode-rest-client/src/lib.rs new file mode 100644 index 00000000..254c9d82 --- /dev/null +++ b/common/dnode-rest-client/src/lib.rs @@ -0,0 +1,7 @@ +#[macro_use] +extern crate log; +#[macro_use] +extern crate anyhow; + +pub mod blocking; +pub mod ds; diff --git a/dove/src/index/resolver/chain/loader.rs b/dove/src/index/resolver/chain/loader.rs index 3c2f6982..4647a204 100644 --- a/dove/src/index/resolver/chain/loader.rs +++ b/dove/src/index/resolver/chain/loader.rs @@ -68,20 +68,21 @@ impl BytecodeLoader for RestBytecodeLoader { #[derive(Deserialize, Serialize, Debug, Clone, Default)] pub struct LoaderResponse { /// Result. - result: Response, + pub result: Response, } /// Success response. #[derive(Deserialize, Serialize, Debug, Clone, Default)] pub struct Response { /// Hex encoded bytecode. - value: String, + pub value: String, } ///Error response. #[derive(Deserialize, Serialize, Debug, Clone, Default)] pub struct LoaderErrorResponse { - error: String, + /// Error message. + pub error: String, } /// Module loader. diff --git a/resource-viewer/Cargo.toml b/resource-viewer/Cargo.toml new file mode 100644 index 00000000..0a836ebe --- /dev/null +++ b/resource-viewer/Cargo.toml @@ -0,0 +1,32 @@ +[package] +name = "move-resource-viewer" +version = "0.1.1" +authors = ["Alex Koz. "] +edition = "2018" + + +[dependencies] +log = "0.4" +anyhow = { version = "1.0", default-features = false } + +http = "0.2" + +serde = { version = "1.0", features = ["derive", "rc"] } +serde_json = "1.0" +schemars = { version = "0.8", features = ["default", "derive", "preserve_order"] } +hex = "0.4.2" + +# move-lang deps: +libra = { package = "dfibra", git = "https://github.com/dfinance/libra.git", branch = "release-1.0" } +rv = { git = "https://github.com/dfinance/libra.git", branch = "release-1.0", package = "resource-viewer" } + +lang = { path = "../lang" } +git-hash = { path = "../common/git-hash" } +compat = { path = "../lang/compat", package = "move-compat"} +dnclient = { path = "../common/dnode-rest-client", package = "dnode-rest-client" } + +# cli: +[target.'cfg(not(target_arch = "wasm32"))'.dependencies] +anyhow = { version = "1.0", default-features = true } +clap = { version = "3.0.0-beta.2", features = [ "default", "suggestions", "color" ] } +env_logger = "0.8.2" diff --git a/resource-viewer/src/main.rs b/resource-viewer/src/main.rs new file mode 100644 index 00000000..7a6cafc6 --- /dev/null +++ b/resource-viewer/src/main.rs @@ -0,0 +1,162 @@ +// Simple querie examples: +// "0x1::Account::Balance<0x1::XFI::T>", +// "0x1::Account::Balance<0x1::Coins::ETH>", +// "0x1::Account::Balance<0x1::Coins::BTC>", +// "0x1::Account::Balance<0x1::Coins::USDT>", +// "0x1::Account::Balance<0x1::Coins::SXFI>", + +#[macro_use] +extern crate log; +#[macro_use] +extern crate anyhow; + +use std::path::{Path, PathBuf}; +use anyhow::{Result, Error, anyhow}; +use http::Uri; +use clap::Clap; +use libra::prelude::*; +use lang::compiler::bech32::{bech32_into_libra, HRP}; +use dnclient::blocking as net; + +mod ser; +mod tte; + +const VERSION: &str = git_hash::crate_version_with_git_hash_short!(); +const JSON_SCHEMA_STDOUT: &str = "-"; + +#[derive(Clap, Debug)] +#[clap(name = "Move resource viewer", version = VERSION)] +struct Cfg { + /// Owner's address + #[clap(long, short)] + address: String, + + /// Query in `TypeTag` format. + /// Mainly, in most cases should be StructTag. + /// Additionaly can contain index at the end. + /// Query examples: + /// "0x1::Account::Balance<0x1::XFI::T>", + /// "0x1::Account::Balance<0x1::Coins::ETH>" + #[clap(long, short)] + query: tte::TypeTagExt, + + /// Output file path + #[clap(long, short)] + output: PathBuf, + + /// Sets output format to JSON. + /// Optional, `true` if output file extension is .json + #[clap(long, short)] + json: Option, + + /// Node REST API address + #[clap(long)] + api: Uri, + + /// Enables compatibility mode + #[clap(long, short)] + compat: bool, + + /// Export JSON schema for output format. + /// Special value for write to stdout: "-" + #[clap(long = "json-schema")] + json_schema: Option, +} + +fn main() { + if let Err(err) = run() { + error!("{}", err) + } else { + info!("completed successfully") + } +} + +fn run() -> Result<(), Error> { + env_logger::init(); + + let cfg = Cfg::parse(); + + produce_json_schema(&cfg); + + let host = cfg.api; + let output = cfg.output; + let json = cfg.json.unwrap_or_else(|| { + output + .extension() + .map(|ext| ext == "json") + .unwrap_or_default() + }); + let (tte, index) = cfg.query.into_inner(); + let addr = if cfg.address.starts_with(HRP) { + AccountAddress::from_hex_literal(&bech32_into_libra(&cfg.address)?) + } else { + AccountAddress::from_hex_literal(&cfg.address) + }?; + + match tte { + TypeTag::Struct(st) => { + let key = ResourceKey::new(addr, st.clone()); + let res = net::get_resource(&key, &host); + res.map(|bytes| { + if !bytes.is_empty() { + let client = net::client::DnodeRestClient::new(host); + + // Internally produce FatStructType (with layout) for StructTag by + // resolving & de-.. entire deps-chain. + let annotator = rv::MoveValueAnnotator::new_no_stdlib(&client); + + annotator + .view_resource(&st, &bytes) + .and_then(|result| { + // debug!("result: {:#?}", result); + + if json { + serde_json::ser::to_string_pretty( + &ser::AnnotatedMoveStructHelper(result), + ) + .map_err(|err| anyhow!("{}", err)) + } else { + Ok(format!("{}", result)) + } + }) + .map(|result| write_output(&output, result)) + } else { + Err(anyhow!("Err: res is empty")) + } + }) + .and_then(|result| result) + } + + TypeTag::Vector(tt) => { + // TODO: query using index, seed + Err(anyhow!( + "Err: unsupported root type Vec<{}>{:?}", + tt, + index.map(|v| [v]).unwrap_or_default() + )) + } + + _ => Err(anyhow!("Err: unsupported type {}", tte)), + } +} + +fn produce_json_schema(cfg: &Cfg) { + if let Some(path) = cfg.json_schema.as_ref() { + let schema = ser::produce_json_schema(); + let render = serde_json::to_string_pretty(&schema).unwrap(); + if path.as_os_str() == JSON_SCHEMA_STDOUT { + println!("{}", &render); + } else { + write_output(&path, render); + info!("schema generated successfully"); + } + } +} + +fn write_output(path: &Path, result: String) { + use std::io::prelude::*; + std::fs::File::create(path) + .and_then(|mut f| f.write_all(result.as_bytes())) + .map_err(|err| error!("Err: cannot write output: {}", err)) + .ok(); +} diff --git a/resource-viewer/src/ser.rs b/resource-viewer/src/ser.rs new file mode 100644 index 00000000..edbbdfeb --- /dev/null +++ b/resource-viewer/src/ser.rs @@ -0,0 +1,170 @@ +use libra::{ + prelude::*, + vm::{StructTag}, +}; +use libra::account::Identifier; +use rv::{AnnotatedMoveStruct, AnnotatedMoveValue}; +use serde::Serialize; +use schemars::{JsonSchema, schema_for}; +use schemars::schema::RootSchema; + +pub fn produce_json_schema() -> RootSchema { + schema_for!(AnnotatedMoveStructExt) +} + +#[derive(Serialize, JsonSchema)] +pub struct AnnotatedMoveStructHelper( + #[serde(with = "AnnotatedMoveStructExt")] pub AnnotatedMoveStruct, +); + +#[derive(Serialize, JsonSchema)] +#[serde(remote = "rv::AnnotatedMoveStruct")] +struct AnnotatedMoveStructExt { + is_resource: bool, + #[serde(rename = "type")] + #[serde(with = "schema_support::StructTagExt")] + type_: StructTag, + #[schemars(schema_with = "schema_support::vec_identifier_annotated_move_value")] + #[serde(serialize_with = "vec_annotated_move_value_mapped::serialize")] + value: Vec<(Identifier, AnnotatedMoveValue)>, +} + +#[derive(Serialize, JsonSchema)] +#[serde(remote = "rv::AnnotatedMoveValue")] +enum AnnotatedMoveValueExt { + U8(u8), + U64(u64), + U128(u128), + Bool(bool), + Address(#[serde(with = "AccountAddressExt")] AccountAddress), + Vector( + // #[serde(with = "AnnotatedMoveValueExt")] + #[schemars(schema_with = "schema_support::vec_annotated_move_value")] + #[serde(serialize_with = "vec_annotated_move_value::serialize")] + Vec, + ), + Bytes(Vec), + Struct(#[serde(with = "AnnotatedMoveStructExt")] AnnotatedMoveStruct), +} + +#[derive(Serialize, JsonSchema)] +#[serde(remote = "AccountAddress")] +struct AccountAddressExt( + #[serde(getter = "AccountAddressExt::ext_to_u8")] pub [u8; AccountAddress::LENGTH], +); +impl AccountAddressExt { + pub fn ext_to_u8(addr: &AccountAddress) -> [u8; AccountAddress::LENGTH] { + addr.to_u8() + } +} + +#[derive(Serialize, JsonSchema)] +#[serde(remote = "Identifier")] +struct IdentifierExt(#[serde(getter = "Identifier::to_string")] pub String); + +mod vec_annotated_move_value { + use super::{AnnotatedMoveValue, AnnotatedMoveValueExt}; + use serde::{Serialize, Serializer}; + use schemars::JsonSchema; + + pub fn serialize(vec: &[AnnotatedMoveValue], serializer: S) -> Result + where + S: Serializer, + { + #[derive(Serialize, JsonSchema)] + struct Helper<'a>(#[serde(with = "AnnotatedMoveValueExt")] &'a AnnotatedMoveValue); + + vec.iter() + .map(Helper) + .collect::>() + .serialize(serializer) + } +} + +mod vec_annotated_move_value_mapped { + use super::{AnnotatedMoveValue, AnnotatedMoveValueExt}; + use super::{Identifier, IdentifierExt}; + use serde::{Serialize, Serializer}; + use schemars::JsonSchema; + + pub fn serialize( + vec: &[(Identifier, AnnotatedMoveValue)], + serializer: S, + ) -> Result + where + S: Serializer, + { + #[derive(Serialize, JsonSchema)] + struct Helper<'a> { + #[serde(with = "IdentifierExt")] + id: &'a Identifier, + #[serde(with = "AnnotatedMoveValueExt")] + value: &'a AnnotatedMoveValue, + } + + vec.iter() + .map(|(id, value)| Helper { id, value }) + .collect::>() + .serialize(serializer) + } +} + +mod schema_support { + use super::*; + use schemars::{ + gen::SchemaGenerator, + schema::{ArrayValidation, InstanceType, Schema, SchemaObject, SingleOrVec}, + }; + + #[derive(Serialize, JsonSchema)] + #[serde(remote = "StructTag")] + pub struct StructTagExt { + #[serde(with = "AccountAddressExt")] + pub address: AccountAddress, + #[serde(with = "IdentifierExt")] + pub module: Identifier, + #[serde(with = "IdentifierExt")] + pub name: Identifier, + #[schemars(schema_with = "vec_type_tag")] + pub type_params: Vec, + } + + #[derive(Serialize, JsonSchema)] + #[serde(remote = "TypeTag")] + pub enum TypeTagExt { + Bool, + U8, + U64, + U128, + Address, + Signer, + Vector(#[serde(with = "schema_support::TypeTagExt")] Box), + Struct(#[serde(with = "schema_support::StructTagExt")] StructTag), + } + + pub fn vec_type_tag(gen: &mut SchemaGenerator) -> Schema { + schema_vec::(gen) + } + + pub fn vec_annotated_move_value(gen: &mut SchemaGenerator) -> Schema { + schema_vec::(gen) + } + + pub fn vec_identifier_annotated_move_value(gen: &mut SchemaGenerator) -> Schema { + schema_vec::<(IdentifierExt, AnnotatedMoveValueExt)>(gen) + } + + pub fn schema_vec(gen: &mut SchemaGenerator) -> Schema { + Schema::Object(SchemaObject { + instance_type: Some(SingleOrVec::Single(InstanceType::Array.into())), + array: Some( + ArrayValidation { + items: Some(SingleOrVec::Single(gen.subschema_for::().into())), + ..Default::default() + } + .into(), + ), + ..Default::default() + }) + } +} diff --git a/resource-viewer/src/tte.rs b/resource-viewer/src/tte.rs new file mode 100644 index 00000000..b0ba47d4 --- /dev/null +++ b/resource-viewer/src/tte.rs @@ -0,0 +1,165 @@ +use std::str::FromStr; + +use anyhow::{Result, Error, bail}; + +use libra::{ + compiler::{ModuleAccess_, ModuleIdent_, Type, Type_}, + vm::StructTag, +}; +use libra::move_lang::parser::lexer::{Lexer, Tok}; +use libra::move_lang::parser::syntax::{parse_num, parse_type}; +use libra::account::Identifier; +use libra::prelude::*; + +#[derive(Debug)] +pub struct TypeTagExt { + tt: TypeTag, + i: Option, +} + +impl FromStr for TypeTagExt { + type Err = Error; + + fn from_str(s: &str) -> Result { + self::parse(s) + } +} + +impl Into<(TypeTag, Option)> for TypeTagExt { + fn into(self) -> (TypeTag, Option) { + (self.tt, self.i) + } +} + +impl TypeTagExt { + pub fn into_inner(self) -> (TypeTag, Option) { + self.into() + } +} + +fn unwrap_spanned_ty(ty: Type) -> Result { + fn unwrap_spanned_ty_(ty: Type, this: Option) -> Result { + let st = match ty.value { + Type_::Apply(ma, mut ty_params) => { + match (ma.value, this) { + // N + (ModuleAccess_::Name(name), this) => match name.value.as_ref() { + "bool" => TypeTag::Bool, + "u8" => TypeTag::U8, + "u64" => TypeTag::U64, + "u128" => TypeTag::U128, + "address" => TypeTag::Address, + "signer" => TypeTag::Signer, + "Vec" if ty_params.len() == 1 => TypeTag::Vector( + unwrap_spanned_ty_(ty_params.pop().unwrap(), this) + .unwrap() + .into(), + ), + _ => bail!( + "Could not parse input: type without struct name & module address" + ), + }, + // M.S + (ModuleAccess_::ModuleAccess(_module, _struct_name), None) => { + bail!("Could not parse input: type without module address"); + } + // M.S + parent address + (ModuleAccess_::ModuleAccess(name, struct_name), Some(this)) => { + TypeTag::Struct(StructTag { + address: this, + module: Identifier::new(name.0.value)?, + name: Identifier::new(struct_name.value)?, + type_params: ty_params + .into_iter() + .map(|ty| unwrap_spanned_ty_(ty, Some(this))) + .map(|res| match res { + Ok(st) => st, + Err(err) => panic!("{:?}", err), + }) + .collect(), + }) + } + + // OxADDR.M.S + (ModuleAccess_::QualifiedModuleAccess(module_id, struct_name), _) => { + let ModuleIdent_ { name, address } = module_id.0.value; + let address = AccountAddress::new(address.to_u8()); + TypeTag::Struct(StructTag { + address, + module: Identifier::new(name.0.value)?, + name: Identifier::new(struct_name.value)?, + type_params: ty_params + .into_iter() + .map(|ty| unwrap_spanned_ty_(ty, Some(address))) + .map(|res| match res { + Ok(st) => st, + Err(err) => panic!("{:?}", err), + }) + .collect(), + }) + } + } + } + _ => { + bail!("Could not parse input: unsupported type"); + } + }; + + Ok(st) + } + + unwrap_spanned_ty_(ty, None) +} + +pub fn parse(s: &str) -> Result { + let map_err = |err| anyhow!("{:?}", err); + let mut lexer = Lexer::new(s, "query", Default::default()); + lexer.advance().map_err(map_err)?; + + let ty = parse_type(&mut lexer).map_err(map_err)?; + let tt = unwrap_spanned_ty(ty)?; + + let mut i = None; + while lexer.peek() != Tok::EOF { + let tok = lexer.peek(); + lexer.advance().map_err(map_err)?; + + match tok { + Tok::LBracket => i = parse_num(&mut lexer).ok(), + _ => break, + } + } + + Ok(TypeTagExt { tt, i }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse() { + assert!(parse("0x1::Foo").is_err()); + + let inputs = [ + "0x1::Foo::Res", + "0x1::Foo::Res", + "0x1::Foo::Res<0x1::Bar::Struct>", + "0x1::Foo::Res<0x1::Bar::T>[42]", + "0x1::Foo::Res<0x1::Bar::T>[42]", + "0x1::Foo::Res>", + "0x1::Foo::Res>", + "0x1::Foo::Res>[42]", + "0x1::Foo::Bar::Ignored", + ]; + + inputs + .iter() + .cloned() + .map(|inp| (inp, parse(inp))) + .for_each(|(inp, res)| { + assert!(res.is_ok(), "failed on '{}'", inp); + println!("{:?}", res.unwrap()); + }); + } +}