diff --git a/build.sh b/build.sh index 9dd7d12a..e6b08c01 100755 --- a/build.sh +++ b/build.sh @@ -1,6 +1,9 @@ #!/bin/bash -xv set -euo pipefail +# Create C to Rust bindings +#bindgen libra-dev/include/data.h --whitelist-type=CEventHandle --whitelist-type=CDevAccountResource -o libra-dev/src/data.rs + # Build libra-dev first cd libra-dev cargo build diff --git a/libra-dev/Cargo.lock b/libra-dev/Cargo.lock index 451b350d..6ec47074 100644 --- a/libra-dev/Cargo.lock +++ b/libra-dev/Cargo.lock @@ -8,6 +8,14 @@ dependencies = [ "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ansi_term" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "arc-swap" version = "0.4.3" @@ -71,11 +79,27 @@ name = "bech32" version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bit-vec" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "bitflags" version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "blake2" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "blake2b_simd" version = "0.5.9" @@ -105,11 +129,46 @@ dependencies = [ "byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "bs58" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "byte-tools" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "bytecode-source-map" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "bytecode-verifier 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ir-to-bytecode-syntax 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-failure-ext 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "vm 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", +] + +[[package]] +name = "bytecode-verifier" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "libra-failure-ext 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "mirai-annotations 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)", + "vm 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "vm-runtime-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", +] + [[package]] name = "byteorder" version = "1.3.2" @@ -132,6 +191,11 @@ dependencies = [ "ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "c_linked_list" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "cc" version = "1.0.47" @@ -153,6 +217,20 @@ dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "clap" +version = "2.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "atty 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "clear_on_drop" version = "0.2.3" @@ -169,6 +247,26 @@ dependencies = [ "bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "codespan" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "failure 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "codespan-reporting" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "constant_time_eq" version = "0.1.4" @@ -270,6 +368,11 @@ dependencies = [ "subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "data-encoding" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "derivative" version = "1.0.3" @@ -398,6 +501,26 @@ dependencies = [ "typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "get_if_addrs" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "get_if_addrs-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "get_if_addrs-sys" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "getrandom" version = "0.1.13" @@ -435,6 +558,16 @@ dependencies = [ "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "idna" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-normalization 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "iovec" version = "0.1.4" @@ -443,6 +576,34 @@ dependencies = [ "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "ir-to-bytecode" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "bytecode-source-map 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ir-to-bytecode-syntax 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-failure-ext 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", + "vm 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", +] + +[[package]] +name = "ir-to-bytecode-syntax" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libra-failure-ext 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "regex 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "itertools" version = "0.8.1" @@ -479,6 +640,25 @@ dependencies = [ "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "libra-config" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "get_if_addrs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libra-crypto 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-failure-ext 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-tools 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "mirai-annotations 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "libra-crypto" version = "0.1.0" @@ -520,9 +700,12 @@ dependencies = [ name = "libra-dev" version = "0.1.0" dependencies = [ + "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", "libra-canonical-serialization 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", "libra-crypto 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "transaction-builder 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", ] [[package]] @@ -567,6 +750,15 @@ dependencies = [ "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "libra-tools" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "libra-types" version = "0.1.0" @@ -605,6 +797,16 @@ name = "mach_o_sys" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "matches" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "maybe-uninit" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "memchr" version = "2.2.1" @@ -629,6 +831,11 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "mirai-annotations" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "multimap" version = "0.4.0" @@ -681,6 +888,11 @@ name = "opaque-debug" version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "ordermap" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "pairing" version = "0.14.2" @@ -690,12 +902,49 @@ dependencies = [ "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "parity-multiaddr" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", + "bs58 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "parity-multihash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", + "unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "percent-encoding" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "petgraph" version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fixedbitset 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -711,6 +960,16 @@ dependencies = [ "toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "proc-macro-error" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "proc-macro2" version = "0.4.30" @@ -1084,6 +1343,17 @@ dependencies = [ "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "sha-1" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", + "digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", + "fake-simd 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "sha2" version = "0.8.0" @@ -1169,6 +1439,52 @@ dependencies = [ "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "smallvec" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "stdlib" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "bytecode-source-map 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "bytecode-verifier 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "ir-to-bytecode 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", +] + +[[package]] +name = "strsim" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "structopt" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "structopt-derive" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "subtle" version = "1.0.0" @@ -1237,6 +1553,22 @@ dependencies = [ "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "termcolor" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "textwrap" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "thread-id" version = "3.3.0" @@ -1300,16 +1632,51 @@ dependencies = [ "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "transaction-builder" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "ir-to-bytecode 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libra-config 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-crypto 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "stdlib 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "vm 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", +] + [[package]] name = "typenum" version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-bidi" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "unicode-normalization" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "unicode-segmentation" version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unicode-width" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "unicode-xid" version = "0.1.0" @@ -1320,6 +1687,58 @@ name = "unicode-xid" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "unsigned-varint" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "url" +version = "1.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", + "percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "vec_map" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "vm" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libra-canonical-serialization 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-crypto 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-failure-ext 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "mirai-annotations 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "vm-runtime-types" +version = "0.1.0" +source = "git+https://github.com/libra/libra.git?branch=testnet#7bfcd43b9a765ba42e05d682087fd8acde323a7d" +dependencies = [ + "bit-vec 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libra-canonical-serialization 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-crypto 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-failure-ext 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", + "serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)", + "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", + "vm 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)", +] + [[package]] name = "wasi" version = "0.7.0" @@ -1334,6 +1753,11 @@ dependencies = [ "libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "winapi" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "winapi" version = "0.3.8" @@ -1348,11 +1772,28 @@ name = "winapi-i686-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "winapi-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "wincolor" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "x25519-dalek" version = "0.5.2" @@ -1365,6 +1806,7 @@ dependencies = [ [metadata] "checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d" +"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum arc-swap 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f1a1eca3195b729bbd64e292ef2f5fff6b1c28504fed762ce2b1013dde4d8e92" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cff77d8686867eceff3105329d4698d96c2391c176d5d03adc90c7389162b5b8" @@ -1374,19 +1816,28 @@ dependencies = [ "checksum backtrace-sys 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)" = "5d6575f128516de27e3ce99689419835fce9643a9b215a14d2b5b685be018491" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bech32 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "58946044516aa9dc922182e0d6e9d124a31aafe6b421614654eb27cf90cec09c" +"checksum bit-vec 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a4523a10839ffae575fb08aa3423026c8cb4687eef43952afb956229d4f246f7" "checksum bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" +"checksum blake2 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "94cb07b0da6a73955f8fb85d24c466778e70cda767a568229b104f0264089330" "checksum blake2b_simd 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b83b7baab1e671718d78204225800d6b170e648188ac7dc992e9d6bddf87d0c0" "checksum block-buffer 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" "checksum block-padding 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +"checksum bs58 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "c95ee6bba9d950218b6cc910cf62bc9e0a171d0f4537e3627b0f54d08549b188" "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" +"checksum bytecode-source-map 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" +"checksum bytecode-verifier 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a7c3dd8985a7111efc5c80b44e23ecdd8c007de8ade3b96595387e812b957cf5" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" "checksum c2-chacha 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "214238caa1bf3a496ec3392968969cab8549f96ff30652c9e56885329315f6bb" +"checksum c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" "checksum cc 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)" = "aa87058dce70a3ff5621797f1506cb837edd02ac4c0ae642b4542dce802908b8" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" "checksum chrono 0.4.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e8493056968583b0193c1bb04d6f7684586f3726992d6c573261941a895dbd68" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum clear_on_drop 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "97276801e127ffb46b66ce23f35cc96bd454fa311294bced4bbace7baa8b1d17" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" +"checksum codespan 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "004def512a9848b23a68ed110927d102b0e6d9f3dc732e28570879afde051f8c" +"checksum codespan-reporting 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab081a14ab8f9598ce826890fe896d0addee68c7a58ab49008369ccbb51510a8" "checksum constant_time_eq 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "995a44c877f9212528ccc74b21a232f66ad69001e40ede5bcee2ac9ef2657120" "checksum crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e" "checksum crossbeam-channel 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "acec9a3b0b3559f15aee4f90746c4e5e293b701c0f7d3925d24e01645267b68c" @@ -1398,6 +1849,7 @@ dependencies = [ "checksum crunchy 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" "checksum crypto-mac 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" "checksum curve25519-dalek 1.2.3 (git+https://github.com/calibra/curve25519-dalek.git?branch=fiat)" = "" +"checksum data-encoding 2.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f4f47ca1860a761136924ddd2422ba77b2ea54fe8cc75b9040804a0d9d32ad97" "checksum derivative 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "942ca430eef7a3806595a6737bc388bf51adb888d3fc0dd1b50f1c170167ee3a" "checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" "checksum dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "13aea89a5c93364a98e9b37b2fa237effbb694d5cfe01c5b70941f7eb087d5e3" @@ -1414,30 +1866,40 @@ dependencies = [ "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" +"checksum get_if_addrs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "abddb55a898d32925f3148bd281174a68eeb68bbfd9a5938a57b18f506ee4ef7" +"checksum get_if_addrs-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d04f9fb746cf36b191c00f3ede8bde9c8e64f9f4b05ae2694a9ccf5e3f5ab48" "checksum getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "e7db7ca94ed4cd01190ceee0d8a8052f08a247aa1b469a7f68c6a3b71afcf407" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum hex_fmt 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b07f60793ff0a4d9cef0f18e63b5357e06209987153a64648c972c1e5aff336f" "checksum hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" +"checksum ir-to-bytecode 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" +"checksum ir-to-bytecode-syntax 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum itertools 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "87fa75c9dea7b07be3138c49abbb83fd4bea199b5cdc76f9804458edc5da0d6e" "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum keccak 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "67c21572b4949434e4fc1e1978b99c5f77064153c59d998bf13ecd96fb5ecba7" "checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" "checksum libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)" = "1a31a0627fdf1f6a39ec0dd577e101440b7db22672c0901fe00a9a6fbb5c24e8" "checksum libra-canonical-serialization 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" +"checksum libra-config 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum libra-crypto 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum libra-crypto-derive 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum libra-failure-ext 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum libra-failure-macros 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum libra-logger 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum libra-nibble 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" +"checksum libra-tools 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum libra-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)" = "14b6052be84e6b71ab17edffc2eeabf5c2c3ae1fdb464aae35ac50c67a44e1f7" "checksum mach_o_sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3e854583a83f20cf329bb9283366335387f7db59d640d1412167e05fedb98826" +"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" +"checksum maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" "checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e" "checksum memoffset 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "75189eb85871ea5c2e2c15abbdd541185f63b408415e5051f5cac122d8c774b9" "checksum memsec 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ccabb92f665f997bcb4f3ade019a8e07315148d8bcef3e65fbc5dbd65a22eb04" +"checksum mirai-annotations 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7968d6cdc3c7a9632e45d738fd07fde89d04bbb0e88e7abb058871a82fa92645" "checksum multimap 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb04b9f127583ed176e163fb9ec6f3e793b87e21deedd5734a69386a18a0151" "checksum nibble_vec 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c8d77f3db4bce033f4d04db08079b2ef1c3d02b44e86f25d08886fafa7756ffa" "checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" @@ -1445,10 +1907,15 @@ dependencies = [ "checksum num_enum 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "be601e38e20a6f3d01049d85801cb9b7a34a8da7a0da70df507bbde7735058c8" "checksum num_enum_derive 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b59f30f6a043f2606adbd0addbf1eef6f2e28e8c4968918b63b7ff97ac0db2a7" "checksum opaque-debug 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +"checksum ordermap 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a86ed3f5f244b372d6b1a00b72ef7f8876d0bc6a78a4c9985c53614041512063" "checksum pairing 0.14.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ceda21136251c6d5a422d3d798d8ac22515a6e8d3521bb60c59a8349d36d0d57" +"checksum parity-multiaddr 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "045b3c7af871285146300da35b1932bb6e4639b66c7c98e85d06a32cbc4e8fa7" +"checksum parity-multihash 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "df3a17dc27848fd99e4f87eb0f8c9baba6ede0a6d555400c850ca45254ef4ce3" +"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" "checksum petgraph 0.4.13 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3659d1ee90221741f65dd128d9998311b0e40c5d3c23a62445938214abce4f" "checksum ppv-lite86 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "74490b50b9fbe561ac330df47c08f3f33073d2d00c150f719147d7c54522fa1b" "checksum proc-macro-crate 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "e10d4b51f154c8a7fb96fd6dad097cb74b863943ec010ac94b9fd1be8861fe1e" +"checksum proc-macro-error 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aeccfe4d5d8ea175d5f0e4a2ad0637e0f4121d63bd99d356fb1f39ab2e7c6097" "checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum proc-macro2 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "9c9e470a8dc4aeae2dee2f335e8f533e2d4b347e1434e5671afc49b054592f27" "checksum prost 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "96d14b1c185652833d24aaad41c5832b0be5616a590227c1fbff57c616754b23" @@ -1491,6 +1958,7 @@ dependencies = [ "checksum serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4b39bd9b0b087684013a792c59e3e07a46a01d2322518d8a1104641a0b1be0" "checksum serde_derive 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)" = "ca13fc1a832f793322228923fbb3aba9f3f44444898f835d31ad1b74fa0a2bf8" "checksum serde_json 1.0.41 (registry+https://github.com/rust-lang/crates.io-index)" = "2f72eb2a68a7dc3f9a691bfda9305a1c017a6215e5a4545c258500d2099a37c2" +"checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" "checksum sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b4d8bfd0e469f417657573d8451fb33d16cfe0989359b93baf3a1ffc639543d" "checksum sha3 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd26bc0e7a2e3a7c959bc494caf58b72ee0c71d67704e9520f736ca7e4853ecf" "checksum slog 2.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1cc9c640a4adbfbcc11ffb95efe5aa7af7309e002adab54b185507dbf2377b99" @@ -1499,6 +1967,11 @@ dependencies = [ "checksum slog-scope 4.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c44c89dd8b0ae4537d1ae318353eaf7840b4869c536e31c41e963d1ea523ee6" "checksum slog-stdlog 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "be4d87903baf655da2d82bc3ac3f7ef43868c58bf712b3a661fda72009304c23" "checksum slog-term 2.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "54b50e85b73c2bd42ceb97b6ded235576d405bd1e974242ccfe634fa269f6da7" +"checksum smallvec 0.6.13 (registry+https://github.com/rust-lang/crates.io-index)" = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +"checksum stdlib 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum structopt 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c167b61c7d4c126927f5346a4327ce20abf8a186b8041bbeb1ce49e5db49587b" +"checksum structopt-derive 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "519621841414165d2ad0d4c92be8f41844203f2b67e245f9345a5a12d40c69d7" "checksum subtle 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" "checksum subtle 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ab3af2eb31c42e8f0ccf43548232556c42737e01a96db6e1777b0be108e79799" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" @@ -1507,19 +1980,33 @@ dependencies = [ "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" "checksum tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" "checksum term 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c0863a3345e70f61d613eab32ee046ccd1bcc5f9105fe402c61fcd0c13eeb8b5" +"checksum termcolor 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "96d6098003bde162e4277c70665bd87c326f5a0c3f3fbfb285787fa482d54e6e" +"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7fbf4c9d56b320106cd64fd024dadfa0be7cb4706725fc44a7d7ce952d820c1" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum threshold_crypto 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "95be1032c63011f20b01c5edb64930e2b51512782b43b458b1e3449613d70f87" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" "checksum tiny-keccak 1.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d8a021c69bb74a44ccedb824a046447e2c84a01df9e5c20779750acb38e11b2" "checksum toml 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "01d1404644c8b12b16bfcffa4322403a91a451584daaaa7c28d3152e6cbc98cf" +"checksum transaction-builder 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9" +"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" +"checksum unicode-normalization 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "09c8070a9942f5e7cfccd93f490fdebd230ee3c3c9f107cb25bad5351ef671cf" "checksum unicode-segmentation 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e83e153d1053cbb5a118eeff7fd5be06ed99153f00dbcd8ae310c5fb2b22edc0" +"checksum unicode-width 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7007dbd421b92cc6e28410fe7362e2e0a2503394908f417b68ec8d1c364c4e20" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c" +"checksum unsigned-varint 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f0023a96687fe169081e8adce3f65e3874426b7886e9234d490af2dc077959" +"checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" +"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" +"checksum vm 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" +"checksum vm-runtime-types 0.1.0 (git+https://github.com/libra/libra.git?branch=testnet)" = "" "checksum wasi 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b89c3ce4ce14bdc6fb6beaf9ec7928ca331de5df7e5ea278375642a2f478570d" "checksum which 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b57acb10231b9493c8472b20cb57317d0679a49e0bdbee44b3b803a6473af164" +"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +"checksum winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7168bab6e1daee33b4557efd0e95d5ca70a03706d39fa5f3fe7a236f584b03c9" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +"checksum wincolor 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "96f5016b18804d24db43cebf3c77269e7569b8954a8464501c216cc5e070eaa9" "checksum x25519-dalek 0.5.2 (git+https://github.com/calibra/x25519-dalek.git?branch=fiat)" = "" diff --git a/libra-dev/Cargo.toml b/libra-dev/Cargo.toml index d29a7be7..c7dabb6b 100644 --- a/libra-dev/Cargo.toml +++ b/libra-dev/Cargo.toml @@ -9,9 +9,12 @@ edition = "2018" [dependencies] libra-types = { git = "https://github.com/libra/libra.git", branch = "testnet" } libra-crypto = { git = "https://github.com/libra/libra.git", branch = "testnet" } +transaction-builder = {git = "https://github.com/libra/libra.git", branch = "testnet" } +lcs = { git = "https://github.com/libra/libra.git", branch = "testnet", package = "libra-canonical-serialization" } +libc = "0.2.65" [dev-dependencies] -lcs = { git = "https://github.com/libra/libra.git", branch = "testnet", package = "libra-canonical-serialization" } +rand = "0.6.5" [lib] crate-type = ["cdylib"] diff --git a/libra-dev/include/data.h b/libra-dev/include/data.h index cbae5122..c8d0c493 100644 --- a/libra-dev/include/data.h +++ b/libra-dev/include/data.h @@ -8,6 +8,7 @@ extern "C" { #include #include #include +#include struct CEventHandle { uint64_t count; @@ -26,7 +27,18 @@ struct CDevAccountResource { struct CDevAccountResource account_resource_from_lcs(const uint8_t *buf, size_t len); void account_resource_free(struct CDevAccountResource *point); - +/*! + * To get the serialized transaction in a memory safe manner, the client needs to pass in a pointer to a pointer to the allocated memory in rust + * and call free on the memory address with `libra_signed_transaction_free`. + * @param[out] buf is the pointer that will be filled with the memory address of the transaction allocated in rust. User takes ownership of pointer returned by *buf, which needs to be freed using libra_signed_transcation_free + * @param[out] len is the length of the signed transaction memory buffer. +*/ +void libra_signed_transaction_build(const uint8_t sender[32], const uint8_t receiver[32], uint64_t sequence, uint64_t num_coins, uint64_t max_gas_amount, uint64_t gas_unit_price, uint64_t expiration_time_millis, const uint8_t* private_key_bytes, uint8_t** buf, size_t* len); +/*! + * Function to free the allocation memory in rust for transaction + * @param buf is the pointer to the memory address of the transaction allocated in rust, and needs to be freed from client side + */ +void libra_signed_transaction_free(uint8_t** buf); #ifdef __cplusplus }; diff --git a/libra-dev/src/account_resource.rs b/libra-dev/src/account_resource.rs index 83f69cb0..48d5ebd4 100644 --- a/libra-dev/src/account_resource.rs +++ b/libra-dev/src/account_resource.rs @@ -2,18 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 use crate::data::{CDevAccountResource, CEventHandle}; use libra_types::{ - account_config::get_account_resource_or_default, - account_state_blob::AccountStateBlob, - byte_array::ByteArray, - event::{EventHandle, EVENT_KEY_LENGTH}, + account_config::get_account_resource_or_default, account_state_blob::AccountStateBlob, + event::EVENT_KEY_LENGTH, }; use std::slice; #[no_mangle] -pub extern "C" fn account_resource_from_lcs( - buf: *const u8, - len: usize, -) -> CDevAccountResource { +pub extern "C" fn account_resource_from_lcs(buf: *const u8, len: usize) -> CDevAccountResource { let buf: &[u8] = unsafe { slice::from_raw_parts(buf, len) }; let account_state_blob = AccountStateBlob::from(buf.to_vec()); @@ -39,7 +34,6 @@ pub extern "C" fn account_resource_from_lcs( key: received_key_copy, }; - let result = CDevAccountResource { balance: account_resource.balance(), sequence: account_resource.sequence_number(), @@ -56,12 +50,12 @@ pub extern "C" fn account_resource_from_lcs( /// Generate an AccountBlob and verify we can parse it #[test] fn test_get_account_resource() { - use std::collections::BTreeMap; - use libra_types::account_config::account_resource_path; - use libra_types::account_config::AccountResource; use libra_crypto::ed25519::compat; - use libra_types::account_address::AccountAddress; - + use libra_types::{ + account_address::AccountAddress, account_config::account_resource_path, + account_config::AccountResource, byte_array::ByteArray, event::EventHandle, + }; + use std::collections::BTreeMap; let keypair = compat::generate_keypair(None); @@ -78,21 +72,35 @@ fn test_get_account_resource() { ); // Fill in data - map.insert(account_resource_path(), lcs::to_bytes(&ar ).expect("Must success")); + map.insert( + account_resource_path(), + lcs::to_bytes(&ar).expect("Must success"), + ); let account_state_blob = lcs::to_bytes(&map).expect("LCS serialization failed"); - let result = unsafe { - account_resource_from_lcs(account_state_blob.as_ptr(), account_state_blob.len()) - }; + let result = + unsafe { account_resource_from_lcs(account_state_blob.as_ptr(), account_state_blob.len()) }; assert_eq!(result.balance, ar.balance()); assert_eq!(result.sequence, ar.sequence_number()); - assert_eq!(result.authentication_key, ar.authentication_key().as_bytes() ); - assert_eq!(result.delegated_key_rotation_capability, ar.delegated_key_rotation_capability()); - assert_eq!(result.delegated_withdrawal_capability, ar.delegated_withdrawal_capability()); + assert_eq!( + result.authentication_key, + ar.authentication_key().as_bytes() + ); + assert_eq!( + result.delegated_key_rotation_capability, + ar.delegated_key_rotation_capability() + ); + assert_eq!( + result.delegated_withdrawal_capability, + ar.delegated_withdrawal_capability() + ); assert_eq!(result.sent_events.count, ar.sent_events().count()); assert_eq!(result.sent_events.key, ar.sent_events().key().as_bytes()); assert_eq!(result.received_events.count, ar.received_events().count()); - assert_eq!(result.received_events.key, ar.received_events().key().as_bytes()); + assert_eq!( + result.received_events.key, + ar.received_events().key().as_bytes() + ); } diff --git a/libra-dev/src/lib.rs b/libra-dev/src/lib.rs index d9a1f21f..e44c92f6 100644 --- a/libra-dev/src/lib.rs +++ b/libra-dev/src/lib.rs @@ -7,4 +7,4 @@ mod data; pub mod account_resource; - +pub mod transaction; diff --git a/libra-dev/src/transaction.rs b/libra-dev/src/transaction.rs new file mode 100644 index 00000000..5f59cd60 --- /dev/null +++ b/libra-dev/src/transaction.rs @@ -0,0 +1,129 @@ +// Copyright (c) The Libra Core Contributors +// SPDX-License-Identifier: Apache-2.0 + +use lcs::to_bytes; +use libra_crypto::{ed25519::*, test_utils::KeyPair}; +use libra_types::{ + account_address::{AccountAddress, ADDRESS_LENGTH}, + transaction::{helpers::TransactionSigner, RawTransaction, TransactionPayload}, +}; +use std::{convert::TryFrom, slice, time::Duration}; +use transaction_builder::encode_transfer_script; + +#[no_mangle] +pub extern "C" fn libra_signed_transaction_build( + sender: *const u8, + receiver: *const u8, + sequence: u64, + num_coins: u64, + max_gas_amount: u64, + gas_unit_price: u64, + expiration_time_millis: u64, + private_key_bytes: *const u8, + buf: *mut *mut u8, + len: *mut usize, +) { + let sender_buf = unsafe { slice::from_raw_parts(sender, ADDRESS_LENGTH) }; + let sender_address = AccountAddress::try_from(sender_buf).unwrap(); + let receiver_buf = unsafe { slice::from_raw_parts(receiver, ADDRESS_LENGTH) }; + let receiver_address = AccountAddress::try_from(receiver_buf).unwrap(); + let expiration_time = Duration::from_millis(expiration_time_millis); + + let program = encode_transfer_script(&receiver_address, num_coins); + let payload = TransactionPayload::Script(program); + let raw_txn = RawTransaction::new( + sender_address, + sequence, + payload, + max_gas_amount, + gas_unit_price, + expiration_time, + ); + + let private_key_buf: &[u8] = + unsafe { slice::from_raw_parts(private_key_bytes, ED25519_PRIVATE_KEY_LENGTH) }; + let private_key = + Ed25519PrivateKey::try_from(private_key_buf).expect("Unable to deserialize Private Key"); + let key_pair = KeyPair::from(private_key); + let signer: Box<&dyn TransactionSigner> = Box::new(&key_pair); + + let signed_txn = signer + .sign_txn(raw_txn) + .expect("Unable to sign transaction"); + + let signed_txn_bytes = to_bytes(&signed_txn).expect("Unable to serialize SignedTransaction"); + unsafe { + let txn_buf: (*mut u8) = libc::malloc(signed_txn_bytes.len()).cast(); + txn_buf.copy_from(signed_txn_bytes.as_ptr(), signed_txn_bytes.len()); + + *buf = txn_buf; + *len = signed_txn_bytes.len(); + } +} + +#[no_mangle] +pub unsafe extern "C" fn libra_signed_transaction_free(buf: *mut *mut u8) { + if !buf.is_null() { + libc::free(*buf as *mut libc::c_void); + } +} + +/// Generate an Signed Transaction and deserialize +#[test] +fn test_lcs_signed_transaction() { + use lcs::from_bytes; + use libra_crypto::test_utils::TEST_SEED; + use libra_types::transaction::{SignedTransaction, TransactionArgument}; + use rand::{rngs::StdRng, SeedableRng}; + + // generate key pair + let mut rng = StdRng::from_seed(TEST_SEED); + let key_pair = compat::generate_keypair(&mut rng); + let private_key = key_pair.0; + let public_key = key_pair.1; + let private_key_bytes = private_key.to_bytes(); + + // create transfer parameters + let sender_address = AccountAddress::from_public_key(&public_key); + let receiver_address = AccountAddress::random(); + let sequence = 0; + let amount = 100000000; + let gas_unit_price = 123; + let max_gas_amount = 1000; + let expiration_time_millis = 0; + + let mut buf: u8 = 0; + let mut buf_ptr: *mut u8 = &mut buf; + let mut len: usize = 0; + + unsafe { + libra_signed_transaction_build( + sender_address.as_ref().as_ptr(), + receiver_address.as_ref().as_ptr(), + sequence, + amount, + max_gas_amount, + gas_unit_price, + expiration_time_millis, + private_key_bytes.as_ptr(), + &mut buf_ptr, + &mut len, + ) + }; + + let signed_txn_bytes_buf: &[u8] = unsafe { slice::from_raw_parts(buf_ptr, len) }; + let deserialized_signed_txn: SignedTransaction = + from_bytes(signed_txn_bytes_buf).expect("LCS deserialization failed"); + + if let TransactionPayload::Script(program) = deserialized_signed_txn.payload() { + if let TransactionArgument::U64(val) = program.args()[1] { + assert_eq!(val, amount); + } + } + assert_eq!(deserialized_signed_txn.sequence_number(), 0); + assert_eq!(deserialized_signed_txn.gas_unit_price(), gas_unit_price); + assert_eq!(deserialized_signed_txn.public_key(), public_key); + assert!(deserialized_signed_txn.check_signature().is_ok()); + + unsafe { libra_signed_transaction_free(&mut buf_ptr) }; +}