From 47ee03cadd338b6a5e1c48570f3b081604bab25a Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Tue, 23 Apr 2019 11:29:59 +0100 Subject: [PATCH 01/36] V2 slate versioning enablement (#85) * fix for command line listener port override * reduce parameter query size * Add slate versioning * rustfmt * bump version number * Add tests for slate version conversion * rustfmt * Updates and test addition based on bdap's review * rustfmt --- Cargo.lock | 443 +++--- Cargo.toml | 14 +- api/Cargo.toml | 10 +- api/src/foreign_rpc.rs | 15 +- api/src/lib.rs | 1 + api/tests/slate_versioning.rs | 131 ++ api/tests/slates/v1_req.slate | 1037 ++++++++++++++ api/tests/slates/v1_res.slate | 1955 +++++++++++++++++++++++++++ config/Cargo.toml | 4 +- controller/Cargo.toml | 12 +- impls/Cargo.toml | 8 +- impls/src/adapters/http.rs | 3 + libwallet/Cargo.toml | 6 +- libwallet/src/lib.rs | 2 + libwallet/src/slate.rs | 303 ++++- libwallet/src/slate_versions/mod.rs | 83 ++ util/Cargo.toml | 38 +- 17 files changed, 3787 insertions(+), 278 deletions(-) create mode 100644 api/tests/slate_versioning.rs create mode 100644 api/tests/slates/v1_req.slate create mode 100644 api/tests/slates/v1_res.slate diff --git a/Cargo.lock b/Cargo.lock index cc5c4522a..6c6ebcf86 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,7 +18,7 @@ name = "ansi_term" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -28,7 +28,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "arc-swap" -version = "0.3.8" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -69,7 +69,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -79,15 +79,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -95,7 +95,7 @@ name = "backtrace-sys" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -116,14 +116,14 @@ dependencies = [ "cexpr 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "clang-sys 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "peeking_take_while 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -197,7 +197,7 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -220,7 +220,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -236,14 +236,14 @@ dependencies = [ [[package]] name = "clap" -version = "2.32.0" +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.11 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "textwrap 0.10.0 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -293,7 +293,7 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bindgen 0.37.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -369,7 +369,7 @@ version = "3.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -392,7 +392,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -408,7 +408,7 @@ dependencies = [ "easy-jsonrpc-proc-macro 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 10.1.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.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -419,8 +419,8 @@ 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-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -444,7 +444,7 @@ dependencies = [ "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -453,7 +453,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -463,8 +463,8 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -554,28 +554,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "grin_api" -version = "1.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "1.1.0-beta.2" +source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_chain 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_p2p 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_pool 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_store 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-rustls 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustls 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -586,8 +586,8 @@ dependencies = [ [[package]] name = "grin_chain" -version = "1.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "1.1.0-beta.2" +source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -595,22 +595,22 @@ dependencies = [ "croaring 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_keychain 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_store 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_core" -version = "1.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "1.1.0-beta.2" +source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -619,37 +619,37 @@ dependencies = [ "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_keychain 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_keychain" -version = "1.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "1.1.0-beta.2" +source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "pbkdf2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "ripemd160 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -657,41 +657,42 @@ dependencies = [ [[package]] name = "grin_p2p" -version = "1.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "1.1.0-beta.2" +source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_store 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_pool" -version = "1.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "1.1.0-beta.2" +source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_keychain 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_store 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -704,36 +705,36 @@ dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_store" -version = "1.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "1.1.0-beta.2" +source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "croaring 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "lmdb-zero 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_util" -version = "1.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" +version = "1.1.0-beta.2" +source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" dependencies = [ - "backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "grin_secp256k1zkp 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -742,8 +743,8 @@ dependencies = [ "log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -751,19 +752,19 @@ dependencies = [ [[package]] name = "grin_wallet" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" dependencies = [ "built 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_api 1.1.0-beta.1", - "grin_wallet_config 1.1.0-beta.1", - "grin_wallet_controller 1.1.0-beta.1", - "grin_wallet_impls 1.1.0-beta.1", - "grin_wallet_libwallet 1.1.0-beta.1", - "grin_wallet_util 1.1.0-beta.1", + "grin_wallet_api 1.1.0-beta.2", + "grin_wallet_config 1.1.0-beta.2", + "grin_wallet_controller 1.1.0-beta.2", + "grin_wallet_impls 1.1.0-beta.2", + "grin_wallet_libwallet 1.1.0-beta.2", + "grin_wallet_util 1.1.0-beta.2", "linefeed 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "prettytable-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -772,16 +773,16 @@ dependencies = [ [[package]] name = "grin_wallet_api" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "easy-jsonrpc 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.1", - "grin_wallet_impls 1.1.0-beta.1", - "grin_wallet_libwallet 1.1.0-beta.1", - "grin_wallet_util 1.1.0-beta.1", + "grin_wallet_config 1.1.0-beta.2", + "grin_wallet_impls 1.1.0-beta.2", + "grin_wallet_libwallet 1.1.0-beta.2", + "grin_wallet_util 1.1.0-beta.2", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -790,39 +791,39 @@ dependencies = [ [[package]] name = "grin_wallet_config" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_util 1.1.0-beta.1", + "grin_wallet_util 1.1.0-beta.2", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_wallet_controller" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "easy-jsonrpc 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_api 1.1.0-beta.1", - "grin_wallet_config 1.1.0-beta.1", - "grin_wallet_impls 1.1.0-beta.1", - "grin_wallet_libwallet 1.1.0-beta.1", - "grin_wallet_util 1.1.0-beta.1", + "grin_wallet_api 1.1.0-beta.2", + "grin_wallet_config 1.1.0-beta.2", + "grin_wallet_impls 1.1.0-beta.2", + "grin_wallet_libwallet 1.1.0-beta.2", + "grin_wallet_util 1.1.0-beta.2", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "prettytable-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -834,21 +835,21 @@ dependencies = [ [[package]] name = "grin_wallet_impls" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.1", - "grin_wallet_libwallet 1.1.0-beta.1", - "grin_wallet_util 1.1.0-beta.1", + "grin_wallet_config 1.1.0-beta.2", + "grin_wallet_libwallet 1.1.0-beta.2", + "grin_wallet_util 1.1.0-beta.2", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -858,51 +859,51 @@ dependencies = [ [[package]] name = "grin_wallet_libwallet" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.1", - "grin_wallet_util 1.1.0-beta.1", + "grin_wallet_config 1.1.0-beta.2", + "grin_wallet_util 1.1.0-beta.2", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_wallet_util" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_api 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_chain 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_keychain 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_store 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "h2" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -929,7 +930,7 @@ dependencies = [ [[package]] name = "http" -version = "0.1.16" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -958,8 +959,8 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "h2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -983,7 +984,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ct-logs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustls 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1030,8 +1031,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1064,7 +1065,7 @@ name = "libgit2-sys" version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1084,8 +1085,8 @@ name = "libloading" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1093,7 +1094,7 @@ name = "libz-sys" version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1106,7 +1107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "mortal 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1140,7 +1141,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1154,7 +1155,7 @@ version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "arc-swap 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1162,14 +1163,14 @@ dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)", "thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1204,7 +1205,7 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1217,7 +1218,7 @@ name = "miniz-sys" version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1234,7 +1235,7 @@ name = "miniz_oxide_c_api" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1291,7 +1292,7 @@ dependencies = [ "terminfo 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1300,7 +1301,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1310,7 +1311,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1332,7 +1333,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1530,7 +1531,7 @@ dependencies = [ "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1542,7 +1543,7 @@ dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1667,7 +1668,7 @@ dependencies = [ [[package]] name = "quote" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1691,7 +1692,7 @@ dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1703,7 +1704,7 @@ dependencies = [ "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1721,7 +1722,7 @@ dependencies = [ "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1769,7 +1770,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1782,7 +1783,7 @@ dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1812,7 +1813,7 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.1.52" +version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1820,7 +1821,7 @@ name = "redox_termios" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "redox_syscall 0.1.52 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1831,12 +1832,12 @@ dependencies = [ "argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.52 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "regex" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1859,7 +1860,7 @@ name = "remove_dir_all" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1867,7 +1868,7 @@ name = "ring" version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1895,7 +1896,7 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1994,10 +1995,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.89" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2006,17 +2007,17 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.89" +version = "1.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2026,7 +2027,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2036,7 +2037,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2086,7 +2087,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "strsim" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2096,11 +2097,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "0.15.30" +version = "0.15.32" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2110,8 +2111,8 @@ version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", - "quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2123,9 +2124,9 @@ dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.52 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2135,7 +2136,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2163,13 +2164,13 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.52 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "textwrap" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2181,8 +2182,8 @@ version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.52 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2199,8 +2200,8 @@ version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "redox_syscall 0.1.52 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2422,7 +2423,7 @@ name = "toml" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2519,7 +2520,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2528,7 +2529,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2557,7 +2558,7 @@ version = "2.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2604,7 +2605,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "winapi" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2626,7 +2627,7 @@ name = "winapi-util" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2639,7 +2640,7 @@ name = "wincolor" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2685,14 +2686,14 @@ dependencies = [ "checksum aho-corasick 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e6f484ae0c99fec2e858eb6134949117399f222608d84cadb3f58c1f97c2364c" "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" "checksum antidote 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "34fde25430d87a9388dadbe6e34d7f72a462c8b43ac8d309b42b0a8505d7e2a5" -"checksum arc-swap 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c79e383ce3e5b88b123589fe774221be2240a9936866f4f2286cbfe555ef36e8" +"checksum arc-swap 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)" = "bc4662175ead9cd84451d5c35070517777949a2ed84551764129cedb88384841" "checksum argon2rs 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3f67b0b6a86dae6e67ff4ca2b6201396074996379fba2b92ff649126f37cb392" "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "06f59fe10306bb78facd90d28c2038ad23ffaaefa85bac43c8a434cde383334f" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" "checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" -"checksum backtrace 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "cd5a90e2b463010cd0e0ce9a11d4a9d5d58d9f41d4a6ba3dcaf9e68b466e88b4" +"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bindgen 0.37.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1b25ab82877ea8fe6ce1ce1f8ac54361f0218bad900af9eb11803994bf67c221" @@ -2706,12 +2707,12 @@ dependencies = [ "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -"checksum cc 1.0.34 (registry+https://github.com/rust-lang/crates.io-index)" = "30f813bf45048a18eda9190fd3c6b78644146056740c43172a5a3699118588fd" +"checksum cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5f3fee5eeb60324c2781f1e41286bdee933850fff9b3c672587fed5ec58c83" "checksum cexpr 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42aac45e9567d97474a834efdee3081b3c942b2205be932092f53354ce503d6c" "checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clang-sys 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d7f7c04e52c35222fffcc3a115b5daf5f7e2bfb71c13c4e2321afe1fc71859c2" -"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" +"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" @@ -2749,19 +2750,19 @@ dependencies = [ "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" "checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum grin_api 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8acfd77294b90e56bef4ed20a1b1dfd79a0e91f195cbafe4b828c6e5e3336ed2" -"checksum grin_chain 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "80e67abf851f851e62a85c18edd100478fea8b96aa3113c54f44f6eeb0221afe" -"checksum grin_core 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4a5080a20dd53809dbfbaeb69eca5dd26f26f00300abf91a2f6cc298f3976524" -"checksum grin_keychain 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ebbe3297e29423f6fccd2427245f43a7c7b33b3261965fd6f4a9d6004b17f6fc" -"checksum grin_p2p 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a4198a5b11aba1f51dababa3fab99d49e102fbc9594cb69b21f11ee38f5c9dd" -"checksum grin_pool 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44176deddf87495e7f0eb534de2848d50b1a09fbdfe61ef62d517650a4e902af" +"checksum grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" "checksum grin_secp256k1zkp 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "75e9a265f3eeea4c204470f7262e2c6fe18f3d8ddf5fb24340cb550ac4f909c5" -"checksum grin_store 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8229ec3e60f4571292a373159cc3af76391ec830d7dcfc2db48e3da177ab172f" -"checksum grin_util 1.1.0-beta.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afe8186fffdebab979bf2d0bf5fdc870c02a274672505204f6022d21e53e6bfe" -"checksum h2 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "910a5e7be6283a9c91b3982fa5188368c8719cce2a3cf3b86048673bf9d9c36b" +"checksum grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "85ab6286db06040ddefb71641b50017c06874614001a134b423783e2db2920bd" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "733e1b3ac906631ca01ebb577e9bb0f5e37a454032b9036b5eaea4013ed6f99a" -"checksum http 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "fe67e3678f2827030e89cc4b9e7ecd16d52f132c0b940ab5005f88e821500f6a" +"checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" "checksum hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)" = "f1ebec079129e43af5e234ef36ee3d7e6085687d145b7ea653b262d16c6b65f1" @@ -2841,7 +2842,7 @@ dependencies = [ "checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" -"checksum quote 0.6.11 (registry+https://github.com/rust-lang/crates.io-index)" = "cdd8e04bd9c52e0342b406469d494fcb033be4bdbe5c606016defbb1681411e1" +"checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" "checksum rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)" = "64ac302d8f83c0c1974bf758f6b041c6c8ada916fbb44a609158ca8b064cc76c" "checksum rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" "checksum rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" @@ -2856,16 +2857,16 @@ dependencies = [ "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" "checksum rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2" -"checksum redox_syscall 0.1.52 (registry+https://github.com/rust-lang/crates.io-index)" = "d32b3053e5ced86e4bc0411fec997389532bf56b000e66cb4884eeeb41413d69" +"checksum redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)" = "12229c14a0f65c4f1cb046a3b52047cdd9da1f4b30f8a39c5063c8bae515e252" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe5204c3a17e97dde73f285d49be585df59ed84b50a872baf416e73b62c3828" -"checksum regex 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "559008764a17de49a3146b234641644ed37d118d1ef641a0bb573d146edc6ce0" +"checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" "checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" "checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" "checksum ripemd160 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "482aa56cc68aaeccdaaff1cc5a72c247da8bbad3beb174ca5741f274c22883fb" "checksum rpassword 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37473170aedbe66ffa3ad3726939ba677d83c646ad4fd99e5b4bc38712f45ec" -"checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" +"checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" @@ -2880,9 +2881,9 @@ dependencies = [ "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "92514fb95f900c9b5126e32d020f5c6d40564c27a5ea6d1d7d9f157a96623560" +"checksum serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "aa5f7c20820475babd2c077c3ab5f8c77a31c15e16ea38687b4c02d3e48680f4" "checksum serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a663f873dedc4eac1a559d4c6bc0d0b2c34dc5ac4702e105014b8281489e44f" -"checksum serde_derive 1.0.89 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6eabf4b5914e88e24eea240bb7c9f9a2cbc1bbbe8d961d381975ec3c6b806c" +"checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" "checksum serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0887a8e097a69559b56aa2526bf7aff7c3048cf627dff781f0b56a6001534593" "checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" @@ -2892,16 +2893,16 @@ dependencies = [ "checksum smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "c4488ae950c49d403731982257768f48fada354a5203fe81f9bb6f43ca9002be" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" -"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" +"checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" "checksum supercow 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "171758edb47aa306a78dfa4ab9aeb5167405bd4e3dc2b64e88f6a84bbe98bd63" -"checksum syn 0.15.30 (registry+https://github.com/rust-lang/crates.io-index)" = "66c8865bf5a7cbb662d8b011950060b3c8743dca141b054bf7195b20d314d8e2" +"checksum syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)" = "846620ec526c1599c070eff393bfeeeb88a93afa2513fc3b49f1fea84cf7b0ed" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" "checksum tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b86c784c88d98c801132806dadd3819ed29d8600836c4088e855cdf3e178ed8a" "checksum term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum terminfo 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8e51065bafd2abe106b6036483b69d1741f4a1ec56ce8a2378de341637de689e" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" -"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" +"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 time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" @@ -2949,7 +2950,7 @@ dependencies = [ "checksum webpki-roots 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "85d1f408918fd590908a70d36b7ac388db2edc221470333e4d6e5b598e44cabf" "checksum which 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e84a603e7e0b1ce1aa1ee2b109c7be00155ce52df5081590d1ffb93f4f515cb2" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" -"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" +"checksum winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f10e386af2b13e47c89e7236a7a14a086791a2b88ebad6df9bf42040195cf770" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "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" diff --git a/Cargo.toml b/Cargo.toml index bfa6ee26f..0122a88cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" authors = ["Grin Developers "] description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -29,13 +29,13 @@ prettytable-rs = "0.7" log = "0.4" linefeed = "0.5" -grin_wallet_api = { path = "./api", version = "1.1.0-beta.1" } -grin_wallet_impls = { path = "./impls", version = "1.1.0-beta.1" } -grin_wallet_libwallet = { path = "./libwallet", version = "1.1.0-beta.1" } -grin_wallet_controller = { path = "./controller", version = "1.1.0-beta.1" } -grin_wallet_config = { path = "./config", version = "1.1.0-beta.1" } +grin_wallet_api = { path = "./api", version = "1.1.0-beta.2" } +grin_wallet_impls = { path = "./impls", version = "1.1.0-beta.2" } +grin_wallet_libwallet = { path = "./libwallet", version = "1.1.0-beta.2" } +grin_wallet_controller = { path = "./controller", version = "1.1.0-beta.2" } +grin_wallet_config = { path = "./config", version = "1.1.0-beta.2" } -grin_wallet_util = { path = "./util", version = "1.1.0-beta.1" } +grin_wallet_util = { path = "./util", version = "1.1.0-beta.2" } [build-dependencies] built = "0.3" diff --git a/api/Cargo.toml b/api/Cargo.toml index e6595329c..ce09c3386 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_api" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" authors = ["Grin Developers "] description = "Grin Wallet API" license = "Apache-2.0" @@ -18,11 +18,11 @@ serde_json = "1" easy-jsonrpc = "0.4.1" chrono = { version = "0.4.4", features = ["serde"] } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.1" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.1" } -grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.1" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.2" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.2" } +grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.2" } -grin_wallet_util = { path = "../util", version = "1.1.0-beta.1" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } [dev-dependencies] serde_json = "1" diff --git a/api/src/foreign_rpc.rs b/api/src/foreign_rpc.rs index 7e7e48e30..64d660481 100644 --- a/api/src/foreign_rpc.rs +++ b/api/src/foreign_rpc.rs @@ -15,9 +15,9 @@ //! JSON-RPC Stub generation for the Foreign API use crate::keychain::Keychain; -use crate::libwallet::slate::Slate; use crate::libwallet::types::{BlockFees, CbData, InitTxArgs, NodeClient, WalletBackend}; use crate::libwallet::ErrorKind; +use crate::libwallet::{Slate, VersionedSlate}; use crate::Foreign; use easy_jsonrpc; @@ -310,10 +310,10 @@ pub trait ForeignRpc { */ fn receive_tx( &self, - slate: Slate, + slate: VersionedSlate, dest_acct_name: Option, message: Option, - ) -> Result; + ) -> Result; } impl ForeignRpc for Foreign @@ -332,10 +332,12 @@ where fn receive_tx( &self, - slate: Slate, + slate: VersionedSlate, dest_acct_name: Option, message: Option, - ) -> Result { + ) -> Result { + let version = slate.version(); + let slate: Slate = slate.into(); let slate = Foreign::receive_tx( self, &slate, @@ -343,7 +345,8 @@ where message, ) .map_err(|e| e.kind())?; - Ok(slate) + + Ok(VersionedSlate::into_version(slate, version)) } } diff --git a/api/src/lib.rs b/api/src/lib.rs index 43174e8c4..dea8156d4 100644 --- a/api/src/lib.rs +++ b/api/src/lib.rs @@ -43,5 +43,6 @@ pub use crate::foreign_rpc::ForeignRpc; pub use crate::owner::Owner; pub use crate::owner_rpc::OwnerRpc; +pub use crate::foreign_rpc::foreign_rpc as foreign_rpc_client; pub use crate::foreign_rpc::run_doctest_foreign; pub use crate::owner_rpc::run_doctest_owner; diff --git a/api/tests/slate_versioning.rs b/api/tests/slate_versioning.rs new file mode 100644 index 000000000..38c2493f0 --- /dev/null +++ b/api/tests/slate_versioning.rs @@ -0,0 +1,131 @@ +// Copyright 2019 The Grin Developers +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! core::libtx specific tests +use grin_wallet_api::foreign_rpc_client; +use grin_wallet_api::run_doctest_foreign; +use grin_wallet_libwallet::{Slate, SlateVersion, VersionedSlate}; +use serde_json; +use serde_json::Value; +use tempfile::tempdir; +//use grin_wallet_libwallet::slate_versions::v1::SlateV1; +//use grin_wallet_libwallet::slate_versions::v2::SlateV2; + +// test all slate conversions +#[test] +fn receive_versioned_slate() { + // as in doctests, except exercising versioning functionality + // by accepting and responding with a V1 slate + + let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap(); + let dir = dir + .path() + .to_str() + .ok_or("Failed to convert tmpdir path to string.".to_owned()) + .unwrap(); + + let v1_req = include_str!("slates/v1_req.slate"); + let v1_resp = include_str!("slates/v1_res.slate"); + + // leave here for the ability to create earlier slate versions + // for test input + /*let v: Value = serde_json::from_str(v1_req).unwrap(); + let v2_slate = v["params"][0].clone(); + println!("{}", v2_slate); + let v2_slate_str = v2_slate.to_string(); + println!("{}", v2_slate_str); + let v2: SlateV2 = serde_json::from_str(&v2_slate.to_string()).unwrap(); + let v1 = SlateV1::from(v2); + let v1_str = serde_json::to_string_pretty(&v1).unwrap(); + panic!("{}", v1_str);*/ + + let request_val: Value = serde_json::from_str(v1_req).unwrap(); + let expected_response: Value = serde_json::from_str(v1_resp).unwrap(); + + let response = run_doctest_foreign(request_val, dir, 5, true) + .unwrap() + .unwrap(); + + if response != expected_response { + panic!( + "(left != right) \nleft: {}\nright: {}", + serde_json::to_string_pretty(&response).unwrap(), + serde_json::to_string_pretty(&expected_response).unwrap() + ); + } +} + +/// call ForeignRpc::receive_tx on vs and return the result +fn receive_tx(vs: VersionedSlate) -> VersionedSlate { + let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap(); + let dir = dir + .path() + .to_str() + .ok_or("Failed to convert tmpdir path to string.".to_owned()) + .unwrap(); + let bound_method = foreign_rpc_client::receive_tx( + vs, + None, + Some("Thanks for saving my dog from that tree, bddap.".into()), + ) + .unwrap(); + let (call, tracker) = bound_method.call(); + let json_response = run_doctest_foreign(call.as_request(), dir, 5, false) + .unwrap() + .unwrap(); + let mut response = easy_jsonrpc::Response::from_json_response(json_response).unwrap(); + tracker.get_return(&mut response).unwrap().unwrap() +} + +#[test] +fn version_unchanged() { + let req: Value = serde_json::from_str(include_str!("slates/v1_req.slate")).unwrap(); + let slate: VersionedSlate = serde_json::from_value(req["params"][0].clone()).unwrap(); + let slate_req: Slate = slate.into(); + + assert_eq!( + receive_tx(VersionedSlate::into_version( + slate_req.clone(), + SlateVersion::V0 + )) + .version(), + SlateVersion::V0 + ); + + assert_eq!( + receive_tx(VersionedSlate::into_version( + slate_req.clone(), + SlateVersion::V1 + )) + .version(), + SlateVersion::V1 + ); + + assert_eq!( + receive_tx(VersionedSlate::into_version( + slate_req.clone(), + SlateVersion::V2 + )) + .version(), + SlateVersion::V2 + ); + + // compile time test will remind us to update these tests when updating slate format + fn _all_versions_tested(vs: VersionedSlate) { + match vs { + VersionedSlate::V0(_) => (), + VersionedSlate::V1(_) => (), + VersionedSlate::V2(_) => (), + } + } +} diff --git a/api/tests/slates/v1_req.slate b/api/tests/slates/v1_req.slate new file mode 100644 index 000000000..d3ff7a584 --- /dev/null +++ b/api/tests/slates/v1_req.slate @@ -0,0 +1,1037 @@ +{ + "jsonrpc": "2.0", + "method": "receive_tx", + "id": 1, + "params": [ + { + "num_participants": 2, + "id": "0436430c-2b02-624c-2032-570501212b00", + "tx": { + "offset": [ + 210, + 2, + 150, + 73, + 0, + 0, + 0, + 0, + 211, + 2, + 150, + 73, + 0, + 0, + 0, + 0, + 212, + 2, + 150, + 73, + 0, + 0, + 0, + 0, + 213, + 2, + 150, + 73, + 0, + 0, + 0, + 0 + ], + "body": { + "inputs": [ + { + "features": "Coinbase", + "commit": [ + 8, + 125, + 243, + 35, + 4, + 197, + 212, + 174, + 139, + 42, + 240, + 188, + 49, + 231, + 0, + 1, + 157, + 114, + 41, + 16, + 239, + 135, + 221, + 78, + 236, + 49, + 151, + 184, + 11, + 32, + 126, + 48, + 69 + ] + }, + { + "features": "Coinbase", + "commit": [ + 8, + 225, + 218, + 158, + 109, + 196, + 214, + 232, + 8, + 167, + 24, + 178, + 241, + 16, + 169, + 145, + 221, + 119, + 93, + 101, + 206, + 90, + 228, + 8, + 164, + 225, + 240, + 2, + 164, + 150, + 26, + 169, + 231 + ] + } + ], + "outputs": [ + { + "features": "Plain", + "commit": [ + 8, + 18, + 39, + 108, + 199, + 136, + 230, + 135, + 6, + 18, + 41, + 109, + 146, + 108, + 186, + 159, + 14, + 123, + 152, + 16, + 103, + 7, + 16, + 181, + 166, + 230, + 241, + 186, + 0, + 109, + 57, + 87, + 116 + ], + "proof": [ + 220, + 255, + 97, + 117, + 57, + 12, + 96, + 43, + 250, + 146, + 194, + 255, + 209, + 169, + 178, + 216, + 77, + 204, + 158, + 169, + 65, + 246, + 243, + 23, + 189, + 208, + 248, + 117, + 36, + 78, + 242, + 62, + 105, + 111, + 209, + 124, + 113, + 223, + 121, + 118, + 12, + 229, + 206, + 26, + 150, + 170, + 177, + 209, + 93, + 208, + 87, + 53, + 141, + 200, + 53, + 233, + 114, + 254, + 190, + 184, + 109, + 80, + 204, + 236, + 13, + 173, + 124, + 254, + 2, + 70, + 215, + 66, + 235, + 117, + 60, + 247, + 184, + 140, + 4, + 93, + 21, + 188, + 113, + 35, + 248, + 207, + 113, + 85, + 100, + 124, + 207, + 102, + 63, + 202, + 146, + 168, + 60, + 154, + 101, + 208, + 237, + 117, + 110, + 167, + 235, + 255, + 210, + 202, + 201, + 12, + 56, + 10, + 16, + 46, + 217, + 202, + 170, + 53, + 93, + 23, + 94, + 208, + 191, + 88, + 211, + 172, + 47, + 94, + 144, + 157, + 108, + 68, + 125, + 252, + 107, + 96, + 94, + 4, + 146, + 92, + 43, + 23, + 195, + 62, + 189, + 25, + 8, + 201, + 101, + 165, + 84, + 30, + 165, + 210, + 237, + 69, + 160, + 149, + 142, + 100, + 2, + 248, + 157, + 122, + 86, + 223, + 25, + 146, + 224, + 54, + 216, + 54, + 231, + 64, + 23, + 231, + 60, + 202, + 213, + 203, + 58, + 130, + 184, + 225, + 57, + 227, + 9, + 121, + 42, + 49, + 177, + 95, + 63, + 253, + 114, + 237, + 3, + 50, + 83, + 66, + 140, + 21, + 108, + 43, + 151, + 153, + 69, + 138, + 37, + 193, + 218, + 101, + 183, + 25, + 120, + 10, + 34, + 222, + 127, + 231, + 244, + 55, + 174, + 47, + 204, + 210, + 44, + 247, + 234, + 53, + 122, + 181, + 170, + 102, + 165, + 239, + 125, + 113, + 251, + 13, + 198, + 74, + 160, + 181, + 118, + 31, + 104, + 39, + 128, + 98, + 187, + 57, + 187, + 41, + 108, + 120, + 126, + 76, + 171, + 197, + 226, + 162, + 147, + 58, + 65, + 108, + 225, + 201, + 169, + 105, + 97, + 96, + 56, + 100, + 73, + 196, + 55, + 233, + 18, + 15, + 123, + 178, + 110, + 91, + 14, + 116, + 209, + 242, + 231, + 213, + 188, + 215, + 170, + 251, + 42, + 146, + 184, + 125, + 21, + 72, + 241, + 249, + 17, + 251, + 6, + 175, + 123, + 214, + 204, + 19, + 206, + 226, + 159, + 124, + 156, + 183, + 144, + 33, + 174, + 209, + 129, + 134, + 39, + 42, + 240, + 233, + 209, + 137, + 236, + 16, + 124, + 129, + 168, + 163, + 174, + 180, + 120, + 43, + 13, + 149, + 14, + 72, + 129, + 170, + 81, + 183, + 118, + 187, + 104, + 68, + 178, + 91, + 206, + 151, + 3, + 91, + 72, + 169, + 189, + 178, + 174, + 163, + 96, + 134, + 135, + 188, + 221, + 71, + 157, + 79, + 169, + 152, + 181, + 168, + 57, + 255, + 136, + 85, + 142, + 74, + 41, + 223, + 240, + 237, + 19, + 181, + 89, + 0, + 171, + 181, + 212, + 57, + 183, + 7, + 147, + 217, + 2, + 174, + 154, + 211, + 69, + 135, + 177, + 140, + 145, + 159, + 107, + 135, + 92, + 145, + 209, + 77, + 238, + 177, + 195, + 115, + 245, + 231, + 101, + 112, + 213, + 154, + 101, + 73, + 117, + 143, + 101, + 95, + 17, + 40, + 165, + 79, + 22, + 45, + 254, + 136, + 104, + 225, + 88, + 112, + 40, + 226, + 106, + 217, + 30, + 82, + 140, + 90, + 231, + 238, + 147, + 53, + 250, + 88, + 251, + 89, + 2, + 43, + 93, + 226, + 157, + 128, + 240, + 118, + 74, + 153, + 23, + 57, + 13, + 70, + 219, + 137, + 154, + 204, + 106, + 91, + 65, + 110, + 37, + 236, + 201, + 220, + 203, + 113, + 83, + 100, + 106, + 221, + 204, + 129, + 202, + 219, + 95, + 0, + 120, + 254, + 188, + 126, + 5, + 215, + 115, + 90, + 186, + 73, + 79, + 57, + 239, + 5, + 105, + 123, + 188, + 201, + 180, + 123, + 44, + 204, + 121, + 89, + 93, + 117, + 252, + 19, + 200, + 6, + 120, + 181, + 226, + 55, + 237, + 206, + 88, + 215, + 49, + 243, + 76, + 5, + 177, + 221, + 202, + 166, + 73, + 172, + 242, + 216, + 101, + 187, + 188, + 60, + 237, + 161, + 5, + 8, + 188, + 221, + 41, + 208, + 73, + 103, + 68, + 100, + 75, + 241, + 195, + 81, + 111, + 102, + 135, + 223, + 238, + 245, + 100, + 156, + 125, + 255, + 144, + 98, + 125, + 100, + 39, + 57, + 165, + 157, + 145, + 168, + 209, + 208, + 196, + 220, + 85, + 215, + 74, + 148, + 158, + 16, + 116, + 66, + 118, + 100, + 180, + 103, + 153, + 44, + 158, + 15, + 125, + 58, + 249, + 214, + 234, + 121, + 81, + 62, + 137, + 70, + 221, + 192, + 211, + 86, + 186, + 196, + 152, + 120, + 230, + 78, + 106, + 149, + 176, + 163, + 2, + 20, + 33, + 79, + 175, + 44, + 227, + 23, + 250, + 98, + 47, + 243, + 38, + 107, + 50, + 168, + 22, + 225, + 10, + 24, + 230, + 215, + 137, + 165, + 218, + 31, + 35, + 230, + 123, + 79, + 151, + 10, + 104, + 167, + 188, + 217, + 225, + 136, + 37, + 238, + 39, + 75, + 4, + 131, + 137, + 106, + 64 + ] + } + ], + "kernels": [ + { + "features": "Plain", + "fee": 7000000, + "lock_height": 0, + "excess": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "excess_sig": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ] + } + ] + } + }, + "amount": 60000000000, + "fee": 7000000, + "height": 5, + "lock_height": 0, + "participant_data": [ + { + "id": 0, + "public_blind_excess": [ + 3, + 58, + 194, + 21, + 143, + 160, + 7, + 127, + 8, + 125, + 230, + 12, + 25, + 216, + 228, + 49, + 117, + 59, + 170, + 91, + 99, + 182, + 225, + 71, + 127, + 5, + 162, + 166, + 231, + 25, + 13, + 69, + 146 + ], + "public_nonce": [ + 3, + 27, + 132, + 197, + 86, + 123, + 18, + 100, + 64, + 153, + 93, + 62, + 213, + 170, + 186, + 5, + 101, + 215, + 30, + 24, + 52, + 96, + 72, + 25, + 255, + 156, + 23, + 245, + 233, + 213, + 221, + 7, + 143 + ], + "part_sig": null, + "message": null, + "message_sig": null + } + ], + "version": 1 + }, + null, + "Thanks, Yeastplume" + ] +} diff --git a/api/tests/slates/v1_res.slate b/api/tests/slates/v1_res.slate new file mode 100644 index 000000000..86a3e94aa --- /dev/null +++ b/api/tests/slates/v1_res.slate @@ -0,0 +1,1955 @@ +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "amount": 60000000000, + "fee": 7000000, + "height": 5, + "id": "0436430c-2b02-624c-2032-570501212b00", + "lock_height": 0, + "num_participants": 2, + "participant_data": [ + { + "id": 0, + "message": null, + "message_sig": null, + "part_sig": null, + "public_blind_excess": [ + 3, + 58, + 194, + 21, + 143, + 160, + 7, + 127, + 8, + 125, + 230, + 12, + 25, + 216, + 228, + 49, + 117, + 59, + 170, + 91, + 99, + 182, + 225, + 71, + 127, + 5, + 162, + 166, + 231, + 25, + 13, + 69, + 146 + ], + "public_nonce": [ + 3, + 27, + 132, + 197, + 86, + 123, + 18, + 100, + 64, + 153, + 93, + 62, + 213, + 170, + 186, + 5, + 101, + 215, + 30, + 24, + 52, + 96, + 72, + 25, + 255, + 156, + 23, + 245, + 233, + 213, + 221, + 7, + 143 + ] + }, + { + "id": 1, + "message": "Thanks, Yeastplume", + "message_sig": [ + 143, + 7, + 221, + 213, + 233, + 245, + 23, + 156, + 255, + 25, + 72, + 96, + 52, + 24, + 30, + 215, + 101, + 5, + 186, + 170, + 213, + 62, + 93, + 153, + 64, + 100, + 18, + 123, + 86, + 197, + 132, + 27, + 48, + 161, + 241, + 178, + 30, + 173, + 225, + 180, + 189, + 33, + 30, + 31, + 19, + 127, + 189, + 188, + 161, + 183, + 141, + 196, + 61, + 162, + 27, + 22, + 149, + 246, + 160, + 237, + 242, + 67, + 127, + 249 + ], + "part_sig": [ + 143, + 7, + 221, + 213, + 233, + 245, + 23, + 156, + 255, + 25, + 72, + 96, + 52, + 24, + 30, + 215, + 101, + 5, + 186, + 170, + 213, + 62, + 93, + 153, + 64, + 100, + 18, + 123, + 86, + 197, + 132, + 27, + 43, + 53, + 189, + 40, + 223, + 210, + 38, + 158, + 6, + 112, + 224, + 207, + 146, + 112, + 189, + 109, + 242, + 208, + 63, + 189, + 100, + 82, + 62, + 228, + 174, + 98, + 35, + 150, + 5, + 91, + 150, + 252 + ], + "public_blind_excess": [ + 3, + 143, + 224, + 68, + 50, + 67, + 218, + 177, + 115, + 192, + 104, + 239, + 95, + 168, + 145, + 178, + 66, + 210, + 181, + 235, + 137, + 14, + 160, + 148, + 117, + 230, + 227, + 129, + 23, + 4, + 66, + 238, + 22 + ], + "public_nonce": [ + 3, + 27, + 132, + 197, + 86, + 123, + 18, + 100, + 64, + 153, + 93, + 62, + 213, + 170, + 186, + 5, + 101, + 215, + 30, + 24, + 52, + 96, + 72, + 25, + 255, + 156, + 23, + 245, + 233, + 213, + 221, + 7, + 143 + ] + } + ], + "tx": { + "body": { + "inputs": [ + { + "commit": [ + 8, + 125, + 243, + 35, + 4, + 197, + 212, + 174, + 139, + 42, + 240, + 188, + 49, + 231, + 0, + 1, + 157, + 114, + 41, + 16, + 239, + 135, + 221, + 78, + 236, + 49, + 151, + 184, + 11, + 32, + 126, + 48, + 69 + ], + "features": "Coinbase" + }, + { + "commit": [ + 8, + 225, + 218, + 158, + 109, + 196, + 214, + 232, + 8, + 167, + 24, + 178, + 241, + 16, + 169, + 145, + 221, + 119, + 93, + 101, + 206, + 90, + 228, + 8, + 164, + 225, + 240, + 2, + 164, + 150, + 26, + 169, + 231 + ], + "features": "Coinbase" + } + ], + "kernels": [ + { + "excess": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "excess_sig": [ + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0 + ], + "features": "Plain", + "fee": 7000000, + "lock_height": 0 + } + ], + "outputs": [ + { + "commit": [ + 8, + 78, + 233, + 125, + 239, + 168, + 195, + 113, + 36, + 212, + 198, + 155, + 170, + 117, + 62, + 37, + 50, + 83, + 95, + 170, + 129, + 247, + 158, + 165, + 224, + 72, + 157, + 178, + 82, + 151, + 213, + 190, + 184 + ], + "features": "Plain", + "proof": [ + 191, + 251, + 38, + 231, + 223, + 75, + 247, + 83, + 244, + 216, + 232, + 16, + 198, + 127, + 181, + 16, + 107, + 23, + 70, + 193, + 135, + 15, + 92, + 185, + 101, + 133, + 83, + 126, + 184, + 226, + 246, + 107, + 55, + 46, + 208, + 95, + 211, + 90, + 225, + 140, + 110, + 133, + 21, + 205, + 159, + 42, + 170, + 232, + 93, + 90, + 118, + 85, + 54, + 28, + 106, + 133, + 115, + 226, + 15, + 189, + 253, + 218, + 110, + 10, + 11, + 37, + 129, + 127, + 192, + 219, + 35, + 220, + 37, + 41, + 115, + 130, + 175, + 55, + 150, + 89, + 216, + 70, + 189, + 128, + 68, + 248, + 7, + 196, + 103, + 114, + 39, + 8, + 211, + 163, + 121, + 123, + 132, + 252, + 235, + 9, + 235, + 41, + 241, + 28, + 119, + 183, + 156, + 124, + 147, + 197, + 120, + 208, + 109, + 149, + 181, + 141, + 132, + 89, + 48, + 83, + 30, + 92, + 172, + 99, + 70, + 209, + 55, + 62, + 225, + 197, + 219, + 105, + 193, + 77, + 10, + 161, + 169, + 194, + 46, + 24, + 125, + 195, + 70, + 21, + 108, + 70, + 133, + 64, + 173, + 22, + 106, + 4, + 144, + 45, + 63, + 175, + 53, + 126, + 211, + 26, + 80, + 119, + 93, + 39, + 73, + 19, + 204, + 201, + 186, + 151, + 108, + 163, + 151, + 126, + 24, + 243, + 131, + 178, + 15, + 12, + 208, + 42, + 8, + 102, + 183, + 180, + 72, + 71, + 191, + 187, + 163, + 92, + 9, + 159, + 94, + 186, + 156, + 151, + 71, + 202, + 217, + 97, + 3, + 51, + 33, + 146, + 95, + 62, + 10, + 212, + 62, + 53, + 122, + 174, + 204, + 80, + 152, + 155, + 187, + 203, + 91, + 68, + 234, + 213, + 143, + 227, + 89, + 197, + 153, + 3, + 83, + 12, + 88, + 191, + 28, + 154, + 111, + 159, + 177, + 32, + 163, + 73, + 46, + 131, + 95, + 171, + 192, + 27, + 184, + 179, + 27, + 82, + 177, + 90, + 206, + 71, + 133, + 160, + 140, + 62, + 169, + 168, + 43, + 209, + 92, + 65, + 199, + 68, + 84, + 66, + 134, + 177, + 20, + 177, + 190, + 115, + 63, + 166, + 35, + 115, + 0, + 207, + 45, + 201, + 158, + 138, + 246, + 248, + 85, + 123, + 217, + 160, + 131, + 186, + 89, + 204, + 26, + 80, + 11, + 223, + 186, + 34, + 139, + 83, + 120, + 90, + 127, + 219, + 245, + 118, + 247, + 220, + 224, + 53, + 118, + 144, + 88, + 188, + 118, + 68, + 4, + 30, + 197, + 115, + 20, + 133, + 229, + 100, + 30, + 172, + 92, + 117, + 166, + 235, + 87, + 228, + 171, + 194, + 135, + 176, + 190, + 142, + 171, + 119, + 199, + 232, + 165, + 18, + 46, + 232, + 212, + 159, + 2, + 241, + 3, + 163, + 175, + 111, + 227, + 139, + 143, + 206, + 205, + 26, + 169, + 187, + 52, + 43, + 62, + 17, + 15, + 64, + 3, + 238, + 108, + 119, + 30, + 217, + 52, + 1, + 202, + 52, + 56, + 220, + 240, + 215, + 81, + 163, + 109, + 187, + 122, + 122, + 69, + 211, + 39, + 9, + 82, + 86, + 134, + 243, + 210, + 229, + 245, + 66, + 199, + 71, + 201, + 199, + 69, + 254, + 80, + 205, + 120, + 154, + 10, + 165, + 84, + 25, + 147, + 74, + 255, + 243, + 99, + 4, + 77, + 60, + 63, + 95, + 118, + 105, + 235, + 185, + 242, + 36, + 91, + 68, + 155, + 253, + 196, + 224, + 157, + 251, + 22, + 97, + 85, + 36, + 133, + 16, + 122, + 251, + 217, + 162, + 181, + 113, + 160, + 100, + 123, + 31, + 195, + 48, + 8, + 154, + 101, + 228, + 181, + 223, + 7, + 245, + 143, + 26, + 156, + 17, + 195, + 218, + 81, + 213, + 108, + 216, + 84, + 242, + 39, + 197, + 17, + 29, + 37, + 202, + 140, + 75, + 236, + 75, + 176, + 251, + 203, + 74, + 35, + 252, + 50, + 136, + 65, + 132, + 35, + 221, + 6, + 73, + 215, + 49, + 182, + 166, + 192, + 136, + 81, + 149, + 78, + 169, + 32, + 4, + 108, + 230, + 122, + 65, + 20, + 211, + 92, + 56, + 118, + 194, + 83, + 97, + 231, + 169, + 148, + 116, + 170, + 4, + 53, + 74, + 78, + 208, + 85, + 95, + 155, + 239, + 82, + 125, + 144, + 47, + 187, + 13, + 29, + 92, + 43, + 66, + 245, + 238, + 165, + 206, + 211, + 89, + 0, + 81, + 33, + 22, + 127, + 153, + 8, + 114, + 153, + 57, + 219, + 166, + 16, + 205, + 171, + 202, + 65, + 247, + 20, + 225, + 68, + 171, + 20, + 143, + 174, + 199, + 127, + 77, + 112, + 86, + 98, + 135, + 103, + 30, + 103, + 134, + 69, + 155, + 215, + 209, + 103, + 135, + 162, + 78, + 18, + 242, + 50, + 139, + 159, + 170, + 177, + 199, + 172, + 128, + 169, + 22, + 210, + 248, + 63, + 18, + 167, + 53, + 26, + 43, + 237, + 255, + 97, + 13, + 51, + 223, + 178, + 223, + 125, + 142, + 87, + 182, + 143, + 180, + 165, + 220, + 192, + 216, + 228, + 250, + 128, + 123, + 32, + 119, + 135, + 122, + 169, + 107, + 167, + 188, + 34, + 230, + 39, + 164, + 246, + 163, + 8, + 211, + 171, + 192, + 145, + 245, + 109, + 81, + 130, + 88, + 240, + 115, + 204, + 27, + 112, + 239, + 129 + ] + }, + { + "commit": [ + 8, + 18, + 39, + 108, + 199, + 136, + 230, + 135, + 6, + 18, + 41, + 109, + 146, + 108, + 186, + 159, + 14, + 123, + 152, + 16, + 103, + 7, + 16, + 181, + 166, + 230, + 241, + 186, + 0, + 109, + 57, + 87, + 116 + ], + "features": "Plain", + "proof": [ + 220, + 255, + 97, + 117, + 57, + 12, + 96, + 43, + 250, + 146, + 194, + 255, + 209, + 169, + 178, + 216, + 77, + 204, + 158, + 169, + 65, + 246, + 243, + 23, + 189, + 208, + 248, + 117, + 36, + 78, + 242, + 62, + 105, + 111, + 209, + 124, + 113, + 223, + 121, + 118, + 12, + 229, + 206, + 26, + 150, + 170, + 177, + 209, + 93, + 208, + 87, + 53, + 141, + 200, + 53, + 233, + 114, + 254, + 190, + 184, + 109, + 80, + 204, + 236, + 13, + 173, + 124, + 254, + 2, + 70, + 215, + 66, + 235, + 117, + 60, + 247, + 184, + 140, + 4, + 93, + 21, + 188, + 113, + 35, + 248, + 207, + 113, + 85, + 100, + 124, + 207, + 102, + 63, + 202, + 146, + 168, + 60, + 154, + 101, + 208, + 237, + 117, + 110, + 167, + 235, + 255, + 210, + 202, + 201, + 12, + 56, + 10, + 16, + 46, + 217, + 202, + 170, + 53, + 93, + 23, + 94, + 208, + 191, + 88, + 211, + 172, + 47, + 94, + 144, + 157, + 108, + 68, + 125, + 252, + 107, + 96, + 94, + 4, + 146, + 92, + 43, + 23, + 195, + 62, + 189, + 25, + 8, + 201, + 101, + 165, + 84, + 30, + 165, + 210, + 237, + 69, + 160, + 149, + 142, + 100, + 2, + 248, + 157, + 122, + 86, + 223, + 25, + 146, + 224, + 54, + 216, + 54, + 231, + 64, + 23, + 231, + 60, + 202, + 213, + 203, + 58, + 130, + 184, + 225, + 57, + 227, + 9, + 121, + 42, + 49, + 177, + 95, + 63, + 253, + 114, + 237, + 3, + 50, + 83, + 66, + 140, + 21, + 108, + 43, + 151, + 153, + 69, + 138, + 37, + 193, + 218, + 101, + 183, + 25, + 120, + 10, + 34, + 222, + 127, + 231, + 244, + 55, + 174, + 47, + 204, + 210, + 44, + 247, + 234, + 53, + 122, + 181, + 170, + 102, + 165, + 239, + 125, + 113, + 251, + 13, + 198, + 74, + 160, + 181, + 118, + 31, + 104, + 39, + 128, + 98, + 187, + 57, + 187, + 41, + 108, + 120, + 126, + 76, + 171, + 197, + 226, + 162, + 147, + 58, + 65, + 108, + 225, + 201, + 169, + 105, + 97, + 96, + 56, + 100, + 73, + 196, + 55, + 233, + 18, + 15, + 123, + 178, + 110, + 91, + 14, + 116, + 209, + 242, + 231, + 213, + 188, + 215, + 170, + 251, + 42, + 146, + 184, + 125, + 21, + 72, + 241, + 249, + 17, + 251, + 6, + 175, + 123, + 214, + 204, + 19, + 206, + 226, + 159, + 124, + 156, + 183, + 144, + 33, + 174, + 209, + 129, + 134, + 39, + 42, + 240, + 233, + 209, + 137, + 236, + 16, + 124, + 129, + 168, + 163, + 174, + 180, + 120, + 43, + 13, + 149, + 14, + 72, + 129, + 170, + 81, + 183, + 118, + 187, + 104, + 68, + 178, + 91, + 206, + 151, + 3, + 91, + 72, + 169, + 189, + 178, + 174, + 163, + 96, + 134, + 135, + 188, + 221, + 71, + 157, + 79, + 169, + 152, + 181, + 168, + 57, + 255, + 136, + 85, + 142, + 74, + 41, + 223, + 240, + 237, + 19, + 181, + 89, + 0, + 171, + 181, + 212, + 57, + 183, + 7, + 147, + 217, + 2, + 174, + 154, + 211, + 69, + 135, + 177, + 140, + 145, + 159, + 107, + 135, + 92, + 145, + 209, + 77, + 238, + 177, + 195, + 115, + 245, + 231, + 101, + 112, + 213, + 154, + 101, + 73, + 117, + 143, + 101, + 95, + 17, + 40, + 165, + 79, + 22, + 45, + 254, + 136, + 104, + 225, + 88, + 112, + 40, + 226, + 106, + 217, + 30, + 82, + 140, + 90, + 231, + 238, + 147, + 53, + 250, + 88, + 251, + 89, + 2, + 43, + 93, + 226, + 157, + 128, + 240, + 118, + 74, + 153, + 23, + 57, + 13, + 70, + 219, + 137, + 154, + 204, + 106, + 91, + 65, + 110, + 37, + 236, + 201, + 220, + 203, + 113, + 83, + 100, + 106, + 221, + 204, + 129, + 202, + 219, + 95, + 0, + 120, + 254, + 188, + 126, + 5, + 215, + 115, + 90, + 186, + 73, + 79, + 57, + 239, + 5, + 105, + 123, + 188, + 201, + 180, + 123, + 44, + 204, + 121, + 89, + 93, + 117, + 252, + 19, + 200, + 6, + 120, + 181, + 226, + 55, + 237, + 206, + 88, + 215, + 49, + 243, + 76, + 5, + 177, + 221, + 202, + 166, + 73, + 172, + 242, + 216, + 101, + 187, + 188, + 60, + 237, + 161, + 5, + 8, + 188, + 221, + 41, + 208, + 73, + 103, + 68, + 100, + 75, + 241, + 195, + 81, + 111, + 102, + 135, + 223, + 238, + 245, + 100, + 156, + 125, + 255, + 144, + 98, + 125, + 100, + 39, + 57, + 165, + 157, + 145, + 168, + 209, + 208, + 196, + 220, + 85, + 215, + 74, + 148, + 158, + 16, + 116, + 66, + 118, + 100, + 180, + 103, + 153, + 44, + 158, + 15, + 125, + 58, + 249, + 214, + 234, + 121, + 81, + 62, + 137, + 70, + 221, + 192, + 211, + 86, + 186, + 196, + 152, + 120, + 230, + 78, + 106, + 149, + 176, + 163, + 2, + 20, + 33, + 79, + 175, + 44, + 227, + 23, + 250, + 98, + 47, + 243, + 38, + 107, + 50, + 168, + 22, + 225, + 10, + 24, + 230, + 215, + 137, + 165, + 218, + 31, + 35, + 230, + 123, + 79, + 151, + 10, + 104, + 167, + 188, + 217, + 225, + 136, + 37, + 238, + 39, + 75, + 4, + 131, + 137, + 106, + 64 + ] + } + ] + }, + "offset": [ + 210, + 2, + 150, + 73, + 0, + 0, + 0, + 0, + 211, + 2, + 150, + 73, + 0, + 0, + 0, + 0, + 212, + 2, + 150, + 73, + 0, + 0, + 0, + 0, + 213, + 2, + 150, + 73, + 0, + 0, + 0, + 0 + ] + }, + "version": 1 + } + } +} diff --git a/config/Cargo.toml b/config/Cargo.toml index 6ccb8ad2e..d43542169 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_config" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" authors = ["Grin Developers "] description = "Configuration for grin wallet , a simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -16,7 +16,7 @@ serde_derive = "1" toml = "0.4" dirs = "1.0.3" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.1" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } [dev-dependencies] pretty_assertions = "0.5.1" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 07f95ca8e..0631035f6 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_controller" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" authors = ["Grin Developers "] description = "Controllers for grin wallet instantiation" license = "Apache-2.0" @@ -32,9 +32,9 @@ chrono = { version = "0.4.4", features = ["serde"] } easy-jsonrpc = "0.4.1" lazy_static = "1" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.1" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } -grin_wallet_api = { path = "../api", version = "1.1.0-beta.1" } -grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.1" } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.1" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.1" } +grin_wallet_api = { path = "../api", version = "1.1.0-beta.2" } +grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.2" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.2" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.2" } diff --git a/impls/Cargo.toml b/impls/Cargo.toml index 631bb15ef..982c2a8e6 100644 --- a/impls/Cargo.toml +++ b/impls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_impls" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" authors = ["Grin Developers "] description = "Concrete types derived from libwallet traits" license = "Apache-2.0" @@ -26,7 +26,7 @@ tokio-retry = "0.1" uuid = { version = "0.7", features = ["serde", "v4"] } chrono = { version = "0.4.4", features = ["serde"] } -grin_wallet_util = { path = "../util", version = "1.1.0-beta.1" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.1" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.1" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.2" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.2" } diff --git a/impls/src/adapters/http.rs b/impls/src/adapters/http.rs index 5d93ae526..107c689f9 100644 --- a/impls/src/adapters/http.rs +++ b/impls/src/adapters/http.rs @@ -12,6 +12,8 @@ // See the License for the specific language governing permissions and // limitations under the License. +//TODO: Update to V2 API when after Hard fork + /// HTTP Wallet 'plugin' implementation use crate::api; use crate::libwallet::slate::Slate; @@ -48,6 +50,7 @@ impl WalletCommAdapter for HTTPWalletCommAdapter { } let url = format!("{}/v1/wallet/foreign/receive_tx", dest); debug!("Posting transaction slate to {}", url); + //TODO: Use VersionedSlate when converting to V2 API let slate = slate.serialize_to_version(Some(slate.version_info.orig_version))?; // For compatibility with older clients let res: Slate = { diff --git a/libwallet/Cargo.toml b/libwallet/Cargo.toml index 2cfc9383e..83c9391a2 100644 --- a/libwallet/Cargo.toml +++ b/libwallet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_libwallet" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" authors = ["Grin Developers "] description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -23,7 +23,7 @@ uuid = { version = "0.7", features = ["serde", "v4"] } chrono = { version = "0.4.4", features = ["serde"] } lazy_static = "1" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.1" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } [dev-dependencies] -grin_wallet_config = { path = "../config", version = "1.1.0-beta.1" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.2" } diff --git a/libwallet/src/lib.rs b/libwallet/src/lib.rs index 23a6f2ac4..655d03245 100644 --- a/libwallet/src/lib.rs +++ b/libwallet/src/lib.rs @@ -47,4 +47,6 @@ pub mod slate_versions; pub mod types; pub use crate::error::{Error, ErrorKind}; +pub use crate::slate::Slate; +pub use crate::slate_versions::{SlateVersion, VersionedSlate}; pub use internal::restore::{check_repair, restore}; diff --git a/libwallet/src/slate.rs b/libwallet/src/slate.rs index 4f882ce40..9e1585999 100644 --- a/libwallet/src/slate.rs +++ b/libwallet/src/slate.rs @@ -20,10 +20,12 @@ use crate::error::{Error, ErrorKind}; use crate::grin_core::core::amount_to_hr_string; use crate::grin_core::core::committed::Committed; use crate::grin_core::core::transaction::{ - kernel_features, kernel_sig_msg, Transaction, Weighting, + kernel_features, kernel_sig_msg, Input, Output, Transaction, TransactionBody, TxKernel, + Weighting, }; use crate::grin_core::core::verifier_cache::LruVerifierCache; use crate::grin_core::libtx::{aggsig, build, secp_ser, tx_fee}; +use crate::grin_core::map_vec; use crate::grin_keychain::{BlindSum, BlindingFactor, Keychain}; use crate::grin_util::secp; use crate::grin_util::secp::key::{PublicKey, SecretKey}; @@ -38,12 +40,13 @@ use uuid::Uuid; use crate::slate_versions::v0::SlateV0; use crate::slate_versions::v1::SlateV1; -use crate::slate_versions::v2::SlateV2; - -const CURRENT_SLATE_VERSION: u16 = 2; +use crate::slate_versions::v2::{ + InputV2, OutputV2, ParticipantDataV2, SlateV2, TransactionBodyV2, TransactionV2, TxKernelV2, + VersionCompatInfoV2, +}; +use crate::slate_versions::CURRENT_SLATE_VERSION; /// Public data for each participant in the slate - #[derive(Serialize, Deserialize, Debug, Clone)] pub struct ParticipantData { /// Id of participant in the transaction. (For now, 0=sender, 1=rec) @@ -661,3 +664,293 @@ impl Slate { Ok(()) } } + +// Current slate version to versioned conversions + +// Slate to versioned +impl From for SlateV2 { + fn from(slate: Slate) -> SlateV2 { + let Slate { + num_participants, + id, + tx, + amount, + fee, + height, + lock_height, + participant_data, + version_info, + } = slate; + let participant_data = map_vec!(participant_data, |data| ParticipantDataV2::from(data)); + let version_info = VersionCompatInfoV2::from(&version_info); + let tx = TransactionV2::from(tx); + SlateV2 { + num_participants, + id, + tx, + amount, + fee, + height, + lock_height, + participant_data, + version_info, + } + } +} + +impl From<&ParticipantData> for ParticipantDataV2 { + fn from(data: &ParticipantData) -> ParticipantDataV2 { + let ParticipantData { + id, + public_blind_excess, + public_nonce, + part_sig, + message, + message_sig, + } = data; + let id = *id; + let public_blind_excess = *public_blind_excess; + let public_nonce = *public_nonce; + let part_sig = *part_sig; + let message: Option = message.as_ref().map(|t| String::from(&**t)); + let message_sig = *message_sig; + ParticipantDataV2 { + id, + public_blind_excess, + public_nonce, + part_sig, + message, + message_sig, + } + } +} + +impl From<&VersionCompatInfo> for VersionCompatInfoV2 { + fn from(data: &VersionCompatInfo) -> VersionCompatInfoV2 { + let VersionCompatInfo { + version, + orig_version, + min_compat_version, + } = data; + let version = *version; + let orig_version = *orig_version; + let min_compat_version = *min_compat_version; + VersionCompatInfoV2 { + version, + orig_version, + min_compat_version, + } + } +} + +impl From for TransactionV2 { + fn from(tx: Transaction) -> TransactionV2 { + let Transaction { offset, body } = tx; + let body = TransactionBodyV2::from(&body); + TransactionV2 { offset, body } + } +} + +impl From<&TransactionBody> for TransactionBodyV2 { + fn from(body: &TransactionBody) -> TransactionBodyV2 { + let TransactionBody { + inputs, + outputs, + kernels, + } = body; + + let inputs = map_vec!(inputs, |inp| InputV2::from(inp)); + let outputs = map_vec!(outputs, |out| OutputV2::from(out)); + let kernels = map_vec!(kernels, |kern| TxKernelV2::from(kern)); + TransactionBodyV2 { + inputs, + outputs, + kernels, + } + } +} + +impl From<&Input> for InputV2 { + fn from(input: &Input) -> InputV2 { + let Input { features, commit } = *input; + InputV2 { features, commit } + } +} + +impl From<&Output> for OutputV2 { + fn from(output: &Output) -> OutputV2 { + let Output { + features, + commit, + proof, + } = *output; + OutputV2 { + features, + commit, + proof, + } + } +} + +impl From<&TxKernel> for TxKernelV2 { + fn from(kernel: &TxKernel) -> TxKernelV2 { + let TxKernel { + features, + fee, + lock_height, + excess, + excess_sig, + } = *kernel; + TxKernelV2 { + features, + fee, + lock_height, + excess, + excess_sig, + } + } +} + +// Versioned to current slate +impl From for Slate { + fn from(slate: SlateV2) -> Slate { + let SlateV2 { + num_participants, + id, + tx, + amount, + fee, + height, + lock_height, + participant_data, + version_info, + } = slate; + let participant_data = map_vec!(participant_data, |data| ParticipantData::from(data)); + let version_info = VersionCompatInfo::from(&version_info); + let tx = Transaction::from(tx); + Slate { + num_participants, + id, + tx, + amount, + fee, + height, + lock_height, + participant_data, + version_info, + } + } +} + +impl From<&ParticipantDataV2> for ParticipantData { + fn from(data: &ParticipantDataV2) -> ParticipantData { + let ParticipantDataV2 { + id, + public_blind_excess, + public_nonce, + part_sig, + message, + message_sig, + } = data; + let id = *id; + let public_blind_excess = *public_blind_excess; + let public_nonce = *public_nonce; + let part_sig = *part_sig; + let message: Option = message.as_ref().map(|t| String::from(&**t)); + let message_sig = *message_sig; + ParticipantData { + id, + public_blind_excess, + public_nonce, + part_sig, + message, + message_sig, + } + } +} + +impl From<&VersionCompatInfoV2> for VersionCompatInfo { + fn from(data: &VersionCompatInfoV2) -> VersionCompatInfo { + let VersionCompatInfoV2 { + version, + orig_version, + min_compat_version, + } = data; + let version = *version; + let orig_version = *orig_version; + let min_compat_version = *min_compat_version; + VersionCompatInfo { + version, + orig_version, + min_compat_version, + } + } +} + +impl From for Transaction { + fn from(tx: TransactionV2) -> Transaction { + let TransactionV2 { offset, body } = tx; + let body = TransactionBody::from(&body); + Transaction { offset, body } + } +} + +impl From<&TransactionBodyV2> for TransactionBody { + fn from(body: &TransactionBodyV2) -> TransactionBody { + let TransactionBodyV2 { + inputs, + outputs, + kernels, + } = body; + + let inputs = map_vec!(inputs, |inp| Input::from(inp)); + let outputs = map_vec!(outputs, |out| Output::from(out)); + let kernels = map_vec!(kernels, |kern| TxKernel::from(kern)); + TransactionBody { + inputs, + outputs, + kernels, + } + } +} + +impl From<&InputV2> for Input { + fn from(input: &InputV2) -> Input { + let InputV2 { features, commit } = *input; + Input { features, commit } + } +} + +impl From<&OutputV2> for Output { + fn from(output: &OutputV2) -> Output { + let OutputV2 { + features, + commit, + proof, + } = *output; + Output { + features, + commit, + proof, + } + } +} + +impl From<&TxKernelV2> for TxKernel { + fn from(kernel: &TxKernelV2) -> TxKernel { + let TxKernelV2 { + features, + fee, + lock_height, + excess, + excess_sig, + } = *kernel; + TxKernel { + features, + fee, + lock_height, + excess, + excess_sig, + } + } +} diff --git a/libwallet/src/slate_versions/mod.rs b/libwallet/src/slate_versions/mod.rs index 5aaf1796d..d92037a58 100644 --- a/libwallet/src/slate_versions/mod.rs +++ b/libwallet/src/slate_versions/mod.rs @@ -14,9 +14,92 @@ //! This module contains old slate versions and conversions to the newest slate version //! Used for serialization and deserialization of slates in a backwards compatible way. +use crate::slate::Slate; +use crate::slate_versions::v0::SlateV0; +use crate::slate_versions::v1::SlateV1; +use crate::slate_versions::v2::SlateV2; + #[allow(missing_docs)] pub mod v0; #[allow(missing_docs)] pub mod v1; #[allow(missing_docs)] pub mod v2; + +/// The most recent version of the slate +pub const CURRENT_SLATE_VERSION: u16 = 2; + +/// Existing versions of the slate +#[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] +pub enum SlateVersion { + /// V0 + V0, + /// V1 + V1, + /// V2 (most current) + V2, +} + +#[derive(Serialize, Deserialize)] +#[serde(untagged)] +/// Versions are ordered newest to oldest so serde attempts to +/// deserialize newer versions first, then falls back to older versions. +pub enum VersionedSlate { + /// Current + V2(SlateV2), + /// V1 - Grin 1.0.1 - 1.0.3) + V1(SlateV1), + /// V0 - Grin 1.0.0 + V0(SlateV0), +} + +impl VersionedSlate { + /// Return slate version + pub fn version(&self) -> SlateVersion { + match *self { + VersionedSlate::V2(_) => SlateVersion::V2, + VersionedSlate::V1(_) => SlateVersion::V1, + VersionedSlate::V0(_) => SlateVersion::V0, + } + } + + /// convert this slate type to a specified older version + pub fn into_version(slate: Slate, version: SlateVersion) -> VersionedSlate { + match version { + SlateVersion::V2 => VersionedSlate::V2(slate.into()), + SlateVersion::V1 => { + let s = SlateV2::from(slate); + let s = SlateV1::from(s); + VersionedSlate::V1(s) + } + SlateVersion::V0 => { + let s = SlateV2::from(slate); + let s = SlateV1::from(s); + let s = SlateV0::from(s); + VersionedSlate::V0(s) + } + } + } +} + +impl From for Slate { + fn from(slate: VersionedSlate) -> Slate { + match slate { + VersionedSlate::V2(s) => { + let s = SlateV2::from(s); + Slate::from(s) + } + VersionedSlate::V1(s) => { + let s = SlateV1::from(s); + let s = SlateV2::from(s); + Slate::from(s) + } + VersionedSlate::V0(s) => { + let s = SlateV0::from(s); + let s = SlateV1::from(s); + let s = SlateV2::from(s); + Slate::from(s) + } + } + } +} diff --git a/util/Cargo.toml b/util/Cargo.toml index 105dcdbb4..19a799839 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_util" -version = "1.1.0-beta.1" +version = "1.1.0-beta.2" authors = ["Grin Developers "] description = "Util, for generic utilities and to re-export grin crates" license = "Apache-2.0" @@ -17,28 +17,28 @@ toml = "0.4" dirs = "1.0.3" # For Release -grin_core = "1.1.0-beta.1" -grin_keychain = "1.1.0-beta.1" -grin_chain = "1.1.0-beta.1" -grin_util = "1.1.0-beta.1" -grin_api = "1.1.0-beta.1" -grin_store = "1.1.0-beta.1" +#grin_core = "1.1.0-beta.1" +#grin_keychain = "1.1.0-beta.1" +#grin_chain = "1.1.0-beta.1" +#grin_util = "1.1.0-beta.1" +#grin_api = "1.1.0-beta.1" +#grin_store = "1.1.0-beta.1" # For bleeding edge -#grin_core = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -#grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -#grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -#grin_util = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -#grin_api = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -#grin_store = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } +grin_core = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_util = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_api = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_store = { git = "https://github.com/mimblewimble/grin", branch = "master" } # For local testing -#grin_core = { path = "../../grin/core", version= "1.1.0"} -#grin_keychain = { path = "../../grin/keychain", version= "1.1.0"} -#grin_chain = { path = "../../grin/chain", version= "1.1.0"} -#grin_util = { path = "../../grin/util", version= "1.1.0"} -#grin_api = { path = "../../grin/api", version= "1.1.0"} -#grin_store = { path = "../../grin/store", version= "1.1.0"} +#grin_core = { path = "../../grin/core", version= "1.1.0-beta.2"} +#grin_keychain = { path = "../../grin/keychain", version= "1.1.0-beta.2"} +#grin_chain = { path = "../../grin/chain", version= "1.1.0-beta.2"} +#grin_util = { path = "../../grin/util", version= "1.1.0-beta.2"} +#grin_api = { path = "../../grin/api", version= "1.1.0-beta.2"} +#grin_store = { path = "../../grin/store", version= "1.1.0-beta.2"} [dev-dependencies] pretty_assertions = "0.5.1" From bff07eb3f5554ff13f81d8ff7ea10c4bc52609f8 Mon Sep 17 00:00:00 2001 From: Andrew Dirksen Date: Wed, 24 Apr 2019 01:26:52 -0700 Subject: [PATCH 02/36] fix #88 (#89) --- Cargo.lock | 14 +++++++------- api/Cargo.toml | 2 +- api/src/foreign_rpc.rs | 2 +- api/src/owner_rpc.rs | 2 +- controller/Cargo.toml | 2 +- controller/src/controller.rs | 20 +++++++++++--------- 6 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c6ebcf86..e858cd3ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -402,10 +402,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "easy-jsonrpc" -version = "0.4.1" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "easy-jsonrpc-proc-macro 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "easy-jsonrpc-proc-macro 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 10.1.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.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -414,7 +414,7 @@ dependencies = [ [[package]] name = "easy-jsonrpc-proc-macro" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -776,7 +776,7 @@ name = "grin_wallet_api" version = "1.1.0-beta.2" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "easy-jsonrpc 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "easy-jsonrpc 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "grin_wallet_config 1.1.0-beta.2", @@ -807,7 +807,7 @@ name = "grin_wallet_controller" version = "1.1.0-beta.2" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "easy-jsonrpc 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", + "easy-jsonrpc 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2731,8 +2731,8 @@ dependencies = [ "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" "checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" -"checksum easy-jsonrpc 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2f0d8eaadf5a9ed73697761ad586140c40aa0837fb5b141a2b04ee9c07eacbfe" -"checksum easy-jsonrpc-proc-macro 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b50f53cc7025979b06da8fde906f948f0fa4665bf840043f4de1e25acee53c97" +"checksum easy-jsonrpc 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cb424ab9ae1c46a5ee5a21f5a11a40b01b7d71a5bd45b12961974fd33701b93f" +"checksum easy-jsonrpc-proc-macro 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9fb33793846951f339a70580375734416898ff8ddbb74401865031e25ba6751" "checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" "checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38" diff --git a/api/Cargo.toml b/api/Cargo.toml index ce09c3386..d9d87c7a4 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -15,7 +15,7 @@ failure_derive = "0.1" log = "0.4" uuid = { version = "0.7", features = ["serde", "v4"] } serde_json = "1" -easy-jsonrpc = "0.4.1" +easy-jsonrpc = "0.5.1" chrono = { version = "0.4.4", features = ["serde"] } grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.2" } diff --git a/api/src/foreign_rpc.rs b/api/src/foreign_rpc.rs index 64d660481..9d622a78e 100644 --- a/api/src/foreign_rpc.rs +++ b/api/src/foreign_rpc.rs @@ -440,7 +440,7 @@ pub fn run_doctest_foreign( let mut api_foreign = Foreign::new(wallet1.clone()); api_foreign.doctest_mode = true; let foreign_api = &api_foreign as &dyn ForeignRpc; - Ok(foreign_api.handle_request(request)) + Ok(foreign_api.handle_request(request).as_option()) } #[doc(hidden)] diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index 6d9be88b8..d134e31ea 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -1202,7 +1202,7 @@ pub fn run_doctest_owner( let mut api_owner = Owner::new(wallet1.clone()); api_owner.doctest_mode = true; let owner_api = &api_owner as &dyn OwnerRpc; - Ok(owner_api.handle_request(request)) + Ok(owner_api.handle_request(request).as_option()) } #[doc(hidden)] diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 0631035f6..9cbd1207e 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -29,7 +29,7 @@ tokio-retry = "0.1" uuid = { version = "0.7", features = ["serde", "v4"] } url = "1.7.0" chrono = { version = "0.4.4", features = ["serde"] } -easy-jsonrpc = "0.4.1" +easy-jsonrpc = "0.5.1" lazy_static = "1" grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } diff --git a/controller/src/controller.rs b/controller/src/controller.rs index 0322deda7..a2122ec87 100644 --- a/controller/src/controller.rs +++ b/controller/src/controller.rs @@ -44,7 +44,7 @@ use uuid::Uuid; use crate::apiwallet::{Foreign, ForeignRpc, Owner, OwnerRpc}; use easy_jsonrpc; -use easy_jsonrpc::Handler; +use easy_jsonrpc::{Handler, MaybeReply}; lazy_static! { pub static ref GRIN_OWNER_BASIC_REALM: HeaderValue = @@ -687,10 +687,11 @@ where Box::new(parse_body(req).and_then(move |val: serde_json::Value| { let owner_api = &api as &dyn OwnerRpc; match owner_api.handle_request(val) { - Some(r) => ok(r), - None => { - error!("OwnerAPI: call_api: failed with error"); - err(ErrorKind::GenericError(format!("OwnerAPI Call Failed")).into()) + MaybeReply::Reply(r) => ok(r), + MaybeReply::DontReply => { + // Since it's http, we need to return something. We return [] because jsonrpc + // clients will parse it as an empty batch response. + ok(serde_json::json!([])) } } })) @@ -866,10 +867,11 @@ where Box::new(parse_body(req).and_then(move |val: serde_json::Value| { let foreign_api = &api as &dyn ForeignRpc; match foreign_api.handle_request(val) { - Some(r) => ok(r), - None => { - error!("ForeignAPI: call_api: failed with error"); - err(ErrorKind::GenericError(format!("ForeignAPI Call Failed")).into()) + MaybeReply::Reply(r) => ok(r), + MaybeReply::DontReply => { + // Since it's http, we need to return something. We return [] because jsonrpc + // clients will parse it as an empty batch response. + ok(serde_json::json!([])) } } })) From d774272fee41c6c1ab3ecefb86deacc109012471 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Wed, 24 Apr 2019 09:27:14 +0100 Subject: [PATCH 03/36] Add `check_version` function to Foreign API (#87) * move api deser types into separate types mod * rustfmt * missing types file * make all exports from libwallet more explicit * rustfmt * add version check function to foreign api * rustfmt * change check_version return value to result, for consistency --- api/src/foreign.rs | 33 ++++- api/src/foreign_rpc.rs | 45 +++++- api/src/owner.rs | 12 +- api/src/owner_rpc.rs | 8 +- controller/src/command.rs | 2 +- controller/src/controller.rs | 8 +- controller/src/display.rs | 5 +- controller/tests/accounts.rs | 2 +- controller/tests/check.rs | 17 +-- controller/tests/file.rs | 2 +- controller/tests/repost.rs | 3 +- controller/tests/restore.rs | 11 +- controller/tests/self_send.rs | 2 +- controller/tests/transaction.rs | 7 +- impls/src/adapters/file.rs | 3 +- impls/src/adapters/http.rs | 3 +- impls/src/adapters/keybase.rs | 3 +- impls/src/adapters/mod.rs | 3 +- impls/src/adapters/null.rs | 3 +- impls/src/lib.rs | 2 +- impls/src/lmdb_wallet.rs | 6 +- impls/src/node_clients/http.rs | 2 +- impls/src/test_framework/mod.rs | 2 +- impls/src/test_framework/testclient.rs | 3 +- libwallet/src/api_impl.rs | 1 + libwallet/src/api_impl/foreign.rs | 16 +- libwallet/src/api_impl/owner.rs | 6 +- libwallet/src/api_impl/types.rs | 193 +++++++++++++++++++++++++ libwallet/src/internal/restore.rs | 2 +- libwallet/src/internal/updater.rs | 4 +- libwallet/src/lib.rs | 14 +- libwallet/src/types.rs | 167 +-------------------- libwallet/tests/libwallet.rs | 2 +- libwallet/tests/slate_versioning.rs | 2 +- src/bin/cmd/wallet_args.rs | 2 +- src/bin/cmd/wallet_tests.rs | 2 +- 36 files changed, 342 insertions(+), 256 deletions(-) create mode 100644 libwallet/src/api_impl/types.rs diff --git a/api/src/foreign.rs b/api/src/foreign.rs index 921f04282..56b63157c 100644 --- a/api/src/foreign.rs +++ b/api/src/foreign.rs @@ -16,9 +16,7 @@ use crate::keychain::Keychain; use crate::libwallet::api_impl::foreign; -use crate::libwallet::slate::Slate; -use crate::libwallet::types::{BlockFees, CbData, NodeClient, WalletBackend}; -use crate::libwallet::Error; +use crate::libwallet::{BlockFees, CbData, Error, NodeClient, Slate, VersionInfo, WalletBackend}; use crate::util::Mutex; use std::marker::PhantomData; use std::sync::Arc; @@ -91,7 +89,7 @@ where /// use api::Foreign; /// use config::WalletConfig; /// use impls::{HTTPNodeClient, LMDBBackend}; - /// use libwallet::types::WalletBackend; + /// use libwallet::WalletBackend; /// /// let mut wallet_config = WalletConfig::default(); /// # let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap(); @@ -125,6 +123,26 @@ where } } + /// Return the version capabilities of the running ForeignApi Node + /// # Arguments + /// None + /// # Returns + /// * [`VersionInfo`](../grin_wallet_libwallet/api_impl/types/struct.VersionInfo.html) + /// # Example + /// Set up as in [`new`](struct.Foreign.html#method.new) method above. + /// ``` + /// # grin_wallet_api::doctest_helper_setup_doc_env_foreign!(wallet, wallet_config); + /// + /// let mut api_foreign = Foreign::new(wallet.clone()); + /// + /// let version_info = api_foreign.check_version(); + /// // check and proceed accordingly + /// ``` + + pub fn check_version(&self) -> Result { + Ok(foreign::check_version()) + } + /// Builds a new unconfirmed coinbase output in the wallet, generally for inclusion in a /// potential new block's coinbase output during mining. /// @@ -136,7 +154,7 @@ where /// /// # Arguments /// - /// * `block_fees` - A [`BlockFees`](../grin_wallet_libwallet/types/struct.BlockFees.html) + /// * `block_fees` - A [`BlockFees`](../grin_wallet_libwallet/api_impl/types/struct.BlockFees.html) /// struct, set up as follows: /// /// `fees` - should contain the sum of all transaction fees included in the potential @@ -149,7 +167,7 @@ where /// id will be assigned /// /// # Returns - /// * `Ok`([`cb_data`](../grin_wallet_libwallet/types/struct.CbData.html)`)` if successful. This + /// * `Ok`([`cb_data`](../grin_wallet_libwallet/api_impl/types/struct.CbData.html)`)` if successful. This /// will contain the corresponding output, kernel and keyID used to create the coinbase output. /// * or [`libwallet::Error`](../grin_wallet_libwallet/struct.Error.html) if an error is encountered. /// @@ -305,7 +323,6 @@ macro_rules! doctest_helper_setup_doc_env_foreign { use grin_wallet_libwallet as libwallet; use grin_wallet_util::grin_keychain as keychain; use grin_wallet_util::grin_util as util; - use libwallet::slate::Slate; use keychain::ExtKeychain; use tempfile::tempdir; @@ -316,7 +333,7 @@ macro_rules! doctest_helper_setup_doc_env_foreign { use api::Foreign; use config::WalletConfig; use impls::{HTTPNodeClient, LMDBBackend, WalletSeed}; - use libwallet::types::{BlockFees, WalletBackend}; + use libwallet::{BlockFees, Slate, WalletBackend}; let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap(); let dir = dir diff --git a/api/src/foreign_rpc.rs b/api/src/foreign_rpc.rs index 9d622a78e..62b758e59 100644 --- a/api/src/foreign_rpc.rs +++ b/api/src/foreign_rpc.rs @@ -15,9 +15,10 @@ //! JSON-RPC Stub generation for the Foreign API use crate::keychain::Keychain; -use crate::libwallet::types::{BlockFees, CbData, InitTxArgs, NodeClient, WalletBackend}; -use crate::libwallet::ErrorKind; -use crate::libwallet::{Slate, VersionedSlate}; +use crate::libwallet::{ + BlockFees, CbData, ErrorKind, InitTxArgs, NodeClient, Slate, VersionInfo, VersionedSlate, + WalletBackend, +}; use crate::Foreign; use easy_jsonrpc; @@ -27,6 +28,40 @@ use easy_jsonrpc; /// * The endpoint only supports POST operations, with the json-rpc request as the body #[easy_jsonrpc::rpc] pub trait ForeignRpc { + /** + Networked version of [Foreign::check_version](struct.Foreign.html#method.check_version). + + # Json rpc example + + ``` + # grin_wallet_api::doctest_helper_json_rpc_foreign_assert_response!( + # r#" + { + "jsonrpc": "2.0", + "method": "check_version", + "id": 1, + "params": [] + } + # "# + # , + # r#" + { + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "default_slate_version": 2, + "foreign_api_version": 2 + } + } + } + # "# + # , 0, false); + ``` + + */ + fn check_version(&self) -> Result; + /** Networked version of [Foreign::build_coinbase](struct.Foreign.html#method.build_coinbase). @@ -322,6 +357,10 @@ where C: NodeClient, K: Keychain, { + fn check_version(&self) -> Result { + Foreign::check_version(self).map_err(|e| e.kind()) + } + fn build_coinbase(&self, block_fees: &BlockFees) -> Result { Foreign::build_coinbase(self, block_fees).map_err(|e| e.kind()) } diff --git a/api/src/owner.rs b/api/src/owner.rs index 732e6444e..ee706f1ed 100644 --- a/api/src/owner.rs +++ b/api/src/owner.rs @@ -24,12 +24,10 @@ use crate::core::core::Transaction; use crate::impls::{HTTPWalletCommAdapter, KeybaseWalletCommAdapter}; use crate::keychain::{Identifier, Keychain}; use crate::libwallet::api_impl::owner; -use crate::libwallet::slate::Slate; -use crate::libwallet::types::{ - AcctPathMapping, InitTxArgs, NodeClient, NodeHeightResult, OutputCommitMapping, TxLogEntry, - WalletBackend, WalletInfo, +use crate::libwallet::{ + AcctPathMapping, Error, ErrorKind, InitTxArgs, NodeClient, NodeHeightResult, + OutputCommitMapping, Slate, TxLogEntry, WalletBackend, WalletInfo, }; -use crate::libwallet::{Error, ErrorKind}; /// Main interface into all wallet API functions. /// Wallet APIs are split into two seperate blocks of functionality @@ -99,7 +97,7 @@ where /// use api::Owner; /// use config::WalletConfig; /// use impls::{HTTPNodeClient, LMDBBackend}; - /// use libwallet::types::WalletBackend; + /// use libwallet::WalletBackend; /// /// let mut wallet_config = WalletConfig::default(); /// # let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap(); @@ -1018,7 +1016,7 @@ macro_rules! doctest_helper_setup_doc_env { use api::Owner; use config::WalletConfig; use impls::{HTTPNodeClient, LMDBBackend, WalletSeed}; - use libwallet::types::{InitTxArgs, WalletBackend}; + use libwallet::{InitTxArgs, WalletBackend}; let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap(); let dir = dir diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index d134e31ea..31f637b49 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -17,12 +17,10 @@ use uuid::Uuid; use crate::core::core::Transaction; use crate::keychain::{Identifier, Keychain}; -use crate::libwallet::slate::Slate; -use crate::libwallet::types::{ - AcctPathMapping, InitTxArgs, NodeClient, NodeHeightResult, OutputCommitMapping, TxLogEntry, - WalletBackend, WalletInfo, +use crate::libwallet::{ + AcctPathMapping, ErrorKind, InitTxArgs, NodeClient, NodeHeightResult, OutputCommitMapping, + Slate, TxLogEntry, WalletBackend, WalletInfo, }; -use crate::libwallet::ErrorKind; use crate::Owner; use easy_jsonrpc; diff --git a/controller/src/command.rs b/controller/src/command.rs index fb33470e4..ae5cba102 100644 --- a/controller/src/command.rs +++ b/controller/src/command.rs @@ -35,7 +35,7 @@ use crate::impls::{ LMDBBackend, NullWalletCommAdapter, }; use crate::impls::{HTTPNodeClient, WalletSeed}; -use crate::libwallet::types::{InitTxArgs, NodeClient, WalletInst}; +use crate::libwallet::{InitTxArgs, NodeClient, WalletInst}; use crate::{controller, display}; /// Arguments common to all wallet commands diff --git a/controller/src/controller.rs b/controller/src/controller.rs index a2122ec87..01f1601e9 100644 --- a/controller/src/controller.rs +++ b/controller/src/controller.rs @@ -20,12 +20,10 @@ use crate::core::core; use crate::core::core::Transaction; use crate::impls::{FileWalletCommAdapter, HTTPWalletCommAdapter, KeybaseWalletCommAdapter}; use crate::keychain::Keychain; -use crate::libwallet::slate::Slate; -use crate::libwallet::types::{ - CbData, InitTxArgs, NodeClient, OutputCommitMapping, SendTXArgs, TxLogEntry, WalletBackend, - WalletInfo, +use crate::libwallet::{ + CbData, Error, ErrorKind, InitTxArgs, NodeClient, OutputCommitMapping, SendTXArgs, Slate, + TxLogEntry, WalletBackend, WalletInfo, }; -use crate::libwallet::{Error, ErrorKind}; use crate::util::to_base64; use crate::util::Mutex; use failure::ResultExt; diff --git a/controller/src/display.rs b/controller/src/display.rs index 461d0ec49..c8944960a 100644 --- a/controller/src/display.rs +++ b/controller/src/display.rs @@ -14,10 +14,9 @@ use crate::core::core::{self, amount_to_hr_string}; use crate::core::global; -use crate::libwallet::types::{ - AcctPathMapping, OutputCommitMapping, OutputStatus, TxLogEntry, WalletInfo, +use crate::libwallet::{ + AcctPathMapping, Error, OutputCommitMapping, OutputStatus, TxLogEntry, WalletInfo, }; -use crate::libwallet::Error; use crate::util; use prettytable; use std::io::prelude::Write; diff --git a/controller/tests/accounts.rs b/controller/tests/accounts.rs index 1074a5694..85fe59150 100644 --- a/controller/tests/accounts.rs +++ b/controller/tests/accounts.rs @@ -26,7 +26,7 @@ use self::core::global::ChainTypes; use self::keychain::{ExtKeychain, Keychain}; use grin_wallet_libwallet as libwallet; use impls::test_framework::{self, LocalWalletClient, WalletProxy}; -use libwallet::types::InitTxArgs; +use libwallet::InitTxArgs; use std::fs; use std::thread; use std::time::Duration; diff --git a/controller/tests/check.rs b/controller/tests/check.rs index 79e76f2a7..144e29021 100644 --- a/controller/tests/check.rs +++ b/controller/tests/check.rs @@ -28,7 +28,7 @@ use self::keychain::ExtKeychain; use grin_wallet_libwallet as libwallet; use impls::test_framework::{self, LocalWalletClient, WalletProxy}; use impls::FileWalletCommAdapter; -use libwallet::types::{InitTxArgs, WalletInst}; +use libwallet::{InitTxArgs, WalletInst}; use std::fs; use std::thread; use std::time::Duration; @@ -123,7 +123,7 @@ fn check_repair_impl(test_dir: &str) -> Result<(), libwallet::Error> { assert_eq!(wallet1_info.amount_currently_spendable, (bh - cm) * reward); // check tx log as well let (_, txs) = api.retrieve_txs(true, None, None)?; - let (c, _) = libwallet::types::TxLogEntry::sum_confirmed(&txs); + let (c, _) = libwallet::TxLogEntry::sum_confirmed(&txs); assert_eq!(wallet1_info.total, c); assert_eq!(txs.len(), bh as usize); Ok(()) @@ -135,7 +135,7 @@ fn check_repair_impl(test_dir: &str) -> Result<(), libwallet::Error> { w1_outputs_commits = api.retrieve_outputs(false, true, None)?.1; Ok(()) })?; - let w1_outputs: Vec = + let w1_outputs: Vec = w1_outputs_commits.into_iter().map(|m| m.output).collect(); { let mut w = wallet1.lock(); @@ -145,7 +145,7 @@ fn check_repair_impl(test_dir: &str) -> Result<(), libwallet::Error> { batch.delete(&w1_outputs[4].key_id, &None)?; batch.delete(&w1_outputs[10].key_id, &None)?; let mut accidental_spent = w1_outputs[13].clone(); - accidental_spent.status = libwallet::types::OutputStatus::Spent; + accidental_spent.status = libwallet::OutputStatus::Spent; batch.save(accidental_spent)?; batch.commit()?; } @@ -156,7 +156,7 @@ fn check_repair_impl(test_dir: &str) -> Result<(), libwallet::Error> { wallet::controller::owner_single_use(wallet1.clone(), |api| { let (_, wallet1_info) = api.retrieve_summary_info(true, 1)?; let (_, txs) = api.retrieve_txs(true, None, None)?; - let (c, _) = libwallet::types::TxLogEntry::sum_confirmed(&txs); + let (c, _) = libwallet::TxLogEntry::sum_confirmed(&txs); assert!(wallet1_info.total != c); Ok(()) })?; @@ -223,10 +223,9 @@ fn check_repair_impl(test_dir: &str) -> Result<(), libwallet::Error> { fn two_wallets_one_seed_impl(test_dir: &str) -> Result<(), libwallet::Error> { setup(test_dir); - let seed_phrase = - "affair pistol cancel crush garment candy ancient flag work \ - market crush dry stand focus mutual weapon offer ceiling rival turn team spring \ - where swift"; + let seed_phrase = "affair pistol cancel crush garment candy ancient flag work \ + market crush dry stand focus mutual weapon offer ceiling rival turn team spring \ + where swift"; // Create a new proxy to simulate server and wallet responses let mut wallet_proxy: WalletProxy = WalletProxy::new(test_dir); diff --git a/controller/tests/file.rs b/controller/tests/file.rs index 3d923925e..3816f8f8f 100644 --- a/controller/tests/file.rs +++ b/controller/tests/file.rs @@ -31,7 +31,7 @@ use std::fs; use std::thread; use std::time::Duration; -use grin_wallet_libwallet::types::InitTxArgs; +use grin_wallet_libwallet::InitTxArgs; use serde_json; diff --git a/controller/tests/repost.rs b/controller/tests/repost.rs index f3f5b0b18..0377b5431 100644 --- a/controller/tests/repost.rs +++ b/controller/tests/repost.rs @@ -25,8 +25,7 @@ use grin_wallet_util::grin_util as util; use self::core::global; use self::core::global::ChainTypes; use self::keychain::ExtKeychain; -use self::libwallet::slate::Slate; -use self::libwallet::types::InitTxArgs; +use self::libwallet::{InitTxArgs, Slate}; use impls::test_framework::{self, LocalWalletClient, WalletProxy}; use impls::FileWalletCommAdapter; use std::fs; diff --git a/controller/tests/restore.rs b/controller/tests/restore.rs index 0b3874ab4..dd660b95c 100644 --- a/controller/tests/restore.rs +++ b/controller/tests/restore.rs @@ -25,8 +25,7 @@ use grin_wallet_util::grin_util as util; use self::core::global; use self::core::global::ChainTypes; use self::keychain::{ExtKeychain, Identifier, Keychain}; -use self::libwallet::slate::Slate; -use self::libwallet::types::{AcctPathMapping, InitTxArgs}; +use self::libwallet::{AcctPathMapping, InitTxArgs, Slate}; use impls::test_framework::{self, LocalWalletClient, WalletProxy}; use std::fs; use std::sync::atomic::Ordering; @@ -124,11 +123,11 @@ fn compare_wallet_restore( } }); - let mut src_info: Option = None; - let mut dest_info: Option = None; + let mut src_info: Option = None; + let mut dest_info: Option = None; - let mut src_txs: Option> = None; - let mut dest_txs: Option> = None; + let mut src_txs: Option> = None; + let mut dest_txs: Option> = None; let mut src_accts: Option> = None; let mut dest_accts: Option> = None; diff --git a/controller/tests/self_send.rs b/controller/tests/self_send.rs index 7c1f5bc1a..8053cfa82 100644 --- a/controller/tests/self_send.rs +++ b/controller/tests/self_send.rs @@ -26,7 +26,7 @@ use self::core::global::ChainTypes; use self::keychain::ExtKeychain; use grin_wallet_libwallet as libwallet; use impls::test_framework::{self, LocalWalletClient, WalletProxy}; -use libwallet::types::InitTxArgs; +use libwallet::InitTxArgs; use std::fs; use std::thread; use std::time::Duration; diff --git a/controller/tests/transaction.rs b/controller/tests/transaction.rs index 640f6e206..57459863c 100644 --- a/controller/tests/transaction.rs +++ b/controller/tests/transaction.rs @@ -26,8 +26,7 @@ use self::core::core::transaction; use self::core::global; use self::core::global::ChainTypes; use self::keychain::ExtKeychain; -use self::libwallet::slate::Slate; -use self::libwallet::types::{InitTxArgs, OutputStatus}; +use self::libwallet::{InitTxArgs, OutputStatus, Slate}; use impls::test_framework::{self, LocalWalletClient, WalletProxy}; use std::fs; use std::thread; @@ -75,7 +74,7 @@ fn basic_transaction_api(test_dir: &str) -> Result<(), libwallet::Error> { // few values to keep things shorter let reward = core::consensus::REWARD; let cm = global::coinbase_maturity(); // assume all testing precedes soft fork height - // mine a few blocks + // mine a few blocks let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), 10, false); // Check wallet 1 contents are as expected @@ -379,7 +378,7 @@ fn tx_rollback(test_dir: &str) -> Result<(), libwallet::Error> { // few values to keep things shorter let reward = core::consensus::REWARD; let cm = global::coinbase_maturity(); // assume all testing precedes soft fork height - // mine a few blocks + // mine a few blocks let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), 5, false); let amount = 30_000_000_000; diff --git a/impls/src/adapters/file.rs b/impls/src/adapters/file.rs index 2e396b29b..03d8c1443 100644 --- a/impls/src/adapters/file.rs +++ b/impls/src/adapters/file.rs @@ -17,8 +17,7 @@ use std::fs::File; use std::io::{Read, Write}; use crate::config::WalletConfig; -use crate::libwallet::slate::Slate; -use crate::libwallet::Error; +use crate::libwallet::{Error, Slate}; use crate::WalletCommAdapter; use std::collections::HashMap; diff --git a/impls/src/adapters/http.rs b/impls/src/adapters/http.rs index 107c689f9..094aa5deb 100644 --- a/impls/src/adapters/http.rs +++ b/impls/src/adapters/http.rs @@ -16,9 +16,8 @@ /// HTTP Wallet 'plugin' implementation use crate::api; -use crate::libwallet::slate::Slate; use crate::libwallet::slate_versions::{v0, v1}; -use crate::libwallet::{Error, ErrorKind}; +use crate::libwallet::{Error, ErrorKind, Slate}; use crate::WalletCommAdapter; use config::WalletConfig; use failure::ResultExt; diff --git a/impls/src/adapters/keybase.rs b/impls/src/adapters/keybase.rs index b99a43721..bf71d9f14 100644 --- a/impls/src/adapters/keybase.rs +++ b/impls/src/adapters/keybase.rs @@ -16,8 +16,7 @@ use crate::config::WalletConfig; use crate::libwallet::api_impl::foreign; -use crate::libwallet::slate::Slate; -use crate::libwallet::{Error, ErrorKind}; +use crate::libwallet::{Error, ErrorKind, Slate}; use crate::{instantiate_wallet, HTTPNodeClient, WalletCommAdapter}; use failure::ResultExt; use serde::Serialize; diff --git a/impls/src/adapters/mod.rs b/impls/src/adapters/mod.rs index f765cb4b7..fa4ce0fd7 100644 --- a/impls/src/adapters/mod.rs +++ b/impls/src/adapters/mod.rs @@ -23,8 +23,7 @@ pub use self::keybase::KeybaseWalletCommAdapter; pub use self::null::NullWalletCommAdapter; use crate::config::WalletConfig; -use crate::libwallet::slate::Slate; -use crate::libwallet::Error; +use crate::libwallet::{Error, Slate}; use std::collections::HashMap; /// Encapsulate wallet to wallet communication functions diff --git a/impls/src/adapters/null.rs b/impls/src/adapters/null.rs index 8c6e4723d..376133c07 100644 --- a/impls/src/adapters/null.rs +++ b/impls/src/adapters/null.rs @@ -14,8 +14,7 @@ use crate::config::WalletConfig; /// Null Output 'plugin' implementation -use crate::libwallet::slate::Slate; -use crate::libwallet::Error; +use crate::libwallet::{Error, Slate}; use crate::WalletCommAdapter; use std::collections::HashMap; diff --git a/impls/src/lib.rs b/impls/src/lib.rs index 697f0d718..f2ee142cd 100644 --- a/impls/src/lib.rs +++ b/impls/src/lib.rs @@ -50,7 +50,7 @@ pub use crate::seed::{EncryptedWalletSeed, WalletSeed, SEED_FILE}; use crate::util::Mutex; use std::sync::Arc; -use libwallet::types::{NodeClient, WalletBackend, WalletInst}; +use libwallet::{NodeClient, WalletBackend, WalletInst}; /// Helper to create an instance of the LMDB wallet pub fn instantiate_wallet( diff --git a/impls/src/lmdb_wallet.rs b/impls/src/lmdb_wallet.rs index 5a54bcad8..3fd9df74c 100644 --- a/impls/src/lmdb_wallet.rs +++ b/impls/src/lmdb_wallet.rs @@ -30,9 +30,11 @@ use crate::store::{self, option_to_not_found, to_key, to_key_u64}; use crate::core::core::Transaction; use crate::core::{global, ser}; -use crate::libwallet::types::*; use crate::libwallet::{check_repair, restore}; -use crate::libwallet::{Error, ErrorKind}; +use crate::libwallet::{ + AcctPathMapping, Context, Error, ErrorKind, NodeClient, OutputData, TxLogEntry, WalletBackend, + WalletOutputBatch, +}; use crate::util; use crate::util::secp::constants::SECRET_KEY_SIZE; use crate::util::ZeroingString; diff --git a/impls/src/node_clients/http.rs b/impls/src/node_clients/http.rs index 3fe9b2bb3..6a30acbd3 100644 --- a/impls/src/node_clients/http.rs +++ b/impls/src/node_clients/http.rs @@ -17,7 +17,7 @@ use futures::{stream, Stream}; -use crate::libwallet::types::*; +use crate::libwallet::{NodeClient, TxWrapper}; use std::collections::HashMap; use tokio::runtime::Runtime; diff --git a/impls/src/test_framework/mod.rs b/impls/src/test_framework/mod.rs index f7a8d186f..b748aa4a4 100644 --- a/impls/src/test_framework/mod.rs +++ b/impls/src/test_framework/mod.rs @@ -22,7 +22,7 @@ use crate::core::{consensus, global, pow}; use crate::keychain; use crate::libwallet; use crate::libwallet::api_impl::{foreign, owner}; -use crate::libwallet::types::{ +use crate::libwallet::{ BlockFees, CbData, InitTxArgs, NodeClient, WalletBackend, WalletInfo, WalletInst, }; use crate::lmdb_wallet::LMDBBackend; diff --git a/impls/src/test_framework/testclient.rs b/impls/src/test_framework/testclient.rs index 4e2742419..70c7a43f7 100644 --- a/impls/src/test_framework/testclient.rs +++ b/impls/src/test_framework/testclient.rs @@ -26,8 +26,7 @@ use crate::core::global::{set_mining_mode, ChainTypes}; use crate::core::{pow, ser}; use crate::keychain::Keychain; use crate::libwallet::api_impl::foreign; -use crate::libwallet::slate::Slate; -use crate::libwallet::types::*; +use crate::libwallet::{NodeClient, Slate, TxWrapper, WalletInst}; use crate::util; use crate::util::secp::pedersen; use crate::util::secp::pedersen::Commitment; diff --git a/libwallet/src/api_impl.rs b/libwallet/src/api_impl.rs index 0de2fe495..45070975d 100644 --- a/libwallet/src/api_impl.rs +++ b/libwallet/src/api_impl.rs @@ -23,3 +23,4 @@ pub mod foreign; pub mod owner; +pub mod types; diff --git a/libwallet/src/api_impl/foreign.rs b/libwallet/src/api_impl/foreign.rs index 2deadbc66..b0592a0d6 100644 --- a/libwallet/src/api_impl/foreign.rs +++ b/libwallet/src/api_impl/foreign.rs @@ -16,12 +16,22 @@ use crate::grin_keychain::Keychain; use crate::internal::{tx, updater}; -use crate::slate::Slate; -use crate::types::{BlockFees, CbData, NodeClient, TxLogEntryType, WalletBackend}; -use crate::{Error, ErrorKind}; +use crate::{ + slate_versions, BlockFees, CbData, Error, ErrorKind, NodeClient, Slate, TxLogEntryType, + VersionInfo, WalletBackend, +}; +const FOREIGN_API_VERSION: u16 = 2; const USER_MESSAGE_MAX_LEN: usize = 256; +/// Return the version info +pub fn check_version() -> VersionInfo { + VersionInfo { + foreign_api_version: FOREIGN_API_VERSION, + default_slate_version: slate_versions::CURRENT_SLATE_VERSION, + } +} + /// Build a coinbase transaction pub fn build_coinbase( w: &mut T, diff --git a/libwallet/src/api_impl/owner.rs b/libwallet/src/api_impl/owner.rs index 8b763fee9..a381fbbbf 100644 --- a/libwallet/src/api_impl/owner.rs +++ b/libwallet/src/api_impl/owner.rs @@ -24,11 +24,9 @@ use crate::grin_util; use crate::grin_keychain::{Identifier, Keychain}; use crate::internal::{keys, selection, tx, updater}; use crate::slate::Slate; -use crate::types::{ - AcctPathMapping, InitTxArgs, NodeClient, NodeHeightResult, OutputCommitMapping, TxLogEntry, - TxWrapper, WalletBackend, WalletInfo, -}; +use crate::types::{AcctPathMapping, NodeClient, TxLogEntry, TxWrapper, WalletBackend, WalletInfo}; use crate::{Error, ErrorKind}; +use crate::{InitTxArgs, NodeHeightResult, OutputCommitMapping}; const USER_MESSAGE_MAX_LEN: usize = 256; diff --git a/libwallet/src/api_impl/types.rs b/libwallet/src/api_impl/types.rs new file mode 100644 index 000000000..473ddabb1 --- /dev/null +++ b/libwallet/src/api_impl/types.rs @@ -0,0 +1,193 @@ +// Copyright 2018 The Grin Developers +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Types specific to the wallet api, mostly argument serialization + +use crate::grin_core::core::{Output, TxKernel}; +use crate::grin_core::libtx::secp_ser; +use crate::grin_keychain::Identifier; +use crate::grin_util::secp::pedersen; +use crate::types::OutputData; + +/// Send TX API Args +// TODO: This is here to ensure the legacy V1 API remains intact +// remove this when v1 api is removed +#[derive(Clone, Serialize, Deserialize)] +pub struct SendTXArgs { + /// amount to send + pub amount: u64, + /// minimum confirmations + pub minimum_confirmations: u64, + /// payment method + pub method: String, + /// destination url + pub dest: String, + /// Max number of outputs + pub max_outputs: usize, + /// Number of change outputs to generate + pub num_change_outputs: usize, + /// whether to use all outputs (combine) + pub selection_strategy_is_use_all: bool, + /// Optional message, that will be signed + pub message: Option, + /// Optional slate version to target when sending + pub target_slate_version: Option, +} + +/// V2 Init / Send TX API Args +#[derive(Clone, Serialize, Deserialize)] +pub struct InitTxArgs { + /// The human readable account name from which to draw outputs + /// for the transaction, overriding whatever the active account is as set via the + /// [`set_active_account`](../grin_wallet_api/owner/struct.Owner.html#method.set_active_account) method. + pub src_acct_name: Option, + #[serde(with = "secp_ser::string_or_u64")] + /// The amount to send, in nanogrins. (`1 G = 1_000_000_000nG`) + pub amount: u64, + #[serde(with = "secp_ser::string_or_u64")] + /// The minimum number of confirmations an output + /// should have in order to be included in the transaction. + pub minimum_confirmations: u64, + /// By default, the wallet selects as many inputs as possible in a + /// transaction, to reduce the Output set and the fees. The wallet will attempt to spend + /// include up to `max_outputs` in a transaction, however if this is not enough to cover + /// the whole amount, the wallet will include more outputs. This parameter should be considered + /// a soft limit. + pub max_outputs: u32, + /// The target number of change outputs to create in the transaction. + /// The actual number created will be `num_change_outputs` + whatever remainder is needed. + pub num_change_outputs: u32, + /// If `true`, attempt to use up as many outputs as + /// possible to create the transaction, up the 'soft limit' of `max_outputs`. This helps + /// to reduce the size of the UTXO set and the amount of data stored in the wallet, and + /// minimizes fees. This will generally result in many inputs and a large change output(s), + /// usually much larger than the amount being sent. If `false`, the transaction will include + /// as many outputs as are needed to meet the amount, (and no more) starting with the smallest + /// value outputs. + pub selection_strategy_is_use_all: bool, + /// An optional participant message to include alongside the sender's public + /// ParticipantData within the slate. This message will include a signature created with the + /// sender's private excess value, and will be publically verifiable. Note this message is for + /// the convenience of the participants during the exchange; it is not included in the final + /// transaction sent to the chain. The message will be truncated to 256 characters. + pub message: Option, + /// Optionally set the output target slate version (acceptable + /// down to the minimum slate version compatible with the current. If `None` the slate + /// is generated with the latest version. + pub target_slate_version: Option, + /// If true, just return an estimate of the resulting slate, containing fees and amounts + /// locked without actually locking outputs or creating the transaction. Note if this is set to + /// 'true', the amount field in the slate will contain the total amount locked, not the provided + /// transaction amount + pub estimate_only: Option, + /// Sender arguments. If present, the underlying function will also attempt to send the + /// transaction to a destination and optionally finalize the result + pub send_args: Option, +} + +/// Send TX API Args, for convenience functionality that inits the transaction and sends +/// in one go +#[derive(Clone, Serialize, Deserialize)] +pub struct InitTxSendArgs { + /// The transaction method. Can currently be 'http' or 'keybase'. + pub method: String, + /// The destination, contents will depend on the particular method + pub dest: String, + /// Whether to finalize the result immediately if the send was successful + pub finalize: bool, + /// Whether to post the transasction if the send and finalize were successful + pub post_tx: bool, + /// Whether to use dandelion when posting. If false, skip the dandelion relay + pub fluff: bool, +} + +impl Default for InitTxArgs { + fn default() -> InitTxArgs { + InitTxArgs { + src_acct_name: None, + amount: 0, + minimum_confirmations: 10, + max_outputs: 500, + num_change_outputs: 1, + selection_strategy_is_use_all: true, + message: None, + target_slate_version: None, + estimate_only: Some(false), + send_args: None, + } + } +} + +/// Fees in block to use for coinbase amount calculation +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct BlockFees { + /// fees + #[serde(with = "secp_ser::string_or_u64")] + pub fees: u64, + /// height + #[serde(with = "secp_ser::string_or_u64")] + pub height: u64, + /// key id + pub key_id: Option, +} + +impl BlockFees { + /// return key id + pub fn key_id(&self) -> Option { + self.key_id.clone() + } +} + +/// Response to build a coinbase output. +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct CbData { + /// Output + pub output: Output, + /// Kernel + pub kernel: TxKernel, + /// Key Id + pub key_id: Option, +} + +/// Map Outputdata to commits +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct OutputCommitMapping { + /// Output Data + pub output: OutputData, + /// The commit + #[serde( + serialize_with = "secp_ser::as_hex", + deserialize_with = "secp_ser::commitment_from_hex" + )] + pub commit: pedersen::Commitment, +} + +/// Node height result +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct NodeHeightResult { + /// Last known height + #[serde(with = "secp_ser::string_or_u64")] + pub height: u64, + /// Whether this height was updated from the node + pub updated_from_node: bool, +} + +/// Version request result +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct VersionInfo { + /// API version + pub foreign_api_version: u16, + /// Slate version + pub default_slate_version: u16, +} diff --git a/libwallet/src/internal/restore.rs b/libwallet/src/internal/restore.rs index 661d42865..21fdca285 100644 --- a/libwallet/src/internal/restore.rs +++ b/libwallet/src/internal/restore.rs @@ -19,7 +19,7 @@ use crate::grin_keychain::{ExtKeychain, Identifier, Keychain}; use crate::grin_util::secp::{key::SecretKey, pedersen}; use crate::internal::{keys, updater}; use crate::types::*; -use crate::Error; +use crate::{Error, OutputCommitMapping}; use std::collections::HashMap; /// Utility struct for return values from below diff --git a/libwallet/src/internal/updater.rs b/libwallet/src/internal/updater.rs index c4ec78535..4d7130579 100644 --- a/libwallet/src/internal/updater.rs +++ b/libwallet/src/internal/updater.rs @@ -28,9 +28,9 @@ use crate::grin_util as util; use crate::grin_util::secp::pedersen; use crate::internal::keys; use crate::types::{ - BlockFees, CbData, NodeClient, OutputCommitMapping, OutputData, OutputStatus, TxLogEntry, - TxLogEntryType, WalletBackend, WalletInfo, + NodeClient, OutputData, OutputStatus, TxLogEntry, TxLogEntryType, WalletBackend, WalletInfo, }; +use crate::{BlockFees, CbData, OutputCommitMapping}; /// Retrieve all of the outputs (doesn't attempt to update from node) pub fn retrieve_outputs( diff --git a/libwallet/src/lib.rs b/libwallet/src/lib.rs index 655d03245..fcf23cf67 100644 --- a/libwallet/src/lib.rs +++ b/libwallet/src/lib.rs @@ -42,11 +42,19 @@ extern crate lazy_static; pub mod api_impl; mod error; mod internal; -pub mod slate; +mod slate; pub mod slate_versions; -pub mod types; +mod types; pub use crate::error::{Error, ErrorKind}; -pub use crate::slate::Slate; +pub use crate::slate::{ParticipantData, ParticipantMessageData, Slate}; pub use crate::slate_versions::{SlateVersion, VersionedSlate}; +pub use api_impl::types::{ + BlockFees, CbData, InitTxArgs, InitTxSendArgs, NodeHeightResult, OutputCommitMapping, + SendTXArgs, VersionInfo, +}; pub use internal::restore::{check_repair, restore}; +pub use types::{ + AcctPathMapping, BlockIdentifier, Context, NodeClient, OutputData, OutputStatus, TxLogEntry, + TxLogEntryType, TxWrapper, WalletBackend, WalletInfo, WalletInst, WalletOutputBatch, +}; diff --git a/libwallet/src/types.rs b/libwallet/src/types.rs index 95cdeb369..c79a28b65 100644 --- a/libwallet/src/types.rs +++ b/libwallet/src/types.rs @@ -17,7 +17,7 @@ use crate::error::{Error, ErrorKind}; use crate::grin_core::core::hash::Hash; -use crate::grin_core::core::{Output, Transaction, TxKernel}; +use crate::grin_core::core::Transaction; use crate::grin_core::libtx::{aggsig, secp_ser}; use crate::grin_core::ser; use crate::grin_keychain::{Identifier, Keychain}; @@ -697,168 +697,3 @@ pub struct TxWrapper { /// hex representation of transaction pub tx_hex: String, } - -// Types to facilitate API arguments and serialization - -/// Send TX API Args -// TODO: This is here to ensure the legacy V1 API remains intact -// remove this when v1 api is removed -#[derive(Clone, Serialize, Deserialize)] -pub struct SendTXArgs { - /// amount to send - pub amount: u64, - /// minimum confirmations - pub minimum_confirmations: u64, - /// payment method - pub method: String, - /// destination url - pub dest: String, - /// Max number of outputs - pub max_outputs: usize, - /// Number of change outputs to generate - pub num_change_outputs: usize, - /// whether to use all outputs (combine) - pub selection_strategy_is_use_all: bool, - /// Optional message, that will be signed - pub message: Option, - /// Optional slate version to target when sending - pub target_slate_version: Option, -} - -/// V2 Init / Send TX API Args -#[derive(Clone, Serialize, Deserialize)] -pub struct InitTxArgs { - /// The human readable account name from which to draw outputs - /// for the transaction, overriding whatever the active account is as set via the - /// [`set_active_account`](../grin_wallet_api/owner/struct.Owner.html#method.set_active_account) method. - pub src_acct_name: Option, - #[serde(with = "secp_ser::string_or_u64")] - /// The amount to send, in nanogrins. (`1 G = 1_000_000_000nG`) - pub amount: u64, - #[serde(with = "secp_ser::string_or_u64")] - /// The minimum number of confirmations an output - /// should have in order to be included in the transaction. - pub minimum_confirmations: u64, - /// By default, the wallet selects as many inputs as possible in a - /// transaction, to reduce the Output set and the fees. The wallet will attempt to spend - /// include up to `max_outputs` in a transaction, however if this is not enough to cover - /// the whole amount, the wallet will include more outputs. This parameter should be considered - /// a soft limit. - pub max_outputs: u32, - /// The target number of change outputs to create in the transaction. - /// The actual number created will be `num_change_outputs` + whatever remainder is needed. - pub num_change_outputs: u32, - /// If `true`, attempt to use up as many outputs as - /// possible to create the transaction, up the 'soft limit' of `max_outputs`. This helps - /// to reduce the size of the UTXO set and the amount of data stored in the wallet, and - /// minimizes fees. This will generally result in many inputs and a large change output(s), - /// usually much larger than the amount being sent. If `false`, the transaction will include - /// as many outputs as are needed to meet the amount, (and no more) starting with the smallest - /// value outputs. - pub selection_strategy_is_use_all: bool, - /// An optional participant message to include alongside the sender's public - /// ParticipantData within the slate. This message will include a signature created with the - /// sender's private excess value, and will be publically verifiable. Note this message is for - /// the convenience of the participants during the exchange; it is not included in the final - /// transaction sent to the chain. The message will be truncated to 256 characters. - pub message: Option, - /// Optionally set the output target slate version (acceptable - /// down to the minimum slate version compatible with the current. If `None` the slate - /// is generated with the latest version. - pub target_slate_version: Option, - /// If true, just return an estimate of the resulting slate, containing fees and amounts - /// locked without actually locking outputs or creating the transaction. Note if this is set to - /// 'true', the amount field in the slate will contain the total amount locked, not the provided - /// transaction amount - pub estimate_only: Option, - /// Sender arguments. If present, the underlying function will also attempt to send the - /// transaction to a destination and optionally finalize the result - pub send_args: Option, -} - -/// Send TX API Args, for convenience functionality that inits the transaction and sends -/// in one go -#[derive(Clone, Serialize, Deserialize)] -pub struct InitTxSendArgs { - /// The transaction method. Can currently be 'http' or 'keybase'. - pub method: String, - /// The destination, contents will depend on the particular method - pub dest: String, - /// Whether to finalize the result immediately if the send was successful - pub finalize: bool, - /// Whether to post the transasction if the send and finalize were successful - pub post_tx: bool, - /// Whether to use dandelion when posting. If false, skip the dandelion relay - pub fluff: bool, -} - -impl Default for InitTxArgs { - fn default() -> InitTxArgs { - InitTxArgs { - src_acct_name: None, - amount: 0, - minimum_confirmations: 10, - max_outputs: 500, - num_change_outputs: 1, - selection_strategy_is_use_all: true, - message: None, - target_slate_version: None, - estimate_only: Some(false), - send_args: None, - } - } -} - -/// Fees in block to use for coinbase amount calculation -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct BlockFees { - /// fees - #[serde(with = "secp_ser::string_or_u64")] - pub fees: u64, - /// height - #[serde(with = "secp_ser::string_or_u64")] - pub height: u64, - /// key id - pub key_id: Option, -} - -impl BlockFees { - /// return key id - pub fn key_id(&self) -> Option { - self.key_id.clone() - } -} - -/// Response to build a coinbase output. -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct CbData { - /// Output - pub output: Output, - /// Kernel - pub kernel: TxKernel, - /// Key Id - pub key_id: Option, -} - -/// Map Outputdata to commits -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct OutputCommitMapping { - /// Output Data - pub output: OutputData, - /// The commit - #[serde( - serialize_with = "secp_ser::as_hex", - deserialize_with = "secp_ser::commitment_from_hex" - )] - pub commit: pedersen::Commitment, -} - -/// Node height result -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct NodeHeightResult { - /// Last known height - #[serde(with = "secp_ser::string_or_u64")] - pub height: u64, - /// Whether this height was updated from the node - pub updated_from_node: bool, -} diff --git a/libwallet/tests/libwallet.rs b/libwallet/tests/libwallet.rs index 4ecf91791..76fea7835 100644 --- a/libwallet/tests/libwallet.rs +++ b/libwallet/tests/libwallet.rs @@ -12,7 +12,7 @@ // limitations under the License. //! core::libtx specific tests -use grin_wallet_libwallet::types::Context; +use grin_wallet_libwallet::Context; use grin_wallet_util::grin_core::core::transaction; use grin_wallet_util::grin_core::libtx::{aggsig, proof}; use grin_wallet_util::grin_keychain::{ diff --git a/libwallet/tests/slate_versioning.rs b/libwallet/tests/slate_versioning.rs index 495727352..cd0e0484f 100644 --- a/libwallet/tests/slate_versioning.rs +++ b/libwallet/tests/slate_versioning.rs @@ -12,7 +12,7 @@ // limitations under the License. //! core::libtx specific tests -use grin_wallet_libwallet::slate::Slate; +use grin_wallet_libwallet::Slate; // test all slate conversions #[test] diff --git a/src/bin/cmd/wallet_args.rs b/src/bin/cmd/wallet_args.rs index 145a9c2bf..79c276abd 100644 --- a/src/bin/cmd/wallet_args.rs +++ b/src/bin/cmd/wallet_args.rs @@ -22,7 +22,7 @@ use grin_wallet_config::WalletConfig; use grin_wallet_controller::command; use grin_wallet_controller::{Error, ErrorKind}; use grin_wallet_impls::{instantiate_wallet, WalletSeed}; -use grin_wallet_libwallet::types::{NodeClient, WalletInst}; +use grin_wallet_libwallet::{NodeClient, WalletInst}; use grin_wallet_util::grin_core as core; use grin_wallet_util::grin_keychain as keychain; use linefeed::terminal::Signal; diff --git a/src/bin/cmd/wallet_tests.rs b/src/bin/cmd/wallet_tests.rs index db598e0e5..7dd27a1b5 100644 --- a/src/bin/cmd/wallet_tests.rs +++ b/src/bin/cmd/wallet_tests.rs @@ -28,7 +28,7 @@ mod wallet_tests { use grin_wallet_config::{GlobalWalletConfig, WalletConfig}; use grin_wallet_impls::{LMDBBackend, WalletSeed}; - use grin_wallet_libwallet::types::{WalletBackend, WalletInst}; + use grin_wallet_libwallet::{WalletBackend, WalletInst}; use grin_wallet_util::grin_core::global::{self, ChainTypes}; use grin_wallet_util::grin_keychain::ExtKeychain; From e509405b8a413d4b897c58f9f49d541a42845dbb Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Thu, 25 Apr 2019 14:59:45 +0800 Subject: [PATCH 04/36] Revert "Merge branch 'master' into master" This reverts commit a63f2c7cea7392dfa91c8afdb0f912fd8c1b8aac, reversing changes made to d774272fee41c6c1ab3ecefb86deacc109012471. --- README.md | 8 +- api/src/owner.rs | 58 +----- api/src/owner_rpc.rs | 2 - controller/src/command.rs | 32 +-- controller/src/display.rs | 89 +-------- controller/tests/transaction.rs | 20 -- impls/src/backends/lmdb.rs | 57 +----- impls/src/lmdb_wallet.rs | 57 +----- libwallet/src/api_impl/owner.rs | 27 +-- libwallet/src/internal/restore.rs | 3 +- libwallet/src/internal/selection.rs | 2 - libwallet/src/internal/tx.rs | 65 +----- libwallet/src/internal/updater.rs | 62 +----- libwallet/src/types.rs | 300 +--------------------------- src/bin/cmd/wallet_args.rs | 8 - src/bin/cmd/wallet_tests.rs | 4 - src/bin/grin-wallet.yml | 4 +- 17 files changed, 26 insertions(+), 772 deletions(-) diff --git a/README.md b/README.md index b816e71da..6185b0730 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -[![Build Status](https://img.shields.io/travis/gottstech/grin-wallet/master.svg)](https://travis-ci.org/gottstech/grin-wallet) -[![Coverage Status](https://img.shields.io/codecov/c/github/gottstech/grin-wallet/master.svg)](https://codecov.io/gh/gottstech/grin-wallet) +[![Build Status](https://img.shields.io/travis/mimblewimble/grin-wallet/master.svg)](https://travis-ci.org/mimblewimble/grin-wallet) +[![Coverage Status](https://img.shields.io/codecov/c/github/mimblewimble/grin-wallet/master.svg)](https://codecov.io/gh/mimblewimble/grin-wallet) [![Chat](https://img.shields.io/gitter/room/grin_community/Lobby.svg)](https://gitter.im/grin_community/Lobby) [![Support](https://img.shields.io/badge/support-on%20gitter-brightgreen.svg)](https://gitter.im/grin_community/support) [![Documentation Wiki](https://img.shields.io/badge/doc-wiki-blue.svg)](https://github.com/mimblewimble/docs/wiki) -[![Release Version](https://img.shields.io/github/release/gottstech/grin-wallet.svg)](https://github.com/gottstech/grin-wallet/releases) -[![License](https://img.shields.io/github/license/gottstech/grin-wallet.svg)](https://github.com/gottstech/grin-wallet/blob/master/LICENSE) +[![Release Version](https://img.shields.io/github/release/mimblewimble/grin-wallet.svg)](https://github.com/mimblewimble/grin-wallet/releases) +[![License](https://img.shields.io/github/license/mimblewimble/grin-wallet.svg)](https://github.com/mimblewimble/grin-wallet/blob/master/LICENSE) # Grin Wallet diff --git a/api/src/owner.rs b/api/src/owner.rs index dcc36eb10..ee706f1ed 100644 --- a/api/src/owner.rs +++ b/api/src/owner.rs @@ -24,11 +24,9 @@ use crate::core::core::Transaction; use crate::impls::{HTTPWalletCommAdapter, KeybaseWalletCommAdapter}; use crate::keychain::{Identifier, Keychain}; use crate::libwallet::api_impl::owner; - -use crate::libwallet::slate::Slate; -use crate::libwallet::types::{ - AcctPathMapping, Error, ErrorKind, InitTxArgs, NodeClient, NodeHeightResult, OutputCommitMapping, - PaymentCommitMapping, Slate, TxLogEntry, WalletBackend, WalletInfo, +use crate::libwallet::{ + AcctPathMapping, Error, ErrorKind, InitTxArgs, NodeClient, NodeHeightResult, + OutputCommitMapping, Slate, TxLogEntry, WalletBackend, WalletInfo, }; /// Main interface into all wallet API functions. @@ -304,56 +302,6 @@ where res } - /// Returns a list of payment outputs from the active account in the wallet. - /// - /// # Arguments - /// * `refresh_from_node` - If true, the wallet will attempt to contact - /// a node (via the [`NodeClient`](../grin_wallet_libwallet/types/trait.NodeClient.html) - /// provided during wallet instantiation). If `false`, the results will - /// contain output information that may be out-of-date (from the last time - /// the wallet's output set was refreshed against the node). - /// * `tx_id` - If `Some(i)`, only return the outputs associated with - /// the transaction log entry of id `i`. - /// - /// # Returns - /// * `(bool, Vec)` - A tuple: - /// * The first `bool` element indicates whether the data was successfully - /// refreshed from the node (note this may be false even if the `refresh_from_node` - /// argument was set to `true`. - /// * The second element contains a vector of - /// [PaymentCommitMapping](../grin_wallet_libwallet/types/struct.PaymentCommitMapping.html) - /// of which each element is a mapping between the wallet's internal - /// [PaymentData](../grin_wallet_libwallet/types/struct.Output.html) - /// and the Output commitment - /// - /// # Example - /// Set up as in [`new`](struct.Owner.html#method.new) method above. - /// ``` - /// # grin_wallet_api::doctest_helper_setup_doc_env!(wallet, wallet_config); - /// - /// let api_owner = Owner::new(wallet.clone()); - /// let update_from_node = true; - /// let tx_id = None; - /// - /// let result = api_owner.retrieve_payments(update_from_node, tx_id); - /// - /// if let Ok((was_updated, payment_mappings)) = result { - /// //... - /// } - /// ``` - - pub fn retrieve_payments( - &self, - refresh_from_node: bool, - tx_id: Option, - ) -> Result<(bool, Vec), Error> { - let mut w = self.wallet.lock(); - w.open_with_credentials()?; - let res = owner::retrieve_payments(&mut *w, refresh_from_node, tx_id); - w.close()?; - res - } - /// Returns a list of [Transaction Log Entries](../grin_wallet_libwallet/types/struct.TxLogEntry.html) /// from the active account in the wallet. /// diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index 6f3c38766..31f637b49 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -160,7 +160,6 @@ pub trait OwnerRpc { "mmr_index": null, "n_child": 0, "root_key_id": "0200000000000000000000000000000000", - "slate_id": null, "status": "Unspent", "tx_log_entry": 0, "value": "60000000000" @@ -177,7 +176,6 @@ pub trait OwnerRpc { "mmr_index": null, "n_child": 1, "root_key_id": "0200000000000000000000000000000000", - "slate_id": null, "status": "Unspent", "tx_log_entry": 1, "value": "60000000000" diff --git a/controller/src/command.rs b/controller/src/command.rs index 4b0e93abe..ae5cba102 100644 --- a/controller/src/command.rs +++ b/controller/src/command.rs @@ -433,20 +433,6 @@ pub fn outputs( Ok(()) } -pub fn payments( - wallet: Arc>>, - g_args: &GlobalArgs, - dark_scheme: bool, -) -> Result<(), Error> { - controller::owner_single_use(wallet.clone(), |api| { - let res = api.node_height()?; - let (validated, outputs) = api.retrieve_payments(true, None)?; - display::payments(&g_args.account, res.height, validated, outputs, dark_scheme)?; - Ok(()) - })?; - Ok(()) -} - /// Txs command args pub struct TxsArgs { pub id: Option, @@ -476,22 +462,8 @@ pub fn txs( let (_, outputs) = api.retrieve_outputs(true, false, args.id)?; display::outputs(&g_args.account, res.height, validated, outputs, dark_scheme)?; // should only be one here, but just in case - for tx in &txs { - let (_, outputs) = api.retrieve_payments(true, tx.tx_slate_id)?; - if outputs.len() > 0 { - display::payments( - &g_args.account, - res.height, - validated, - outputs, - dark_scheme, - )?; - } - } - - // should only be one here, but just in case - for tx in &txs { - display::tx_messages(tx, dark_scheme)?; + for tx in txs { + display::tx_messages(&tx, dark_scheme)?; } }; Ok(()) diff --git a/controller/src/display.rs b/controller/src/display.rs index bb53bd605..c8944960a 100644 --- a/controller/src/display.rs +++ b/controller/src/display.rs @@ -14,10 +14,8 @@ use crate::core::core::{self, amount_to_hr_string}; use crate::core::global; - -use crate::libwallet::types::{ - AcctPathMapping, Error, OutputCommitMapping, OutputStatus, PaymentCommitMapping, TxLogEntry, - WalletInfo, +use crate::libwallet::{ + AcctPathMapping, Error, OutputCommitMapping, OutputStatus, TxLogEntry, WalletInfo, }; use crate::util; use prettytable; @@ -120,89 +118,6 @@ pub fn outputs( Ok(()) } -/// Display payments in a pretty way -pub fn payments( - account: &str, - cur_height: u64, - validated: bool, - outputs: Vec, - dark_background_color_scheme: bool, -) -> Result<(), Error> { - let title = format!( - "Wallet Payments - Account '{}' - Block Height: {}", - account, cur_height - ); - println!(); - let mut t = term::stdout().unwrap(); - t.fg(term::color::MAGENTA).unwrap(); - writeln!(t, "{}", title).unwrap(); - t.reset().unwrap(); - - let mut table = table!(); - - table.set_titles(row![ - bMG->"Output Commitment", - bMG->"Block Height", - bMG->"Locked Until", - bMG->"Status", - bMG->"# Confirms", - bMG->"Value", - bMG->"Shared Transaction Id" - ]); - - for payment in outputs { - let commit = format!("{}", util::to_hex(payment.commit.as_ref().to_vec())); - let out = payment.output; - - let height = format!("{}", out.height); - let lock_height = format!("{}", out.lock_height); - let status = format!("{}", out.status); - - let num_confirmations = format!("{}", out.num_confirmations(cur_height)); - let value = if out.value == 0 { - "unknown".to_owned() - } else { - format!("{}", core::amount_to_hr_string(out.value, false)) - }; - let slate_id = format!("{}", out.slate_id); - - if dark_background_color_scheme { - table.add_row(row![ - bFC->commit, - bFB->height, - bFB->lock_height, - bFR->status, - bFB->num_confirmations, - bFG->value, - bFC->slate_id, - ]); - } else { - table.add_row(row![ - bFD->commit, - bFB->height, - bFB->lock_height, - bFR->status, - bFB->num_confirmations, - bFG->value, - bFD->slate_id, - ]); - } - } - - table.set_format(*prettytable::format::consts::FORMAT_NO_COLSEP); - table.printstd(); - println!(); - - if !validated { - println!( - "\nWARNING: Wallet failed to verify data. \ - The above is from local cache and possibly invalid! \ - (is your `grin server` offline or broken?)" - ); - } - Ok(()) -} - /// Display transaction log in a pretty way pub fn txs( account: &str, diff --git a/controller/tests/transaction.rs b/controller/tests/transaction.rs index 277a40eb4..57459863c 100644 --- a/controller/tests/transaction.rs +++ b/controller/tests/transaction.rs @@ -429,16 +429,6 @@ fn tx_rollback(test_dir: &str) -> Result<(), libwallet::Error> { assert_eq!(output_mappings.len(), 3); assert_eq!(locked_count, 2); assert_eq!(unconfirmed_count, 1); - // check the payments are as expected - unconfirmed_count = 0; - let (_, payments) = api.retrieve_payments(false, tx.unwrap().tx_slate_id)?; - for p in &payments { - if p.output.status == OutputStatus::Unconfirmed { - unconfirmed_count = unconfirmed_count + 1; - } - } - assert_eq!(payments.len(), 1); - assert_eq!(unconfirmed_count, 1); Ok(()) })?; @@ -459,16 +449,6 @@ fn tx_rollback(test_dir: &str) -> Result<(), libwallet::Error> { } assert_eq!(outputs.len(), 1); assert_eq!(unconfirmed_count, 1); - // check the payments are as expected: receiver don't have this. - unconfirmed_count = 0; - let (_, payments) = api.retrieve_payments(false, tx.unwrap().tx_slate_id)?; - for p in &payments { - if p.output.status == OutputStatus::Unconfirmed { - unconfirmed_count = unconfirmed_count + 1; - } - } - assert_eq!(payments.len(), 0); - assert_eq!(unconfirmed_count, 0); let (refreshed, wallet2_info) = api.retrieve_summary_info(true, 1)?; assert!(refreshed); assert_eq!(wallet2_info.amount_currently_spendable, 0,); diff --git a/impls/src/backends/lmdb.rs b/impls/src/backends/lmdb.rs index a8a32b422..d939808e4 100644 --- a/impls/src/backends/lmdb.rs +++ b/impls/src/backends/lmdb.rs @@ -42,8 +42,6 @@ pub const DB_DIR: &'static str = "db"; pub const TX_SAVE_DIR: &'static str = "saved_txs"; const OUTPUT_PREFIX: u8 = 'o' as u8; -const PAYMENT_PREFIX: u8 = 'P' as u8; -const PAYMENT_COMMITS_PREFIX: u8 = 'Q' as u8; const DERIV_PREFIX: u8 = 'd' as u8; const CONFIRMED_HEIGHT_PREFIX: u8 = 'c' as u8; const PRIVATE_TX_CONTEXT_PREFIX: u8 = 'p' as u8; @@ -240,20 +238,6 @@ where Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap()) } - fn get_payment_log_commits(&self, u: &Uuid) -> Result, Error> { - let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec()); - self.db.get_ser(&key).map_err(|e| e.into()) - } - - fn get_payment_log_entry(&self, commit: String) -> Result, Error> { - let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec()); - self.db.get_ser(&key).map_err(|e| e.into()) - } - - fn payment_log_iter<'a>(&'a self) -> Box + 'a> { - Box::new(self.db.iter(&[PAYMENT_PREFIX]).unwrap()) - } - fn get_tx_log_entry(&self, u: &Uuid) -> Result, Error> { let key = to_key(TX_LOG_ENTRY_PREFIX, &mut u.as_bytes().to_vec()); self.db.get_ser(&key).map_err(|e| e.into()) @@ -396,7 +380,7 @@ where } fn save(&mut self, out: OutputData) -> Result<(), Error> { - // Save the self output data to the db. + // Save the output data to the db. { let key = match out.mmr_index { Some(i) => to_key_u64(OUTPUT_PREFIX, &mut out.key_id.to_bytes().to_vec(), i), @@ -408,27 +392,6 @@ where Ok(()) } - fn save_payment_commits(&mut self, u: &Uuid, commits: PaymentCommits) -> Result<(), Error> { - // Save the payment commits list data to the db. - { - let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec()); - self.db.borrow().as_ref().unwrap().put_ser(&key, &commits)?; - } - - Ok(()) - } - - fn save_payment(&mut self, out: PaymentData) -> Result<(), Error> { - // Save the payment output data to the db. - { - let commit = out.commit.clone(); - let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec()); - self.db.borrow().as_ref().unwrap().put_ser(&key, &out)?; - } - - Ok(()) - } - fn get(&self, id: &Identifier, mmr_index: &Option) -> Result { let key = match mmr_index { Some(i) => to_key_u64(OUTPUT_PREFIX, &mut id.to_bytes().to_vec(), *i), @@ -441,24 +404,6 @@ where .map_err(|e| e.into()) } - fn get_payment_commits(&self, u: &Uuid) -> Result { - let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec()); - option_to_not_found( - self.db.borrow().as_ref().unwrap().get_ser(&key), - &format!("slate_id: {}", u.to_string()), - ) - .map_err(|e| e.into()) - } - - fn get_payment_log_entry(&self, commit: String) -> Result { - let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec()); - option_to_not_found( - self.db.borrow().as_ref().unwrap().get_ser(&key), - &format!("key: {:?}", commit), - ) - .map_err(|e| e.into()) - } - fn iter(&self) -> Box> { Box::new( self.db diff --git a/impls/src/lmdb_wallet.rs b/impls/src/lmdb_wallet.rs index ac9e39a74..3fd9df74c 100644 --- a/impls/src/lmdb_wallet.rs +++ b/impls/src/lmdb_wallet.rs @@ -45,8 +45,6 @@ pub const DB_DIR: &'static str = "db"; pub const TX_SAVE_DIR: &'static str = "saved_txs"; const OUTPUT_PREFIX: u8 = 'o' as u8; -const PAYMENT_PREFIX: u8 = 'P' as u8; -const PAYMENT_COMMITS_PREFIX: u8 = 'Q' as u8; const DERIV_PREFIX: u8 = 'd' as u8; const CONFIRMED_HEIGHT_PREFIX: u8 = 'c' as u8; const PRIVATE_TX_CONTEXT_PREFIX: u8 = 'p' as u8; @@ -243,20 +241,6 @@ where Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap().map(|o| o.1)) } - fn get_payment_log_commits(&self, u: &Uuid) -> Result, Error> { - let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec()); - self.db.get_ser(&key).map_err(|e| e.into()) - } - - fn get_payment_log_entry(&self, commit: String) -> Result, Error> { - let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec()); - self.db.get_ser(&key).map_err(|e| e.into()) - } - - fn payment_log_iter<'a>(&'a self) -> Box + 'a> { - Box::new(self.db.iter(&[PAYMENT_PREFIX]).unwrap().map(|o| o.1)) - } - fn get_tx_log_entry(&self, u: &Uuid) -> Result, Error> { let key = to_key(TX_LOG_ENTRY_PREFIX, &mut u.as_bytes().to_vec()); self.db.get_ser(&key).map_err(|e| e.into()) @@ -404,7 +388,7 @@ where } fn save(&mut self, out: OutputData) -> Result<(), Error> { - // Save the self output data to the db. + // Save the output data to the db. { let key = match out.mmr_index { Some(i) => to_key_u64(OUTPUT_PREFIX, &mut out.key_id.to_bytes().to_vec(), i), @@ -416,27 +400,6 @@ where Ok(()) } - fn save_payment_commits(&mut self, u: &Uuid, commits: PaymentCommits) -> Result<(), Error> { - // Save the payment commits list data to the db. - { - let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec()); - self.db.borrow().as_ref().unwrap().put_ser(&key, &commits)?; - } - - Ok(()) - } - - fn save_payment(&mut self, out: PaymentData) -> Result<(), Error> { - // Save the payment output data to the db. - { - let commit = out.commit.clone(); - let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec()); - self.db.borrow().as_ref().unwrap().put_ser(&key, &out)?; - } - - Ok(()) - } - fn get(&self, id: &Identifier, mmr_index: &Option) -> Result { let key = match mmr_index { Some(i) => to_key_u64(OUTPUT_PREFIX, &mut id.to_bytes().to_vec(), *i), @@ -449,24 +412,6 @@ where .map_err(|e| e.into()) } - fn get_payment_commits(&self, u: &Uuid) -> Result { - let key = to_key(PAYMENT_COMMITS_PREFIX, &mut u.as_bytes().to_vec()); - option_to_not_found( - self.db.borrow().as_ref().unwrap().get_ser(&key), - &format!("slate_id: {}", u.to_string()), - ) - .map_err(|e| e.into()) - } - - fn get_payment_log_entry(&self, commit: String) -> Result { - let key = to_key(PAYMENT_PREFIX, &mut commit.as_bytes().to_vec()); - option_to_not_found( - self.db.borrow().as_ref().unwrap().get_ser(&key), - &format!("key: {:?}", commit), - ) - .map_err(|e| e.into()) - } - fn iter(&self) -> Box> { Box::new( self.db diff --git a/libwallet/src/api_impl/owner.rs b/libwallet/src/api_impl/owner.rs index 2e522c720..a381fbbbf 100644 --- a/libwallet/src/api_impl/owner.rs +++ b/libwallet/src/api_impl/owner.rs @@ -24,11 +24,9 @@ use crate::grin_util; use crate::grin_keychain::{Identifier, Keychain}; use crate::internal::{keys, selection, tx, updater}; use crate::slate::Slate; -use crate::types::{ - AcctPathMapping, NodeClient, TxLogEntry, TxWrapper, WalletBackend, WalletInfo, -}; +use crate::types::{AcctPathMapping, NodeClient, TxLogEntry, TxWrapper, WalletBackend, WalletInfo}; use crate::{Error, ErrorKind}; -use crate::{InitTxArgs, NodeHeightResult, OutputCommitMapping, PaymentCommitMapping}; +use crate::{InitTxArgs, NodeHeightResult, OutputCommitMapping}; const USER_MESSAGE_MAX_LEN: usize = 256; @@ -83,29 +81,10 @@ where Ok(( validated, - updater::retrieve_outputs(&mut *w, include_spent, tx_id, None, Some(&parent_key_id))?, + updater::retrieve_outputs(&mut *w, include_spent, tx_id, Some(&parent_key_id))?, )) } -/// Returns a list of payment outputs from the active account in the wallet. -pub fn retrieve_payments( - w: &mut T, - refresh_from_node: bool, - tx_id: Option, -) -> Result<(bool, Vec), Error> -where - T: WalletBackend, - C: NodeClient, - K: Keychain, -{ - let mut validated = false; - if refresh_from_node { - validated = update_outputs(w, false); - } - - Ok((validated, updater::retrieve_payments(w, tx_id)?)) -} - /// Retrieve txs pub fn retrieve_txs( w: &mut T, diff --git a/libwallet/src/internal/restore.rs b/libwallet/src/internal/restore.rs index 3d3041b8a..21fdca285 100644 --- a/libwallet/src/internal/restore.rs +++ b/libwallet/src/internal/restore.rs @@ -215,7 +215,6 @@ where lock_height: output.lock_height, is_coinbase: output.is_coinbase, tx_log_entry: Some(log_id), - slate_id: None, }); let max_child_index = found_parents.get(&parent_key_id).unwrap().clone(); @@ -284,7 +283,7 @@ where // Now, get all outputs owned by this wallet (regardless of account) let wallet_outputs = { - let res = updater::retrieve_outputs(&mut *wallet, true, None, None, None)?; + let res = updater::retrieve_outputs(&mut *wallet, true, None, None)?; res }; diff --git a/libwallet/src/internal/selection.rs b/libwallet/src/internal/selection.rs index 18658623b..38d33af70 100644 --- a/libwallet/src/internal/selection.rs +++ b/libwallet/src/internal/selection.rs @@ -155,7 +155,6 @@ where lock_height: 0, is_coinbase: false, tx_log_entry: Some(log_id), - slate_id: Some(slate_id.clone()), })?; } batch.save_tx_log_entry(t.clone(), &parent_key_id)?; @@ -225,7 +224,6 @@ where lock_height: 0, is_coinbase: false, tx_log_entry: Some(log_id), - slate_id: Some(slate_id), })?; batch.save_tx_log_entry(t, &parent_key_id)?; batch.commit()?; diff --git a/libwallet/src/internal/tx.rs b/libwallet/src/internal/tx.rs index ff22fb055..52165a0f3 100644 --- a/libwallet/src/internal/tx.rs +++ b/libwallet/src/internal/tx.rs @@ -17,14 +17,10 @@ use uuid::Uuid; use crate::grin_keychain::{Identifier, Keychain}; -use crate::grin_util::secp::pedersen; -use crate::grin_util::to_hex; use crate::grin_util::Mutex; use crate::internal::{selection, updater}; use crate::slate::Slate; -use crate::types::{ - Context, NodeClient, OutputStatus, PaymentCommits, PaymentData, TxLogEntryType, WalletBackend, -}; +use crate::types::{Context, NodeClient, TxLogEntryType, WalletBackend}; use crate::{Error, ErrorKind}; /// static for incrementing test UUIDs @@ -224,63 +220,6 @@ where )?; // Final transaction can be built by anyone at this stage slate.finalize(wallet.keychain())?; - - let parent_key_id = Some(&context.parent_key_id); - - // Get the change output/s from database - let changes = updater::retrieve_outputs(wallet, false, None, Some(slate.id), parent_key_id)?; - let change_commits = changes - .iter() - .map(|oc| oc.commit.clone()) - .collect::>(); - - // Find the payment output/s - let mut outputs: Vec = Vec::new(); - for output in slate.tx.outputs() { - if !change_commits.contains(&output.commit) { - outputs.insert(0, output.commit.clone()); - } - } - - // sender save the payment output - let mut batch = wallet.batch()?; - batch.save_payment_commits( - &slate.id, - PaymentCommits { - commits: outputs - .iter() - .map(|c| to_hex(c.as_ref().to_vec())) - .collect::>(), - slate_id: slate.id, - }, - )?; - // todo: multiple receivers transaction - if outputs.len() > 1 { - for output in outputs { - let payment_output = to_hex(output.clone().as_ref().to_vec()); - batch.save_payment(PaymentData { - commit: payment_output, - value: 0, // '0' means unknown here, since '0' value is impossible for an output. - status: OutputStatus::Unconfirmed, - height: slate.height, - lock_height: 0, - slate_id: slate.id, - })?; - } - } else if outputs.len() == 1 { - let payment_output = to_hex(outputs.first().clone().unwrap().as_ref().to_vec()); - batch.save_payment(PaymentData { - commit: payment_output, - value: slate.amount, - status: OutputStatus::Unconfirmed, - height: slate.height, - lock_height: 0, - slate_id: slate.id, - })?; - } else { - warn!("complete_tx - no 'payment' output! is this a sending to self for test purpose?"); - } - batch.commit()?; Ok(()) } @@ -314,7 +253,7 @@ where return Err(ErrorKind::TransactionNotCancellable(tx_id_string))?; } // get outputs associated with tx - let res = updater::retrieve_outputs(wallet, false, Some(tx.id), None, Some(&parent_key_id))?; + let res = updater::retrieve_outputs(wallet, false, Some(tx.id), Some(&parent_key_id))?; let outputs = res.iter().map(|m| m.output.clone()).collect(); updater::cancel_tx_and_outputs(wallet, tx, outputs, parent_key_id)?; Ok(()) diff --git a/libwallet/src/internal/updater.rs b/libwallet/src/internal/updater.rs index 4cf6b6671..4d7130579 100644 --- a/libwallet/src/internal/updater.rs +++ b/libwallet/src/internal/updater.rs @@ -30,14 +30,13 @@ use crate::internal::keys; use crate::types::{ NodeClient, OutputData, OutputStatus, TxLogEntry, TxLogEntryType, WalletBackend, WalletInfo, }; -use crate::{BlockFees, CbData, OutputCommitMapping, PaymentCommitMapping}; +use crate::{BlockFees, CbData, OutputCommitMapping}; -/// Retrieve all of the self outputs (doesn't attempt to update from node) +/// Retrieve all of the outputs (doesn't attempt to update from node) pub fn retrieve_outputs( wallet: &mut T, show_spent: bool, tx_id: Option, - slate_id: Option, parent_key_id: Option<&Identifier>, ) -> Result, Error> where @@ -59,14 +58,6 @@ where .collect::>(); } - // only include outputs with a given slate_id if provided - if let Some(id) = slate_id { - outputs = outputs - .into_iter() - .filter(|out| out.slate_id == Some(id)) - .collect::>(); - } - if let Some(k) = parent_key_id { outputs = outputs .iter() @@ -91,38 +82,6 @@ where Ok(res) } -/// Retrieve all of the payment outputs (doesn't attempt to update from node) -pub fn retrieve_payments( - wallet: &mut T, - tx_id: Option, -) -> Result, Error> -where - T: WalletBackend, - C: NodeClient, - K: Keychain, -{ - // just read the wallet here, no need for a write lock - let mut outputs = wallet.payment_log_iter().collect::>(); - - // only include outputs with a given tx_id if provided - if let Some(id) = tx_id { - outputs = outputs - .into_iter() - .filter(|out| out.slate_id == id) - .collect::>(); - } - - let res = outputs - .into_iter() - .map(|output| { - let commit = - pedersen::Commitment::from_vec(util::from_hex(output.commit.clone()).unwrap()); - PaymentCommitMapping { output, commit } - }) - .collect(); - Ok(res) -} - /// Retrieve all of the transaction entries, or a particular entry /// if `parent_key_id` is set, only return entries from that key pub fn retrieve_txs( @@ -332,21 +291,6 @@ where t.confirmed = true; batch.save_tx_log_entry(t, &parent_key_id)?; } - - // if there's a related payment output being confirmed, refresh that payment log - if let Some(slate_id) = output.slate_id { - if let Ok(commits) = batch.get_payment_commits(&slate_id) { - for commit in commits.commits { - if let Ok(mut payment) = - batch.get_payment_log_entry(commit.clone()) - { - payment.height = o.1; - payment.mark_confirmed(); - batch.save_payment(payment)?; - } - } - } - } } output.height = o.1; output.mark_unspent(); @@ -469,7 +413,6 @@ where locked_total += out.value; } OutputStatus::Spent => {} - OutputStatus::Confirmed => {} } } @@ -547,7 +490,6 @@ where lock_height: lock_height, is_coinbase: true, tx_log_entry: None, - slate_id: None, })?; batch.commit()?; } diff --git a/libwallet/src/types.rs b/libwallet/src/types.rs index 7bb08e2a4..c79a28b65 100644 --- a/libwallet/src/types.rs +++ b/libwallet/src/types.rs @@ -85,19 +85,10 @@ where /// return the parent path fn parent_key_id(&mut self) -> Identifier; - /// Iterate over all self output data stored by the backend + /// Iterate over all output data stored by the backend fn iter<'a>(&'a self) -> Box + 'a>; - /// Get payment commits list by slate id - fn get_payment_log_commits(&self, u: &Uuid) -> Result, Error>; - - /// Get payment output data by commit - fn get_payment_log_entry(&self, commit: String) -> Result, Error>; - - /// Iterate over all payment output data stored by the backend - fn payment_log_iter<'a>(&'a self) -> Box + 'a>; - - /// Get self owned output data by id + /// Get output data by id fn get(&self, id: &Identifier, mmr_index: &Option) -> Result; /// Get an (Optional) tx log entry by uuid @@ -149,24 +140,12 @@ where /// Return the keychain being used fn keychain(&mut self) -> &mut K; - /// Add or update data about a self owned output to the backend + /// Add or update data about an output to the backend fn save(&mut self, out: OutputData) -> Result<(), Error>; - /// Add or update data about a payment output to the backend - fn save_payment(&mut self, out: PaymentData) -> Result<(), Error>; - - /// Add or update data about a payment commits list to the backend - fn save_payment_commits(&mut self, u: &Uuid, commits: PaymentCommits) -> Result<(), Error>; - - /// Gets self owned output data by id + /// Gets output data by id fn get(&self, id: &Identifier, mmr_index: &Option) -> Result; - /// Gets payment commits list by slate id - fn get_payment_commits(&self, u: &Uuid) -> Result; - - /// Gets payment output data by commit - fn get_payment_log_entry(&self, commit: String) -> Result; - /// Iterate over all output data stored by the backend fn iter(&self) -> Box>; @@ -291,8 +270,6 @@ pub struct OutputData { pub is_coinbase: bool, /// Optional corresponding internal entry in tx entry log pub tx_log_entry: Option, - /// Unique transaction ID, selected by sender - pub slate_id: Option, } impl ser::Writeable for OutputData { @@ -369,94 +346,6 @@ impl OutputData { } } } - -/// Information about a payment output that's being tracked by the wallet. -/// It belongs to the receiver, and it's paid by this wallet. - -#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, PartialOrd, Eq, Ord)] -pub struct PaymentData { - /// The actual commit - pub commit: String, - /// Value of the output - pub value: u64, - /// Current status of the output - pub status: OutputStatus, - /// Height of the output - pub height: u64, - /// Height we are locked until - pub lock_height: u64, - /// Unique transaction ID, selected by sender - pub slate_id: Uuid, -} - -impl ser::Writeable for PaymentData { - fn write(&self, writer: &mut W) -> Result<(), ser::Error> { - writer.write_bytes(&serde_json::to_vec(self).map_err(|_| ser::Error::CorruptedData)?) - } -} - -impl ser::Readable for PaymentData { - fn read(reader: &mut dyn ser::Reader) -> Result { - let data = reader.read_bytes_len_prefix()?; - serde_json::from_slice(&data[..]).map_err(|_| ser::Error::CorruptedData) - } -} - -impl PaymentData { - /// How many confirmations has this output received? - /// If height == 0 then we are either Unconfirmed or the output was - /// cut-through - /// so we do not actually know how many confirmations this output had (and - /// never will). - pub fn num_confirmations(&self, current_height: u64) -> u64 { - if self.height > current_height { - return 0; - } - if self.status == OutputStatus::Unconfirmed { - 0 - } else { - // if an output has height n and we are at block n - // then we have a single confirmation (the block it originated in) - 1 + (current_height - self.height) - } - } - - /// Marks this output as confirmed if it was previously unconfirmed - pub fn mark_confirmed(&mut self) { - match self.status { - OutputStatus::Unconfirmed => self.status = OutputStatus::Confirmed, - _ => (), - } - } -} - -/// Information about the payment commit/s in one tx that's being tracked by the wallet. -/// They belong to the receiver/s, and they're paid by this wallet. -/// -/// Note: because lmdb can't have multiple keys to same value, we have to use this to find -/// the commit lists by the slate id, in case we support multiple receivers in one tx in the future. - -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct PaymentCommits { - /// The actual commit/s - pub commits: Vec, - /// Unique transaction ID, selected by sender - pub slate_id: Uuid, -} - -impl ser::Writeable for PaymentCommits { - fn write(&self, writer: &mut W) -> Result<(), ser::Error> { - writer.write_bytes(&serde_json::to_vec(self).map_err(|_| ser::Error::CorruptedData)?) - } -} - -impl ser::Readable for PaymentCommits { - fn read(reader: &mut dyn ser::Reader) -> Result { - let data = reader.read_bytes_len_prefix()?; - serde_json::from_slice(&data[..]).map_err(|_| ser::Error::CorruptedData) - } -} - /// Status of an output that's being tracked by the wallet. Can either be /// unconfirmed, spent, unspent, or locked (when it's been used to generate /// a transaction but we don't have confirmation that the transaction was @@ -471,8 +360,6 @@ pub enum OutputStatus { Locked, /// Spent Spent, - /// Confirmed - Confirmed, } impl fmt::Display for OutputStatus { @@ -482,7 +369,6 @@ impl fmt::Display for OutputStatus { OutputStatus::Unspent => write!(f, "Unspent"), OutputStatus::Locked => write!(f, "Locked"), OutputStatus::Spent => write!(f, "Spent"), - OutputStatus::Confirmed => write!(f, "Confirmed"), } } } @@ -811,181 +697,3 @@ pub struct TxWrapper { /// hex representation of transaction pub tx_hex: String, } - -// Types to facilitate API arguments and serialization - -/// Send TX API Args -// TODO: This is here to ensure the legacy V1 API remains intact -// remove this when v1 api is removed -#[derive(Clone, Serialize, Deserialize)] -pub struct SendTXArgs { - /// amount to send - pub amount: u64, - /// minimum confirmations - pub minimum_confirmations: u64, - /// payment method - pub method: String, - /// destination url - pub dest: String, - /// Max number of outputs - pub max_outputs: usize, - /// Number of change outputs to generate - pub num_change_outputs: usize, - /// whether to use all outputs (combine) - pub selection_strategy_is_use_all: bool, - /// Optional message, that will be signed - pub message: Option, - /// Optional slate version to target when sending - pub target_slate_version: Option, -} - -/// V2 Init / Send TX API Args -#[derive(Clone, Serialize, Deserialize)] -pub struct InitTxArgs { - /// The human readable account name from which to draw outputs - /// for the transaction, overriding whatever the active account is as set via the - /// [`set_active_account`](../grin_wallet_api/owner/struct.Owner.html#method.set_active_account) method. - pub src_acct_name: Option, - #[serde(with = "secp_ser::string_or_u64")] - /// The amount to send, in nanogrins. (`1 G = 1_000_000_000nG`) - pub amount: u64, - #[serde(with = "secp_ser::string_or_u64")] - /// The minimum number of confirmations an output - /// should have in order to be included in the transaction. - pub minimum_confirmations: u64, - /// By default, the wallet selects as many inputs as possible in a - /// transaction, to reduce the Output set and the fees. The wallet will attempt to spend - /// include up to `max_outputs` in a transaction, however if this is not enough to cover - /// the whole amount, the wallet will include more outputs. This parameter should be considered - /// a soft limit. - pub max_outputs: u32, - /// The target number of change outputs to create in the transaction. - /// The actual number created will be `num_change_outputs` + whatever remainder is needed. - pub num_change_outputs: u32, - /// If `true`, attempt to use up as many outputs as - /// possible to create the transaction, up the 'soft limit' of `max_outputs`. This helps - /// to reduce the size of the UTXO set and the amount of data stored in the wallet, and - /// minimizes fees. This will generally result in many inputs and a large change output(s), - /// usually much larger than the amount being sent. If `false`, the transaction will include - /// as many outputs as are needed to meet the amount, (and no more) starting with the smallest - /// value outputs. - pub selection_strategy_is_use_all: bool, - /// An optional participant message to include alongside the sender's public - /// ParticipantData within the slate. This message will include a signature created with the - /// sender's private excess value, and will be publically verifiable. Note this message is for - /// the convenience of the participants during the exchange; it is not included in the final - /// transaction sent to the chain. The message will be truncated to 256 characters. - pub message: Option, - /// Optionally set the output target slate version (acceptable - /// down to the minimum slate version compatible with the current. If `None` the slate - /// is generated with the latest version. - pub target_slate_version: Option, - /// If true, just return an estimate of the resulting slate, containing fees and amounts - /// locked without actually locking outputs or creating the transaction. Note if this is set to - /// 'true', the amount field in the slate will contain the total amount locked, not the provided - /// transaction amount - pub estimate_only: Option, - /// Sender arguments. If present, the underlying function will also attempt to send the - /// transaction to a destination and optionally finalize the result - pub send_args: Option, -} - -/// Send TX API Args, for convenience functionality that inits the transaction and sends -/// in one go -#[derive(Clone, Serialize, Deserialize)] -pub struct InitTxSendArgs { - /// The transaction method. Can currently be 'http' or 'keybase'. - pub method: String, - /// The destination, contents will depend on the particular method - pub dest: String, - /// Whether to finalize the result immediately if the send was successful - pub finalize: bool, - /// Whether to post the transasction if the send and finalize were successful - pub post_tx: bool, - /// Whether to use dandelion when posting. If false, skip the dandelion relay - pub fluff: bool, -} - -impl Default for InitTxArgs { - fn default() -> InitTxArgs { - InitTxArgs { - src_acct_name: None, - amount: 0, - minimum_confirmations: 10, - max_outputs: 500, - num_change_outputs: 1, - selection_strategy_is_use_all: true, - message: None, - target_slate_version: None, - estimate_only: Some(false), - send_args: None, - } - } -} - -/// Fees in block to use for coinbase amount calculation -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct BlockFees { - /// fees - #[serde(with = "secp_ser::string_or_u64")] - pub fees: u64, - /// height - #[serde(with = "secp_ser::string_or_u64")] - pub height: u64, - /// key id - pub key_id: Option, -} - -impl BlockFees { - /// return key id - pub fn key_id(&self) -> Option { - self.key_id.clone() - } -} - -/// Response to build a coinbase output. -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct CbData { - /// Output - pub output: Output, - /// Kernel - pub kernel: TxKernel, - /// Key Id - pub key_id: Option, -} - -/// Map Outputdata to commits -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct OutputCommitMapping { - /// Output Data - pub output: OutputData, - /// The commit - #[serde( - serialize_with = "secp_ser::as_hex", - deserialize_with = "secp_ser::commitment_from_hex" - )] - pub commit: pedersen::Commitment, -} - -/// Map PaymentData to commits -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct PaymentCommitMapping { - /// Payment Data - pub output: PaymentData, - /// The commit - #[serde( - serialize_with = "secp_ser::as_hex", - deserialize_with = "secp_ser::commitment_from_hex" - )] - pub commit: pedersen::Commitment, -} - -/// Node height result -#[derive(Serialize, Deserialize, Debug, Clone)] -pub struct NodeHeightResult { - /// Last known height - #[serde(with = "secp_ser::string_or_u64")] - pub height: u64, - /// Whether this height was updated from the node - pub updated_from_node: bool, -} diff --git a/src/bin/cmd/wallet_args.rs b/src/bin/cmd/wallet_args.rs index 74d620bed..79c276abd 100644 --- a/src/bin/cmd/wallet_args.rs +++ b/src/bin/cmd/wallet_args.rs @@ -624,14 +624,6 @@ pub fn wallet_command( &global_wallet_args, wallet_config.dark_background_color_scheme.unwrap_or(true), ), - ("payments", Some(_)) => { - info!("payments command received"); - command::payments( - inst_wallet(), - &global_wallet_args, - wallet_config.dark_background_color_scheme.unwrap_or(true), - ) - } ("txs", Some(args)) => { let a = arg_parse!(parse_txs_args(&args)); command::txs( diff --git a/src/bin/cmd/wallet_tests.rs b/src/bin/cmd/wallet_tests.rs index 402359e62..7dd27a1b5 100644 --- a/src/bin/cmd/wallet_tests.rs +++ b/src/bin/cmd/wallet_tests.rs @@ -501,10 +501,6 @@ mod wallet_tests { let arg_vec = vec!["grin-wallet", "-p", "password", "-a", "mining", "outputs"]; execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?; - // payments - let arg_vec = vec!["grin-wallet", "-p", "password", "-a", "mining", "payments"]; - execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?; - // let logging finish thread::sleep(Duration::from_millis(200)); Ok(()) diff --git a/src/bin/grin-wallet.yml b/src/bin/grin-wallet.yml index 8157a77ee..01a5dd42d 100644 --- a/src/bin/grin-wallet.yml +++ b/src/bin/grin-wallet.yml @@ -163,9 +163,7 @@ subcommands: short: f long: fluff - outputs: - about: Raw wallet self owned output info (list of outputs) - - payments: - about: Raw wallet payment output info (list of outputs) + about: Raw wallet output info (list of outputs) - txs: about: Display transaction information args: From 3a3057defb7780b26da8af63209580dd1cd0b117 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Wed, 1 May 2019 20:12:23 +0100 Subject: [PATCH 05/36] [WIP] Invoiced Transactions API Support (#90) * basic invoiced tx working * rustfmt * teardown * rustfmt * rename, new struct for invoice args, begin to add new functions to RPC apis * rustfmt * add fns to rpc api * rustfmt * owner api functions RPC documentation in place * rustfmt * doctests for new invoicing functions * rustfmt * test fixes * update documentation and doctests * rustfmt * invoice testing verification of tx log output * rustfmt --- api/src/foreign.rs | 59 ++++++- api/src/foreign_rpc.rs | 238 ++++++++++++++++++++++++-- api/src/owner.rs | 124 ++++++++++++-- api/src/owner_rpc.rs | 252 +++++++++++++++++++++++++++- api/tests/slate_versioning.rs | 4 +- controller/src/command.rs | 4 +- controller/src/controller.rs | 2 +- controller/tests/accounts.rs | 2 +- controller/tests/check.rs | 2 +- controller/tests/file.rs | 2 +- controller/tests/invoice.rs | 187 +++++++++++++++++++++ controller/tests/repost.rs | 4 +- controller/tests/restore.rs | 8 +- controller/tests/self_send.rs | 2 +- controller/tests/transaction.rs | 14 +- impls/src/test_framework/mod.rs | 2 +- libwallet/src/api_impl/foreign.rs | 21 +++ libwallet/src/api_impl/owner.rs | 135 ++++++++++++++- libwallet/src/api_impl/types.rs | 29 ++++ libwallet/src/internal/selection.rs | 5 +- libwallet/src/internal/tx.rs | 45 +++-- libwallet/src/lib.rs | 4 +- libwallet/src/slate.rs | 7 +- 23 files changed, 1072 insertions(+), 80 deletions(-) create mode 100644 controller/tests/invoice.rs diff --git a/api/src/foreign.rs b/api/src/foreign.rs index 56b63157c..817eb0695 100644 --- a/api/src/foreign.rs +++ b/api/src/foreign.rs @@ -311,6 +311,61 @@ where w.close()?; res } + + /// Finalizes an invoice transaction initiated by this wallet's Owner api. + /// This step assumes the paying party has completed round 1 and 2 of slate + /// creation, and added their partial signatures. The invoicer will verify + /// and add their partial sig, then create the finalized transaction, + /// ready to post to a node. + /// + /// Note that this function DOES NOT POST the transaction to a node + /// for validation. This is done in separately via the + /// [`post_tx`](struct.Owner.html#method.post_tx) function. + /// + /// This function also stores the final transaction in the user's wallet files for retrieval + /// via the [`get_stored_tx`](struct.Owner.html#method.get_stored_tx) function. + /// + /// # Arguments + /// * `slate` - The transaction [`Slate`](../grin_wallet_libwallet/slate/struct.Slate.html). The + /// payer should have filled in round 1 and 2. + /// + /// # Returns + /// * Ok([`slate`](../grin_wallet_libwallet/slate/struct.Slate.html)) if successful, + /// containing the new finalized slate. + /// * or [`libwallet::Error`](../grin_wallet_libwallet/struct.Error.html) if an error is encountered. + /// + /// # Example + /// Set up as in [`new`](struct.Owner.html#method.new) method above. + /// ``` + /// # grin_wallet_api::doctest_helper_setup_doc_env_foreign!(wallet, wallet_config); + /// + /// let mut api_owner = Owner::new(wallet.clone()); + /// let mut api_foreign = Foreign::new(wallet.clone()); + /// + /// // . . . + /// // Issue the invoice tx via the owner API + /// let args = IssueInvoiceTxArgs { + /// amount: 10_000_000_000, + /// ..Default::default() + /// }; + /// let result = api_owner.issue_invoice_tx(args); + /// + /// // If result okay, send to payer, who will apply the transaction via their + /// // owner API, then send back the slate + /// // ... + /// # let slate = Slate::blank(2); + /// + /// let slate = api_foreign.finalize_invoice_tx(&slate); + /// // if okay, then post via the owner API + /// ``` + + pub fn finalize_invoice_tx(&self, slate: &Slate) -> Result { + let mut w = self.wallet.lock(); + w.open_with_credentials()?; + let res = foreign::finalize_invoice_tx(&mut *w, slate); + w.close()?; + res + } } #[doc(hidden)] @@ -330,10 +385,10 @@ macro_rules! doctest_helper_setup_doc_env_foreign { use std::sync::Arc; use util::Mutex; - use api::Foreign; + use api::{Foreign, Owner}; use config::WalletConfig; use impls::{HTTPNodeClient, LMDBBackend, WalletSeed}; - use libwallet::{BlockFees, Slate, WalletBackend}; + use libwallet::{BlockFees, IssueInvoiceTxArgs, Slate, WalletBackend}; let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap(); let dir = dir diff --git a/api/src/foreign_rpc.rs b/api/src/foreign_rpc.rs index 62b758e59..634dfcab7 100644 --- a/api/src/foreign_rpc.rs +++ b/api/src/foreign_rpc.rs @@ -16,8 +16,8 @@ use crate::keychain::Keychain; use crate::libwallet::{ - BlockFees, CbData, ErrorKind, InitTxArgs, NodeClient, Slate, VersionInfo, VersionedSlate, - WalletBackend, + BlockFees, CbData, ErrorKind, InitTxArgs, IssueInvoiceTxArgs, NodeClient, Slate, VersionInfo, + VersionedSlate, WalletBackend, }; use crate::Foreign; use easy_jsonrpc; @@ -56,9 +56,8 @@ pub trait ForeignRpc { } } # "# - # , 0, false); + # , 0, false, false); ``` - */ fn check_version(&self) -> Result; @@ -107,9 +106,9 @@ pub trait ForeignRpc { } } # "# - # , 4, false); + # , 4, false, false); ``` - */ + */ fn build_coinbase(&self, block_fees: &BlockFees) -> Result; /** @@ -187,9 +186,9 @@ pub trait ForeignRpc { } } # "# - # ,1 ,false); + # ,1 ,false, false); ``` - */ + */ fn verify_slate_messages(&self, slate: &Slate) -> Result<(), ErrorKind>; /** @@ -340,15 +339,178 @@ pub trait ForeignRpc { } } # "# - # , 5, true); + # , 5, true, false); ``` - */ + */ fn receive_tx( &self, slate: VersionedSlate, dest_acct_name: Option, message: Option, ) -> Result; + + /** + + Networked version of [Foreign::finalize_invoice_tx](struct.Foreign.html#method.finalize_invoice_tx). + + # Json rpc example + + ``` + # grin_wallet_api::doctest_helper_json_rpc_foreign_assert_response!( + # r#" + { + "jsonrpc": "2.0", + "method": "finalize_invoice_tx", + "id": 1, + "params": [{ + "version_info": { + "version": 2, + "orig_version": 2, + "min_compat_version": 0 + }, + "num_participants": 2, + "id": "0436430c-2b02-624c-2032-570501212b00", + "tx": { + "offset": "d202964900000000d302964900000000d402964900000000d502964900000000", + "body": { + "inputs": [ + { + "features": "Coinbase", + "commit": "087df32304c5d4ae8b2af0bc31e700019d722910ef87dd4eec3197b80b207e3045" + }, + { + "features": "Coinbase", + "commit": "08e1da9e6dc4d6e808a718b2f110a991dd775d65ce5ae408a4e1f002a4961aa9e7" + } + ], + "outputs": [ + { + "features": "Plain", + "commit": "099b48cfb1f80a2347dc89818449e68e76a3c6817a532a8e9ef2b4a5ccf4363850", + "proof": "7ebcd2ed9bf5fb29854033ba3d0e720613bdf7dfacc586d2f6084c1cde0a2b72e955d4ce625916701dc7c347132f40d0f102a34e801d745ee54b49b765d08aae0bb801c60403e57cafade3b4b174e795b633ab9e402b5b1b6e1243fd10bbcf9368a75cb6a6c375c7bdf02da9e03b7f210df45d942e6fba2729cd512a372e6ed91a1b5c9c22831febea843e3f85adcf198f39ac9f7b73b70c60bfb474aa69878ea8d1d32fef30166b59caacaec3fd024de29a90f1587e08d2c36b3d5c560cabf658e212e0a40a4129b3e5c35557058def5551f4eb395759597ba808b3c34eac3bfb9716e4480d7931c5789c538463ec75be0eb807c894047fda6cbcd22682d3c6d3823cb330f090a2099e3510a3706b57d46c95224394d7f1c0a20d99cc314b8f1d9d02668e2e435f62e1194de0be6a1f50f72ed777ed51c8819f527a94918d1aa8df6461e98ed4c2b18210de50fbcf8c3df210bfe326d41f1dc0ad748cb0320ae28401c85ab4f7dcb99d88a052e95dc85b76d22b36cabd60e06ab84bb7e4ddfdab9c9730c8a986583237ed1ecbb323ee8e79b8cadca4b438b7c09531670b471dda6a2eb3e747916c88ce7d9d8e1b7f61660eeb9e5a13c60e4dfe89d1177d81d6f6570fda85158e646a15f1e8b9e977494dc19a339aab2e0e478670d80092d6ba37646e60714ef64eb4a3d37fe15f8f38b59114af34b235489eed3f69b7781c5fe496eb43ffe245c14bd740f745844a38cf0d904347aaa2b64f51add18822dac009d8b63fa3e4c9b1fa72187f9a4acba1ab315daa1b04c9a41f3be846ac420b37990e6c947a16cc9d5c0671b292bf77d7d8b8974d2ad3afae95ba7772c37432840f53a007f31e0195f3abdf100c4477723cc6c6d5da14894a73dfac342833731036487488fdade7b9d556c06f26173b6b67598d3769447ce2828d71dd45ac5af436c6b0" + }, + { + "features": "Plain", + "commit": "0812276cc788e6870612296d926cba9f0e7b9810670710b5a6e6f1ba006d395774", + "proof": "dcff6175390c602bfa92c2ffd1a9b2d84dcc9ea941f6f317bdd0f875244ef23e696fd17c71df79760ce5ce1a96aab1d15dd057358dc835e972febeb86d50ccec0dad7cfe0246d742eb753cf7b88c045d15bc7123f8cf7155647ccf663fca92a83c9a65d0ed756ea7ebffd2cac90c380a102ed9caaa355d175ed0bf58d3ac2f5e909d6c447dfc6b605e04925c2b17c33ebd1908c965a5541ea5d2ed45a0958e6402f89d7a56df1992e036d836e74017e73ccad5cb3a82b8e139e309792a31b15f3ffd72ed033253428c156c2b9799458a25c1da65b719780a22de7fe7f437ae2fccd22cf7ea357ab5aa66a5ef7d71fb0dc64aa0b5761f68278062bb39bb296c787e4cabc5e2a2933a416ce1c9a9696160386449c437e9120f7bb26e5b0e74d1f2e7d5bcd7aafb2a92b87d1548f1f911fb06af7bd6cc13cee29f7c9cb79021aed18186272af0e9d189ec107c81a8a3aeb4782b0d950e4881aa51b776bb6844b25bce97035b48a9bdb2aea3608687bcdd479d4fa998b5a839ff88558e4a29dff0ed13b55900abb5d439b70793d902ae9ad34587b18c919f6b875c91d14deeb1c373f5e76570d59a6549758f655f1128a54f162dfe8868e1587028e26ad91e528c5ae7ee9335fa58fb59022b5de29d80f0764a9917390d46db899acc6a5b416e25ecc9dccb7153646addcc81cadb5f0078febc7e05d7735aba494f39ef05697bbcc9b47b2ccc79595d75fc13c80678b5e237edce58d731f34c05b1ddcaa649acf2d865bbbc3ceda10508bcdd29d0496744644bf1c3516f6687dfeef5649c7dff90627d642739a59d91a8d1d0c4dc55d74a949e1074427664b467992c9e0f7d3af9d6ea79513e8946ddc0d356bac49878e64e6a95b0a30214214faf2ce317fa622ff3266b32a816e10a18e6d789a5da1f23e67b4f970a68a7bcd9e18825ee274b0483896a40" + } + ], + "kernels": [ + { + "features": "Plain", + "fee": "7000000", + "lock_height": "0", + "excess": "000000000000000000000000000000000000000000000000000000000000000000", + "excess_sig": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + } + ] + } + }, + "amount": "60000000000", + "fee": "7000000", + "height": "5", + "lock_height": "0", + "participant_data": [ + { + "id": "1", + "public_blind_excess": "033bbe2a419ea2e9d6810a8d66552e709d1783ca50759a44dbaf63fc79c0164c4c", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", + "part_sig": null, + "message": null, + "message_sig": null + }, + { + "id": "0", + "public_blind_excess": "029f12f9f8c5489a18904de7cd46dc3384b79369d4cbc17cd74b299da8c2cf7445", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", + "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fe3cccc5ff1d832edb7e3cb3b1414b9e9d3d1d503294224b4c93bf3d59ed64018", + "message": null, + "message_sig": null + } + ] + }] + } + # "# + # , + # r#" + { + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "amount": "60000000000", + "fee": "7000000", + "height": "5", + "id": "0436430c-2b02-624c-2032-570501212b00", + "lock_height": "0", + "num_participants": 2, + "participant_data": [ + { + "id": "1", + "message": null, + "message_sig": null, + "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fc0e6f263f91010a6fea7099029c70eabdf75b48aefd977e14d1ed659b221eac9", + "public_blind_excess": "033bbe2a419ea2e9d6810a8d66552e709d1783ca50759a44dbaf63fc79c0164c4c", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" + }, + { + "id": "0", + "message": null, + "message_sig": null, + "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fe3cccc5ff1d832edb7e3cb3b1414b9e9d3d1d503294224b4c93bf3d59ed64018", + "public_blind_excess": "029f12f9f8c5489a18904de7cd46dc3384b79369d4cbc17cd74b299da8c2cf7445", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" + } + ], + "tx": { + "body": { + "inputs": [ + { + "commit": "087df32304c5d4ae8b2af0bc31e700019d722910ef87dd4eec3197b80b207e3045", + "features": "Coinbase" + }, + { + "commit": "08e1da9e6dc4d6e808a718b2f110a991dd775d65ce5ae408a4e1f002a4961aa9e7", + "features": "Coinbase" + } + ], + "kernels": [ + { + "excess": "09bac6083b05a32a9d9b37710c70dd0a1ef9329fde0848558976b6f1b81d80ceed", + "excess_sig": "4d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766a4b3bec3eae84394b68ad4cb3ddbc896f898aca769d2fc5a56886ba280c1e9a0", + "features": "Plain", + "fee": "7000000", + "lock_height": "0" + } + ], + "outputs": [ + { + "commit": "099b48cfb1f80a2347dc89818449e68e76a3c6817a532a8e9ef2b4a5ccf4363850", + "features": "Plain", + "proof": "7ebcd2ed9bf5fb29854033ba3d0e720613bdf7dfacc586d2f6084c1cde0a2b72e955d4ce625916701dc7c347132f40d0f102a34e801d745ee54b49b765d08aae0bb801c60403e57cafade3b4b174e795b633ab9e402b5b1b6e1243fd10bbcf9368a75cb6a6c375c7bdf02da9e03b7f210df45d942e6fba2729cd512a372e6ed91a1b5c9c22831febea843e3f85adcf198f39ac9f7b73b70c60bfb474aa69878ea8d1d32fef30166b59caacaec3fd024de29a90f1587e08d2c36b3d5c560cabf658e212e0a40a4129b3e5c35557058def5551f4eb395759597ba808b3c34eac3bfb9716e4480d7931c5789c538463ec75be0eb807c894047fda6cbcd22682d3c6d3823cb330f090a2099e3510a3706b57d46c95224394d7f1c0a20d99cc314b8f1d9d02668e2e435f62e1194de0be6a1f50f72ed777ed51c8819f527a94918d1aa8df6461e98ed4c2b18210de50fbcf8c3df210bfe326d41f1dc0ad748cb0320ae28401c85ab4f7dcb99d88a052e95dc85b76d22b36cabd60e06ab84bb7e4ddfdab9c9730c8a986583237ed1ecbb323ee8e79b8cadca4b438b7c09531670b471dda6a2eb3e747916c88ce7d9d8e1b7f61660eeb9e5a13c60e4dfe89d1177d81d6f6570fda85158e646a15f1e8b9e977494dc19a339aab2e0e478670d80092d6ba37646e60714ef64eb4a3d37fe15f8f38b59114af34b235489eed3f69b7781c5fe496eb43ffe245c14bd740f745844a38cf0d904347aaa2b64f51add18822dac009d8b63fa3e4c9b1fa72187f9a4acba1ab315daa1b04c9a41f3be846ac420b37990e6c947a16cc9d5c0671b292bf77d7d8b8974d2ad3afae95ba7772c37432840f53a007f31e0195f3abdf100c4477723cc6c6d5da14894a73dfac342833731036487488fdade7b9d556c06f26173b6b67598d3769447ce2828d71dd45ac5af436c6b0" + }, + { + "commit": "0812276cc788e6870612296d926cba9f0e7b9810670710b5a6e6f1ba006d395774", + "features": "Plain", + "proof": "dcff6175390c602bfa92c2ffd1a9b2d84dcc9ea941f6f317bdd0f875244ef23e696fd17c71df79760ce5ce1a96aab1d15dd057358dc835e972febeb86d50ccec0dad7cfe0246d742eb753cf7b88c045d15bc7123f8cf7155647ccf663fca92a83c9a65d0ed756ea7ebffd2cac90c380a102ed9caaa355d175ed0bf58d3ac2f5e909d6c447dfc6b605e04925c2b17c33ebd1908c965a5541ea5d2ed45a0958e6402f89d7a56df1992e036d836e74017e73ccad5cb3a82b8e139e309792a31b15f3ffd72ed033253428c156c2b9799458a25c1da65b719780a22de7fe7f437ae2fccd22cf7ea357ab5aa66a5ef7d71fb0dc64aa0b5761f68278062bb39bb296c787e4cabc5e2a2933a416ce1c9a9696160386449c437e9120f7bb26e5b0e74d1f2e7d5bcd7aafb2a92b87d1548f1f911fb06af7bd6cc13cee29f7c9cb79021aed18186272af0e9d189ec107c81a8a3aeb4782b0d950e4881aa51b776bb6844b25bce97035b48a9bdb2aea3608687bcdd479d4fa998b5a839ff88558e4a29dff0ed13b55900abb5d439b70793d902ae9ad34587b18c919f6b875c91d14deeb1c373f5e76570d59a6549758f655f1128a54f162dfe8868e1587028e26ad91e528c5ae7ee9335fa58fb59022b5de29d80f0764a9917390d46db899acc6a5b416e25ecc9dccb7153646addcc81cadb5f0078febc7e05d7735aba494f39ef05697bbcc9b47b2ccc79595d75fc13c80678b5e237edce58d731f34c05b1ddcaa649acf2d865bbbc3ceda10508bcdd29d0496744644bf1c3516f6687dfeef5649c7dff90627d642739a59d91a8d1d0c4dc55d74a949e1074427664b467992c9e0f7d3af9d6ea79513e8946ddc0d356bac49878e64e6a95b0a30214214faf2ce317fa622ff3266b32a816e10a18e6d789a5da1f23e67b4f970a68a7bcd9e18825ee274b0483896a40" + } + ] + }, + "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" + }, + "version_info": { + "min_compat_version": 0, + "orig_version": 2, + "version": 2 + } + } + } + } + # "# + # , 5, false, true); + ``` + */ + fn finalize_invoice_tx(&self, slate: &Slate) -> Result; } impl ForeignRpc for Foreign @@ -387,6 +549,10 @@ where Ok(VersionedSlate::into_version(slate, version)) } + + fn finalize_invoice_tx(&self, slate: &Slate) -> Result { + Foreign::finalize_invoice_tx(self, slate).map_err(|e| e.kind()) + } } /// helper to set up a real environment to run integrated doctests @@ -395,6 +561,7 @@ pub fn run_doctest_foreign( test_dir: &str, blocks_to_mine: u64, init_tx: bool, + init_invoice_tx: bool, ) -> Result, String> { use crate::{Foreign, ForeignRpc}; use easy_jsonrpc::Handler; @@ -457,6 +624,36 @@ pub fn run_doctest_foreign( w.close().unwrap(); } + if init_invoice_tx { + let amount = 60_000_000_000; + let mut slate = { + let mut w = wallet2.lock(); + w.open_with_credentials().unwrap(); + let args = IssueInvoiceTxArgs { + amount, + ..Default::default() + }; + api_impl::owner::issue_invoice_tx(&mut *w, args, true).unwrap() + }; + slate = { + let mut w = wallet1.lock(); + w.open_with_credentials().unwrap(); + let args = InitTxArgs { + src_acct_name: None, + amount: slate.amount, + minimum_confirmations: 2, + max_outputs: 500, + num_change_outputs: 1, + selection_strategy_is_use_all: true, + ..Default::default() + }; + api_impl::owner::process_invoice_tx(&mut *w, &slate, args, true).unwrap() + }; + println!("INIT INVOICE SLATE"); + // Spit out slate for input to finalize_invoice_tx + println!("{}", serde_json::to_string_pretty(&slate).unwrap()); + } + if init_tx { let amount = 60_000_000_000; let mut w = wallet1.lock(); @@ -470,13 +667,16 @@ pub fn run_doctest_foreign( selection_strategy_is_use_all: true, ..Default::default() }; - let slate = api_impl::owner::initiate_tx(&mut *w, args, true).unwrap(); + let slate = api_impl::owner::init_send_tx(&mut *w, args, true).unwrap(); println!("INIT SLATE"); // Spit out slate for input to finalize_tx println!("{}", serde_json::to_string_pretty(&slate).unwrap()); } - let mut api_foreign = Foreign::new(wallet1.clone()); + let mut api_foreign = match init_invoice_tx { + false => Foreign::new(wallet1.clone()), + true => Foreign::new(wallet2.clone()), + }; api_foreign.doctest_mode = true; let foreign_api = &api_foreign as &dyn ForeignRpc; Ok(foreign_api.handle_request(request).as_option()) @@ -485,7 +685,7 @@ pub fn run_doctest_foreign( #[doc(hidden)] #[macro_export] macro_rules! doctest_helper_json_rpc_foreign_assert_response { - ($request:expr, $expected_response:expr, $blocks_to_mine:expr, $init_tx:expr) => { + ($request:expr, $expected_response:expr, $blocks_to_mine:expr, $init_tx:expr, $init_invoice_tx:expr) => { // create temporary wallet, run jsonrpc request on owner api of wallet, delete wallet, return // json response. // In order to prevent leaking tempdirs, This function should not panic. @@ -504,9 +704,15 @@ macro_rules! doctest_helper_json_rpc_foreign_assert_response { let request_val: Value = serde_json::from_str($request).unwrap(); let expected_response: Value = serde_json::from_str($expected_response).unwrap(); - let response = run_doctest_foreign(request_val, dir, $blocks_to_mine, $init_tx) - .unwrap() - .unwrap(); + let response = run_doctest_foreign( + request_val, + dir, + $blocks_to_mine, + $init_tx, + $init_invoice_tx, + ) + .unwrap() + .unwrap(); if response != expected_response { panic!( diff --git a/api/src/owner.rs b/api/src/owner.rs index ee706f1ed..17868ec0a 100644 --- a/api/src/owner.rs +++ b/api/src/owner.rs @@ -25,8 +25,8 @@ use crate::impls::{HTTPWalletCommAdapter, KeybaseWalletCommAdapter}; use crate::keychain::{Identifier, Keychain}; use crate::libwallet::api_impl::owner; use crate::libwallet::{ - AcctPathMapping, Error, ErrorKind, InitTxArgs, NodeClient, NodeHeightResult, - OutputCommitMapping, Slate, TxLogEntry, WalletBackend, WalletInfo, + AcctPathMapping, Error, ErrorKind, InitTxArgs, IssueInvoiceTxArgs, NodeClient, + NodeHeightResult, OutputCommitMapping, Slate, TxLogEntry, WalletBackend, WalletInfo, }; /// Main interface into all wallet API functions. @@ -474,7 +474,7 @@ where /// message: Some("Have some Grins. Love, Yeastplume".to_owned()), /// ..Default::default() /// }; - /// let result = api_owner.initiate_tx( + /// let result = api_owner.init_send_tx( /// args, /// ); /// @@ -486,12 +486,12 @@ where /// } /// ``` - pub fn initiate_tx(&self, args: InitTxArgs) -> Result { + pub fn init_send_tx(&self, args: InitTxArgs) -> Result { let send_args = args.send_args.clone(); let mut slate = { let mut w = self.wallet.lock(); w.open_with_credentials()?; - let slate = owner::initiate_tx(&mut *w, args, self.doctest_mode)?; + let slate = owner::init_send_tx(&mut *w, args, self.doctest_mode)?; w.close()?; slate }; @@ -528,6 +528,108 @@ where } } + /// Issues a new invoice transaction slate, essentially a `request for payment`. + /// The slate created by this function will contain the amount, an output for the amount, + /// as well as round 1 of singature creation complete. The slate should then be send + /// to the payer, who should add their inputs and signature data and return the slate + /// via the [Foreign API's `finalize_invoice_tx`](struct.Foreign.html#method.finalize_invoice_tx) method. + /// + /// # Arguments + /// * `args` - [`IssueInvoiceTxArgs`](../grin_wallet_libwallet/types/struct.IssueInvoiceTxArgs.html), + /// invoice transaction initialization arguments. See struct documentation for further detail. + /// + /// # Returns + /// * ``Ok([`slate`](../grin_wallet_libwallet/slate/struct.Slate.html))` if successful, + /// containing the updated slate. + /// * or [`libwallet::Error`](../grin_wallet_libwallet/struct.Error.html) if an error is encountered. + /// + /// # Example + /// Set up as in [`new`](struct.Owner.html#method.new) method above. + /// ``` + /// # grin_wallet_api::doctest_helper_setup_doc_env!(wallet, wallet_config); + /// + /// let mut api_owner = Owner::new(wallet.clone()); + /// + /// let args = IssueInvoiceTxArgs { + /// amount: 60_000_000_000, + /// ..Default::default() + /// }; + /// let result = api_owner.issue_invoice_tx(args); + /// + /// if let Ok(slate) = result { + /// // if okay, send to the payer to add their inputs + /// // . . . + /// } + /// ``` + pub fn issue_invoice_tx(&self, args: IssueInvoiceTxArgs) -> Result { + let mut w = self.wallet.lock(); + w.open_with_credentials()?; + let slate = owner::issue_invoice_tx(&mut *w, args, self.doctest_mode)?; + w.close()?; + Ok(slate) + } + + /// Processes an invoice tranaction created by another party, essentially + /// a `request for payment`. The incoming slate should contain a requested + /// amount, an output created by the invoicer convering the amount, and + /// part 1 of signature creation completed. This function will add inputs + /// equalling the amount + fees, as well as perform round 1 and 2 of signature + /// creation. + /// + /// Callers should note that no prompting of the user will be done by this function + /// it is up to the caller to present the request for payment to the user + /// and verify that payment should go ahead. + /// + /// This function also stores the final transaction in the user's wallet files for retrieval + /// via the [`get_stored_tx`](struct.Owner.html#method.get_stored_tx) function. + /// + /// # Arguments + /// * `slate` - The transaction [`Slate`](../grin_wallet_libwallet/slate/struct.Slate.html). The + /// payer should have filled in round 1 and 2. + /// * `args` - [`InitTxArgs`](../grin_wallet_libwallet/types/struct.InitTxArgs.html), + /// transaction initialization arguments. See struct documentation for further detail. + /// + /// # Returns + /// * ``Ok([`slate`](../grin_wallet_libwallet/slate/struct.Slate.html))` if successful, + /// containing the updated slate. + /// * or [`libwallet::Error`](../grin_wallet_libwallet/struct.Error.html) if an error is encountered. + /// + /// # Example + /// Set up as in [`new`](struct.Owner.html#method.new) method above. + /// ``` + /// # grin_wallet_api::doctest_helper_setup_doc_env!(wallet, wallet_config); + /// + /// let mut api_owner = Owner::new(wallet.clone()); + /// + /// // . . . + /// // The slate has been recieved from the invoicer, somehow + /// # let slate = Slate::blank(2); + /// let args = InitTxArgs { + /// src_acct_name: None, + /// amount: slate.amount, + /// minimum_confirmations: 2, + /// max_outputs: 500, + /// num_change_outputs: 1, + /// selection_strategy_is_use_all: true, + /// ..Default::default() + /// }; + /// + /// let result = api_owner.process_invoice_tx(&slate, args); + /// + /// if let Ok(slate) = result { + /// // If result okay, send back to the invoicer + /// // . . . + /// } + /// ``` + + pub fn process_invoice_tx(&self, slate: &Slate, args: InitTxArgs) -> Result { + let mut w = self.wallet.lock(); + w.open_with_credentials()?; + let slate = owner::process_invoice_tx(&mut *w, slate, args, self.doctest_mode)?; + w.close()?; + Ok(slate) + } + /// Locks the outputs associated with the inputs to the transaction in the given /// [`Slate`](../grin_wallet_libwallet/slate/struct.Slate.html), /// making them unavailable for use in further transactions. This function is called @@ -566,7 +668,7 @@ where /// message: Some("Remember to lock this when we're happy this is sent".to_owned()), /// ..Default::default() /// }; - /// let result = api_owner.initiate_tx( + /// let result = api_owner.init_send_tx( /// args, /// ); /// @@ -624,7 +726,7 @@ where /// message: Some("Finalize this tx now".to_owned()), /// ..Default::default() /// }; - /// let result = api_owner.initiate_tx( + /// let result = api_owner.init_send_tx( /// args, /// ); /// @@ -681,7 +783,7 @@ where /// message: Some("Post this tx".to_owned()), /// ..Default::default() /// }; - /// let result = api_owner.initiate_tx( + /// let result = api_owner.init_send_tx( /// args, /// ); /// @@ -742,7 +844,7 @@ where /// message: Some("Cancel this tx".to_owned()), /// ..Default::default() /// }; - /// let result = api_owner.initiate_tx( + /// let result = api_owner.init_send_tx( /// args, /// ); /// @@ -835,7 +937,7 @@ where /// message: Some("Just verify messages".to_owned()), /// ..Default::default() /// }; - /// let result = api_owner.initiate_tx( + /// let result = api_owner.init_send_tx( /// args, /// ); /// @@ -1016,7 +1118,7 @@ macro_rules! doctest_helper_setup_doc_env { use api::Owner; use config::WalletConfig; use impls::{HTTPNodeClient, LMDBBackend, WalletSeed}; - use libwallet::{InitTxArgs, WalletBackend}; + use libwallet::{InitTxArgs, IssueInvoiceTxArgs, Slate, WalletBackend}; let dir = tempdir().map_err(|e| format!("{:#?}", e)).unwrap(); let dir = dir diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index 31f637b49..5e06c7002 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -18,8 +18,8 @@ use uuid::Uuid; use crate::core::core::Transaction; use crate::keychain::{Identifier, Keychain}; use crate::libwallet::{ - AcctPathMapping, ErrorKind, InitTxArgs, NodeClient, NodeHeightResult, OutputCommitMapping, - Slate, TxLogEntry, WalletBackend, WalletInfo, + AcctPathMapping, ErrorKind, InitTxArgs, IssueInvoiceTxArgs, NodeClient, NodeHeightResult, + OutputCommitMapping, Slate, TxLogEntry, WalletBackend, WalletInfo, }; use crate::Owner; use easy_jsonrpc; @@ -314,14 +314,14 @@ pub trait OwnerRpc { ) -> Result<(bool, WalletInfo), ErrorKind>; /** - Networked version of [Owner::estimate_initiate_tx](struct.Owner.html#method.initiate_tx). + Networked version of [Owner::init_send_tx](struct.Owner.html#method.init_send_tx). ``` # grin_wallet_api::doctest_helper_json_rpc_owner_assert_response!( # r#" { "jsonrpc": "2.0", - "method": "initiate_tx", + "method": "init_send_tx", "params": { "args": { "src_acct_name": null, @@ -401,7 +401,235 @@ pub trait OwnerRpc { ``` */ - fn initiate_tx(&self, args: InitTxArgs) -> Result; + fn init_send_tx(&self, args: InitTxArgs) -> Result; + + /** + Networked version of [Owner::issue_invoice_tx](struct.Owner.html#method.issue_invoice_tx). + + ``` + # grin_wallet_api::doctest_helper_json_rpc_owner_assert_response!( + # r#" + { + "jsonrpc": "2.0", + "method": "issue_invoice_tx", + "params": { + "args": { + "amount": "6000000000", + "message": "Please give me your grins", + "dest_acct_name": null, + "target_slate_version": null + } + }, + "id": 1 + } + # "# + # , + # r#" + { + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "amount": "6000000000", + "fee": "0", + "height": "4", + "id": "0436430c-2b02-624c-2032-570501212b00", + "lock_height": "0", + "num_participants": 2, + "participant_data": [ + { + "id": "1", + "message": "Please give me your grins", + "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fd2599ab38942986602e943f684a85992893a6d34367dc7cc2b403a5dcfcdbcd9", + "part_sig": null, + "public_blind_excess": "028e95921cc0d5be5922362265d352c9bdabe51a9e1502a3f0d4a10387f1893f40", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" + } + ], + "tx": { + "body": { + "inputs": [], + "kernels": [ + { + "excess": "000000000000000000000000000000000000000000000000000000000000000000", + "excess_sig": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "features": "Plain", + "fee": "0", + "lock_height": "0" + } + ], + "outputs": [ + { + "commit": "09cf47204446c326e361a1a92f34b174deff732daaedb80d7339fbe3db5ca2f6ba", + "features": "Plain", + "proof": "8f511614315626b5f39224482351d766f5a8ef136262befc050d839be8479b0a13470cd88f4436346d213d83847a4055c6e0ac63681556470349a1aab47034a3015eb64d8163955998e2dd4165dd24386b1e279974b05deb5d46ba2bc321f7000c0784f8f10690605ffe717119d045e02b141ed12d8fc6d20930483a8af889ef533495eb442fcff36d98ebc104f13fc645c28431b3296e4a11f7c991ff97f9abbc2f8886762d7f29fdacb31d52c6850e6ccf5386117d89e8ea4ca3071c56c218dd5d3bcd65f6c06ed9f51f848507ca1d594f41796d1cf99f68a5c3f0c5dd9873602284cff31269b102fcc6c68607565faaf0adb04ed4ff3ea5d41f3b5235ac6cb90e4046c808c9c48c27172c891b20085c56a99913ef47fd8b3dc4920cef50534b9319a7cefe0df10a0206a634ac837e11da92df83ff58b1a14de81313400988aa48b946fcbe1b81f0e79e13f7c6c639b1c10983b424bda08d0ce593a20f1f47e0aa01473e7144f116b76d9ebc60599053d8f1542d60747793d99064e51fce8f8866390325d48d6e8e3bbdbc1822c864303451525c6cb4c6902f105a70134186fb32110d8192fc2528a9483fc8a4001f4bdeab1dd7b3d1ccb9ae2e746a78013ef74043f0b2436f0ca49627af1768b7c791c669bd331fd18c16ef88ad0a29861db70f2f76f3e74fde5accb91b73573e31333333223693d6fbc786e740c085e4fc6e7bde0a3f54e9703f816c54f012d3b1f41ec4d253d9337af61e7f1f1383bd929421ac346e3d2771dfee0b60503b33938e7c83eb37af3b6bf66041a3519a2b4cb557b34e3b9afcf95524f9a011425a34d32e7b6e9f255291094930acae26e8f7a1e4e6bc405d0f88e919f354f3ba85356a34f1aba5f7da1fad88e2692f4129cc1fb80a2122b2d996c6ccf7f08d8248e511d92af9ce49039de728848a2dc74101f4e94a" + } + ] + }, + "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" + }, + "version_info": { + "min_compat_version": 0, + "orig_version": 2, + "version": 2 + } + } + } + } + # "# + # ,4, false, false, false); + ``` + */ + + fn issue_invoice_tx(&self, args: IssueInvoiceTxArgs) -> Result; + + /** + Networked version of [Owner::process_invoice_tx](struct.Owner.html#method.process_invoice_tx). + + ``` + # grin_wallet_api::doctest_helper_json_rpc_owner_assert_response!( + # r#" + { + "jsonrpc": "2.0", + "method": "process_invoice_tx", + "params": [ + { + "amount": "6000000000", + "fee": "0", + "height": "4", + "id": "0436430c-2b02-624c-2032-570501212b00", + "lock_height": "0", + "num_participants": 2, + "participant_data": [ + { + "id": "1", + "message": "Please give me your grins", + "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fd2599ab38942986602e943f684a85992893a6d34367dc7cc2b403a5dcfcdbcd9", + "part_sig": null, + "public_blind_excess": "028e95921cc0d5be5922362265d352c9bdabe51a9e1502a3f0d4a10387f1893f40", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" + } + ], + "tx": { + "body": { + "inputs": [], + "kernels": [ + { + "excess": "000000000000000000000000000000000000000000000000000000000000000000", + "excess_sig": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "features": "Plain", + "fee": "0", + "lock_height": "0" + } + ], + "outputs": [ + { + "commit": "09cf47204446c326e361a1a92f34b174deff732daaedb80d7339fbe3db5ca2f6ba", + "features": "Plain", + "proof": "8f511614315626b5f39224482351d766f5a8ef136262befc050d839be8479b0a13470cd88f4436346d213d83847a4055c6e0ac63681556470349a1aab47034a3015eb64d8163955998e2dd4165dd24386b1e279974b05deb5d46ba2bc321f7000c0784f8f10690605ffe717119d045e02b141ed12d8fc6d20930483a8af889ef533495eb442fcff36d98ebc104f13fc645c28431b3296e4a11f7c991ff97f9abbc2f8886762d7f29fdacb31d52c6850e6ccf5386117d89e8ea4ca3071c56c218dd5d3bcd65f6c06ed9f51f848507ca1d594f41796d1cf99f68a5c3f0c5dd9873602284cff31269b102fcc6c68607565faaf0adb04ed4ff3ea5d41f3b5235ac6cb90e4046c808c9c48c27172c891b20085c56a99913ef47fd8b3dc4920cef50534b9319a7cefe0df10a0206a634ac837e11da92df83ff58b1a14de81313400988aa48b946fcbe1b81f0e79e13f7c6c639b1c10983b424bda08d0ce593a20f1f47e0aa01473e7144f116b76d9ebc60599053d8f1542d60747793d99064e51fce8f8866390325d48d6e8e3bbdbc1822c864303451525c6cb4c6902f105a70134186fb32110d8192fc2528a9483fc8a4001f4bdeab1dd7b3d1ccb9ae2e746a78013ef74043f0b2436f0ca49627af1768b7c791c669bd331fd18c16ef88ad0a29861db70f2f76f3e74fde5accb91b73573e31333333223693d6fbc786e740c085e4fc6e7bde0a3f54e9703f816c54f012d3b1f41ec4d253d9337af61e7f1f1383bd929421ac346e3d2771dfee0b60503b33938e7c83eb37af3b6bf66041a3519a2b4cb557b34e3b9afcf95524f9a011425a34d32e7b6e9f255291094930acae26e8f7a1e4e6bc405d0f88e919f354f3ba85356a34f1aba5f7da1fad88e2692f4129cc1fb80a2122b2d996c6ccf7f08d8248e511d92af9ce49039de728848a2dc74101f4e94a" + } + ] + }, + "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" + }, + "version_info": { + "min_compat_version": 0, + "orig_version": 2, + "version": 2 + } + }, + { + "src_acct_name": null, + "amount": "0", + "minimum_confirmations": 2, + "max_outputs": 500, + "num_change_outputs": 1, + "selection_strategy_is_use_all": true, + "message": "Ok, here are your grins", + "target_slate_version": null, + "send_args": null + } + ], + "id": 1 + } + # "# + # , + # r#" + { + "id": 1, + "jsonrpc": "2.0", + "result": { + "Ok": { + "amount": "6000000000", + "fee": "8000000", + "height": "4", + "id": "0436430c-2b02-624c-2032-570501212b00", + "lock_height": "0", + "num_participants": 2, + "participant_data": [ + { + "id": "1", + "message": "Please give me your grins", + "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fd2599ab38942986602e943f684a85992893a6d34367dc7cc2b403a5dcfcdbcd9", + "part_sig": null, + "public_blind_excess": "028e95921cc0d5be5922362265d352c9bdabe51a9e1502a3f0d4a10387f1893f40", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" + }, + { + "id": "0", + "message": "Ok, here are your grins", + "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f463643727bf45004637269e9afb5f5fbd8cdcc1881a2ef9ec3ab0fb5f6e01ae9", + "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f19d37c475bc5cc495b732dfddb0fb5a5e782b7ae2797ef4904b66f6afb409d61", + "public_blind_excess": "0309e22f2adaa9b81f51414b775b86acd096e17794eb8159bfcfef27caa4bf5c90", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" + } + ], + "tx": { + "body": { + "inputs": [ + { + "commit": "08e1da9e6dc4d6e808a718b2f110a991dd775d65ce5ae408a4e1f002a4961aa9e7", + "features": "Coinbase" + } + ], + "kernels": [ + { + "excess": "000000000000000000000000000000000000000000000000000000000000000000", + "excess_sig": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "features": "Plain", + "fee": "8000000", + "lock_height": "0" + } + ], + "outputs": [ + { + "commit": "09cf47204446c326e361a1a92f34b174deff732daaedb80d7339fbe3db5ca2f6ba", + "features": "Plain", + "proof": "8f511614315626b5f39224482351d766f5a8ef136262befc050d839be8479b0a13470cd88f4436346d213d83847a4055c6e0ac63681556470349a1aab47034a3015eb64d8163955998e2dd4165dd24386b1e279974b05deb5d46ba2bc321f7000c0784f8f10690605ffe717119d045e02b141ed12d8fc6d20930483a8af889ef533495eb442fcff36d98ebc104f13fc645c28431b3296e4a11f7c991ff97f9abbc2f8886762d7f29fdacb31d52c6850e6ccf5386117d89e8ea4ca3071c56c218dd5d3bcd65f6c06ed9f51f848507ca1d594f41796d1cf99f68a5c3f0c5dd9873602284cff31269b102fcc6c68607565faaf0adb04ed4ff3ea5d41f3b5235ac6cb90e4046c808c9c48c27172c891b20085c56a99913ef47fd8b3dc4920cef50534b9319a7cefe0df10a0206a634ac837e11da92df83ff58b1a14de81313400988aa48b946fcbe1b81f0e79e13f7c6c639b1c10983b424bda08d0ce593a20f1f47e0aa01473e7144f116b76d9ebc60599053d8f1542d60747793d99064e51fce8f8866390325d48d6e8e3bbdbc1822c864303451525c6cb4c6902f105a70134186fb32110d8192fc2528a9483fc8a4001f4bdeab1dd7b3d1ccb9ae2e746a78013ef74043f0b2436f0ca49627af1768b7c791c669bd331fd18c16ef88ad0a29861db70f2f76f3e74fde5accb91b73573e31333333223693d6fbc786e740c085e4fc6e7bde0a3f54e9703f816c54f012d3b1f41ec4d253d9337af61e7f1f1383bd929421ac346e3d2771dfee0b60503b33938e7c83eb37af3b6bf66041a3519a2b4cb557b34e3b9afcf95524f9a011425a34d32e7b6e9f255291094930acae26e8f7a1e4e6bc405d0f88e919f354f3ba85356a34f1aba5f7da1fad88e2692f4129cc1fb80a2122b2d996c6ccf7f08d8248e511d92af9ce49039de728848a2dc74101f4e94a" + }, + { + "commit": "094be57c91787fc2033d5d97fae099f1a6ddb37ea48370f1a138f09524c767fdd3", + "features": "Plain", + "proof": "2a42e9e902b70ce44e1fccb14de87ee0a97100bddf12c6bead1b9c5f4eb60300f29c13094fa12ffeee238fb4532b18f6b61cf51b23c1c7e1ad2e41560dc27edc0a2b9e647a0b3e4e806fced5b65e61d0f1f5197d3e2285c632d359e27b6b9206b2caffea4f67e0c7a2812e7a22c134b98cf89bd43d9f28b8bec25cce037a0ac5b1ae8f667e54e1250813a5263004486b4465ad4e641ab2b535736ea26535a11013564f08f483b7dab1c2bcc3ee38eadf2f7850eff7e3459a4bbabf9f0cf6c50d0c0a4120565cd4a2ce3e354c11721cd695760a24c70e0d5a0dfc3c5dcd51dfad6de2c237a682f36dc0b271f21bb3655e5333016aaa42c2efa1446e5f3c0a79ec417c4d30f77556951cb0f05dbfafb82d9f95951a9ea241fda2a6388f73ace036b98acce079f0e4feebccc96290a86dcc89118a901210b245f2d114cf94396e4dbb461e82aa26a0581389707957968c7cdc466213bb1cd417db207ef40c05842ab67a01a9b96eb1430ebc26e795bb491258d326d5174ad549401059e41782121e506744af8af9d8e493644a87d613600888541cbbe538c625883f3eb4aa3102c5cfcc25de8e97af8927619ce6a731b3b8462d51d993066b935b0648d2344ad72e4fd70f347fbd81041042e5ea31cc7b2e3156a920b80ecba487b950ca32ca95fae85b759c936246ecf441a9fdd95e8fee932d6782cdec686064018c857efc47fb4b2a122600d5fdd79af2486f44df7e629184e1c573bc0a9b3feb40b190ef2861a1ab45e2ac2201b9cd42e495deea247269820ed32389a2810ad6c0f9a296d2a2d9c54089fed50b7f5ecfcd33ab9954360e1d7f5598c32128cfcf2a1d8bf14616818da8a5343bfa88f0eedf392e9d4ab1ace1b60324129cd4852c2e27813a9cf71a6ae6229a4fcecc1a756b3e664c5f50af333082616815a3bec8fc0b75b8e4e767d719" + } + ] + }, + "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" + }, + "version_info": { + "min_compat_version": 0, + "orig_version": 2, + "version": 2 + } + } + } + } + # "# + # ,4, false, false, false); + ``` + */ + + fn process_invoice_tx(&self, slate: &Slate, args: InitTxArgs) -> Result; /** Networked version of [Owner::tx_lock_outputs](struct.Owner.html#method.tx_lock_outputs). @@ -1049,8 +1277,16 @@ where .map_err(|e| e.kind()) } - fn initiate_tx(&self, args: InitTxArgs) -> Result { - Owner::initiate_tx(self, args).map_err(|e| e.kind()) + fn init_send_tx(&self, args: InitTxArgs) -> Result { + Owner::init_send_tx(self, args).map_err(|e| e.kind()) + } + + fn issue_invoice_tx(&self, args: IssueInvoiceTxArgs) -> Result { + Owner::issue_invoice_tx(self, args).map_err(|e| e.kind()) + } + + fn process_invoice_tx(&self, slate: &Slate, args: InitTxArgs) -> Result { + Owner::process_invoice_tx(self, slate, args).map_err(|e| e.kind()) } fn finalize_tx(&self, mut slate: Slate) -> Result { @@ -1173,7 +1409,7 @@ pub fn run_doctest_owner( selection_strategy_is_use_all: true, ..Default::default() }; - let mut slate = api_impl::owner::initiate_tx(&mut *w, args, true).unwrap(); + let mut slate = api_impl::owner::init_send_tx(&mut *w, args, true).unwrap(); { let mut w2 = wallet2.lock(); w2.open_with_credentials().unwrap(); diff --git a/api/tests/slate_versioning.rs b/api/tests/slate_versioning.rs index 38c2493f0..51b99ac63 100644 --- a/api/tests/slate_versioning.rs +++ b/api/tests/slate_versioning.rs @@ -52,7 +52,7 @@ fn receive_versioned_slate() { let request_val: Value = serde_json::from_str(v1_req).unwrap(); let expected_response: Value = serde_json::from_str(v1_resp).unwrap(); - let response = run_doctest_foreign(request_val, dir, 5, true) + let response = run_doctest_foreign(request_val, dir, 5, true, false) .unwrap() .unwrap(); @@ -80,7 +80,7 @@ fn receive_tx(vs: VersionedSlate) -> VersionedSlate { ) .unwrap(); let (call, tracker) = bound_method.call(); - let json_response = run_doctest_foreign(call.as_request(), dir, 5, false) + let json_response = run_doctest_foreign(call.as_request(), dir, 5, false, false) .unwrap() .unwrap(); let mut response = easy_jsonrpc::Response::from_json_response(json_response).unwrap(); diff --git a/controller/src/command.rs b/controller/src/command.rs index ae5cba102..374e66c0f 100644 --- a/controller/src/command.rs +++ b/controller/src/command.rs @@ -257,7 +257,7 @@ pub fn send( estimate_only: Some(true), ..Default::default() }; - let slate = api.initiate_tx(init_args).unwrap(); + let slate = api.init_send_tx(init_args).unwrap(); (strategy, slate.amount, slate.fee) }) .collect(); @@ -275,7 +275,7 @@ pub fn send( send_args: None, ..Default::default() }; - let result = api.initiate_tx(init_args); + let result = api.init_send_tx(init_args); let mut slate = match result { Ok(s) => { info!( diff --git a/controller/src/controller.rs b/controller/src/controller.rs index 01f1601e9..5a5f92154 100644 --- a/controller/src/controller.rs +++ b/controller/src/controller.rs @@ -359,7 +359,7 @@ where send_args: None, ..Default::default() }; - let result = api.initiate_tx(init_args); + let result = api.init_send_tx(init_args); let mut slate = match result { Ok(s) => { info!( diff --git a/controller/tests/accounts.rs b/controller/tests/accounts.rs index 85fe59150..1feb699dc 100644 --- a/controller/tests/accounts.rs +++ b/controller/tests/accounts.rs @@ -189,7 +189,7 @@ fn accounts_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let mut slate = api.initiate_tx(args)?; + let mut slate = api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate)?; api.tx_lock_outputs(&slate)?; slate = api.finalize_tx(&slate)?; diff --git a/controller/tests/check.rs b/controller/tests/check.rs index 144e29021..cf8d2a0ef 100644 --- a/controller/tests/check.rs +++ b/controller/tests/check.rs @@ -187,7 +187,7 @@ fn check_repair_impl(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let mut slate = api.initiate_tx(args)?; + let mut slate = api.init_send_tx(args)?; // output tx file let file_adapter = FileWalletCommAdapter::new(); let send_file = format!("{}/part_tx_1.tx", test_dir); diff --git a/controller/tests/file.rs b/controller/tests/file.rs index 3816f8f8f..a41989bd3 100644 --- a/controller/tests/file.rs +++ b/controller/tests/file.rs @@ -117,7 +117,7 @@ fn file_exchange_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { message: Some(message.to_owned()), ..Default::default() }; - let mut slate = api.initiate_tx(args)?; + let mut slate = api.init_send_tx(args)?; // output tx file let file_adapter = FileWalletCommAdapter::new(); file_adapter.send_tx_async(&send_file, &mut slate)?; diff --git a/controller/tests/invoice.rs b/controller/tests/invoice.rs new file mode 100644 index 000000000..62482ba81 --- /dev/null +++ b/controller/tests/invoice.rs @@ -0,0 +1,187 @@ +// Copyright 2018 The Grin Developers +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Test a wallet sending to self +#[macro_use] +extern crate log; +extern crate grin_wallet_controller as wallet; +extern crate grin_wallet_impls as impls; + +use grin_wallet_util::grin_core as core; +use grin_wallet_util::grin_keychain as keychain; +use grin_wallet_util::grin_util as util; + +use self::core::global; +use self::core::global::ChainTypes; +use self::keychain::ExtKeychain; +use grin_wallet_libwallet as libwallet; +use impls::test_framework::{self, LocalWalletClient, WalletProxy}; +use libwallet::{InitTxArgs, IssueInvoiceTxArgs, Slate}; +use std::fs; +use std::thread; +use std::time::Duration; + +fn clean_output_dir(test_dir: &str) { + let _ = fs::remove_dir_all(test_dir); +} + +fn setup(test_dir: &str) { + util::init_test_logger(); + clean_output_dir(test_dir); + global::set_mining_mode(ChainTypes::AutomatedTesting); +} + +fn teardown(test_dir: &str) { + clean_output_dir(test_dir); +} + +/// self send impl +fn invoice_tx_impl(test_dir: &str) -> Result<(), libwallet::Error> { + { + setup(test_dir); + // Create a new proxy to simulate server and wallet responses + let mut wallet_proxy: WalletProxy = + WalletProxy::new(test_dir); + let chain = wallet_proxy.chain.clone(); + + // Create a new wallet test client, and set its queues to communicate with the proxy + let client1 = LocalWalletClient::new("wallet1", wallet_proxy.tx.clone()); + let wallet1 = + test_framework::create_wallet(&format!("{}/wallet1", test_dir), client1.clone(), None); + wallet_proxy.add_wallet("wallet1", client1.get_send_instance(), wallet1.clone()); + + // wallet 2, will be recipient + let client2 = LocalWalletClient::new("wallet2", wallet_proxy.tx.clone()); + let wallet2 = + test_framework::create_wallet(&format!("{}/wallet2", test_dir), client2.clone(), None); + wallet_proxy.add_wallet("wallet2", client2.get_send_instance(), wallet2.clone()); + + // Set the wallet proxy listener running + thread::spawn(move || { + if let Err(e) = wallet_proxy.run() { + error!("Wallet Proxy error: {}", e); + } + }); + + // few values to keep things shorter + let reward = core::consensus::REWARD; + + // add some accounts + wallet::controller::owner_single_use(wallet1.clone(), |api| { + api.create_account_path("mining")?; + api.create_account_path("listener")?; + Ok(()) + })?; + + // Get some mining done + { + let mut w = wallet1.lock(); + w.set_parent_key_id_by_name("mining")?; + } + let mut bh = 10u64; + let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), bh as usize, false); + + // Sanity check wallet 1 contents + wallet::controller::owner_single_use(wallet1.clone(), |api| { + let (wallet1_refreshed, wallet1_info) = api.retrieve_summary_info(true, 1)?; + assert!(wallet1_refreshed); + assert_eq!(wallet1_info.last_confirmed_height, bh); + assert_eq!(wallet1_info.total, bh * reward); + Ok(()) + })?; + + let mut slate = Slate::blank(2); + + wallet::controller::owner_single_use(wallet2.clone(), |api| { + // Wallet 2 inititates an invoice transaction, requesting payment + let args = IssueInvoiceTxArgs { + amount: reward * 2, + ..Default::default() + }; + slate = api.issue_invoice_tx(args)?; + Ok(()) + })?; + + wallet::controller::owner_single_use(wallet1.clone(), |api| { + // Wallet 1 receives the invoice transaction + let args = InitTxArgs { + src_acct_name: None, + amount: slate.amount, + minimum_confirmations: 2, + max_outputs: 500, + num_change_outputs: 1, + selection_strategy_is_use_all: true, + ..Default::default() + }; + slate = api.process_invoice_tx(&slate, args)?; + Ok(()) + })?; + + // wallet 2 finalizes and posts + wallet::controller::foreign_single_use(wallet2.clone(), |api| { + // Wallet 2 receives the invoice transaction + slate = api.finalize_invoice_tx(&slate)?; + Ok(()) + })?; + + // wallet 1 posts so wallet 2 doesn't get the mined amount + wallet::controller::owner_single_use(wallet1.clone(), |api| { + api.post_tx(&slate.tx, false)?; + Ok(()) + })?; + bh += 1; + + let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), 3, false); + bh += 3; + + // Check transaction log for wallet 2 + wallet::controller::owner_single_use(wallet2.clone(), |api| { + let (_, wallet2_info) = api.retrieve_summary_info(true, 1)?; + let (refreshed, txs) = api.retrieve_txs(true, None, None)?; + assert!(refreshed); + assert!(txs.len() == 1); + println!( + "last confirmed height: {}, bh: {}", + wallet2_info.last_confirmed_height, bh + ); + assert!(refreshed); + assert_eq!(wallet2_info.amount_currently_spendable, slate.amount); + Ok(()) + })?; + + // let logging finish + thread::sleep(Duration::from_millis(200)); + + // Check transaction log for wallet 1, ensure only 1 entry + // exists + wallet::controller::owner_single_use(wallet1.clone(), |api| { + let (_, wallet1_info) = api.retrieve_summary_info(true, 1)?; + let (refreshed, txs) = api.retrieve_txs(true, None, None)?; + assert!(refreshed); + assert_eq!(txs.len() as u64, bh + 1); + println!( + "Wallet 1: last confirmed height: {}, bh: {}", + wallet1_info.last_confirmed_height, bh + ); + Ok(()) + })?; + } + teardown(test_dir); + Ok(()) +} + +#[test] +fn wallet_invoice_tx() -> Result<(), libwallet::Error> { + let test_dir = "test_output/invoice_tx"; + invoice_tx_impl(test_dir) +} diff --git a/controller/tests/repost.rs b/controller/tests/repost.rs index 0377b5431..0df02e9a6 100644 --- a/controller/tests/repost.rs +++ b/controller/tests/repost.rs @@ -112,7 +112,7 @@ fn file_repost_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let mut slate = api.initiate_tx(args)?; + let mut slate = api.init_send_tx(args)?; // output tx file let file_adapter = FileWalletCommAdapter::new(); file_adapter.send_tx_async(&send_file, &mut slate)?; @@ -209,7 +209,7 @@ fn file_repost_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let slate_i = sender_api.initiate_tx(args)?; + let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate_i)?; sender_api.tx_lock_outputs(&slate)?; slate = sender_api.finalize_tx(&mut slate)?; diff --git a/controller/tests/restore.rs b/controller/tests/restore.rs index dd660b95c..c2cc82414 100644 --- a/controller/tests/restore.rs +++ b/controller/tests/restore.rs @@ -245,7 +245,7 @@ fn setup_restore(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let slate_i = sender_api.initiate_tx(args)?; + let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate_i)?; sender_api.tx_lock_outputs(&slate)?; slate = sender_api.finalize_tx(&slate)?; @@ -268,7 +268,7 @@ fn setup_restore(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let slate_i = sender_api.initiate_tx(args)?; + let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet3", &slate_i)?; sender_api.tx_lock_outputs(&slate)?; slate = sender_api.finalize_tx(&slate)?; @@ -291,7 +291,7 @@ fn setup_restore(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let slate_i = sender_api.initiate_tx(args)?; + let slate_i = sender_api.init_send_tx(args)?; slate = client3.send_tx_slate_direct("wallet2", &slate_i)?; sender_api.tx_lock_outputs(&slate)?; slate = sender_api.finalize_tx(&slate)?; @@ -320,7 +320,7 @@ fn setup_restore(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let slate_i = sender_api.initiate_tx(args)?; + let slate_i = sender_api.init_send_tx(args)?; slate = client3.send_tx_slate_direct("wallet2", &slate_i)?; sender_api.tx_lock_outputs(&slate)?; slate = sender_api.finalize_tx(&slate)?; diff --git a/controller/tests/self_send.rs b/controller/tests/self_send.rs index 8053cfa82..20ab2280b 100644 --- a/controller/tests/self_send.rs +++ b/controller/tests/self_send.rs @@ -96,7 +96,7 @@ fn self_send_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let mut slate = api.initiate_tx(args)?; + let mut slate = api.init_send_tx(args)?; api.tx_lock_outputs(&slate)?; // Send directly to self wallet::controller::foreign_single_use(wallet1.clone(), |api| { diff --git a/controller/tests/transaction.rs b/controller/tests/transaction.rs index 57459863c..bd121e2f1 100644 --- a/controller/tests/transaction.rs +++ b/controller/tests/transaction.rs @@ -73,8 +73,8 @@ fn basic_transaction_api(test_dir: &str) -> Result<(), libwallet::Error> { // few values to keep things shorter let reward = core::consensus::REWARD; - let cm = global::coinbase_maturity(); // assume all testing precedes soft fork height - // mine a few blocks + let cm = global::coinbase_maturity(); + // mine a few blocks let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), 10, false); // Check wallet 1 contents are as expected @@ -108,7 +108,7 @@ fn basic_transaction_api(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let slate_i = sender_api.initiate_tx(args)?; + let slate_i = sender_api.init_send_tx(args)?; // Check we are creating a tx with the expected lock_height of 0. // We will check this produces a Plain kernel later. @@ -261,7 +261,7 @@ fn basic_transaction_api(test_dir: &str) -> Result<(), libwallet::Error> { estimate_only: Some(true), ..Default::default() }; - let est = sender_api.initiate_tx(init_args)?; + let est = sender_api.init_send_tx(init_args)?; assert_eq!(est.amount, 600_000_000_000); assert_eq!(est.fee, 4_000_000); @@ -275,7 +275,7 @@ fn basic_transaction_api(test_dir: &str) -> Result<(), libwallet::Error> { estimate_only: Some(true), ..Default::default() }; - let est = sender_api.initiate_tx(init_args)?; + let est = sender_api.init_send_tx(init_args)?; assert_eq!(est.amount, 180_000_000_000); assert_eq!(est.fee, 6_000_000); @@ -295,7 +295,7 @@ fn basic_transaction_api(test_dir: &str) -> Result<(), libwallet::Error> { selection_strategy_is_use_all: true, ..Default::default() }; - let slate_i = sender_api.initiate_tx(args)?; + let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate_i)?; sender_api.tx_lock_outputs(&slate)?; slate = sender_api.finalize_tx(&slate)?; @@ -395,7 +395,7 @@ fn tx_rollback(test_dir: &str) -> Result<(), libwallet::Error> { ..Default::default() }; - let slate_i = sender_api.initiate_tx(args)?; + let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate_i)?; sender_api.tx_lock_outputs(&slate)?; slate = sender_api.finalize_tx(&slate)?; diff --git a/impls/src/test_framework/mod.rs b/impls/src/test_framework/mod.rs index b748aa4a4..576d61c80 100644 --- a/impls/src/test_framework/mod.rs +++ b/impls/src/test_framework/mod.rs @@ -205,7 +205,7 @@ where selection_strategy_is_use_all: true, ..Default::default() }; - let slate_i = owner::initiate_tx(&mut *w, args, test_mode)?; + let slate_i = owner::init_send_tx(&mut *w, args, test_mode)?; let slate = client.send_tx_slate_direct(dest, &slate_i)?; owner::tx_lock_outputs(&mut *w, &slate)?; let slate = owner::finalize_tx(&mut *w, &slate)?; diff --git a/libwallet/src/api_impl/foreign.rs b/libwallet/src/api_impl/foreign.rs index b0592a0d6..713d4b2a2 100644 --- a/libwallet/src/api_impl/foreign.rs +++ b/libwallet/src/api_impl/foreign.rs @@ -103,8 +103,29 @@ where &parent_key_id, 1, message, + false, use_test_rng, )?; tx::update_message(&mut *w, &mut ret_slate)?; Ok(ret_slate) } + +/// Receive an tx that this wallet has issued +pub fn finalize_invoice_tx(w: &mut T, slate: &Slate) -> Result +where + T: WalletBackend, + C: NodeClient, + K: Keychain, +{ + let mut sl = slate.clone(); + let context = w.get_private_context(sl.id.as_bytes())?; + tx::complete_tx(&mut *w, &mut sl, 1, &context)?; + tx::update_stored_tx(&mut *w, &mut sl, true)?; + tx::update_message(&mut *w, &mut sl)?; + { + let mut batch = w.batch()?; + batch.delete_private_context(sl.id.as_bytes())?; + batch.commit()?; + } + Ok(sl) +} diff --git a/libwallet/src/api_impl/owner.rs b/libwallet/src/api_impl/owner.rs index a381fbbbf..12c7883d7 100644 --- a/libwallet/src/api_impl/owner.rs +++ b/libwallet/src/api_impl/owner.rs @@ -26,7 +26,9 @@ use crate::internal::{keys, selection, tx, updater}; use crate::slate::Slate; use crate::types::{AcctPathMapping, NodeClient, TxLogEntry, TxWrapper, WalletBackend, WalletInfo}; use crate::{Error, ErrorKind}; -use crate::{InitTxArgs, NodeHeightResult, OutputCommitMapping}; +use crate::{ + InitTxArgs, IssueInvoiceTxArgs, NodeHeightResult, OutputCommitMapping, TxLogEntryType, +}; const USER_MESSAGE_MAX_LEN: usize = 256; @@ -133,7 +135,7 @@ where } /// Initiate tx as sender -pub fn initiate_tx( +pub fn init_send_tx( w: &mut T, args: InitTxArgs, use_test_rng: bool, @@ -191,6 +193,7 @@ where &parent_key_id, 0, message, + true, use_test_rng, )?; @@ -207,6 +210,132 @@ where Ok(slate) } +/// Initiate a transaction as the recipient (invoicing) +pub fn issue_invoice_tx( + w: &mut T, + args: IssueInvoiceTxArgs, + use_test_rng: bool, +) -> Result +where + T: WalletBackend, + C: NodeClient, + K: Keychain, +{ + let parent_key_id = match args.dest_acct_name { + Some(d) => { + let pm = w.get_acct_path(d)?; + match pm { + Some(p) => p.path, + None => w.parent_key_id(), + } + } + None => w.parent_key_id(), + }; + + let message = match args.message { + Some(mut m) => { + m.truncate(USER_MESSAGE_MAX_LEN); + Some(m) + } + None => None, + }; + + let mut slate = tx::new_tx_slate(&mut *w, args.amount, 2, use_test_rng)?; + let context = tx::add_output_to_slate( + &mut *w, + &mut slate, + &parent_key_id, + 1, + message, + true, + use_test_rng, + )?; + + // Save the aggsig context in our DB for when we + // recieve the transaction back + { + let mut batch = w.batch()?; + batch.save_private_context(slate.id.as_bytes(), &context)?; + batch.commit()?; + } + + Ok(slate) +} + +/// Receive an invoice tx, essentially adding inputs to whatever +/// output was specified +pub fn process_invoice_tx( + w: &mut T, + slate: &Slate, + args: InitTxArgs, + use_test_rng: bool, +) -> Result +where + T: WalletBackend, + C: NodeClient, + K: Keychain, +{ + let mut ret_slate = slate.clone(); + let parent_key_id = match args.src_acct_name { + Some(d) => { + let pm = w.get_acct_path(d.to_owned())?; + match pm { + Some(p) => p.path, + None => w.parent_key_id(), + } + } + None => w.parent_key_id(), + }; + // Don't do this multiple times + let tx = updater::retrieve_txs( + &mut *w, + None, + Some(ret_slate.id), + Some(&parent_key_id), + use_test_rng, + )?; + for t in &tx { + if t.tx_type == TxLogEntryType::TxSent { + return Err(ErrorKind::TransactionAlreadyReceived(ret_slate.id.to_string()).into()); + } + } + + let message = match args.message { + Some(mut m) => { + m.truncate(USER_MESSAGE_MAX_LEN); + Some(m) + } + None => None, + }; + + let context = tx::add_inputs_to_slate( + &mut *w, + &mut ret_slate, + args.minimum_confirmations, + args.max_outputs as usize, + args.num_change_outputs as usize, + args.selection_strategy_is_use_all, + &parent_key_id, + 0, + message, + false, + use_test_rng, + )?; + + // Save the aggsig context in our DB for when we + // recieve the transaction back + { + let mut batch = w.batch()?; + batch.save_private_context(slate.id.as_bytes(), &context)?; + batch.commit()?; + } + + // Always lock the context for now + selection::lock_tx_context(&mut *w, slate, &context)?; + tx::update_message(&mut *w, &mut ret_slate)?; + Ok(ret_slate) +} + /// Lock sender outputs pub fn tx_lock_outputs(w: &mut T, slate: &Slate) -> Result<(), Error> where @@ -228,7 +357,7 @@ where let mut sl = slate.clone(); let context = w.get_private_context(sl.id.as_bytes())?; tx::complete_tx(&mut *w, &mut sl, 0, &context)?; - tx::update_stored_tx(&mut *w, &mut sl)?; + tx::update_stored_tx(&mut *w, &mut sl, false)?; tx::update_message(&mut *w, &mut sl)?; { let mut batch = w.batch()?; diff --git a/libwallet/src/api_impl/types.rs b/libwallet/src/api_impl/types.rs index 473ddabb1..965ec87dc 100644 --- a/libwallet/src/api_impl/types.rs +++ b/libwallet/src/api_impl/types.rs @@ -129,6 +129,35 @@ impl Default for InitTxArgs { } } +/// V2 Issue Invoice Tx Args +#[derive(Clone, Serialize, Deserialize)] +pub struct IssueInvoiceTxArgs { + /// The human readable account name to which the received funds should be added + /// overriding whatever the active account is as set via the + /// [`set_active_account`](../grin_wallet_api/owner/struct.Owner.html#method.set_active_account) method. + pub dest_acct_name: Option, + /// The invoice amount in nanogrins. (`1 G = 1_000_000_000nG`) + #[serde(with = "secp_ser::string_or_u64")] + pub amount: u64, + /// Optional message, that will be signed + pub message: Option, + /// Optionally set the output target slate version (acceptable + /// down to the minimum slate version compatible with the current. If `None` the slate + /// is generated with the latest version. + pub target_slate_version: Option, +} + +impl Default for IssueInvoiceTxArgs { + fn default() -> IssueInvoiceTxArgs { + IssueInvoiceTxArgs { + dest_acct_name: None, + amount: 0, + message: None, + target_slate_version: None, + } + } +} + /// Fees in block to use for coinbase amount calculation #[derive(Serialize, Deserialize, Debug, Clone)] pub struct BlockFees { diff --git a/libwallet/src/internal/selection.rs b/libwallet/src/internal/selection.rs index 38d33af70..927a04d75 100644 --- a/libwallet/src/internal/selection.rs +++ b/libwallet/src/internal/selection.rs @@ -166,9 +166,8 @@ where } /// Creates a new output in the wallet for the recipient, -/// returning the key of the fresh output and a closure -/// that actually performs the addition of the output to the -/// wallet +/// returning the key of the fresh output +/// Also creates a new transaction containing the output pub fn build_recipient_output( wallet: &mut T, slate: &mut Slate, diff --git a/libwallet/src/internal/tx.rs b/libwallet/src/internal/tx.rs index 52165a0f3..d18f84aee 100644 --- a/libwallet/src/internal/tx.rs +++ b/libwallet/src/internal/tx.rs @@ -118,6 +118,7 @@ pub fn add_inputs_to_slate( parent_key_id: &Identifier, participant_id: usize, message: Option, + is_initator: bool, use_test_rng: bool, ) -> Result where @@ -158,16 +159,27 @@ where use_test_rng, )?; + if !is_initator { + // perform partial sig + let _ = slate.fill_round_2( + wallet.keychain(), + &context.sec_key, + &context.sec_nonce, + participant_id, + )?; + } + Ok(context) } -/// Add outputs to the slate, becoming the recipient +/// Add receiver output to the slate pub fn add_output_to_slate( wallet: &mut T, slate: &mut Slate, parent_key_id: &Identifier, participant_id: usize, message: Option, + is_initiator: bool, use_test_rng: bool, ) -> Result where @@ -189,18 +201,20 @@ where use_test_rng, )?; - // perform partial sig - let _ = slate.fill_round_2( - wallet.keychain(), - &context.sec_key, - &context.sec_nonce, - participant_id, - )?; + if !is_initiator { + // perform partial sig + let _ = slate.fill_round_2( + wallet.keychain(), + &context.sec_key, + &context.sec_nonce, + participant_id, + )?; + } Ok(context) } -/// Complete a transaction as the sender +/// Complete a transaction pub fn complete_tx( wallet: &mut T, slate: &mut Slate, @@ -218,6 +232,7 @@ where &context.sec_nonce, participant_id, )?; + // Final transaction can be built by anyone at this stage slate.finalize(wallet.keychain())?; Ok(()) @@ -260,7 +275,11 @@ where } /// Update the stored transaction (this update needs to happen when the TX is finalised) -pub fn update_stored_tx(wallet: &mut T, slate: &Slate) -> Result<(), Error> +pub fn update_stored_tx( + wallet: &mut T, + slate: &Slate, + is_invoiced: bool, +) -> Result<(), Error> where T: WalletBackend, C: NodeClient, @@ -271,7 +290,11 @@ where let mut tx = None; // don't want to assume this is the right tx, in case of self-sending for t in tx_vec { - if t.tx_type == TxLogEntryType::TxSent { + if t.tx_type == TxLogEntryType::TxSent && !is_invoiced { + tx = Some(t.clone()); + break; + } + if t.tx_type == TxLogEntryType::TxReceived && is_invoiced { tx = Some(t.clone()); break; } diff --git a/libwallet/src/lib.rs b/libwallet/src/lib.rs index fcf23cf67..90629abc4 100644 --- a/libwallet/src/lib.rs +++ b/libwallet/src/lib.rs @@ -50,8 +50,8 @@ pub use crate::error::{Error, ErrorKind}; pub use crate::slate::{ParticipantData, ParticipantMessageData, Slate}; pub use crate::slate_versions::{SlateVersion, VersionedSlate}; pub use api_impl::types::{ - BlockFees, CbData, InitTxArgs, InitTxSendArgs, NodeHeightResult, OutputCommitMapping, - SendTXArgs, VersionInfo, + BlockFees, CbData, InitTxArgs, InitTxSendArgs, IssueInvoiceTxArgs, NodeHeightResult, + OutputCommitMapping, SendTXArgs, VersionInfo, }; pub use internal::restore::{check_repair, restore}; pub use types::{ diff --git a/libwallet/src/slate.rs b/libwallet/src/slate.rs index 9e1585999..83283d57e 100644 --- a/libwallet/src/slate.rs +++ b/libwallet/src/slate.rs @@ -333,7 +333,12 @@ impl Slate { Some(&self.pub_blind_sum(keychain.secp())?), &self.msg_to_sign()?, )?; - self.participant_data[participant_id].part_sig = Some(sig_part); + for i in 0..self.num_participants { + if self.participant_data[i].id == participant_id as u64 { + self.participant_data[i].part_sig = Some(sig_part); + break; + } + } Ok(()) } From 9d6694b9e62e3f7d2f2ebd000a000afaa584e399 Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Fri, 3 May 2019 11:08:14 -0400 Subject: [PATCH 06/36] Add Azure Pipelines to grin-wallet --- .ci/install.yml | 19 ++++++++++ .ci/release.yml | 50 ++++++++++++++++++++++++++ .ci/test.yml | 10 ++++++ .ci/windows-release.yml | 50 ++++++++++++++++++++++++++ azure-pipelines.yml | 79 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 208 insertions(+) create mode 100644 .ci/install.yml create mode 100644 .ci/release.yml create mode 100644 .ci/test.yml create mode 100644 .ci/windows-release.yml create mode 100644 azure-pipelines.yml diff --git a/.ci/install.yml b/.ci/install.yml new file mode 100644 index 000000000..e270f3c3e --- /dev/null +++ b/.ci/install.yml @@ -0,0 +1,19 @@ +steps: + - script: | + curl -sSf -o rustup-init.exe https://win.rustup.rs + rustup-init.exe -y + echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" + displayName: Windows Install Rust + condition: eq( variables['Agent.OS'], 'Windows_NT' ) + - script: | + curl https://sh.rustup.rs -sSf | sh -s -- -y + echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" + displayName: macOS Install Rust + condition: eq( variables['Agent.OS'], 'Darwin' ) + - script: | + curl https://sh.rustup.rs -sSf | sh -s -- -y + sudo apt-get update -yqq + sudo apt-get install -yqq --no-install-recommends libncursesw5-dev + echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" + displayName: Linux Install Rust and Dependencies + condition: eq( variables['Agent.OS'], 'Linux' ) \ No newline at end of file diff --git a/.ci/release.yml b/.ci/release.yml new file mode 100644 index 000000000..da3ad1fd3 --- /dev/null +++ b/.ci/release.yml @@ -0,0 +1,50 @@ +steps: + - script: 'cargo test --all' + displayName: Cargo Test All + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + - script: 'cargo build --release' + displayName: Build Release + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + - script: | + MY_TAG="$(Build.SourceBranch)" + MY_TAG=${MY_TAG#refs/tags/} + echo $MY_TAG + echo "##vso[task.setvariable variable=build.my_tag]$MY_TAG" + echo "##vso[task.setvariable variable=build.platform]$PLATFORM" + displayName: "Create my tag variable" + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + - task: CopyFiles@2 + displayName: Copy assets + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + inputs: + sourceFolder: '$(Build.SourcesDirectory)/target/release' + contents: 'grin-wallet' + targetFolder: '$(Build.BinariesDirectory)/grin-wallet' + - task: ArchiveFiles@2 + displayName: Gather assets + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + inputs: + rootFolderOrFile: '$(Build.BinariesDirectory)/grin-wallet' + archiveType: 'tar' + tarCompression: 'gz' + archiveFile: '$(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform).tar.gz' + - script: | + openssl sha256 $(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform).tar.gz > $(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt + displayName: Create Checksum + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + - task: GithubRelease@0 + displayName: Github release + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + inputs: + gitHubConnection: 'quentinlesceller2' + repositoryName: 'quentinlesceller/grin-wallet' + action: 'edit' + target: '$(build.sourceVersion)' + tagSource: 'manual' + tag: '$(build.my_tag)' + assets: | + $(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform).tar.gz + $(Build.ArtifactStagingDirectory)/grin-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt + title: '$(build.my_tag)' + assetUploadMode: 'replace' + addChangeLog: true \ No newline at end of file diff --git a/.ci/test.yml b/.ci/test.yml new file mode 100644 index 000000000..65c9bee2f --- /dev/null +++ b/.ci/test.yml @@ -0,0 +1,10 @@ +steps: + - script: 'cargo test --all' + displayName: Windows Cargo Test + condition: and(eq( variables['Agent.OS'], 'Windows_NT' ), eq( variables['CI_JOB'], 'test-all' )) + - script: 'cargo test --all' + displayName: macOS Cargo Test + condition: and(eq( variables['Agent.OS'], 'Darwin' ), eq( variables['CI_JOB'], 'test-all' )) + - script: '.ci/general-jobs' + displayName: Linux Cargo Test + condition: eq( variables['Agent.OS'], 'Linux' ) \ No newline at end of file diff --git a/.ci/windows-release.yml b/.ci/windows-release.yml new file mode 100644 index 000000000..069a069c1 --- /dev/null +++ b/.ci/windows-release.yml @@ -0,0 +1,50 @@ +steps: + - script: 'cargo test --all' + displayName: Cargo Test All + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + - script: 'cargo build --release' + displayName: Build Release + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + - script: | + SET MY_TAG=$(Build.SourceBranch) + SET MY_TAG=%MY_TAG:~10% + echo %MY_TAG% + echo %PLATFORM% + echo ##vso[task.setvariable variable=build.my_tag]%MY_TAG% + echo ##vso[task.setvariable variable=build.platform]%PLATFORM% + displayName: "Create my tag variable" + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + - task: CopyFiles@2 + displayName: Copy assets + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + inputs: + sourceFolder: '$(Build.SourcesDirectory)\target\release' + contents: 'grin-wallet.exe' + targetFolder: '$(Build.BinariesDirectory)\grin-wallet' + - task: ArchiveFiles@2 + displayName: Gather assets + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + inputs: + rootFolderOrFile: '$(Build.BinariesDirectory)\grin-wallet' + archiveType: 'zip' + archiveFile: '$(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform).zip' + - script: | + powershell -Command "get-filehash -algorithm sha256 $(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform).zip | Format-List |  Out-String | ForEach-Object { $_.Trim() } > $(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt" + displayName: Create Checksum + condition: and(succeeded(), contains(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + - task: GithubRelease@0 + displayName: Github release + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) + inputs: + gitHubConnection: 'quentinlesceller2' + repositoryName: 'quentinlesceller/grin-wallet' + action: 'edit' + target: '$(build.sourceVersion)' + tagSource: 'manual' + tag: '$(build.my_tag)' + assets: | + $(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform).zip + $(Build.ArtifactStagingDirectory)\grin-wallet-$(build.my_tag)-$(build.platform)-sha256sum.txt + title: '$(build.my_tag)' + assetUploadMode: 'replace' + addChangeLog: true diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..1e65eebb9 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,79 @@ +# Copyright 2019 The Grin Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +trigger: + branches: + include: + - master + tags: + include: ['*'] + +pr: + branches: + include: ['*'] + +variables: + RUST_BACKTRACE: '1' + RUST_FLAGS: '-C debug-assertions' + +jobs: +- job: linux + pool: + vmImage: ubuntu-16.04 + strategy: + matrix: + servers: + CI_JOB: test + CI_JOB_ARGS: config libwallet api + chain/core/keychain: + CI_JOB: test + CI_JOB_ARGS: impls + pool/p2p/src: + CI_JOB: test + CI_JOB_ARGS: controller . + release: + CI_JOB: release + PLATFORM: linux-amd64 + steps: + - template: '.ci/install.yml' + - template: '.ci/test.yml' + - template: '.ci/release.yml' +- job: macos + pool: + vmImage: macos-10.13 + strategy: + matrix: + test: + CI_JOB: test-all + release: + CI_JOB: release + PLATFORM: macos + steps: + - template: '.ci/install.yml' + - template: '.ci/test.yml' + - template: '.ci/release.yml' +- job: windows + pool: + vmImage: vs2017-win2016 + strategy: + matrix: + test: + CI_JOB: test-all + release: + CI_JOB: release + PLATFORM: win-x64 + steps: + - template: '.ci/install.yml' + - template: '.ci/test.yml' + - template: '.ci/windows-release.yml' From e673fd9f916fcbd8e0ff04bb8ca6ca95dc5bb57d Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Fri, 3 May 2019 11:19:03 -0400 Subject: [PATCH 07/36] Remove cursive and fix task names --- .ci/install.yml | 2 -- azure-pipelines.yml | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.ci/install.yml b/.ci/install.yml index e270f3c3e..5c2ef45e2 100644 --- a/.ci/install.yml +++ b/.ci/install.yml @@ -12,8 +12,6 @@ steps: condition: eq( variables['Agent.OS'], 'Darwin' ) - script: | curl https://sh.rustup.rs -sSf | sh -s -- -y - sudo apt-get update -yqq - sudo apt-get install -yqq --no-install-recommends libncursesw5-dev echo "##vso[task.setvariable variable=PATH;]$PATH:$HOME/.cargo/bin" displayName: Linux Install Rust and Dependencies condition: eq( variables['Agent.OS'], 'Linux' ) \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 1e65eebb9..8775ed969 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -33,13 +33,13 @@ jobs: vmImage: ubuntu-16.04 strategy: matrix: - servers: + config/libwallet/api: CI_JOB: test CI_JOB_ARGS: config libwallet api - chain/core/keychain: + impls: CI_JOB: test CI_JOB_ARGS: impls - pool/p2p/src: + controller/.: CI_JOB: test CI_JOB_ARGS: controller . release: From b76c18d6f1f4fbb62df37e6cd6b2537b377aca9c Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Fri, 3 May 2019 11:24:49 -0400 Subject: [PATCH 08/36] Do not crash on empty terminal --- controller/src/display.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/controller/src/display.rs b/controller/src/display.rs index c8944960a..94a294042 100644 --- a/controller/src/display.rs +++ b/controller/src/display.rs @@ -35,6 +35,10 @@ pub fn outputs( account, cur_height ); println!(); + if term::stdout().is_none() { + println!("Could not open terminal"); + return Ok(()); + } let mut t = term::stdout().unwrap(); t.fg(term::color::MAGENTA).unwrap(); writeln!(t, "{}", title).unwrap(); @@ -132,6 +136,10 @@ pub fn txs( account, cur_height ); println!(); + if term::stdout().is_none() { + println!("Could not open terminal"); + return Ok(()); + } let mut t = term::stdout().unwrap(); t.fg(term::color::MAGENTA).unwrap(); writeln!(t, "{}", title).unwrap(); @@ -409,6 +417,10 @@ pub fn accounts(acct_mappings: Vec) { pub fn tx_messages(tx: &TxLogEntry, dark_background_color_scheme: bool) -> Result<(), Error> { let title = format!("Transaction Messages - Transaction '{}'", tx.id,); println!(); + if term::stdout().is_none() { + println!("Could not open terminal"); + return Ok(()); + } let mut t = term::stdout().unwrap(); t.fg(term::color::MAGENTA).unwrap(); writeln!(t, "{}", title).unwrap(); From 77a6628f03eed9fc815efe7672f5d7887d1be128 Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Fri, 3 May 2019 12:19:32 -0400 Subject: [PATCH 09/36] Add LLVM --- .ci/install.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/install.yml b/.ci/install.yml index 5c2ef45e2..4208cd0a7 100644 --- a/.ci/install.yml +++ b/.ci/install.yml @@ -3,6 +3,7 @@ steps: curl -sSf -o rustup-init.exe https://win.rustup.rs rustup-init.exe -y echo "##vso[task.setvariable variable=PATH;]%PATH%;%USERPROFILE%\.cargo\bin" + choco install -y llvm displayName: Windows Install Rust condition: eq( variables['Agent.OS'], 'Windows_NT' ) - script: | From 2a23318cdf2b89619e63af7d5f06756505e4eef1 Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Fri, 3 May 2019 13:04:40 -0400 Subject: [PATCH 10/36] Possible MSFT pipeline bug with . task --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8775ed969..27bb60a2b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -39,7 +39,7 @@ jobs: impls: CI_JOB: test CI_JOB_ARGS: impls - controller/.: + controller/all: CI_JOB: test CI_JOB_ARGS: controller . release: From 6c32174a93fb39d902f4064cc1ba45b51470ee16 Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Thu, 9 May 2019 13:38:14 -0400 Subject: [PATCH 11/36] Change connection name --- .ci/release.yml | 4 ++-- .ci/windows-release.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.ci/release.yml b/.ci/release.yml index da3ad1fd3..354f1e207 100644 --- a/.ci/release.yml +++ b/.ci/release.yml @@ -36,8 +36,8 @@ steps: displayName: Github release condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) inputs: - gitHubConnection: 'quentinlesceller2' - repositoryName: 'quentinlesceller/grin-wallet' + gitHubConnection: 'ignopeverell' + repositoryName: 'mimblewimble/grin-wallet' action: 'edit' target: '$(build.sourceVersion)' tagSource: 'manual' diff --git a/.ci/windows-release.yml b/.ci/windows-release.yml index 069a069c1..d1b985bb8 100644 --- a/.ci/windows-release.yml +++ b/.ci/windows-release.yml @@ -36,8 +36,8 @@ steps: displayName: Github release condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), eq(variables['CI_JOB'], 'release' )) inputs: - gitHubConnection: 'quentinlesceller2' - repositoryName: 'quentinlesceller/grin-wallet' + gitHubConnection: 'ignopeverell' + repositoryName: 'mimblewimble/grin-wallet' action: 'edit' target: '$(build.sourceVersion)' tagSource: 'manual' From 6f875c5e92834df8c59bce6c4f87d8fa795200b7 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Thu, 9 May 2019 19:06:32 +0100 Subject: [PATCH 12/36] Command line implementation of invoice commands (#96) * add issue_invoice_tx command * rustfmt * add first pass at process_invoice command * start of process_invoice fn * rustfmt * rename issue invoice and process invoice to invoice and pay * add prompting and display information to pay invoice command * rustfmt * support invoice transactions in finalize command * rustfmt --- controller/src/command.rs | 165 ++++++++++++++++++++++- controller/tests/invoice.rs | 1 + libwallet/src/api_impl/owner.rs | 3 - libwallet/src/slate.rs | 45 ++++++- libwallet/src/slate_versions/v2.rs | 2 +- src/bin/cmd/wallet_args.rs | 207 ++++++++++++++++++++++++++++- src/bin/cmd/wallet_tests.rs | 54 ++++++++ src/bin/grin-wallet.yml | 68 ++++++++++ 8 files changed, 530 insertions(+), 15 deletions(-) diff --git a/controller/src/command.rs b/controller/src/command.rs index 374e66c0f..346db7e37 100644 --- a/controller/src/command.rs +++ b/controller/src/command.rs @@ -35,7 +35,7 @@ use crate::impls::{ LMDBBackend, NullWalletCommAdapter, }; use crate::impls::{HTTPNodeClient, WalletSeed}; -use crate::libwallet::{InitTxArgs, NodeClient, WalletInst}; +use crate::libwallet::{InitTxArgs, IssueInvoiceTxArgs, NodeClient, WalletInst}; use crate::{controller, display}; /// Arguments common to all wallet commands @@ -377,13 +377,45 @@ pub fn finalize( ) -> Result<(), Error> { let adapter = FileWalletCommAdapter::new(); let mut slate = adapter.receive_tx_async(&args.input)?; - controller::owner_single_use(wallet.clone(), |api| { - if let Err(e) = api.verify_slate_messages(&slate) { - error!("Error validating participant messages: {}", e); - return Err(e); + // Rather than duplicating the entire command, we'll just + // try to determine what kind of finalization this is + // based on the slate contents + // for now, we can tell this is an invoice transaction + // if the receipient (participant 1) hasn't completed sigs + let part_data = slate.participant_with_id(1); + let is_invoice = { + match part_data { + None => { + error!("Expected slate participant data missing"); + return Err(ErrorKind::ArgumentError( + "Expected Slate participant data missing".into(), + ))?; + } + Some(p) => !p.is_complete(), } - slate = api.finalize_tx(&mut slate).expect("Finalize failed"); + }; + + if is_invoice { + controller::foreign_single_use(wallet.clone(), |api| { + if let Err(e) = api.verify_slate_messages(&slate) { + error!("Error validating participant messages: {}", e); + return Err(e); + } + slate = api.finalize_invoice_tx(&mut slate)?; + Ok(()) + })?; + } else { + controller::owner_single_use(wallet.clone(), |api| { + if let Err(e) = api.verify_slate_messages(&slate) { + error!("Error validating participant messages: {}", e); + return Err(e); + } + slate = api.finalize_tx(&mut slate)?; + Ok(()) + })?; + } + controller::owner_single_use(wallet.clone(), |api| { let result = api.post_tx(&slate.tx, args.fluff); match result { Ok(_) => { @@ -396,9 +428,130 @@ pub fn finalize( } } })?; + + Ok(()) +} + +/// Issue Invoice Args +pub struct IssueInvoiceArgs { + /// output file + pub dest: String, + /// issue invoice tx args + pub issue_args: IssueInvoiceTxArgs, +} + +pub fn issue_invoice_tx( + wallet: Arc>>, + args: IssueInvoiceArgs, +) -> Result<(), Error> { + controller::owner_single_use(wallet.clone(), |api| { + let slate = api.issue_invoice_tx(args.issue_args)?; + let mut tx_file = File::create(args.dest.clone())?; + tx_file.write_all(json::to_string(&slate).unwrap().as_bytes())?; + tx_file.sync_all()?; + Ok(()) + })?; Ok(()) } +/// Arguments for the process_invoice command +pub struct ProcessInvoiceArgs { + pub message: Option, + pub minimum_confirmations: u64, + pub selection_strategy: String, + pub method: String, + pub dest: String, + pub max_outputs: usize, + pub target_slate_version: Option, + pub input: String, + pub estimate_selection_strategies: bool, +} + +/// Process invoice +pub fn process_invoice( + wallet: Arc>>, + args: ProcessInvoiceArgs, + dark_scheme: bool, +) -> Result<(), Error> { + let adapter = FileWalletCommAdapter::new(); + let slate = adapter.receive_tx_async(&args.input)?; + controller::owner_single_use(wallet.clone(), |api| { + if args.estimate_selection_strategies { + let strategies = vec!["smallest", "all"] + .into_iter() + .map(|strategy| { + let init_args = InitTxArgs { + src_acct_name: None, + amount: slate.amount, + minimum_confirmations: args.minimum_confirmations, + max_outputs: args.max_outputs as u32, + num_change_outputs: 1u32, + selection_strategy_is_use_all: strategy == "all", + estimate_only: Some(true), + ..Default::default() + }; + let slate = api.init_send_tx(init_args).unwrap(); + (strategy, slate.amount, slate.fee) + }) + .collect(); + display::estimate(slate.amount, strategies, dark_scheme); + } else { + let init_args = InitTxArgs { + src_acct_name: None, + amount: 0, + minimum_confirmations: args.minimum_confirmations, + max_outputs: args.max_outputs as u32, + num_change_outputs: 1u32, + selection_strategy_is_use_all: args.selection_strategy == "all", + message: args.message.clone(), + target_slate_version: args.target_slate_version, + send_args: None, + ..Default::default() + }; + if let Err(e) = api.verify_slate_messages(&slate) { + error!("Error validating participant messages: {}", e); + return Err(e); + } + let result = api.process_invoice_tx(&slate, init_args); + let mut slate = match result { + Ok(s) => { + info!( + "Invoice processed: {} grin to {} (strategy '{}')", + core::amount_to_hr_string(slate.amount, false), + args.dest, + args.selection_strategy, + ); + s + } + Err(e) => { + info!("Tx not created: {}", e); + return Err(e); + } + }; + let adapter = match args.method.as_str() { + "http" => HTTPWalletCommAdapter::new(), + "file" => FileWalletCommAdapter::new(), + "self" => NullWalletCommAdapter::new(), + _ => NullWalletCommAdapter::new(), + }; + if adapter.supports_sync() { + slate = adapter.send_tx_sync(&args.dest, &slate)?; + api.tx_lock_outputs(&slate)?; + if args.method == "self" { + controller::foreign_single_use(wallet, |api| { + slate = api.finalize_invoice_tx(&slate)?; + Ok(()) + })?; + } + } else { + adapter.send_tx_async(&args.dest, &slate)?; + api.tx_lock_outputs(&slate)?; + } + } + Ok(()) + })?; + Ok(()) +} /// Info command args pub struct InfoArgs { pub minimum_confirmations: u64, diff --git a/controller/tests/invoice.rs b/controller/tests/invoice.rs index 62482ba81..faf61253e 100644 --- a/controller/tests/invoice.rs +++ b/controller/tests/invoice.rs @@ -124,6 +124,7 @@ fn invoice_tx_impl(test_dir: &str) -> Result<(), libwallet::Error> { ..Default::default() }; slate = api.process_invoice_tx(&slate, args)?; + api.tx_lock_outputs(&slate)?; Ok(()) })?; diff --git a/libwallet/src/api_impl/owner.rs b/libwallet/src/api_impl/owner.rs index 12c7883d7..fbb6358d0 100644 --- a/libwallet/src/api_impl/owner.rs +++ b/libwallet/src/api_impl/owner.rs @@ -330,9 +330,6 @@ where batch.commit()?; } - // Always lock the context for now - selection::lock_tx_context(&mut *w, slate, &context)?; - tx::update_message(&mut *w, &mut ret_slate)?; Ok(ret_slate) } diff --git a/libwallet/src/slate.rs b/libwallet/src/slate.rs index 83283d57e..1a40d3b78 100644 --- a/libwallet/src/slate.rs +++ b/libwallet/src/slate.rs @@ -27,14 +27,14 @@ use crate::grin_core::core::verifier_cache::LruVerifierCache; use crate::grin_core::libtx::{aggsig, build, secp_ser, tx_fee}; use crate::grin_core::map_vec; use crate::grin_keychain::{BlindSum, BlindingFactor, Keychain}; -use crate::grin_util::secp; use crate::grin_util::secp::key::{PublicKey, SecretKey}; use crate::grin_util::secp::Signature; -use crate::grin_util::RwLock; +use crate::grin_util::{self, secp, RwLock}; use failure::ResultExt; use rand::rngs::mock::StepRng; use rand::thread_rng; use serde_json; +use std::fmt; use std::sync::Arc; use uuid::Uuid; @@ -113,6 +113,36 @@ impl ParticipantMessageData { } } +impl fmt::Display for ParticipantMessageData { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + writeln!(f, "")?; + write!(f, "Participant ID {} ", self.id)?; + if self.id == 0 { + writeln!(f, "(Sender)")?; + } else { + writeln!(f, "(Recipient)")?; + } + writeln!(f, "---------------------")?; + let static_secp = grin_util::static_secp_instance(); + let static_secp = static_secp.lock(); + writeln!( + f, + "Public Key: {}", + &grin_util::to_hex(self.public_key.serialize_vec(&static_secp, true).to_vec()) + )?; + let message = match self.message.clone() { + None => "None".to_owned(), + Some(m) => m, + }; + writeln!(f, "Message: {}", message)?; + let message_sig = match self.message_sig.clone() { + None => "None".to_owned(), + Some(m) => grin_util::to_hex(m.to_raw_data().to_vec()), + }; + writeln!(f, "Message Signature: {}", message_sig) + } +} + /// A 'Slate' is passed around to all parties to build up all of the public /// transaction data needed to create a finalized transaction. Callers can pass /// the slate around by whatever means they choose, (but we can provide some @@ -344,7 +374,6 @@ impl Slate { /// Creates the final signature, callable by either the sender or recipient /// (after phase 3: sender confirmation) - /// TODO: Only callable by receiver at the moment pub fn finalize(&mut self, keychain: &K) -> Result<(), Error> where K: Keychain, @@ -353,6 +382,16 @@ impl Slate { self.finalize_transaction(keychain, &final_sig) } + /// Return the participant with the given id + pub fn participant_with_id(&self, id: usize) -> Option { + for p in self.participant_data.iter() { + if p.id as usize == id { + return Some(p.clone()); + } + } + None + } + /// Return the sum of public nonces fn pub_nonce_sum(&self, secp: &secp::Secp256k1) -> Result { let pub_nonces = self diff --git a/libwallet/src/slate_versions/v2.rs b/libwallet/src/slate_versions/v2.rs index 1de35dac9..62e563e78 100644 --- a/libwallet/src/slate_versions/v2.rs +++ b/libwallet/src/slate_versions/v2.rs @@ -29,7 +29,7 @@ //! * TxKernel fields serialized as hex strings instead of arrays: //! commit //! signature -//! * version_info field removed +//! * version field removed //! * VersionCompatInfo struct created with fields and added to beginning of struct //! version: u16 //! orig_verion: u16, diff --git a/src/bin/cmd/wallet_args.rs b/src/bin/cmd/wallet_args.rs index 79c276abd..cfba47a27 100644 --- a/src/bin/cmd/wallet_args.rs +++ b/src/bin/cmd/wallet_args.rs @@ -21,9 +21,10 @@ use failure::Fail; use grin_wallet_config::WalletConfig; use grin_wallet_controller::command; use grin_wallet_controller::{Error, ErrorKind}; -use grin_wallet_impls::{instantiate_wallet, WalletSeed}; -use grin_wallet_libwallet::{NodeClient, WalletInst}; +use grin_wallet_impls::{instantiate_wallet, FileWalletCommAdapter, WalletSeed}; +use grin_wallet_libwallet::{IssueInvoiceTxArgs, NodeClient, Slate, WalletInst}; use grin_wallet_util::grin_core as core; +use grin_wallet_util::grin_core::core::amount_to_hr_string; use grin_wallet_util::grin_keychain as keychain; use linefeed::terminal::Signal; use linefeed::{Interface, ReadResult}; @@ -140,6 +141,62 @@ fn prompt_recovery_phrase() -> Result { Ok(phrase) } +fn prompt_pay_invoice(slate: &Slate, method: &str, dest: &str) -> Result { + let interface = Arc::new(Interface::new("pay")?); + let amount = amount_to_hr_string(slate.amount, false); + interface.set_report_signal(Signal::Interrupt, true); + interface.set_prompt( + "To proceed, type the exact amount of the invoice as displayed above (or Q/q to quit) > ", + )?; + println!(); + println!( + "This command will pay the amount specified in the invoice using your wallet's funds." + ); + println!("After you confirm, the following will occur: "); + println!(); + println!( + "* {} of your wallet funds will be added to the transaction to pay this invoice.", + amount + ); + if method == "http" { + println!("* The resulting transaction will IMMEDIATELY be sent to the wallet listening at: '{}'.", dest); + } else { + println!("* The resulting transaction will be saved to the file '{}', which you can manually send back to the invoice creator.", dest); + } + println!(); + println!("The invoice slate's participant info is:"); + for m in slate.participant_messages().messages { + println!("{}", m); + } + println!("Please review the above information carefully before proceeding"); + println!(); + loop { + let res = interface.read_line()?; + match res { + ReadResult::Eof => return Ok(false), + ReadResult::Signal(sig) => { + if sig == Signal::Interrupt { + interface.cancel_read_line()?; + return Err(ParseError::CancelledError); + } + } + ReadResult::Input(line) => { + match line.trim() { + "Q" | "q" => return Err(ParseError::CancelledError), + result => { + if result == amount { + return Ok(true); + } else { + println!("Please enter exact amount of the invoice as shown above or Q to quit"); + println!(); + } + } + } + } + } + } +} + // instantiate wallet (needed by most functions) pub fn inst_wallet( @@ -457,6 +514,140 @@ pub fn parse_finalize_args(args: &ArgMatches) -> Result Result { + let amount = parse_required(args, "amount")?; + let amount = core::core::amount_from_hr_string(amount); + let amount = match amount { + Ok(a) => a, + Err(e) => { + let msg = format!( + "Could not parse amount as a number with optional decimal point. e={}", + e + ); + return Err(ParseError::ArgumentError(msg)); + } + }; + // message + let message = match args.is_present("message") { + true => Some(args.value_of("message").unwrap().to_owned()), + false => None, + }; + // target slate version to create + let target_slate_version = { + match args.is_present("slate_version") { + true => { + let v = parse_required(args, "slate_version")?; + Some(parse_u64(v, "slate_version")? as u16) + } + false => None, + } + }; + // dest (output file) + let dest = parse_required(args, "dest")?; + Ok(command::IssueInvoiceArgs { + dest: dest.into(), + issue_args: IssueInvoiceTxArgs { + dest_acct_name: None, + amount, + message, + target_slate_version, + }, + }) +} + +pub fn parse_process_invoice_args( + args: &ArgMatches, +) -> Result { + // TODO: display and prompt for confirmation of what we're doing + // message + let message = match args.is_present("message") { + true => Some(args.value_of("message").unwrap().to_owned()), + false => None, + }; + + // minimum_confirmations + let min_c = parse_required(args, "minimum_confirmations")?; + let min_c = parse_u64(min_c, "minimum_confirmations")?; + + // selection_strategy + let selection_strategy = parse_required(args, "selection_strategy")?; + + // estimate_selection_strategies + let estimate_selection_strategies = args.is_present("estimate_selection_strategies"); + + // method + let method = parse_required(args, "method")?; + + // dest + let dest = { + if method == "self" { + match args.value_of("dest") { + Some(d) => d, + None => "default", + } + } else { + if !estimate_selection_strategies { + parse_required(args, "dest")? + } else { + "" + } + } + }; + if !estimate_selection_strategies + && method == "http" + && !dest.starts_with("http://") + && !dest.starts_with("https://") + { + let msg = format!( + "HTTP Destination should start with http://: or https://: {}", + dest, + ); + return Err(ParseError::ArgumentError(msg)); + } + + // max_outputs + let max_outputs = 500; + + // target slate version to create/send + let target_slate_version = { + match args.is_present("slate_version") { + true => { + let v = parse_required(args, "slate_version")?; + Some(parse_u64(v, "slate_version")? as u16) + } + false => None, + } + }; + + // file input only + let tx_file = parse_required(args, "input")?; + + // Now we need to prompt the user whether they want to do this, + // which requires reading the slate + let adapter = FileWalletCommAdapter::new(); + let slate = match adapter.receive_tx_async(&tx_file) { + Ok(s) => s, + Err(e) => return Err(ParseError::ArgumentError(format!("{}", e))), + }; + + #[cfg(not(test))] // don't prompt during automated testing + prompt_pay_invoice(&slate, method, dest)?; + + Ok(command::ProcessInvoiceArgs { + message: message, + minimum_confirmations: min_c, + selection_strategy: selection_strategy.to_owned(), + estimate_selection_strategies, + method: method.to_owned(), + dest: dest.to_owned(), + max_outputs: max_outputs, + target_slate_version: target_slate_version, + input: tx_file.to_owned(), + }) +} + pub fn parse_info_args(args: &ArgMatches) -> Result { // minimum_confirmations let mc = parse_required(args, "minimum_confirmations")?; @@ -610,6 +801,18 @@ pub fn wallet_command( let a = arg_parse!(parse_finalize_args(&args)); command::finalize(inst_wallet(), a) } + ("invoice", Some(args)) => { + let a = arg_parse!(parse_issue_invoice_args(&args)); + command::issue_invoice_tx(inst_wallet(), a) + } + ("pay", Some(args)) => { + let a = arg_parse!(parse_process_invoice_args(&args)); + command::process_invoice( + inst_wallet(), + a, + wallet_config.dark_background_color_scheme.unwrap_or(true), + ) + } ("info", Some(args)) => { let a = arg_parse!(parse_info_args(&args)); command::info( diff --git a/src/bin/cmd/wallet_tests.rs b/src/bin/cmd/wallet_tests.rs index 7dd27a1b5..69aa3460a 100644 --- a/src/bin/cmd/wallet_tests.rs +++ b/src/bin/cmd/wallet_tests.rs @@ -480,6 +480,54 @@ mod wallet_tests { ]; execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?; + // issue an invoice tx, wallet 2 + let file_name = format!("{}/invoice.slate", test_dir); + let arg_vec = vec![ + "grin-wallet", + "-p", + "password", + "invoice", + "-d", + &file_name, + "-g", + "Please give me your precious grins. Love, Yeast", + "65", + ]; + execute_command(&app, test_dir, "wallet2", &client2, arg_vec)?; + let output_file_name = format!("{}/invoice.slate.paid", test_dir); + + // now pay the invoice tx, wallet 1 + let arg_vec = vec![ + "grin-wallet", + "-a", + "mining", + "-p", + "password", + "pay", + "-i", + &file_name, + "-d", + &output_file_name, + "-g", + "Here you go", + ]; + execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?; + + // and finalize, wallet 2 + let arg_vec = vec![ + "grin-wallet", + "-p", + "password", + "finalize", + "-i", + &output_file_name, + ]; + execute_command(&app, test_dir, "wallet2", &client2, arg_vec)?; + + // bit more mining + let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), 5, false); + //bh += 5; + // txs and outputs (mostly spit out for a visual in test logs) let arg_vec = vec!["grin-wallet", "-p", "password", "-a", "mining", "txs"]; execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?; @@ -501,6 +549,12 @@ mod wallet_tests { let arg_vec = vec!["grin-wallet", "-p", "password", "-a", "mining", "outputs"]; execute_command(&app, test_dir, "wallet1", &client1, arg_vec)?; + let arg_vec = vec!["grin-wallet", "-p", "password", "txs"]; + execute_command(&app, test_dir, "wallet2", &client2, arg_vec)?; + + let arg_vec = vec!["grin-wallet", "-p", "password", "outputs"]; + execute_command(&app, test_dir, "wallet2", &client2, arg_vec)?; + // let logging finish thread::sleep(Duration::from_millis(200)); Ok(()) diff --git a/src/bin/grin-wallet.yml b/src/bin/grin-wallet.yml index 01a5dd42d..22e7d613d 100644 --- a/src/bin/grin-wallet.yml +++ b/src/bin/grin-wallet.yml @@ -162,6 +162,74 @@ subcommands: help: Fluff the transaction (ignore Dandelion relay protocol) short: f long: fluff + - invoice: + about: Initialize an invoice transction. + args: + - amount: + help: Number of coins to invoice with optional fraction, e.g. 12.423 + index: 1 + - message: + help: Optional participant message to include + short: g + long: message + takes_value: true + - slate_version: + help: Target slate version to output/send to receiver + short: v + long: slate_version + takes_value: true + - dest: + help: Name of destination slate output file + short: d + long: dest + takes_value: true + - pay: + about: Spend coins to pay the provided invoice transaction + args: + - minimum_confirmations: + help: Minimum number of confirmations required for an output to be spendable + short: c + long: min_conf + default_value: "10" + takes_value: true + - selection_strategy: + help: Coin/Output selection strategy. + short: s + long: selection + possible_values: + - all + - smallest + default_value: all + takes_value: true + - estimate_selection_strategies: + help: Estimates all possible Coin/Output selection strategies. + short: e + long: estimate-selection + - method: + help: Method for sending the processed invoice back to the invoice creator + short: m + long: method + possible_values: + - file + - http + - self + default_value: file + takes_value: true + - dest: + help: Send the transaction to the provided server (start with http://) or save as file. + short: d + long: dest + takes_value: true + - message: + help: Optional participant message to include + short: g + long: message + takes_value: true + - input: + help: Partial transaction to process, expects the invoicer's transaction file. + short: i + long: input + takes_value: true - outputs: about: Raw wallet output info (list of outputs) - txs: From 9f96e43d3fdcfb7d6a619b33dc47fa496314d4c6 Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Thu, 9 May 2019 14:09:56 -0400 Subject: [PATCH 13/36] Add Azure Pipelines badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6185b0730..8f617fadd 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://img.shields.io/travis/mimblewimble/grin-wallet/master.svg)](https://travis-ci.org/mimblewimble/grin-wallet) +[![Build Status](https://dev.azure.com/mimblewimble/grin-wallet/_apis/build/status/mimblewimble.grin-wallet?branchName=master)](https://dev.azure.com/mimblewimble/grin-wallet/_build/latest?definitionId=3&branchName=master) [![Coverage Status](https://img.shields.io/codecov/c/github/mimblewimble/grin-wallet/master.svg)](https://codecov.io/gh/mimblewimble/grin-wallet) [![Chat](https://img.shields.io/gitter/room/grin_community/Lobby.svg)](https://gitter.im/grin_community/Lobby) [![Support](https://img.shields.io/badge/support-on%20gitter-brightgreen.svg)](https://gitter.im/grin_community/support) From 0b9b16d5cf3ea3d4e602114e0720fcd1ff464409 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Sat, 11 May 2019 17:47:06 +0100 Subject: [PATCH 14/36] Remove duplicate LMDB wallet backend code (#101) * remove leftover wallet lmdb code * rustfmt --- impls/src/backends/lmdb.rs | 31 +- impls/src/backends/mod.rs | 2 +- impls/src/lib.rs | 4 +- impls/src/lmdb_wallet.rs | 574 -------------------------------- impls/src/test_framework/mod.rs | 2 +- 5 files changed, 25 insertions(+), 588 deletions(-) delete mode 100644 impls/src/lmdb_wallet.rs diff --git a/impls/src/backends/lmdb.rs b/impls/src/backends/lmdb.rs index d939808e4..3fd9df74c 100644 --- a/impls/src/backends/lmdb.rs +++ b/impls/src/backends/lmdb.rs @@ -30,8 +30,11 @@ use crate::store::{self, option_to_not_found, to_key, to_key_u64}; use crate::core::core::Transaction; use crate::core::{global, ser}; -use crate::libwallet::types::*; -use crate::libwallet::{internal, Error, ErrorKind}; +use crate::libwallet::{check_repair, restore}; +use crate::libwallet::{ + AcctPathMapping, Context, Error, ErrorKind, NodeClient, OutputData, TxLogEntry, WalletBackend, + WalletOutputBatch, +}; use crate::util; use crate::util::secp::constants::SECRET_KEY_SIZE; use crate::util::ZeroingString; @@ -235,7 +238,7 @@ where } fn iter<'a>(&'a self) -> Box + 'a> { - Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap()) + Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap().map(|o| o.1)) } fn get_tx_log_entry(&self, u: &Uuid) -> Result, Error> { @@ -244,7 +247,7 @@ where } fn tx_log_iter<'a>(&'a self) -> Box + 'a> { - Box::new(self.db.iter(&[TX_LOG_ENTRY_PREFIX]).unwrap()) + Box::new(self.db.iter(&[TX_LOG_ENTRY_PREFIX]).unwrap().map(|o| o.1)) } fn get_private_context(&mut self, slate_id: &[u8]) -> Result { @@ -265,7 +268,12 @@ where } fn acct_path_iter<'a>(&'a self) -> Box + 'a> { - Box::new(self.db.iter(&[ACCOUNT_PATH_MAPPING_PREFIX]).unwrap()) + Box::new( + self.db + .iter(&[ACCOUNT_PATH_MAPPING_PREFIX]) + .unwrap() + .map(|o| o.1), + ) } fn get_acct_path(&self, label: String) -> Result, Error> { @@ -346,12 +354,12 @@ where } fn restore(&mut self) -> Result<(), Error> { - internal::restore::restore(self).context(ErrorKind::Restore)?; + restore(self).context(ErrorKind::Restore)?; Ok(()) } fn check_repair(&mut self, delete_unconfirmed: bool) -> Result<(), Error> { - internal::restore::check_repair(self, delete_unconfirmed).context(ErrorKind::Restore)?; + check_repair(self, delete_unconfirmed).context(ErrorKind::Restore)?; Ok(()) } } @@ -411,7 +419,8 @@ where .as_ref() .unwrap() .iter(&[OUTPUT_PREFIX]) - .unwrap(), + .unwrap() + .map(|o| o.1), ) } @@ -449,7 +458,8 @@ where .as_ref() .unwrap() .iter(&[TX_LOG_ENTRY_PREFIX]) - .unwrap(), + .unwrap() + .map(|o| o.1), ) } @@ -518,7 +528,8 @@ where .as_ref() .unwrap() .iter(&[ACCOUNT_PATH_MAPPING_PREFIX]) - .unwrap(), + .unwrap() + .map(|o| o.1), ) } diff --git a/impls/src/backends/mod.rs b/impls/src/backends/mod.rs index 83b527aed..2cf377e13 100644 --- a/impls/src/backends/mod.rs +++ b/impls/src/backends/mod.rs @@ -14,4 +14,4 @@ mod lmdb; -pub use self::lmdb::LMDBBackend; +pub use self::lmdb::{wallet_db_exists, LMDBBackend}; diff --git a/impls/src/lib.rs b/impls/src/lib.rs index f2ee142cd..ee846562a 100644 --- a/impls/src/lib.rs +++ b/impls/src/lib.rs @@ -32,8 +32,8 @@ use grin_wallet_util::grin_util as util; extern crate grin_wallet_config as config; mod adapters; +mod backends; mod error; -mod lmdb_wallet; mod node_clients; mod seed; pub mod test_framework; @@ -42,8 +42,8 @@ pub use crate::adapters::{ FileWalletCommAdapter, HTTPWalletCommAdapter, KeybaseWalletCommAdapter, NullWalletCommAdapter, WalletCommAdapter, }; +pub use crate::backends::{wallet_db_exists, LMDBBackend}; pub use crate::error::{Error, ErrorKind}; -pub use crate::lmdb_wallet::{wallet_db_exists, LMDBBackend}; pub use crate::node_clients::HTTPNodeClient; pub use crate::seed::{EncryptedWalletSeed, WalletSeed, SEED_FILE}; diff --git a/impls/src/lmdb_wallet.rs b/impls/src/lmdb_wallet.rs deleted file mode 100644 index 3fd9df74c..000000000 --- a/impls/src/lmdb_wallet.rs +++ /dev/null @@ -1,574 +0,0 @@ -// Copyright 2018 The Grin Developers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -use std::cell::RefCell; -use std::{fs, path}; - -// for writing storedtransaction files -use std::fs::File; -use std::io::{Read, Write}; -use std::path::Path; - -use failure::ResultExt; -use uuid::Uuid; - -use crate::blake2::blake2b::Blake2b; - -use crate::keychain::{ChildNumber, ExtKeychain, Identifier, Keychain}; -use crate::store::{self, option_to_not_found, to_key, to_key_u64}; - -use crate::core::core::Transaction; -use crate::core::{global, ser}; -use crate::libwallet::{check_repair, restore}; -use crate::libwallet::{ - AcctPathMapping, Context, Error, ErrorKind, NodeClient, OutputData, TxLogEntry, WalletBackend, - WalletOutputBatch, -}; -use crate::util; -use crate::util::secp::constants::SECRET_KEY_SIZE; -use crate::util::ZeroingString; -use crate::WalletSeed; -use config::WalletConfig; - -pub const DB_DIR: &'static str = "db"; -pub const TX_SAVE_DIR: &'static str = "saved_txs"; - -const OUTPUT_PREFIX: u8 = 'o' as u8; -const DERIV_PREFIX: u8 = 'd' as u8; -const CONFIRMED_HEIGHT_PREFIX: u8 = 'c' as u8; -const PRIVATE_TX_CONTEXT_PREFIX: u8 = 'p' as u8; -const TX_LOG_ENTRY_PREFIX: u8 = 't' as u8; -const TX_LOG_ID_PREFIX: u8 = 'i' as u8; -const ACCOUNT_PATH_MAPPING_PREFIX: u8 = 'a' as u8; - -/// test to see if database files exist in the current directory. If so, -/// use a DB backend for all operations -pub fn wallet_db_exists(config: WalletConfig) -> bool { - let db_path = path::Path::new(&config.data_file_dir).join(DB_DIR); - db_path.exists() -} - -/// Helper to derive XOR keys for storing private transaction keys in the DB -/// (blind_xor_key, nonce_xor_key) -fn private_ctx_xor_keys( - keychain: &K, - slate_id: &[u8], -) -> Result<([u8; SECRET_KEY_SIZE], [u8; SECRET_KEY_SIZE]), Error> -where - K: Keychain, -{ - let root_key = keychain.derive_key(0, &K::root_key_id())?; - - // derive XOR values for storing secret values in DB - // h(root_key|slate_id|"blind") - let mut hasher = Blake2b::new(SECRET_KEY_SIZE); - hasher.update(&root_key.0[..]); - hasher.update(&slate_id[..]); - hasher.update(&"blind".as_bytes()[..]); - let blind_xor_key = hasher.finalize(); - let mut ret_blind = [0; SECRET_KEY_SIZE]; - ret_blind.copy_from_slice(&blind_xor_key.as_bytes()[0..SECRET_KEY_SIZE]); - - // h(root_key|slate_id|"nonce") - let mut hasher = Blake2b::new(SECRET_KEY_SIZE); - hasher.update(&root_key.0[..]); - hasher.update(&slate_id[..]); - hasher.update(&"nonce".as_bytes()[..]); - let nonce_xor_key = hasher.finalize(); - let mut ret_nonce = [0; SECRET_KEY_SIZE]; - ret_nonce.copy_from_slice(&nonce_xor_key.as_bytes()[0..SECRET_KEY_SIZE]); - - Ok((ret_blind, ret_nonce)) -} - -pub struct LMDBBackend { - db: store::Store, - config: WalletConfig, - /// passphrase: TODO better ways of dealing with this other than storing - passphrase: ZeroingString, - /// Keychain - pub keychain: Option, - /// Parent path to use by default for output operations - parent_key_id: Identifier, - /// wallet to node client - w2n_client: C, -} - -impl LMDBBackend { - pub fn new(config: WalletConfig, passphrase: &str, n_client: C) -> Result { - let db_path = path::Path::new(&config.data_file_dir).join(DB_DIR); - fs::create_dir_all(&db_path).expect("Couldn't create wallet backend directory!"); - - let stored_tx_path = path::Path::new(&config.data_file_dir).join(TX_SAVE_DIR); - fs::create_dir_all(&stored_tx_path) - .expect("Couldn't create wallet backend tx storage directory!"); - - let store = store::Store::new(db_path.to_str().unwrap(), None, Some(DB_DIR), None)?; - - // Make sure default wallet derivation path always exists - // as well as path (so it can be retrieved by batches to know where to store - // completed transactions, for reference - let default_account = AcctPathMapping { - label: "default".to_owned(), - path: LMDBBackend::::default_path(), - }; - let acct_key = to_key( - ACCOUNT_PATH_MAPPING_PREFIX, - &mut default_account.label.as_bytes().to_vec(), - ); - - { - let batch = store.batch()?; - batch.put_ser(&acct_key, &default_account)?; - batch.commit()?; - } - - let res = LMDBBackend { - db: store, - config: config.clone(), - passphrase: ZeroingString::from(passphrase), - keychain: None, - parent_key_id: LMDBBackend::::default_path(), - w2n_client: n_client, - }; - Ok(res) - } - - fn default_path() -> Identifier { - // return the default parent wallet path, corresponding to the default account - // in the BIP32 spec. Parent is account 0 at level 2, child output identifiers - // are all at level 3 - ExtKeychain::derive_key_id(2, 0, 0, 0, 0) - } - - /// Just test to see if database files exist in the current directory. If - /// so, use a DB backend for all operations - pub fn exists(config: WalletConfig) -> bool { - let db_path = path::Path::new(&config.data_file_dir).join(DB_DIR); - db_path.exists() - } -} - -impl WalletBackend for LMDBBackend -where - C: NodeClient, - K: Keychain, -{ - /// Initialise with whatever stored credentials we have - fn open_with_credentials(&mut self) -> Result<(), Error> { - let wallet_seed = WalletSeed::from_file(&self.config, &self.passphrase) - .context(ErrorKind::CallbackImpl("Error opening wallet"))?; - self.keychain = Some( - wallet_seed - .derive_keychain(global::is_floonet()) - .context(ErrorKind::CallbackImpl("Error deriving keychain"))?, - ); - Ok(()) - } - - /// Close wallet and remove any stored credentials (TBD) - fn close(&mut self) -> Result<(), Error> { - self.keychain = None; - Ok(()) - } - - /// Return the keychain being used - fn keychain(&mut self) -> &mut K { - self.keychain.as_mut().unwrap() - } - - /// Return the node client being used - fn w2n_client(&mut self) -> &mut C { - &mut self.w2n_client - } - - /// return the version of the commit for caching - fn calc_commit_for_cache( - &mut self, - amount: u64, - id: &Identifier, - ) -> Result, Error> { - if self.config.no_commit_cache == Some(true) { - Ok(None) - } else { - Ok(Some(util::to_hex( - self.keychain().commit(amount, &id)?.0.to_vec(), - ))) - } - } - - /// Set parent path by account name - fn set_parent_key_id_by_name(&mut self, label: &str) -> Result<(), Error> { - let label = label.to_owned(); - let res = self.acct_path_iter().find(|l| l.label == label); - if let Some(a) = res { - self.set_parent_key_id(a.path); - Ok(()) - } else { - return Err(ErrorKind::UnknownAccountLabel(label.clone()).into()); - } - } - - /// set parent path - fn set_parent_key_id(&mut self, id: Identifier) { - self.parent_key_id = id; - } - - fn parent_key_id(&mut self) -> Identifier { - self.parent_key_id.clone() - } - - fn get(&self, id: &Identifier, mmr_index: &Option) -> Result { - let key = match mmr_index { - Some(i) => to_key_u64(OUTPUT_PREFIX, &mut id.to_bytes().to_vec(), *i), - None => to_key(OUTPUT_PREFIX, &mut id.to_bytes().to_vec()), - }; - option_to_not_found(self.db.get_ser(&key), &format!("Key Id: {}", id)).map_err(|e| e.into()) - } - - fn iter<'a>(&'a self) -> Box + 'a> { - Box::new(self.db.iter(&[OUTPUT_PREFIX]).unwrap().map(|o| o.1)) - } - - fn get_tx_log_entry(&self, u: &Uuid) -> Result, Error> { - let key = to_key(TX_LOG_ENTRY_PREFIX, &mut u.as_bytes().to_vec()); - self.db.get_ser(&key).map_err(|e| e.into()) - } - - fn tx_log_iter<'a>(&'a self) -> Box + 'a> { - Box::new(self.db.iter(&[TX_LOG_ENTRY_PREFIX]).unwrap().map(|o| o.1)) - } - - fn get_private_context(&mut self, slate_id: &[u8]) -> Result { - let ctx_key = to_key(PRIVATE_TX_CONTEXT_PREFIX, &mut slate_id.to_vec()); - let (blind_xor_key, nonce_xor_key) = private_ctx_xor_keys(self.keychain(), slate_id)?; - - let mut ctx: Context = option_to_not_found( - self.db.get_ser(&ctx_key), - &format!("Slate id: {:x?}", slate_id.to_vec()), - )?; - - for i in 0..SECRET_KEY_SIZE { - ctx.sec_key.0[i] = ctx.sec_key.0[i] ^ blind_xor_key[i]; - ctx.sec_nonce.0[i] = ctx.sec_nonce.0[i] ^ nonce_xor_key[i]; - } - - Ok(ctx) - } - - fn acct_path_iter<'a>(&'a self) -> Box + 'a> { - Box::new( - self.db - .iter(&[ACCOUNT_PATH_MAPPING_PREFIX]) - .unwrap() - .map(|o| o.1), - ) - } - - fn get_acct_path(&self, label: String) -> Result, Error> { - let acct_key = to_key(ACCOUNT_PATH_MAPPING_PREFIX, &mut label.as_bytes().to_vec()); - self.db.get_ser(&acct_key).map_err(|e| e.into()) - } - - fn store_tx(&self, uuid: &str, tx: &Transaction) -> Result<(), Error> { - let filename = format!("{}.grintx", uuid); - let path = path::Path::new(&self.config.data_file_dir) - .join(TX_SAVE_DIR) - .join(filename); - let path_buf = Path::new(&path).to_path_buf(); - let mut stored_tx = File::create(path_buf)?; - let tx_hex = util::to_hex(ser::ser_vec(tx).unwrap());; - stored_tx.write_all(&tx_hex.as_bytes())?; - stored_tx.sync_all()?; - Ok(()) - } - - fn get_stored_tx(&self, entry: &TxLogEntry) -> Result, Error> { - let filename = match entry.stored_tx.clone() { - Some(f) => f, - None => return Ok(None), - }; - let path = path::Path::new(&self.config.data_file_dir) - .join(TX_SAVE_DIR) - .join(filename); - let tx_file = Path::new(&path).to_path_buf(); - let mut tx_f = File::open(tx_file)?; - let mut content = String::new(); - tx_f.read_to_string(&mut content)?; - let tx_bin = util::from_hex(content).unwrap(); - Ok(Some( - ser::deserialize::(&mut &tx_bin[..]).unwrap(), - )) - } - - fn batch<'a>(&'a mut self) -> Result + 'a>, Error> { - Ok(Box::new(Batch { - _store: self, - db: RefCell::new(Some(self.db.batch()?)), - keychain: self.keychain.clone(), - })) - } - - fn next_child<'a>(&mut self) -> Result { - let parent_key_id = self.parent_key_id.clone(); - let mut deriv_idx = { - let batch = self.db.batch()?; - let deriv_key = to_key(DERIV_PREFIX, &mut self.parent_key_id.to_bytes().to_vec()); - match batch.get_ser(&deriv_key)? { - Some(idx) => idx, - None => 0, - } - }; - let mut return_path = self.parent_key_id.to_path(); - return_path.depth = return_path.depth + 1; - return_path.path[return_path.depth as usize - 1] = ChildNumber::from(deriv_idx); - deriv_idx = deriv_idx + 1; - let mut batch = self.batch()?; - batch.save_child_index(&parent_key_id, deriv_idx)?; - batch.commit()?; - Ok(Identifier::from_path(&return_path)) - } - - fn last_confirmed_height<'a>(&mut self) -> Result { - let batch = self.db.batch()?; - let height_key = to_key( - CONFIRMED_HEIGHT_PREFIX, - &mut self.parent_key_id.to_bytes().to_vec(), - ); - let last_confirmed_height = match batch.get_ser(&height_key)? { - Some(h) => h, - None => 0, - }; - Ok(last_confirmed_height) - } - - fn restore(&mut self) -> Result<(), Error> { - restore(self).context(ErrorKind::Restore)?; - Ok(()) - } - - fn check_repair(&mut self, delete_unconfirmed: bool) -> Result<(), Error> { - check_repair(self, delete_unconfirmed).context(ErrorKind::Restore)?; - Ok(()) - } -} - -/// An atomic batch in which all changes can be committed all at once or -/// discarded on error. -pub struct Batch<'a, C, K> -where - C: NodeClient, - K: Keychain, -{ - _store: &'a LMDBBackend, - db: RefCell>>, - /// Keychain - keychain: Option, -} - -#[allow(missing_docs)] -impl<'a, C, K> WalletOutputBatch for Batch<'a, C, K> -where - C: NodeClient, - K: Keychain, -{ - fn keychain(&mut self) -> &mut K { - self.keychain.as_mut().unwrap() - } - - fn save(&mut self, out: OutputData) -> Result<(), Error> { - // Save the output data to the db. - { - let key = match out.mmr_index { - Some(i) => to_key_u64(OUTPUT_PREFIX, &mut out.key_id.to_bytes().to_vec(), i), - None => to_key(OUTPUT_PREFIX, &mut out.key_id.to_bytes().to_vec()), - }; - self.db.borrow().as_ref().unwrap().put_ser(&key, &out)?; - } - - Ok(()) - } - - fn get(&self, id: &Identifier, mmr_index: &Option) -> Result { - let key = match mmr_index { - Some(i) => to_key_u64(OUTPUT_PREFIX, &mut id.to_bytes().to_vec(), *i), - None => to_key(OUTPUT_PREFIX, &mut id.to_bytes().to_vec()), - }; - option_to_not_found( - self.db.borrow().as_ref().unwrap().get_ser(&key), - &format!("Key ID: {}", id), - ) - .map_err(|e| e.into()) - } - - fn iter(&self) -> Box> { - Box::new( - self.db - .borrow() - .as_ref() - .unwrap() - .iter(&[OUTPUT_PREFIX]) - .unwrap() - .map(|o| o.1), - ) - } - - fn delete(&mut self, id: &Identifier, mmr_index: &Option) -> Result<(), Error> { - // Delete the output data. - { - let key = match mmr_index { - Some(i) => to_key_u64(OUTPUT_PREFIX, &mut id.to_bytes().to_vec(), *i), - None => to_key(OUTPUT_PREFIX, &mut id.to_bytes().to_vec()), - }; - let _ = self.db.borrow().as_ref().unwrap().delete(&key); - } - - Ok(()) - } - - fn next_tx_log_id(&mut self, parent_key_id: &Identifier) -> Result { - let tx_id_key = to_key(TX_LOG_ID_PREFIX, &mut parent_key_id.to_bytes().to_vec()); - let last_tx_log_id = match self.db.borrow().as_ref().unwrap().get_ser(&tx_id_key)? { - Some(t) => t, - None => 0, - }; - self.db - .borrow() - .as_ref() - .unwrap() - .put_ser(&tx_id_key, &(last_tx_log_id + 1))?; - Ok(last_tx_log_id) - } - - fn tx_log_iter(&self) -> Box> { - Box::new( - self.db - .borrow() - .as_ref() - .unwrap() - .iter(&[TX_LOG_ENTRY_PREFIX]) - .unwrap() - .map(|o| o.1), - ) - } - - fn save_last_confirmed_height( - &mut self, - parent_key_id: &Identifier, - height: u64, - ) -> Result<(), Error> { - let height_key = to_key( - CONFIRMED_HEIGHT_PREFIX, - &mut parent_key_id.to_bytes().to_vec(), - ); - self.db - .borrow() - .as_ref() - .unwrap() - .put_ser(&height_key, &height)?; - Ok(()) - } - - fn save_child_index(&mut self, parent_id: &Identifier, child_n: u32) -> Result<(), Error> { - let deriv_key = to_key(DERIV_PREFIX, &mut parent_id.to_bytes().to_vec()); - self.db - .borrow() - .as_ref() - .unwrap() - .put_ser(&deriv_key, &child_n)?; - Ok(()) - } - - fn save_tx_log_entry( - &mut self, - tx_in: TxLogEntry, - parent_id: &Identifier, - ) -> Result<(), Error> { - let tx_log_key = to_key_u64( - TX_LOG_ENTRY_PREFIX, - &mut parent_id.to_bytes().to_vec(), - tx_in.id as u64, - ); - self.db - .borrow() - .as_ref() - .unwrap() - .put_ser(&tx_log_key, &tx_in)?; - Ok(()) - } - - fn save_acct_path(&mut self, mapping: AcctPathMapping) -> Result<(), Error> { - let acct_key = to_key( - ACCOUNT_PATH_MAPPING_PREFIX, - &mut mapping.label.as_bytes().to_vec(), - ); - self.db - .borrow() - .as_ref() - .unwrap() - .put_ser(&acct_key, &mapping)?; - Ok(()) - } - - fn acct_path_iter(&self) -> Box> { - Box::new( - self.db - .borrow() - .as_ref() - .unwrap() - .iter(&[ACCOUNT_PATH_MAPPING_PREFIX]) - .unwrap() - .map(|o| o.1), - ) - } - - fn lock_output(&mut self, out: &mut OutputData) -> Result<(), Error> { - out.lock(); - self.save(out.clone()) - } - - fn save_private_context(&mut self, slate_id: &[u8], ctx: &Context) -> Result<(), Error> { - let ctx_key = to_key(PRIVATE_TX_CONTEXT_PREFIX, &mut slate_id.to_vec()); - let (blind_xor_key, nonce_xor_key) = private_ctx_xor_keys(self.keychain(), slate_id)?; - - let mut s_ctx = ctx.clone(); - for i in 0..SECRET_KEY_SIZE { - s_ctx.sec_key.0[i] = s_ctx.sec_key.0[i] ^ blind_xor_key[i]; - s_ctx.sec_nonce.0[i] = s_ctx.sec_nonce.0[i] ^ nonce_xor_key[i]; - } - - self.db - .borrow() - .as_ref() - .unwrap() - .put_ser(&ctx_key, &s_ctx)?; - Ok(()) - } - - fn delete_private_context(&mut self, slate_id: &[u8]) -> Result<(), Error> { - let ctx_key = to_key(PRIVATE_TX_CONTEXT_PREFIX, &mut slate_id.to_vec()); - self.db - .borrow() - .as_ref() - .unwrap() - .delete(&ctx_key) - .map_err(|e| e.into()) - } - - fn commit(&self) -> Result<(), Error> { - let db = self.db.replace(None); - db.unwrap().commit()?; - Ok(()) - } -} diff --git a/impls/src/test_framework/mod.rs b/impls/src/test_framework/mod.rs index 576d61c80..3ad0d2ffc 100644 --- a/impls/src/test_framework/mod.rs +++ b/impls/src/test_framework/mod.rs @@ -25,10 +25,10 @@ use crate::libwallet::api_impl::{foreign, owner}; use crate::libwallet::{ BlockFees, CbData, InitTxArgs, NodeClient, WalletBackend, WalletInfo, WalletInst, }; -use crate::lmdb_wallet::LMDBBackend; use crate::util; use crate::util::secp::pedersen; use crate::util::Mutex; +use crate::LMDBBackend; use crate::WalletSeed; use chrono::Duration; use std::sync::Arc; From af6a6249e02e796534282835f9430af3998aca19 Mon Sep 17 00:00:00 2001 From: jaspervdm Date: Thu, 16 May 2019 10:17:39 +0200 Subject: [PATCH 15/36] Simplify slate (de)serialization (#103) * Simplify slate (de)serialization * rustfmt * Cleanup * Fix slate version tests * Another fix for tests * Fix slate deser in http adapter --- Cargo.lock | 44 +++++---- controller/src/controller.rs | 4 +- impls/src/adapters/file.rs | 9 +- impls/src/adapters/http.rs | 80 ++++------------ impls/src/adapters/keybase.rs | 3 +- libwallet/src/error.rs | 4 + libwallet/src/slate.rs | 143 +++++++++++++++++++--------- libwallet/tests/slate_versioning.rs | 52 +++++++--- 8 files changed, 189 insertions(+), 150 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e858cd3ee..9af57cbdf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -280,16 +280,16 @@ dependencies = [ [[package]] name = "croaring" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "croaring-sys 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "croaring-sys 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "croaring-sys" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bindgen 0.37.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -555,7 +555,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "grin_api" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" +source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -587,12 +587,12 @@ dependencies = [ [[package]] name = "grin_chain" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" +source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "croaring 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", @@ -610,12 +610,12 @@ dependencies = [ [[package]] name = "grin_core" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" +source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "croaring 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -626,7 +626,7 @@ dependencies = [ "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (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.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -636,7 +636,7 @@ dependencies = [ [[package]] name = "grin_keychain" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" +source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -646,7 +646,7 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "pbkdf2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ripemd160 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -658,7 +658,7 @@ dependencies = [ [[package]] name = "grin_p2p" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" +source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -671,15 +671,16 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (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.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_pool" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" +source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -690,7 +691,7 @@ dependencies = [ "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (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.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -712,10 +713,10 @@ dependencies = [ [[package]] name = "grin_store" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" +source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "croaring 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", + "croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -727,12 +728,13 @@ dependencies = [ "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_util" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#865b9b6b467d6aa0bfad1dee3df052b141ca3eab" +source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" dependencies = [ "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -742,7 +744,7 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.6 (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.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2717,8 +2719,8 @@ dependencies = [ "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" "checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb" "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1" -"checksum croaring 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "d2b350ece8a9ba71eeb9c068a98a86dc420ca5c1d6bd4e1627a4581e9c843c38" -"checksum croaring-sys 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "546b00f33bdf591bce6410a8dca65047d126b1d5a9189190d085aa8c493d43a7" +"checksum croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "71152d60cec9dfdc5d9d793bccfa9ad95927372b80cd00e983db5eb2ce103e3b" +"checksum croaring-sys 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "ac84a4f975e67fc418be3911b7ca9aa74ee8a9717ca75452da7d6839421e2d67" "checksum crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b18cd2e169ad86297e6bc0ad9aa679aee9daa4f19e8163860faf7c164e4f5a71" "checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4" "checksum crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7c979cd6cfe72335896575c6b5688da489e420d36a27a0b9eb0c73db574b4a4b" diff --git a/controller/src/controller.rs b/controller/src/controller.rs index 5a5f92154..cb7ea39b7 100644 --- a/controller/src/controller.rs +++ b/controller/src/controller.rs @@ -776,9 +776,7 @@ where err(e) } else { match api.receive_tx(&slate, None, None) { - Ok(s) => ok(s - .serialize_to_version(Some(s.version_info.orig_version)) - .unwrap()), + Ok(s) => ok(serde_json::to_string(&s).unwrap()), Err(e) => { error!("receive_tx: failed with error: {}", e); err(e) diff --git a/impls/src/adapters/file.rs b/impls/src/adapters/file.rs index 03d8c1443..d63024f0c 100644 --- a/impls/src/adapters/file.rs +++ b/impls/src/adapters/file.rs @@ -17,7 +17,7 @@ use std::fs::File; use std::io::{Read, Write}; use crate::config::WalletConfig; -use crate::libwallet::{Error, Slate}; +use crate::libwallet::{Error, ErrorKind, Slate}; use crate::WalletCommAdapter; use std::collections::HashMap; @@ -42,8 +42,11 @@ impl WalletCommAdapter for FileWalletCommAdapter { fn send_tx_async(&self, dest: &str, slate: &Slate) -> Result<(), Error> { let mut pub_tx = File::create(dest)?; - let slate_string = slate.serialize_to_version(Some(slate.version_info.orig_version))?; - pub_tx.write_all(slate_string.as_bytes())?; + pub_tx.write_all( + serde_json::to_string(slate) + .map_err(|_| ErrorKind::SlateSer)? + .as_bytes(), + )?; pub_tx.sync_all()?; Ok(()) } diff --git a/impls/src/adapters/http.rs b/impls/src/adapters/http.rs index 094aa5deb..d2e7e7133 100644 --- a/impls/src/adapters/http.rs +++ b/impls/src/adapters/http.rs @@ -16,11 +16,10 @@ /// HTTP Wallet 'plugin' implementation use crate::api; -use crate::libwallet::slate_versions::{v0, v1}; use crate::libwallet::{Error, ErrorKind, Slate}; use crate::WalletCommAdapter; use config::WalletConfig; -use failure::ResultExt; +use serde::Serialize; use std::collections::HashMap; #[derive(Clone)] @@ -49,66 +48,14 @@ impl WalletCommAdapter for HTTPWalletCommAdapter { } let url = format!("{}/v1/wallet/foreign/receive_tx", dest); debug!("Posting transaction slate to {}", url); - //TODO: Use VersionedSlate when converting to V2 API - let slate = slate.serialize_to_version(Some(slate.version_info.orig_version))?; - // For compatibility with older clients - let res: Slate = { - if let None = slate.find("version_info") { - let version = Slate::parse_slate_version(&slate)?; - match version { - 1 => { - let ver1: v1::SlateV1 = - serde_json::from_str(&slate).context(ErrorKind::SlateDeser)?; - let r: Result = - api::client::post(url.as_str(), None, &ver1); - match r { - Err(e) => { - let report = format!( - "Posting transaction slate (is recipient listening?): {}", - e - ); - error!("{}", report); - return Err(ErrorKind::ClientCallback(report).into()); - } - Ok(s) => Slate::deserialize_upgrade( - &serde_json::to_string(&s).context(ErrorKind::SlateDeser)?, - )?, - } - } - _ => { - let ver0: v0::SlateV0 = - serde_json::from_str(&slate).context(ErrorKind::SlateDeser)?; - let r: Result = - api::client::post(url.as_str(), None, &ver0); - match r { - Err(e) => { - let report = format!( - "Posting transaction slate (is recipient listening?): {}", - e - ); - error!("{}", report); - return Err(ErrorKind::ClientCallback(report).into()); - } - Ok(s) => Slate::deserialize_upgrade( - &serde_json::to_string(&s).context(ErrorKind::SlateDeser)?, - )?, - } - } - } - } else { - let res: Result = api::client::post(url.as_str(), None, &slate); - match res { - Err(e) => { - let report = - format!("Posting transaction slate (is recipient listening?): {}", e); - error!("{}", report); - return Err(ErrorKind::ClientCallback(report).into()); - } - Ok(r) => Slate::deserialize_upgrade(&r)?, - } - } - }; - Ok(res) + let res: String = post(url.as_str(), None, &slate).map_err(|e| { + let report = format!("Posting transaction slate (is recipient listening?): {}", e); + error!("{}", report); + ErrorKind::ClientCallback(report) + })?; + let slate = Slate::deserialize_upgrade(&res).map_err(|_| ErrorKind::SlateDeser)?; + + Ok(slate) } fn send_tx_async(&self, _dest: &str, _slate: &Slate) -> Result<(), Error> { @@ -130,3 +77,12 @@ impl WalletCommAdapter for HTTPWalletCommAdapter { unimplemented!(); } } + +pub fn post(url: &str, api_secret: Option, input: &IN) -> Result +where + IN: Serialize, +{ + let req = api::client::create_post_request(url, api_secret, input)?; + let res = api::client::send_request(req)?; + Ok(res) +} diff --git a/impls/src/adapters/keybase.rs b/impls/src/adapters/keybase.rs index bf71d9f14..6369ef46d 100644 --- a/impls/src/adapters/keybase.rs +++ b/impls/src/adapters/keybase.rs @@ -389,8 +389,7 @@ impl WalletCommAdapter for KeybaseWalletCommAdapter { // Reply to the same channel with topic SLATE_SIGNED Ok(s) => { let slate = - s.serialize_to_version(Some(slate.version_info.orig_version))?; - // TODO: Send the same version of slate that was sent to us + serde_json::to_string(&s).map_err(|_| ErrorKind::SlateSer)?; let success = send(slate, channel, SLATE_SIGNED, TTL); if success { diff --git a/libwallet/src/error.rs b/libwallet/src/error.rs index 38a25d9bc..807f44add 100644 --- a/libwallet/src/error.rs +++ b/libwallet/src/error.rs @@ -181,6 +181,10 @@ pub enum ErrorKind { #[fail(display = "Can't parse slate version")] SlateVersionParse, + /// Can't serialize slate + #[fail(display = "Can't Serialize slate")] + SlateSer, + /// Can't deserialize slate #[fail(display = "Can't Deserialize slate")] SlateDeser, diff --git a/libwallet/src/slate.rs b/libwallet/src/slate.rs index 1a40d3b78..c897ed561 100644 --- a/libwallet/src/slate.rs +++ b/libwallet/src/slate.rs @@ -33,6 +33,7 @@ use crate::grin_util::{self, secp, RwLock}; use failure::ResultExt; use rand::rngs::mock::StepRng; use rand::thread_rng; +use serde::ser::{Serialize, Serializer}; use serde_json; use std::fmt; use std::sync::Arc; @@ -148,7 +149,7 @@ impl fmt::Display for ParticipantMessageData { /// the slate around by whatever means they choose, (but we can provide some /// binary or JSON serialization helpers here). -#[derive(Serialize, Deserialize, Debug, Clone)] +#[derive(Deserialize, Debug, Clone)] pub struct Slate { /// Versioning info pub version_info: VersionCompatInfo, @@ -196,24 +197,11 @@ pub struct ParticipantMessages { } impl Slate { - /// TODO: Reduce the number of changes that need to occur below for each new - /// slate version + /// Attempt to find slate version pub fn parse_slate_version(slate_json: &str) -> Result { - // keep attempting to deser, working through known versions until we have - // enough to get the version out - let res: Result = serde_json::from_str(slate_json); - if let Ok(s) = res { - return Ok(s.version_info.version); - } - let res: Result = serde_json::from_str(slate_json); - if let Ok(s) = res { - return Ok(s.version as u16); - } - let res: Result = serde_json::from_str(slate_json); - if let Ok(_) = res { - return Ok(0); - } - Err(ErrorKind::SlateVersionParse)? + let probe: SlateVersionProbe = + serde_json::from_str(slate_json).map_err(|_| ErrorKind::SlateVersionParse)?; + Ok(probe.version()) } /// Recieve a slate, upgrade it to the latest version internally @@ -233,35 +221,9 @@ impl Slate { let v1 = SlateV1::from(v0); SlateV2::from(v1) } - _ => return Err(ErrorKind::SlateVersion(version))?, + _ => return Err(ErrorKind::SlateVersion(version).into()), }; - let f = serde_json::to_string(&v2).context(ErrorKind::SlateDeser)?; - Ok(serde_json::from_str(&f).context(ErrorKind::SlateDeser)?) - } - - /// Downgrate slate to desired version - pub fn serialize_to_version(&self, version: Option) -> Result { - let version = match version { - Some(v) => v, - None => CURRENT_SLATE_VERSION, - }; - let ser_self = serde_json::to_string(&self).context(ErrorKind::SlateDeser)?; - match version { - 2 => Ok(ser_self.clone()), - 1 => { - let v2: SlateV2 = serde_json::from_str(&ser_self).context(ErrorKind::SlateDeser)?; - let v1 = SlateV1::from(v2); - let slate = serde_json::to_string(&v1).context(ErrorKind::SlateDeser)?; - Ok(slate) - } - 0 => { - let v2: SlateV2 = serde_json::from_str(&ser_self).context(ErrorKind::SlateDeser)?; - let v1 = SlateV1::from(v2); - let v0 = SlateV0::from(v1); - Ok(serde_json::to_string(&v0).context(ErrorKind::SlateDeser)?) - } - _ => Err(ErrorKind::SlateVersion(version))?, - } + Ok(v2.into()) } /// Create a new slate @@ -709,6 +671,50 @@ impl Slate { } } +impl Serialize for Slate { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + use serde::ser::Error; + + let v2 = SlateV2::from(self); + match self.version_info.orig_version { + 2 => v2.serialize(serializer), + 1 => { + let v1 = SlateV1::from(v2); + v1.serialize(serializer) + } + 0 => { + let v1 = SlateV1::from(v2); + let v0 = SlateV0::from(v1); + v0.serialize(serializer) + } + v => Err(S::Error::custom(format!("Unknown slate version {}", v))), + } + } +} + +#[derive(Serialize, Deserialize, Debug, Clone)] +pub struct SlateVersionProbe { + #[serde(default)] + version: Option, + #[serde(default)] + version_info: Option, +} + +impl SlateVersionProbe { + pub fn version(&self) -> u16 { + match &self.version_info { + Some(v) => v.version, + None => match self.version { + Some(_) => 1, + None => 0, + }, + } + } +} + // Current slate version to versioned conversions // Slate to versioned @@ -742,6 +748,42 @@ impl From for SlateV2 { } } +impl From<&Slate> for SlateV2 { + fn from(slate: &Slate) -> SlateV2 { + let Slate { + num_participants, + id, + tx, + amount, + fee, + height, + lock_height, + participant_data, + version_info, + } = slate; + let num_participants = *num_participants; + let id = *id; + let tx = TransactionV2::from(tx); + let amount = *amount; + let fee = *fee; + let height = *height; + let lock_height = *lock_height; + let participant_data = map_vec!(participant_data, |data| ParticipantDataV2::from(data)); + let version_info = VersionCompatInfoV2::from(version_info); + SlateV2 { + num_participants, + id, + tx, + amount, + fee, + height, + lock_height, + participant_data, + version_info, + } + } +} + impl From<&ParticipantData> for ParticipantDataV2 { fn from(data: &ParticipantData) -> ParticipantDataV2 { let ParticipantData { @@ -795,6 +837,15 @@ impl From for TransactionV2 { } } +impl From<&Transaction> for TransactionV2 { + fn from(tx: &Transaction) -> TransactionV2 { + let Transaction { offset, body } = tx; + let offset = *offset; + let body = TransactionBodyV2::from(body); + TransactionV2 { offset, body } + } +} + impl From<&TransactionBody> for TransactionBodyV2 { fn from(body: &TransactionBody) -> TransactionBodyV2 { let TransactionBody { diff --git a/libwallet/tests/slate_versioning.rs b/libwallet/tests/slate_versioning.rs index cd0e0484f..08a0d66a4 100644 --- a/libwallet/tests/slate_versioning.rs +++ b/libwallet/tests/slate_versioning.rs @@ -22,47 +22,73 @@ fn slate_conversions() { let res = Slate::deserialize_upgrade(&v0); assert!(res.is_ok()); // should serialize as latest - let res = res.unwrap(); + let mut res = res.unwrap(); assert_eq!(res.version_info.orig_version, 0); - let s = res.serialize_to_version(Some(2)); + res.version_info.orig_version = 2; + let s = serde_json::to_string(&res); assert!(s.is_ok()); - println!("v0 -> v2: {}", s.unwrap()); + let s = s.unwrap(); + let v = Slate::parse_slate_version(&s); + assert!(v.is_ok()); + assert_eq!(v.unwrap(), 2); + println!("v0 -> v2: {}", s); // Test V1 to V2 let v1 = include_str!("slates/v1.slate"); let res = Slate::deserialize_upgrade(&v1); assert!(res.is_ok()); // should serialize as latest - let res = res.unwrap(); + let mut res = res.unwrap(); assert_eq!(res.version_info.orig_version, 1); - let s = res.serialize_to_version(Some(2)); + res.version_info.orig_version = 2; + let s = serde_json::to_string(&res); assert!(s.is_ok()); - println!("v1 -> v2: {}", s.unwrap()); + let s = s.unwrap(); + let v = Slate::parse_slate_version(&s); + assert!(v.is_ok()); + assert_eq!(v.unwrap(), 2); + println!("v1 -> v2: {}", s); // V2 -> V2, check version let v2 = include_str!("slates/v2.slate"); let res = Slate::deserialize_upgrade(&v2); assert!(res.is_ok()); - let res = res.unwrap().serialize_to_version(Some(2)); - let s = res.unwrap(); - let res = Slate::deserialize_upgrade(&s).unwrap(); + let res = res.unwrap(); assert_eq!(res.version_info.orig_version, 2); + let s = serde_json::to_string(&res); + assert!(s.is_ok()); + let s = s.unwrap(); + let v = Slate::parse_slate_version(&s); + assert!(v.is_ok()); + assert_eq!(v.unwrap(), 2); // Downgrade to V1 let v2 = include_str!("slates/v2.slate"); let res = Slate::deserialize_upgrade(&v2); assert!(res.is_ok()); + let mut res = res.unwrap(); // downgrade - let s = res.unwrap().serialize_to_version(Some(1)); + res.version_info.orig_version = 1; + let s = serde_json::to_string(&res); assert!(s.is_ok()); - println!("v2 -> v1: {}", s.unwrap()); + let s = s.unwrap(); + let v = Slate::parse_slate_version(&s); + assert!(v.is_ok()); + assert_eq!(v.unwrap(), 1); + println!("v2 -> v1: {}", s); // Downgrade to V0 let v2 = include_str!("slates/v2.slate"); let res = Slate::deserialize_upgrade(&v2); assert!(res.is_ok()); + let mut res = res.unwrap(); // downgrade - let s = res.unwrap().serialize_to_version(Some(0)); + res.version_info.orig_version = 0; + let s = serde_json::to_string(&res); assert!(s.is_ok()); - println!("v2 -> v0: {}", s.unwrap()); + let s = s.unwrap(); + let v = Slate::parse_slate_version(&s); + assert!(v.is_ok()); + assert_eq!(v.unwrap(), 0); + println!("v2 -> v0: {}", s); } From 45750c88371ca7f9e5e43924bc8ae7d7959abbe2 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Thu, 16 May 2019 09:17:54 +0100 Subject: [PATCH 16/36] docstring update and provide a bit of a readme (#104) --- README.md | 17 +++++++++++++++++ api/src/owner_rpc.rs | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8f617fadd..284ce94b5 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,20 @@ [![License](https://img.shields.io/github/license/mimblewimble/grin-wallet.svg)](https://github.com/mimblewimble/grin-wallet/blob/master/LICENSE) # Grin Wallet + +This is the reference implementation of [Grin's](https://github.com/mimblewimble/grin) wallet. It consists of 2 major pieces: + +* The Grin Wallet APIs, which are intended for use by Grin community wallet developers. The wallet APIs can be directly linked into other projects or invoked via a JSON-RPC interface. + +* A reference command-line wallet, which provides a baseline wallet for Grin and demonstrates how the wallet APIs should be called. + +# Usage + +To use the command-line wallet, we recommend using the latest release from the [Releases page](https://github.com/mimblewimble/grin-wallet/releases). There are distributions for Linux, MacOS and Windows. + +Full documentation outlining how to use the command line wallet can be found on [Grin's Wiki](https://github.com/mimblewimble/docs/wiki/Wallet-User-Guide) + +# License + +Apache License v2.0 + diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index 5e06c7002..8b2f33f61 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -25,7 +25,7 @@ use crate::Owner; use easy_jsonrpc; /// Public definition used to generate Owner jsonrpc api. -/// * When running `grin-wallet listen` with defaults, the V2 api is available at +/// * When running `grin-wallet owner_api` with defaults, the V2 api is available at /// `localhost:3420/v2/owner` /// * The endpoint only supports POST operations, with the json-rpc request as the body #[easy_jsonrpc::rpc] From e25c93161ee7aa574848b4ff81252e83e94b33d4 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Thu, 16 May 2019 10:50:31 +0100 Subject: [PATCH 17/36] Updates for 1.1.0-beta.3 release (#106) * bump version number and build from tag for beta 3 release * update for latest grin tag --- Cargo.lock | 146 ++++++++++++------------- Cargo.toml | 14 +-- api/Cargo.toml | 10 +- config/Cargo.toml | 4 +- controller/Cargo.toml | 12 +- impls/Cargo.toml | 8 +- impls/src/test_framework/testclient.rs | 3 +- libwallet/Cargo.toml | 6 +- util/Cargo.toml | 22 ++-- 9 files changed, 116 insertions(+), 109 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9af57cbdf..24c7d43c4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -555,17 +555,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "grin_api" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" +source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-rustls 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -587,7 +587,7 @@ dependencies = [ [[package]] name = "grin_chain" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" +source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -595,10 +595,10 @@ dependencies = [ "croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -610,7 +610,7 @@ dependencies = [ [[package]] name = "grin_core" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" +source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -619,8 +619,8 @@ dependencies = [ "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -636,12 +636,12 @@ dependencies = [ [[package]] name = "grin_keychain" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" +source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", "hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -658,16 +658,16 @@ dependencies = [ [[package]] name = "grin_p2p" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" +source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -680,16 +680,16 @@ dependencies = [ [[package]] name = "grin_pool" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" +source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", "log 0.4.6 (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.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -713,15 +713,15 @@ dependencies = [ [[package]] name = "grin_store" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" +source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", "lmdb-zero 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -734,7 +734,7 @@ dependencies = [ [[package]] name = "grin_util" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#884851cdeb59305b88300e9110500cbb15b51dc2" +source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" dependencies = [ "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -754,19 +754,19 @@ dependencies = [ [[package]] name = "grin_wallet" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" dependencies = [ "built 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_api 1.1.0-beta.2", - "grin_wallet_config 1.1.0-beta.2", - "grin_wallet_controller 1.1.0-beta.2", - "grin_wallet_impls 1.1.0-beta.2", - "grin_wallet_libwallet 1.1.0-beta.2", - "grin_wallet_util 1.1.0-beta.2", + "grin_wallet_api 1.1.0-beta.3", + "grin_wallet_config 1.1.0-beta.3", + "grin_wallet_controller 1.1.0-beta.3", + "grin_wallet_impls 1.1.0-beta.3", + "grin_wallet_libwallet 1.1.0-beta.3", + "grin_wallet_util 1.1.0-beta.3", "linefeed 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "prettytable-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -775,16 +775,16 @@ dependencies = [ [[package]] name = "grin_wallet_api" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "easy-jsonrpc 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.2", - "grin_wallet_impls 1.1.0-beta.2", - "grin_wallet_libwallet 1.1.0-beta.2", - "grin_wallet_util 1.1.0-beta.2", + "grin_wallet_config 1.1.0-beta.3", + "grin_wallet_impls 1.1.0-beta.3", + "grin_wallet_libwallet 1.1.0-beta.3", + "grin_wallet_util 1.1.0-beta.3", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -793,10 +793,10 @@ dependencies = [ [[package]] name = "grin_wallet_config" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_util 1.1.0-beta.2", + "grin_wallet_util 1.1.0-beta.3", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -806,18 +806,18 @@ dependencies = [ [[package]] name = "grin_wallet_controller" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "easy-jsonrpc 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_api 1.1.0-beta.2", - "grin_wallet_config 1.1.0-beta.2", - "grin_wallet_impls 1.1.0-beta.2", - "grin_wallet_libwallet 1.1.0-beta.2", - "grin_wallet_util 1.1.0-beta.2", + "grin_wallet_api 1.1.0-beta.3", + "grin_wallet_config 1.1.0-beta.3", + "grin_wallet_impls 1.1.0-beta.3", + "grin_wallet_libwallet 1.1.0-beta.3", + "grin_wallet_util 1.1.0-beta.3", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -837,16 +837,16 @@ dependencies = [ [[package]] name = "grin_wallet_impls" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.2", - "grin_wallet_libwallet 1.1.0-beta.2", - "grin_wallet_util 1.1.0-beta.2", + "grin_wallet_config 1.1.0-beta.3", + "grin_wallet_libwallet 1.1.0-beta.3", + "grin_wallet_util 1.1.0-beta.3", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -861,14 +861,14 @@ dependencies = [ [[package]] name = "grin_wallet_libwallet" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.2", - "grin_wallet_util 1.1.0-beta.2", + "grin_wallet_config 1.1.0-beta.3", + "grin_wallet_util 1.1.0-beta.3", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -880,15 +880,15 @@ dependencies = [ [[package]] name = "grin_wallet_util" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2752,15 +2752,15 @@ dependencies = [ "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" "checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" +"checksum grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" +"checksum grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" +"checksum grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" +"checksum grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" +"checksum grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" "checksum grin_secp256k1zkp 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "75e9a265f3eeea4c204470f7262e2c6fe18f3d8ddf5fb24340cb550ac4f909c5" -"checksum grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" +"checksum grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" "checksum h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "85ab6286db06040ddefb71641b50017c06874614001a134b423783e2db2920bd" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "733e1b3ac906631ca01ebb577e9bb0f5e37a454032b9036b5eaea4013ed6f99a" diff --git a/Cargo.toml b/Cargo.toml index 0122a88cb..68f219c63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" authors = ["Grin Developers "] description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -29,13 +29,13 @@ prettytable-rs = "0.7" log = "0.4" linefeed = "0.5" -grin_wallet_api = { path = "./api", version = "1.1.0-beta.2" } -grin_wallet_impls = { path = "./impls", version = "1.1.0-beta.2" } -grin_wallet_libwallet = { path = "./libwallet", version = "1.1.0-beta.2" } -grin_wallet_controller = { path = "./controller", version = "1.1.0-beta.2" } -grin_wallet_config = { path = "./config", version = "1.1.0-beta.2" } +grin_wallet_api = { path = "./api", version = "1.1.0-beta.3" } +grin_wallet_impls = { path = "./impls", version = "1.1.0-beta.3" } +grin_wallet_libwallet = { path = "./libwallet", version = "1.1.0-beta.3" } +grin_wallet_controller = { path = "./controller", version = "1.1.0-beta.3" } +grin_wallet_config = { path = "./config", version = "1.1.0-beta.3" } -grin_wallet_util = { path = "./util", version = "1.1.0-beta.2" } +grin_wallet_util = { path = "./util", version = "1.1.0-beta.3" } [build-dependencies] built = "0.3" diff --git a/api/Cargo.toml b/api/Cargo.toml index d9d87c7a4..740ddbcbd 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_api" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" authors = ["Grin Developers "] description = "Grin Wallet API" license = "Apache-2.0" @@ -18,11 +18,11 @@ serde_json = "1" easy-jsonrpc = "0.5.1" chrono = { version = "0.4.4", features = ["serde"] } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.2" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.2" } -grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.2" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.3" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.3" } +grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.3" } -grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } [dev-dependencies] serde_json = "1" diff --git a/config/Cargo.toml b/config/Cargo.toml index d43542169..cc3d4d0ae 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_config" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" authors = ["Grin Developers "] description = "Configuration for grin wallet , a simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -16,7 +16,7 @@ serde_derive = "1" toml = "0.4" dirs = "1.0.3" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } [dev-dependencies] pretty_assertions = "0.5.1" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 9cbd1207e..84d001c86 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_controller" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" authors = ["Grin Developers "] description = "Controllers for grin wallet instantiation" license = "Apache-2.0" @@ -32,9 +32,9 @@ chrono = { version = "0.4.4", features = ["serde"] } easy-jsonrpc = "0.5.1" lazy_static = "1" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } -grin_wallet_api = { path = "../api", version = "1.1.0-beta.2" } -grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.2" } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.2" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.2" } +grin_wallet_api = { path = "../api", version = "1.1.0-beta.3" } +grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.3" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.3" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.3" } diff --git a/impls/Cargo.toml b/impls/Cargo.toml index 982c2a8e6..aa83b40fb 100644 --- a/impls/Cargo.toml +++ b/impls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_impls" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" authors = ["Grin Developers "] description = "Concrete types derived from libwallet traits" license = "Apache-2.0" @@ -26,7 +26,7 @@ tokio-retry = "0.1" uuid = { version = "0.7", features = ["serde", "v4"] } chrono = { version = "0.4.4", features = ["serde"] } -grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.2" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.2" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.3" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.3" } diff --git a/impls/src/test_framework/testclient.rs b/impls/src/test_framework/testclient.rs index 70c7a43f7..860282804 100644 --- a/impls/src/test_framework/testclient.rs +++ b/impls/src/test_framework/testclient.rs @@ -30,7 +30,7 @@ use crate::libwallet::{NodeClient, Slate, TxWrapper, WalletInst}; use crate::util; use crate::util::secp::pedersen; use crate::util::secp::pedersen::Commitment; -use crate::util::{Mutex, RwLock, StopState}; +use crate::util::{Mutex, RwLock}; use crate::{libwallet, WalletCommAdapter}; use failure::ResultExt; use serde_json; @@ -105,7 +105,6 @@ where pow::verify_size, verifier_cache, false, - Arc::new(Mutex::new(StopState::new())), ) .unwrap(); let (tx, rx) = channel(); diff --git a/libwallet/Cargo.toml b/libwallet/Cargo.toml index 83c9391a2..07d4e70a4 100644 --- a/libwallet/Cargo.toml +++ b/libwallet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_libwallet" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" authors = ["Grin Developers "] description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -23,7 +23,7 @@ uuid = { version = "0.7", features = ["serde", "v4"] } chrono = { version = "0.4.4", features = ["serde"] } lazy_static = "1" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.2" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } [dev-dependencies] -grin_wallet_config = { path = "../config", version = "1.1.0-beta.2" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.3" } diff --git a/util/Cargo.toml b/util/Cargo.toml index 19a799839..d73a29fa6 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_util" -version = "1.1.0-beta.2" +version = "1.1.0-beta.3" authors = ["Grin Developers "] description = "Util, for generic utilities and to re-export grin crates" license = "Apache-2.0" @@ -24,13 +24,21 @@ dirs = "1.0.3" #grin_api = "1.1.0-beta.1" #grin_store = "1.1.0-beta.1" +# For beta release +grin_core = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +grin_keychain = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +grin_chain = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +grin_util = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +grin_api = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +grin_store = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } + # For bleeding edge -grin_core = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_util = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_api = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_store = { git = "https://github.com/mimblewimble/grin", branch = "master" } +#grin_core = { git = "https://github.com/mimblewimble/grin", branch = "master" } +#grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "master" } +#grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "master" } +#grin_util = { git = "https://github.com/mimblewimble/grin", branch = "master" } +#grin_api = { git = "https://github.com/mimblewimble/grin", branch = "master" } +#grin_store = { git = "https://github.com/mimblewimble/grin", branch = "master" } # For local testing #grin_core = { path = "../../grin/core", version= "1.1.0-beta.2"} From 94aee6f74290eb4186b6380970f297472f715980 Mon Sep 17 00:00:00 2001 From: jaspervdm Date: Thu, 16 May 2019 20:55:20 +0200 Subject: [PATCH 18/36] Fix keybase adapter (#107) --- impls/src/adapters/keybase.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/impls/src/adapters/keybase.rs b/impls/src/adapters/keybase.rs index 6369ef46d..79cf25bfe 100644 --- a/impls/src/adapters/keybase.rs +++ b/impls/src/adapters/keybase.rs @@ -388,9 +388,7 @@ impl WalletCommAdapter for KeybaseWalletCommAdapter { match res { // Reply to the same channel with topic SLATE_SIGNED Ok(s) => { - let slate = - serde_json::to_string(&s).map_err(|_| ErrorKind::SlateSer)?; - let success = send(slate, channel, SLATE_SIGNED, TTL); + let success = send(s, channel, SLATE_SIGNED, TTL); if success { notify_on_receive( From 4b2bc5fc496539545a97fa510a9c4da935e3057c Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Mon, 20 May 2019 11:29:00 +0100 Subject: [PATCH 19/36] fix version string in yml (#113) --- src/bin/grin-wallet.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/bin/grin-wallet.yml b/src/bin/grin-wallet.yml index 22e7d613d..72525cc37 100644 --- a/src/bin/grin-wallet.yml +++ b/src/bin/grin-wallet.yml @@ -1,6 +1,6 @@ -name: grin -version: "1.0.1" -about: Lightweight implementation of the MimbleWimble protocol. +name: grin-wallet +version: "1.1.0" +about: Reference Grin Wallet author: The Grin Team args: From a45f8d3e9f7603bf3b457ab349de8a021ee6d15b Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Tue, 21 May 2019 17:00:19 +0800 Subject: [PATCH 20/36] fix: invoice transaction pay need update the slate height (#115) --- libwallet/src/api_impl/owner.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libwallet/src/api_impl/owner.rs b/libwallet/src/api_impl/owner.rs index fbb6358d0..1f1b94f7e 100644 --- a/libwallet/src/api_impl/owner.rs +++ b/libwallet/src/api_impl/owner.rs @@ -308,6 +308,9 @@ where None => None, }; + // update slate current height + ret_slate.height = w.w2n_client().get_chain_height()?; + let context = tx::add_inputs_to_slate( &mut *w, &mut ret_slate, From db818ac8b78a492b4955f70b3a16fd5c47ba43c9 Mon Sep 17 00:00:00 2001 From: jaspervdm Date: Tue, 21 May 2019 11:01:21 +0200 Subject: [PATCH 21/36] Remove double json encoding on http response (#114) --- controller/src/controller.rs | 29 +++-------------------------- 1 file changed, 3 insertions(+), 26 deletions(-) diff --git a/controller/src/controller.rs b/controller/src/controller.rs index cb7ea39b7..927781c16 100644 --- a/controller/src/controller.rs +++ b/controller/src/controller.rs @@ -766,7 +766,7 @@ where &self, req: Request, api: Foreign, - ) -> Box + Send> { + ) -> Box + Send> { Box::new(parse_body(req).and_then( //TODO: No way to insert a message from the params move |slate_str: String| { @@ -776,7 +776,7 @@ where err(e) } else { match api.receive_tx(&slate, None, None) { - Ok(s) => ok(serde_json::to_string(&s).unwrap()), + Ok(s) => ok(s), Err(e) => { error!("receive_tx: failed with error: {}", e); err(e) @@ -803,7 +803,7 @@ where ), "receive_tx" => Box::new( self.receive_tx(req, api) - .and_then(|res| ok(json_response_slate(&res))), + .and_then(|res| ok(json_response(&res))), ), _ => Box::new(ok(response(StatusCode::BAD_REQUEST, "unknown action"))), } @@ -915,29 +915,6 @@ where } } -// As above, dealing with stringified slate output -// from older versions. -// Older versions are expecting a slate objects, anything from -// 1.1.0 up is expecting a string -fn json_response_slate(s: &T) -> Response -where - T: Serialize, -{ - match serde_json::to_string(s) { - Ok(mut json) => { - if let None = json.find("version_info") { - let mut r = json.clone(); - r.pop(); - r.remove(0); - // again, for backwards slate compat - json = r.replace("\\\"", "\"") - } - response(StatusCode::OK, json) - } - Err(_) => response(StatusCode::INTERNAL_SERVER_ERROR, ""), - } -} - // pretty-printed version of above fn json_response_pretty(s: &T) -> Response where From 85b55f5ca7e7194f294fa65a4a68270146f1a46e Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Thu, 23 May 2019 16:27:57 +0100 Subject: [PATCH 22/36] Add participant ID as part of key to stored private transaction context data (#117) * add participant_id to saved tranasction context data * rustfmt? * change participant id for command line pay command --- api/src/owner.rs | 20 +++++++------- api/src/owner_rpc.rs | 11 ++++---- controller/src/command.rs | 8 +++--- controller/src/controller.rs | 2 +- controller/tests/accounts.rs | 2 +- controller/tests/check.rs | 2 +- controller/tests/file.rs | 2 +- controller/tests/invoice.rs | 42 ++++++++++++++++++++++++++--- controller/tests/repost.rs | 4 +-- controller/tests/restore.rs | 8 +++--- controller/tests/self_send.rs | 2 +- controller/tests/transaction.rs | 6 ++--- impls/src/backends/lmdb.rs | 37 ++++++++++++++++++++----- impls/src/test_framework/mod.rs | 2 +- libwallet/src/api_impl/foreign.rs | 4 +-- libwallet/src/api_impl/owner.rs | 18 ++++++++----- libwallet/src/internal/selection.rs | 2 ++ libwallet/src/types.rs | 23 +++++++++++++--- libwallet/tests/libwallet.rs | 8 +++--- 19 files changed, 144 insertions(+), 59 deletions(-) diff --git a/api/src/owner.rs b/api/src/owner.rs index 17868ec0a..bc6d96617 100644 --- a/api/src/owner.rs +++ b/api/src/owner.rs @@ -482,7 +482,7 @@ where /// // Send slate somehow /// // ... /// // Lock our outputs if we're happy the slate was (or is being) sent - /// api_owner.tx_lock_outputs(&slate); + /// api_owner.tx_lock_outputs(&slate, 0); /// } /// ``` @@ -513,7 +513,7 @@ where ))?; } } - self.tx_lock_outputs(&slate)?; + self.tx_lock_outputs(&slate, 0)?; let slate = match sa.finalize { true => self.finalize_tx(&slate)?, false => slate, @@ -645,6 +645,8 @@ where /// /// # Arguments /// * `slate` - The transaction [`Slate`](../grin_wallet_libwallet/slate/struct.Slate.html). All + /// * `participant_id` - The participant id, generally 0 for the party putting in funds, 1 for the + /// party receiving. /// elements in the `input` vector of the `tx` field that are found in the wallet's currently /// active account will be set to status `Locked` /// @@ -676,14 +678,14 @@ where /// // Send slate somehow /// // ... /// // Lock our outputs if we're happy the slate was (or is being) sent - /// api_owner.tx_lock_outputs(&slate); + /// api_owner.tx_lock_outputs(&slate, 0); /// } /// ``` - pub fn tx_lock_outputs(&self, slate: &Slate) -> Result<(), Error> { + pub fn tx_lock_outputs(&self, slate: &Slate, participant_id: usize) -> Result<(), Error> { let mut w = self.wallet.lock(); w.open_with_credentials()?; - let res = owner::tx_lock_outputs(&mut *w, slate); + let res = owner::tx_lock_outputs(&mut *w, slate, participant_id); w.close()?; res } @@ -734,7 +736,7 @@ where /// // Send slate somehow /// // ... /// // Lock our outputs if we're happy the slate was (or is being) sent - /// let res = api_owner.tx_lock_outputs(&slate); + /// let res = api_owner.tx_lock_outputs(&slate, 0); /// // /// // Retrieve slate back from recipient /// // @@ -791,7 +793,7 @@ where /// // Send slate somehow /// // ... /// // Lock our outputs if we're happy the slate was (or is being) sent - /// let res = api_owner.tx_lock_outputs(&slate); + /// let res = api_owner.tx_lock_outputs(&slate, 0); /// // /// // Retrieve slate back from recipient /// // @@ -852,7 +854,7 @@ where /// // Send slate somehow /// // ... /// // Lock our outputs if we're happy the slate was (or is being) sent - /// let res = api_owner.tx_lock_outputs(&slate); + /// let res = api_owner.tx_lock_outputs(&slate, 0); /// // /// // We didn't get the slate back, or something else went wrong /// // @@ -945,7 +947,7 @@ where /// // Send slate somehow /// // ... /// // Lock our outputs if we're happy the slate was (or is being) sent - /// let res = api_owner.tx_lock_outputs(&slate); + /// let res = api_owner.tx_lock_outputs(&slate, 0); /// // /// // Retrieve slate back from recipient /// // diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index 8b2f33f61..aea645afa 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -690,7 +690,8 @@ pub trait OwnerRpc { "orig_version": 2, "version": 2 } - } + }, + 0 ] } # "# @@ -708,7 +709,7 @@ pub trait OwnerRpc { ``` */ - fn tx_lock_outputs(&self, slate: Slate) -> Result<(), ErrorKind>; + fn tx_lock_outputs(&self, slate: Slate, participant_id: usize) -> Result<(), ErrorKind>; /** Networked version of [Owner::finalize_tx](struct.Owner.html#method.finalize_tx). @@ -1293,8 +1294,8 @@ where Owner::finalize_tx(self, &mut slate).map_err(|e| e.kind()) } - fn tx_lock_outputs(&self, mut slate: Slate) -> Result<(), ErrorKind> { - Owner::tx_lock_outputs(self, &mut slate).map_err(|e| e.kind()) + fn tx_lock_outputs(&self, mut slate: Slate, participant_id: usize) -> Result<(), ErrorKind> { + Owner::tx_lock_outputs(self, &mut slate, participant_id).map_err(|e| e.kind()) } fn cancel_tx(&self, tx_id: Option, tx_slate_id: Option) -> Result<(), ErrorKind> { @@ -1420,7 +1421,7 @@ pub fn run_doctest_owner( // Spit out slate for input to finalize_tx println!("{}", serde_json::to_string_pretty(&slate).unwrap()); if lock_tx { - api_impl::owner::tx_lock_outputs(&mut *w, &slate).unwrap(); + api_impl::owner::tx_lock_outputs(&mut *w, &slate, 0).unwrap(); } if finalize_tx { api_impl::owner::finalize_tx(&mut *w, &slate).unwrap(); diff --git a/controller/src/command.rs b/controller/src/command.rs index 346db7e37..4c57c3c8f 100644 --- a/controller/src/command.rs +++ b/controller/src/command.rs @@ -300,7 +300,7 @@ pub fn send( }; if adapter.supports_sync() { slate = adapter.send_tx_sync(&args.dest, &slate)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; if args.method == "self" { controller::foreign_single_use(wallet, |api| { slate = api.receive_tx(&slate, Some(&args.dest), None)?; @@ -314,7 +314,7 @@ pub fn send( slate = api.finalize_tx(&slate)?; } else { adapter.send_tx_async(&args.dest, &slate)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; } if adapter.supports_sync() { let result = api.post_tx(&slate.tx, args.fluff); @@ -536,7 +536,7 @@ pub fn process_invoice( }; if adapter.supports_sync() { slate = adapter.send_tx_sync(&args.dest, &slate)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; if args.method == "self" { controller::foreign_single_use(wallet, |api| { slate = api.finalize_invoice_tx(&slate)?; @@ -545,7 +545,7 @@ pub fn process_invoice( } } else { adapter.send_tx_async(&args.dest, &slate)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; } } Ok(()) diff --git a/controller/src/controller.rs b/controller/src/controller.rs index 927781c16..73b2dc308 100644 --- a/controller/src/controller.rs +++ b/controller/src/controller.rs @@ -400,7 +400,7 @@ where ))?; } } - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; if args.method != "file" { slate = api.finalize_tx(&slate)?; } diff --git a/controller/tests/accounts.rs b/controller/tests/accounts.rs index 1feb699dc..e773d9a18 100644 --- a/controller/tests/accounts.rs +++ b/controller/tests/accounts.rs @@ -191,7 +191,7 @@ fn accounts_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { }; let mut slate = api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; slate = api.finalize_tx(&slate)?; api.post_tx(&slate.tx, false)?; Ok(()) diff --git a/controller/tests/check.rs b/controller/tests/check.rs index cf8d2a0ef..cd17ad942 100644 --- a/controller/tests/check.rs +++ b/controller/tests/check.rs @@ -192,7 +192,7 @@ fn check_repair_impl(test_dir: &str) -> Result<(), libwallet::Error> { let file_adapter = FileWalletCommAdapter::new(); let send_file = format!("{}/part_tx_1.tx", test_dir); file_adapter.send_tx_async(&send_file, &mut slate)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; Ok(()) })?; diff --git a/controller/tests/file.rs b/controller/tests/file.rs index a41989bd3..0ac743814 100644 --- a/controller/tests/file.rs +++ b/controller/tests/file.rs @@ -121,7 +121,7 @@ fn file_exchange_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { // output tx file let file_adapter = FileWalletCommAdapter::new(); file_adapter.send_tx_async(&send_file, &mut slate)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; Ok(()) })?; diff --git a/controller/tests/invoice.rs b/controller/tests/invoice.rs index faf61253e..7d31e2d3e 100644 --- a/controller/tests/invoice.rs +++ b/controller/tests/invoice.rs @@ -124,7 +124,7 @@ fn invoice_tx_impl(test_dir: &str) -> Result<(), libwallet::Error> { ..Default::default() }; slate = api.process_invoice_tx(&slate, args)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; Ok(()) })?; @@ -160,9 +160,6 @@ fn invoice_tx_impl(test_dir: &str) -> Result<(), libwallet::Error> { Ok(()) })?; - // let logging finish - thread::sleep(Duration::from_millis(200)); - // Check transaction log for wallet 1, ensure only 1 entry // exists wallet::controller::owner_single_use(wallet1.clone(), |api| { @@ -176,7 +173,44 @@ fn invoice_tx_impl(test_dir: &str) -> Result<(), libwallet::Error> { ); Ok(()) })?; + + // Test self-sending + wallet::controller::owner_single_use(wallet1.clone(), |api| { + // Wallet 1 inititates an invoice transaction, requesting payment + let args = IssueInvoiceTxArgs { + amount: reward * 2, + ..Default::default() + }; + slate = api.issue_invoice_tx(args)?; + // Wallet 1 receives the invoice transaction + let args = InitTxArgs { + src_acct_name: None, + amount: slate.amount, + minimum_confirmations: 2, + max_outputs: 500, + num_change_outputs: 1, + selection_strategy_is_use_all: true, + ..Default::default() + }; + slate = api.process_invoice_tx(&slate, args)?; + api.tx_lock_outputs(&slate, 0)?; + Ok(()) + })?; + + // wallet 1 finalizes and posts + wallet::controller::foreign_single_use(wallet1.clone(), |api| { + // Wallet 2 receives the invoice transaction + slate = api.finalize_invoice_tx(&slate)?; + Ok(()) + })?; + + let _ = test_framework::award_blocks_to_wallet(&chain, wallet1.clone(), 3, false); + //bh += 3; + + // let logging finish + thread::sleep(Duration::from_millis(200)); } + teardown(test_dir); Ok(()) } diff --git a/controller/tests/repost.rs b/controller/tests/repost.rs index 0df02e9a6..856dc472a 100644 --- a/controller/tests/repost.rs +++ b/controller/tests/repost.rs @@ -116,7 +116,7 @@ fn file_repost_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { // output tx file let file_adapter = FileWalletCommAdapter::new(); file_adapter.send_tx_async(&send_file, &mut slate)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; Ok(()) })?; @@ -211,7 +211,7 @@ fn file_repost_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { }; let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate_i)?; - sender_api.tx_lock_outputs(&slate)?; + sender_api.tx_lock_outputs(&slate, 0)?; slate = sender_api.finalize_tx(&mut slate)?; Ok(()) })?; diff --git a/controller/tests/restore.rs b/controller/tests/restore.rs index c2cc82414..b4261a540 100644 --- a/controller/tests/restore.rs +++ b/controller/tests/restore.rs @@ -247,7 +247,7 @@ fn setup_restore(test_dir: &str) -> Result<(), libwallet::Error> { }; let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate_i)?; - sender_api.tx_lock_outputs(&slate)?; + sender_api.tx_lock_outputs(&slate, 0)?; slate = sender_api.finalize_tx(&slate)?; sender_api.post_tx(&slate.tx, false)?; Ok(()) @@ -270,7 +270,7 @@ fn setup_restore(test_dir: &str) -> Result<(), libwallet::Error> { }; let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet3", &slate_i)?; - sender_api.tx_lock_outputs(&slate)?; + sender_api.tx_lock_outputs(&slate, 0)?; slate = sender_api.finalize_tx(&slate)?; sender_api.post_tx(&slate.tx, false)?; Ok(()) @@ -293,7 +293,7 @@ fn setup_restore(test_dir: &str) -> Result<(), libwallet::Error> { }; let slate_i = sender_api.init_send_tx(args)?; slate = client3.send_tx_slate_direct("wallet2", &slate_i)?; - sender_api.tx_lock_outputs(&slate)?; + sender_api.tx_lock_outputs(&slate, 0)?; slate = sender_api.finalize_tx(&slate)?; sender_api.post_tx(&slate.tx, false)?; Ok(()) @@ -322,7 +322,7 @@ fn setup_restore(test_dir: &str) -> Result<(), libwallet::Error> { }; let slate_i = sender_api.init_send_tx(args)?; slate = client3.send_tx_slate_direct("wallet2", &slate_i)?; - sender_api.tx_lock_outputs(&slate)?; + sender_api.tx_lock_outputs(&slate, 0)?; slate = sender_api.finalize_tx(&slate)?; sender_api.post_tx(&slate.tx, false)?; Ok(()) diff --git a/controller/tests/self_send.rs b/controller/tests/self_send.rs index 20ab2280b..f7efd2f25 100644 --- a/controller/tests/self_send.rs +++ b/controller/tests/self_send.rs @@ -97,7 +97,7 @@ fn self_send_test_impl(test_dir: &str) -> Result<(), libwallet::Error> { ..Default::default() }; let mut slate = api.init_send_tx(args)?; - api.tx_lock_outputs(&slate)?; + api.tx_lock_outputs(&slate, 0)?; // Send directly to self wallet::controller::foreign_single_use(wallet1.clone(), |api| { slate = api.receive_tx(&slate, Some("listener"), None)?; diff --git a/controller/tests/transaction.rs b/controller/tests/transaction.rs index bd121e2f1..336a8577f 100644 --- a/controller/tests/transaction.rs +++ b/controller/tests/transaction.rs @@ -115,7 +115,7 @@ fn basic_transaction_api(test_dir: &str) -> Result<(), libwallet::Error> { assert_eq!(0, slate.lock_height); slate = client1.send_tx_slate_direct("wallet2", &slate_i)?; - sender_api.tx_lock_outputs(&slate)?; + sender_api.tx_lock_outputs(&slate, 0)?; slate = sender_api.finalize_tx(&slate)?; // Check we have a single kernel and that it is a Plain kernel (no lock_height). @@ -297,7 +297,7 @@ fn basic_transaction_api(test_dir: &str) -> Result<(), libwallet::Error> { }; let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate_i)?; - sender_api.tx_lock_outputs(&slate)?; + sender_api.tx_lock_outputs(&slate, 0)?; slate = sender_api.finalize_tx(&slate)?; Ok(()) })?; @@ -397,7 +397,7 @@ fn tx_rollback(test_dir: &str) -> Result<(), libwallet::Error> { let slate_i = sender_api.init_send_tx(args)?; slate = client1.send_tx_slate_direct("wallet2", &slate_i)?; - sender_api.tx_lock_outputs(&slate)?; + sender_api.tx_lock_outputs(&slate, 0)?; slate = sender_api.finalize_tx(&slate)?; Ok(()) })?; diff --git a/impls/src/backends/lmdb.rs b/impls/src/backends/lmdb.rs index 3fd9df74c..6d274dd51 100644 --- a/impls/src/backends/lmdb.rs +++ b/impls/src/backends/lmdb.rs @@ -250,8 +250,16 @@ where Box::new(self.db.iter(&[TX_LOG_ENTRY_PREFIX]).unwrap().map(|o| o.1)) } - fn get_private_context(&mut self, slate_id: &[u8]) -> Result { - let ctx_key = to_key(PRIVATE_TX_CONTEXT_PREFIX, &mut slate_id.to_vec()); + fn get_private_context( + &mut self, + slate_id: &[u8], + participant_id: usize, + ) -> Result { + let ctx_key = to_key_u64( + PRIVATE_TX_CONTEXT_PREFIX, + &mut slate_id.to_vec(), + participant_id as u64, + ); let (blind_xor_key, nonce_xor_key) = private_ctx_xor_keys(self.keychain(), slate_id)?; let mut ctx: Context = option_to_not_found( @@ -538,8 +546,17 @@ where self.save(out.clone()) } - fn save_private_context(&mut self, slate_id: &[u8], ctx: &Context) -> Result<(), Error> { - let ctx_key = to_key(PRIVATE_TX_CONTEXT_PREFIX, &mut slate_id.to_vec()); + fn save_private_context( + &mut self, + slate_id: &[u8], + participant_id: usize, + ctx: &Context, + ) -> Result<(), Error> { + let ctx_key = to_key_u64( + PRIVATE_TX_CONTEXT_PREFIX, + &mut slate_id.to_vec(), + participant_id as u64, + ); let (blind_xor_key, nonce_xor_key) = private_ctx_xor_keys(self.keychain(), slate_id)?; let mut s_ctx = ctx.clone(); @@ -556,8 +573,16 @@ where Ok(()) } - fn delete_private_context(&mut self, slate_id: &[u8]) -> Result<(), Error> { - let ctx_key = to_key(PRIVATE_TX_CONTEXT_PREFIX, &mut slate_id.to_vec()); + fn delete_private_context( + &mut self, + slate_id: &[u8], + participant_id: usize, + ) -> Result<(), Error> { + let ctx_key = to_key_u64( + PRIVATE_TX_CONTEXT_PREFIX, + &mut slate_id.to_vec(), + participant_id as u64, + ); self.db .borrow() .as_ref() diff --git a/impls/src/test_framework/mod.rs b/impls/src/test_framework/mod.rs index 3ad0d2ffc..9aac68292 100644 --- a/impls/src/test_framework/mod.rs +++ b/impls/src/test_framework/mod.rs @@ -207,7 +207,7 @@ where }; let slate_i = owner::init_send_tx(&mut *w, args, test_mode)?; let slate = client.send_tx_slate_direct(dest, &slate_i)?; - owner::tx_lock_outputs(&mut *w, &slate)?; + owner::tx_lock_outputs(&mut *w, &slate, 0)?; let slate = owner::finalize_tx(&mut *w, &slate)?; w.close()?; slate diff --git a/libwallet/src/api_impl/foreign.rs b/libwallet/src/api_impl/foreign.rs index 713d4b2a2..975d14b7e 100644 --- a/libwallet/src/api_impl/foreign.rs +++ b/libwallet/src/api_impl/foreign.rs @@ -118,13 +118,13 @@ where K: Keychain, { let mut sl = slate.clone(); - let context = w.get_private_context(sl.id.as_bytes())?; + let context = w.get_private_context(sl.id.as_bytes(), 1)?; tx::complete_tx(&mut *w, &mut sl, 1, &context)?; tx::update_stored_tx(&mut *w, &mut sl, true)?; tx::update_message(&mut *w, &mut sl)?; { let mut batch = w.batch()?; - batch.delete_private_context(sl.id.as_bytes())?; + batch.delete_private_context(sl.id.as_bytes(), 1)?; batch.commit()?; } Ok(sl) diff --git a/libwallet/src/api_impl/owner.rs b/libwallet/src/api_impl/owner.rs index 1f1b94f7e..51f03293a 100644 --- a/libwallet/src/api_impl/owner.rs +++ b/libwallet/src/api_impl/owner.rs @@ -201,7 +201,7 @@ where // recieve the transaction back { let mut batch = w.batch()?; - batch.save_private_context(slate.id.as_bytes(), &context)?; + batch.save_private_context(slate.id.as_bytes(), 0, &context)?; batch.commit()?; } if let Some(v) = args.target_slate_version { @@ -255,7 +255,7 @@ where // recieve the transaction back { let mut batch = w.batch()?; - batch.save_private_context(slate.id.as_bytes(), &context)?; + batch.save_private_context(slate.id.as_bytes(), 1, &context)?; batch.commit()?; } @@ -329,7 +329,7 @@ where // recieve the transaction back { let mut batch = w.batch()?; - batch.save_private_context(slate.id.as_bytes(), &context)?; + batch.save_private_context(slate.id.as_bytes(), 0, &context)?; batch.commit()?; } @@ -337,13 +337,17 @@ where } /// Lock sender outputs -pub fn tx_lock_outputs(w: &mut T, slate: &Slate) -> Result<(), Error> +pub fn tx_lock_outputs( + w: &mut T, + slate: &Slate, + participant_id: usize, +) -> Result<(), Error> where T: WalletBackend, C: NodeClient, K: Keychain, { - let context = w.get_private_context(slate.id.as_bytes())?; + let context = w.get_private_context(slate.id.as_bytes(), participant_id)?; selection::lock_tx_context(&mut *w, slate, &context) } @@ -355,13 +359,13 @@ where K: Keychain, { let mut sl = slate.clone(); - let context = w.get_private_context(sl.id.as_bytes())?; + let context = w.get_private_context(sl.id.as_bytes(), 0)?; tx::complete_tx(&mut *w, &mut sl, 0, &context)?; tx::update_stored_tx(&mut *w, &mut sl, false)?; tx::update_message(&mut *w, &mut sl)?; { let mut batch = w.batch()?; - batch.delete_private_context(sl.id.as_bytes())?; + batch.delete_private_context(sl.id.as_bytes(), 0)?; batch.commit()?; } Ok(sl) diff --git a/libwallet/src/internal/selection.rs b/libwallet/src/internal/selection.rs index 927a04d75..8bb1c1f61 100644 --- a/libwallet/src/internal/selection.rs +++ b/libwallet/src/internal/selection.rs @@ -66,6 +66,7 @@ where blinding.secret_key(&keychain.secp()).unwrap(), &parent_key_id, use_test_nonce, + 0, ); context.fee = fee; @@ -199,6 +200,7 @@ where .unwrap(), &parent_key_id, use_test_rng, + 1, ); context.add_output(&key_id, &None, amount); diff --git a/libwallet/src/types.rs b/libwallet/src/types.rs index c79a28b65..3c9fd3c36 100644 --- a/libwallet/src/types.rs +++ b/libwallet/src/types.rs @@ -95,7 +95,11 @@ where fn get_tx_log_entry(&self, uuid: &Uuid) -> Result, Error>; /// Retrieves the private context associated with a given slate id - fn get_private_context(&mut self, slate_id: &[u8]) -> Result; + fn get_private_context( + &mut self, + slate_id: &[u8], + participant_id: usize, + ) -> Result; /// Iterate over all output data stored by the backend fn tx_log_iter<'a>(&'a self) -> Box + 'a>; @@ -181,10 +185,19 @@ where fn lock_output(&mut self, out: &mut OutputData) -> Result<(), Error>; /// Saves the private context associated with a slate id - fn save_private_context(&mut self, slate_id: &[u8], ctx: &Context) -> Result<(), Error>; + fn save_private_context( + &mut self, + slate_id: &[u8], + participant_id: usize, + ctx: &Context, + ) -> Result<(), Error>; /// Delete the private context associated with the slate id - fn delete_private_context(&mut self, slate_id: &[u8]) -> Result<(), Error>; + fn delete_private_context( + &mut self, + slate_id: &[u8], + participant_id: usize, + ) -> Result<(), Error>; /// Write the wallet data to backend file fn commit(&self) -> Result<(), Error>; @@ -391,6 +404,8 @@ pub struct Context { pub input_ids: Vec<(Identifier, Option, u64)>, /// store the calculated fee pub fee: u64, + /// keep track of the participant id + pub participant_id: usize, } impl Context { @@ -400,6 +415,7 @@ impl Context { sec_key: SecretKey, parent_key_id: &Identifier, use_test_rng: bool, + participant_id: usize, ) -> Context { let sec_nonce = match use_test_rng { false => aggsig::create_secnonce(secp).unwrap(), @@ -412,6 +428,7 @@ impl Context { input_ids: vec![], output_ids: vec![], fee: 0, + participant_id: participant_id, } } } diff --git a/libwallet/tests/libwallet.rs b/libwallet/tests/libwallet.rs index 76fea7835..b3bcfb349 100644 --- a/libwallet/tests/libwallet.rs +++ b/libwallet/tests/libwallet.rs @@ -71,7 +71,7 @@ fn aggsig_sender_receiver_interaction() { let blind = blinding_factor.secret_key(&keychain.secp()).unwrap(); - s_cx = Context::new(&keychain.secp(), blind, &parent, false); + s_cx = Context::new(&keychain.secp(), blind, &parent, false, 0); s_cx.get_public_keys(&keychain.secp()) }; @@ -85,7 +85,7 @@ fn aggsig_sender_receiver_interaction() { // let blind = blind_sum.secret_key(&keychain.secp())?; let blind = keychain.derive_key(0, &key_id).unwrap(); - rx_cx = Context::new(&keychain.secp(), blind, &parent, false); + rx_cx = Context::new(&keychain.secp(), blind, &parent, false, 1); let (pub_excess, pub_nonce) = rx_cx.get_public_keys(&keychain.secp()); rx_cx.add_output(&key_id, &None, 0); @@ -289,7 +289,7 @@ fn aggsig_sender_receiver_interaction_offset() { let blind = blinding_factor.secret_key(&keychain.secp()).unwrap(); - s_cx = Context::new(&keychain.secp(), blind, &parent, false); + s_cx = Context::new(&keychain.secp(), blind, &parent, false, 0); s_cx.get_public_keys(&keychain.secp()) }; @@ -302,7 +302,7 @@ fn aggsig_sender_receiver_interaction_offset() { let blind = keychain.derive_key(0, &key_id).unwrap(); - rx_cx = Context::new(&keychain.secp(), blind, &parent, false); + rx_cx = Context::new(&keychain.secp(), blind, &parent, false, 1); let (pub_excess, pub_nonce) = rx_cx.get_public_keys(&keychain.secp()); rx_cx.add_output(&key_id, &None, 0); From ad59c601e7d3b9ead4260b9c746737dffb5287b2 Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Fri, 24 May 2019 22:43:05 +0800 Subject: [PATCH 23/36] change the api repository to grin-wallet instead of grin (#118) --- api/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/Cargo.toml b/api/Cargo.toml index 740ddbcbd..746c58def 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -4,7 +4,7 @@ version = "1.1.0-beta.3" authors = ["Grin Developers "] description = "Grin Wallet API" license = "Apache-2.0" -repository = "https://github.com/mimblewimble/grin" +repository = "https://github.com/mimblewimble/grin-wallet" keywords = [ "crypto", "grin", "mimblewimble" ] exclude = ["**/*.grin", "**/*.grin2"] edition = "2018" From 84e6c71e8fb6f1c9eebca7f2c013a63f0cad09d5 Mon Sep 17 00:00:00 2001 From: jaspervdm Date: Mon, 27 May 2019 11:44:48 +0200 Subject: [PATCH 24/36] Test (#119) --- integration/Cargo.toml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/integration/Cargo.toml b/integration/Cargo.toml index 7b1522500..a62457346 100644 --- a/integration/Cargo.toml +++ b/integration/Cargo.toml @@ -24,16 +24,16 @@ tokio = "0.1.11" blake2-rfc = "0.2" bufstream = "0.1" -grin_apiwallet = { path = "../apiwallet", version = "1.1.0" } -grin_libwallet = { path = "../libwallet", version = "1.1.0" } -grin_refwallet = { path = "../refwallet", version = "1.1.0" } -grin_wallet_config = { path = "../config", version = "1.1.0" } +#grin_apiwallet = { path = "../apiwallet", version = "1.1.0" } +#grin_libwallet = { path = "../libwallet", version = "1.1.0" } +#grin_refwallet = { path = "../refwallet", version = "1.1.0" } +#grin_wallet_config = { path = "../config", version = "1.1.0" } -grin_core = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -grin_util = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -grin_api = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -grin_store = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -grin_p2p = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } -grin_servers = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } +#grin_core = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } +#grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } +#grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } +#grin_util = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } +#grin_api = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } +#grin_store = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } +#grin_p2p = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } +#grin_servers = { git = "https://github.com/mimblewimble/grin", branch = "milestone/1.1.0" } From 757dfd0d9158f74d6c90b20d9cb5d375c17462ed Mon Sep 17 00:00:00 2001 From: Quentin Le Sceller Date: Wed, 29 May 2019 15:54:10 -0400 Subject: [PATCH 25/36] Remove Travis.yml (#124) --- .ci/release-jobs | 122 ----------------------------------------------- .travis.yml | 84 -------------------------------- 2 files changed, 206 deletions(-) delete mode 100755 .ci/release-jobs delete mode 100644 .travis.yml diff --git a/.ci/release-jobs b/.ci/release-jobs deleted file mode 100755 index 8e4ab070a..000000000 --- a/.ci/release-jobs +++ /dev/null @@ -1,122 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2019 The Grin Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# This script contains release-related jobs. - -# Redeclare CI and VCP specific environment variables -# to make future migration to other providers easier. -readonly JOB_ID="${TRAVIS_JOB_ID}" -readonly OS_NAME="${TRAVIS_OS_NAME}" -readonly TEST_RESULT="${TRAVIS_TEST_RESULT}" -readonly VCP_AUTH_TOKEN="${GITHUB_TOKEN}" - -case "${CI_JOB}" in - "release") - # The release can only be triggered after successful completion of all tests. - [[ "${TEST_RESULT}" != 0 ]] && exit 1 - - readonly REPO_TAG="$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD)" - - case "${OS_NAME}" in - "linux") - cargo clean && \ - cargo build --release - readonly ARCHIVE_CMD="tar zcf" - readonly BIN_SUFFIX="" - readonly PKG_NAME="grin-wallet-${REPO_TAG}-${JOB_ID}-linux-amd64" - readonly PKG_SUFFIX=".tgz" - ;; - - "osx") - brew update - cargo clean && \ - cargo build --release - readonly ARCHIVE_CMD="tar zcf" - readonly BIN_SUFFIX="" - readonly PKG_NAME="grin-wallet-${REPO_TAG}-${JOB_ID}-osx" - readonly PKG_SUFFIX=".tgz" - ;; - - "windows") - cargo clean && \ - cargo build --release - readonly ARCHIVE_CMD="7z a -tzip" - readonly BIN_SUFFIX=".exe" - readonly PKG_NAME="grin-wallet-${REPO_TAG}-${JOB_ID}-win-x64" - readonly PKG_SUFFIX=".zip" - ;; - - *) - printf "Error! Unknown \$OS_NAME: \`%s\`" "${OS_NAME}" - exit 1 - esac - - printf "creating package \`%s\` for the release binary...\n" "${PKG_NAME}${PKG_SUFFIX}" - - cd ./target/release/ || exit 1 - rm -f -- *"${PKG_SUFFIX}" - ${ARCHIVE_CMD} "${PKG_NAME}${PKG_SUFFIX}" "grin-wallet${BIN_SUFFIX}" - ls -ls -- *.tgz | cut -d' ' -f6- - openssl md5 "${PKG_NAME}${PKG_SUFFIX}" > "${PKG_NAME}${PKG_SUFFIX}-md5sum.txt" - ls -ls -- *-md5sum.txt | cut -d' ' -f6- - cd - > /dev/null || exit 1 - - printf "%s package \`%s\` generated\n" "${OS_NAME}" "${PKG_NAME}${PKG_SUFFIX}" - - # Generate changelog only on the Linux platform to avoid duplication. - [[ "${OS_NAME}" != "linux" ]] && exit 0 - - # Generate CHANGELOG.md - readonly REPO_SLUG="mimblewimble/grin-wallet" - readonly REPO_BRANCH="$(git symbolic-ref -q --short HEAD)" - readonly REPO_PREV_RELEASE_TAG="$(git describe --abbrev=0 --tags "$(git rev-list --tags --skip=0 --max-count=1)")" - - gem install github_changelog_generator - - # Needed by github_changelog_generator. - export CHANGELOG_GITHUB_TOKEN="${VCP_AUTH_TOKEN}" - - github_changelog_generator \ - --user "$(cut -d "/" -f1 <<< ${REPO_SLUG})" \ - --project "$(cut -d "/" -f2 <<< ${REPO_SLUG})" \ - --since-tag "${REPO_PREV_RELEASE_TAG}" - - readonly CHANGELOG_CONTENT="$( CHANGELOG.md - - readonly HEADERS="Authorization: token ${VCP_AUTH_TOKEN}" - readonly RELEASE_URL="https://api.github.com/repos/${REPO_SLUG}/releases" - readonly RELEASE_ID="$(curl -0 --request GET -H "${HEADERS}" "${RELEASE_URL}/tags/${REPO_TAG}" 2> /dev/null | grep id | head -n 1 | sed 's/ *"id": *\(.*\),/\1/')" - - printf "updating release changelog %s for repo: %s, branch: %s, release id: %s\n" "${REPO_TAG}" "${REPO_SLUG}" "${REPO_BRANCH}" "${RELEASE_ID}" - curl -H "${HEADERS}" --request PATCH --data @CHANGELOG.md "${RELEASE_URL}/${RELEASE_ID}" - printf "changelog uploaded.\n" - ;; -esac \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 23b20d92c..000000000 --- a/.travis.yml +++ /dev/null @@ -1,84 +0,0 @@ -# Copyright 2019 The Grin Developers -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -dist: trusty -sudo: required - -language: rust - -rust: - - stable - -git: - depth: false - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-5 - - cmake - - libcurl4-openssl-dev - - libelf-dev - - libdw-dev - - cmake - - gcc - - binutils-dev - -cache: - cargo: true - timeout: 240 - directories: - - $HOME/.cargo - - $TRAVIS_BUILD_DIR/target - -env: - global: - - RUST_BACKTRACE="1" - - RUST_FLAGS="-C debug-assertions" - -matrix: - include: - - os: linux - env: CI_JOB="test" CI_JOB_ARGS="config libwallet api" - - os: linux - env: CI_JOB="test" CI_JOB_ARGS="impls" - - os: linux - env: CI_JOB="test" CI_JOB_ARGS="controller ." - - os: linux - env: CI_JOB="release" CI_JOB_ARGS= - - os: osx - env: CI_JOB="release" CI_JOB_ARGS= -# - os: windows -# env: CI_JOB="release" CI_JOB_ARGS= - -script: .ci/general-jobs - -before_cache: - - rm -rf $TRAVIS_BUILD_DIR/target/tmp - -before_deploy: - - bash .ci/release-jobs - -deploy: - provider: releases - api_key: - secure: G2OxRSOSGAYq1mcQTYKliOiUaT8mGLp/ZFPTAjL7ByWa0OVxdlK+WEhzN7FrStdbcb1q8DNi/Mie9b2CurVjFGyqeGSCboTdYT77TDT1Wvxp9fPLG4xbgTRwAChq8o7TxOAqeC2J56HXz2Ed2529omJmn4ems6vqI9cHQ+NfpBfh6CKbPXRD7t6Ul6FygAuggYLJE5/e4ws6pRAaD0pFn3vhSab4Ka3L4LFcxffFzH2xt2fEzoA0/NjRxgD/w8wmq6om61+Jir6Zx41HH04R7zLSn7eWVxrw15o5CD4EPqhCRwYUf1kHAabaLiRcmIz9l7jtpcgzFo68A89bFROZ/GyTHazjjobLMSvo1zZnXPGyjx1MiIfOGLBo0842BuvGCEUD2ACiDoZge0+J7mzkdIVSKVx3y2sR3S7W6z4w0YZaS9pjyukhRfIYITomPUhFcJ6xTj1EsYyEAxr+Ohg5nDZgBpy9yjOmJyBKoQgdk8IMadbBO3dhCjkrw7HO4kdtwayEo/W87UH5b2thxbTsd7EWorMh+aCyzcRdRlNBUXI4pWTaP7vZPZGaBAzRYk4ETbUgxpFVxFFNlyie2TzSPz0/j/0JcG1IZxIh9eAI89ebGVKpVgFm6TQvb58J502g3dHwoGxL8lBQTc7DUQAAVBaNEnM5floFw04igQb6VQs= - file_glob: true - file: target/release/grin-wallet-*.* - skip_cleanup: true - on: - repo: mimblewimble/grin-wallet - tags: true From af16dea6e123fa6a1f40c8482a27b0a87cfd1d8c Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Thu, 30 May 2019 09:34:04 +0100 Subject: [PATCH 26/36] Version Info API Function tweak, remove 'min_compat_version' from slate (#123) * change slate version function to return list of supported slate formats * rustfmt * remove min_compat_version --- Cargo.lock | 20 ++++++++++++++++++++ api/src/foreign_rpc.rs | 17 ++++++++--------- api/src/owner_rpc.rs | 10 +--------- libwallet/Cargo.toml | 2 ++ libwallet/src/api_impl/foreign.rs | 8 +++++--- libwallet/src/api_impl/types.rs | 3 ++- libwallet/src/lib.rs | 4 ++++ libwallet/src/slate.rs | 9 --------- libwallet/src/slate_versions/mod.rs | 2 +- libwallet/src/slate_versions/v2.rs | 5 ----- 10 files changed, 43 insertions(+), 37 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 24c7d43c4..2d3188729 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -875,6 +875,8 @@ dependencies = [ "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", + "strum_macros 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2092,6 +2094,22 @@ name = "strsim" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "strum" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "strum_macros" +version = "0.15.0" +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-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "supercow" version = "0.1.0" @@ -2896,6 +2914,8 @@ dependencies = [ "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum string 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b639411d0b9c738748b5397d5ceba08e648f4f1992231aa859af1a017f31f60b" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" +"checksum strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1c33039533f051704951680f1adfd468fd37ac46816ded0d9ee068e60f05f" +"checksum strum_macros 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "47cd23f5c7dee395a00fa20135e2ec0fffcdfa151c56182966d7a3261343432e" "checksum supercow 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "171758edb47aa306a78dfa4ab9aeb5167405bd4e3dc2b64e88f6a84bbe98bd63" "checksum syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)" = "846620ec526c1599c070eff393bfeeeb88a93afa2513fc3b49f1fea84cf7b0ed" "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" diff --git a/api/src/foreign_rpc.rs b/api/src/foreign_rpc.rs index 634dfcab7..42ee6811c 100644 --- a/api/src/foreign_rpc.rs +++ b/api/src/foreign_rpc.rs @@ -50,8 +50,12 @@ pub trait ForeignRpc { "jsonrpc": "2.0", "result": { "Ok": { - "default_slate_version": 2, - "foreign_api_version": 2 + "foreign_api_version": 2, + "supported_slate_versions": [ + "V0", + "V1", + "V2" + ] } } } @@ -168,7 +172,6 @@ pub trait ForeignRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } @@ -207,8 +210,7 @@ pub trait ForeignRpc { { "version_info": { "version": 2, - "orig_version": 2, - "min_compat_version": 0 + "orig_version": 2 }, "num_participants": 2, "id": "0436430c-2b02-624c-2032-570501212b00", @@ -331,7 +333,6 @@ pub trait ForeignRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } @@ -365,8 +366,7 @@ pub trait ForeignRpc { "params": [{ "version_info": { "version": 2, - "orig_version": 2, - "min_compat_version": 0 + "orig_version": 2 }, "num_participants": 2, "id": "0436430c-2b02-624c-2032-570501212b00", @@ -499,7 +499,6 @@ pub trait ForeignRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index aea645afa..244355ce4 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -389,7 +389,6 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } @@ -469,7 +468,6 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } @@ -533,7 +531,6 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } @@ -617,7 +614,6 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } @@ -686,7 +682,6 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } @@ -725,8 +720,7 @@ pub trait OwnerRpc { { "version_info": { "version": 2, - "orig_version": 2, - "min_compat_version": 0 + "orig_version": 2 }, "num_participants": 2, "id": "0436430c-2b02-624c-2032-570501212b00", @@ -860,7 +854,6 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } @@ -1119,7 +1112,6 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "min_compat_version": 0, "orig_version": 2, "version": 2 } diff --git a/libwallet/Cargo.toml b/libwallet/Cargo.toml index 07d4e70a4..55ece25ba 100644 --- a/libwallet/Cargo.toml +++ b/libwallet/Cargo.toml @@ -22,6 +22,8 @@ log = "0.4" uuid = { version = "0.7", features = ["serde", "v4"] } chrono = { version = "0.4.4", features = ["serde"] } lazy_static = "1" +strum = "0.15" +strum_macros = "0.15" grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } diff --git a/libwallet/src/api_impl/foreign.rs b/libwallet/src/api_impl/foreign.rs index 975d14b7e..e49d1ecdd 100644 --- a/libwallet/src/api_impl/foreign.rs +++ b/libwallet/src/api_impl/foreign.rs @@ -13,12 +13,14 @@ // limitations under the License. //! Generic implementation of owner API functions +use strum::IntoEnumIterator; use crate::grin_keychain::Keychain; use crate::internal::{tx, updater}; +use crate::slate_versions::SlateVersion; use crate::{ - slate_versions, BlockFees, CbData, Error, ErrorKind, NodeClient, Slate, TxLogEntryType, - VersionInfo, WalletBackend, + BlockFees, CbData, Error, ErrorKind, NodeClient, Slate, TxLogEntryType, VersionInfo, + WalletBackend, }; const FOREIGN_API_VERSION: u16 = 2; @@ -28,7 +30,7 @@ const USER_MESSAGE_MAX_LEN: usize = 256; pub fn check_version() -> VersionInfo { VersionInfo { foreign_api_version: FOREIGN_API_VERSION, - default_slate_version: slate_versions::CURRENT_SLATE_VERSION, + supported_slate_versions: SlateVersion::iter().collect(), } } diff --git a/libwallet/src/api_impl/types.rs b/libwallet/src/api_impl/types.rs index 965ec87dc..07e7f0afe 100644 --- a/libwallet/src/api_impl/types.rs +++ b/libwallet/src/api_impl/types.rs @@ -18,6 +18,7 @@ use crate::grin_core::core::{Output, TxKernel}; use crate::grin_core::libtx::secp_ser; use crate::grin_keychain::Identifier; use crate::grin_util::secp::pedersen; +use crate::slate_versions::SlateVersion; use crate::types::OutputData; /// Send TX API Args @@ -218,5 +219,5 @@ pub struct VersionInfo { /// API version pub foreign_api_version: u16, /// Slate version - pub default_slate_version: u16, + pub supported_slate_versions: Vec, } diff --git a/libwallet/src/lib.rs b/libwallet/src/lib.rs index 90629abc4..b5a747b80 100644 --- a/libwallet/src/lib.rs +++ b/libwallet/src/lib.rs @@ -39,6 +39,10 @@ extern crate log; #[macro_use] extern crate lazy_static; +extern crate strum; +#[macro_use] +extern crate strum_macros; + pub mod api_impl; mod error; mod internal; diff --git a/libwallet/src/slate.rs b/libwallet/src/slate.rs index c897ed561..f044664f4 100644 --- a/libwallet/src/slate.rs +++ b/libwallet/src/slate.rs @@ -185,8 +185,6 @@ pub struct VersionCompatInfo { pub version: u16, /// Original version this slate was converted from pub orig_version: u16, - /// Minimum version this slate is compatible with - pub min_compat_version: u16, } /// Helper just to facilitate serialization @@ -240,7 +238,6 @@ impl Slate { version_info: VersionCompatInfo { version: CURRENT_SLATE_VERSION, orig_version: CURRENT_SLATE_VERSION, - min_compat_version: 0, }, } } @@ -816,15 +813,12 @@ impl From<&VersionCompatInfo> for VersionCompatInfoV2 { let VersionCompatInfo { version, orig_version, - min_compat_version, } = data; let version = *version; let orig_version = *orig_version; - let min_compat_version = *min_compat_version; VersionCompatInfoV2 { version, orig_version, - min_compat_version, } } } @@ -969,15 +963,12 @@ impl From<&VersionCompatInfoV2> for VersionCompatInfo { let VersionCompatInfoV2 { version, orig_version, - min_compat_version, } = data; let version = *version; let orig_version = *orig_version; - let min_compat_version = *min_compat_version; VersionCompatInfo { version, orig_version, - min_compat_version, } } } diff --git a/libwallet/src/slate_versions/mod.rs b/libwallet/src/slate_versions/mod.rs index d92037a58..859137526 100644 --- a/libwallet/src/slate_versions/mod.rs +++ b/libwallet/src/slate_versions/mod.rs @@ -30,7 +30,7 @@ pub mod v2; pub const CURRENT_SLATE_VERSION: u16 = 2; /// Existing versions of the slate -#[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] +#[derive(EnumIter, Serialize, Deserialize, Clone, Debug, PartialEq, PartialOrd, Eq, Ord)] pub enum SlateVersion { /// V0 V0, diff --git a/libwallet/src/slate_versions/v2.rs b/libwallet/src/slate_versions/v2.rs index 62e563e78..aac54292d 100644 --- a/libwallet/src/slate_versions/v2.rs +++ b/libwallet/src/slate_versions/v2.rs @@ -33,7 +33,6 @@ //! * VersionCompatInfo struct created with fields and added to beginning of struct //! version: u16 //! orig_verion: u16, -//! min_compat_version: u16 use crate::grin_core::core::transaction::{KernelFeatures, OutputFeatures}; use crate::grin_core::libtx::secp_ser; @@ -84,8 +83,6 @@ pub struct VersionCompatInfoV2 { pub version: u16, /// Original version this slate was converted from pub orig_version: u16, - /// Minimum version this slate is compatible with - pub min_compat_version: u16, } #[derive(Serialize, Deserialize, Debug, Clone)] @@ -338,13 +335,11 @@ impl From for SlateV2 { } = slate; let tx = TransactionV2::from(tx); let version = 2; - let min_compat_version = 0; let orig_version = orig_version as u16; let participant_data = map_vec!(participant_data, |data| ParticipantDataV2::from(data)); let version_info = VersionCompatInfoV2 { version, orig_version, - min_compat_version, }; SlateV2 { num_participants, From b1738e33ed05d8237d0251d18070fc0d4a0101b8 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Fri, 31 May 2019 08:33:23 +0100 Subject: [PATCH 27/36] Changes for 1.1.0 -> 2.0.0 Deployment strategy decisions (#126) * make slate v0 the default for regular sends * add block_header_version to slate * update doc tests for latest grin version * rustfmt * HACF if HF height detected * rustfmt --- Cargo.lock | 648 ++++++++++++++-------------- api/src/foreign_rpc.rs | 35 +- api/src/owner_rpc.rs | 110 ++--- controller/src/command.rs | 4 +- impls/src/node_clients/http.rs | 5 + libwallet/src/api_impl/owner.rs | 8 + libwallet/src/slate.rs | 11 +- libwallet/src/slate_versions/mod.rs | 3 + libwallet/src/slate_versions/v2.rs | 7 +- libwallet/tests/slates/v2.slate | 2 +- src/bin/cmd/wallet.rs | 23 + src/bin/cmd/wallet_args.rs | 30 +- util/Cargo.toml | 24 +- 13 files changed, 490 insertions(+), 420 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d3188729..11f3e9b92 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -67,27 +67,26 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.15" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -95,8 +94,8 @@ name = "backtrace-sys" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -114,7 +113,7 @@ version = "0.37.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cexpr 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "clang-sys 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -197,7 +196,7 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.35" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -210,7 +209,7 @@ dependencies = [ [[package]] name = "cfg-if" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -218,9 +217,9 @@ name = "chrono" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -230,7 +229,7 @@ version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -275,7 +274,7 @@ name = "crc32fast" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -284,7 +283,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "croaring-sys 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -293,8 +292,8 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bindgen 0.37.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -312,7 +311,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -332,7 +331,7 @@ name = "crossbeam-utils" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -365,10 +364,10 @@ dependencies = [ [[package]] name = "ctrlc" -version = "3.1.1" +version = "3.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", + "nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -390,25 +389,25 @@ name = "dirs" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "redox_users 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "dtoa" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "easy-jsonrpc" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "easy-jsonrpc-proc-macro 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-core 10.1.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.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -418,9 +417,9 @@ version = "0.5.0" 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-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -453,7 +452,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -462,10 +461,10 @@ name = "failure_derive" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -479,8 +478,8 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -510,7 +509,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "futures" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -518,7 +517,7 @@ name = "futures-cpupool" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -541,7 +540,7 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -555,17 +554,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "grin_api" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" +source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-rustls 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -574,8 +573,8 @@ dependencies = [ "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustls 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -587,7 +586,7 @@ dependencies = [ [[package]] name = "grin_chain" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" +source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -595,22 +594,22 @@ dependencies = [ "croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_core" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" +source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -619,16 +618,16 @@ dependencies = [ "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.2 (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.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -636,20 +635,20 @@ dependencies = [ [[package]] name = "grin_keychain" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" +source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "pbkdf2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "ripemd160 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -658,42 +657,42 @@ dependencies = [ [[package]] name = "grin_p2p" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" +source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.42 (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.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_pool" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" +source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "log 0.4.6 (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.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -703,40 +702,40 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)", "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_store" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" +source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "lmdb-zero 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_util" version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2#9ab23f6eef1d03aa2facc32d439852bda0127daf" +source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" dependencies = [ - "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "grin_secp256k1zkp 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -745,8 +744,8 @@ dependencies = [ "log4rs 0.8.3 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (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.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -758,7 +757,7 @@ version = "1.1.0-beta.3" dependencies = [ "built 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "ctrlc 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "grin_wallet_api 1.1.0-beta.3", @@ -778,7 +777,7 @@ name = "grin_wallet_api" version = "1.1.0-beta.3" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "easy-jsonrpc 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "easy-jsonrpc 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "grin_wallet_config 1.1.0-beta.3", @@ -787,7 +786,7 @@ dependencies = [ "grin_wallet_util 1.1.0-beta.3", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -799,8 +798,8 @@ dependencies = [ "grin_wallet_util 1.1.0-beta.3", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -809,10 +808,10 @@ name = "grin_wallet_controller" version = "1.1.0-beta.3" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "easy-jsonrpc 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "easy-jsonrpc 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "grin_wallet_api 1.1.0-beta.3", "grin_wallet_config 1.1.0-beta.3", "grin_wallet_impls 1.1.0-beta.3", @@ -824,8 +823,8 @@ dependencies = [ "prettytable-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", @@ -843,15 +842,15 @@ dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "grin_wallet_config 1.1.0-beta.3", "grin_wallet_libwallet 1.1.0-beta.3", "grin_wallet_util 1.1.0-beta.3", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -872,8 +871,8 @@ dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "strum_macros 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -885,28 +884,28 @@ name = "grin_wallet_util" version = "1.1.0-beta.3" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)", + "grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "h2" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -920,7 +919,7 @@ name = "heck" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -939,7 +938,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -961,13 +960,13 @@ version = "0.12.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -976,8 +975,8 @@ dependencies = [ "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -987,7 +986,7 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ct-logs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "rustls 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1019,13 +1018,13 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "itoa" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1033,10 +1032,10 @@ name = "jsonrpc-core" version = "10.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1054,14 +1053,9 @@ name = "lazy_static" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "lazycell" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "libc" -version = "0.2.51" +version = "0.2.55" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1069,8 +1063,8 @@ name = "libgit2-sys" version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1081,7 +1075,7 @@ version = "0.2.2" 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.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1089,7 +1083,7 @@ name = "libloading" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1098,8 +1092,8 @@ name = "libz-sys" version = "1.0.25" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1125,7 +1119,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "liblmdb-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "supercow 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1144,8 +1138,8 @@ name = "log" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1164,14 +1158,14 @@ dependencies = [ "flate2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", "humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "log-mdc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", "thread-id 3.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "typemap 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1195,7 +1189,7 @@ name = "memchr" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1208,7 +1202,7 @@ name = "memmap" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1219,11 +1213,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "miniz-sys" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1239,23 +1233,22 @@ name = "miniz_oxide_c_api" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mio" -version = "0.6.16" +version = "0.6.19" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1269,8 +1262,8 @@ version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1290,7 +1283,7 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallstr 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "terminfo 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1313,8 +1306,8 @@ name = "net2" version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1324,8 +1317,8 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1333,13 +1326,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1372,10 +1365,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", "num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1385,10 +1378,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", "num-rational 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1396,8 +1389,8 @@ name = "num-bigint" version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1407,8 +1400,8 @@ name = "num-bigint" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1416,7 +1409,7 @@ name = "num-complex" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1425,24 +1418,26 @@ name = "num-complex" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-integer" -version = "0.1.39" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-iter" -version = "0.1.37" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1451,8 +1446,8 @@ version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-bigint 0.1.44 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1462,8 +1457,8 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1471,22 +1466,30 @@ name = "num-traits" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "num_cpus" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "numtoa" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "odds" version = "0.2.26" @@ -1497,7 +1500,7 @@ name = "ordered-float" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1531,7 +1534,7 @@ name = "parking_lot_core" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1543,7 +1546,7 @@ name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1651,7 +1654,7 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "0.4.27" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1675,7 +1678,7 @@ name = "quote" version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1683,7 +1686,7 @@ name = "rand" version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1693,7 +1696,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1706,7 +1709,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1716,13 +1719,13 @@ name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1734,7 +1737,7 @@ name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1769,10 +1772,10 @@ dependencies = [ [[package]] name = "rand_jitter" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1784,7 +1787,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1795,7 +1798,7 @@ name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1872,9 +1875,9 @@ name = "ring" version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "untrusted 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1894,13 +1897,13 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "rustc-demangle" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1939,7 +1942,7 @@ dependencies = [ [[package]] name = "ryu" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -1999,10 +2002,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.90" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2011,17 +2014,17 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.90" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2029,19 +2032,19 @@ name = "serde_json" version = "1.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_yaml" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2105,9 +2108,9 @@ version = "0.15.0" 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-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2117,32 +2120,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "syn" -version = "0.15.32" +version = "0.15.34" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "synstructure" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)", + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", - "syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tempfile" -version = "3.0.7" +version = "3.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2180,10 +2183,11 @@ dependencies = [ [[package]] name = "termion" -version = "1.5.1" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2201,7 +2205,7 @@ name = "thread-id" version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2219,7 +2223,7 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2230,8 +2234,8 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2239,8 +2243,8 @@ dependencies = [ "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2251,7 +2255,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2261,16 +2265,16 @@ version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2278,7 +2282,7 @@ name = "tokio-current-thread" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2288,7 +2292,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2296,9 +2300,9 @@ name = "tokio-fs" version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2307,7 +2311,7 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2317,16 +2321,16 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-sync 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2334,7 +2338,7 @@ name = "tokio-retry" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.3.23 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2355,16 +2359,16 @@ name = "tokio-service" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-sync" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2373,22 +2377,22 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tokio-threadpool" -version = "0.1.13" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-queue 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2398,11 +2402,11 @@ dependencies = [ [[package]] name = "tokio-timer" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2413,9 +2417,9 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2427,11 +2431,11 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)", "mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-codec 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2443,7 +2447,7 @@ name = "toml" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2492,7 +2496,7 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2538,9 +2542,9 @@ name = "uuid" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2549,7 +2553,7 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2587,7 +2591,7 @@ name = "want" version = "0.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2615,7 +2619,7 @@ name = "which" version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2712,8 +2716,8 @@ dependencies = [ "checksum arrayvec 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)" = "06f59fe10306bb78facd90d28c2038ad23ffaaefa85bac43c8a434cde383334f" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" -"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" +"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" +"checksum backtrace 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)" = "1a13fc43f04daf08ab4f71e3d27e1fc27fc437d3e95ac0063a796d92fb40f39b" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" "checksum bindgen 0.37.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1b25ab82877ea8fe6ce1ce1f8ac54361f0218bad900af9eb11803994bf67c221" @@ -2727,9 +2731,9 @@ dependencies = [ "checksum byte-tools 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "560c32574a12a89ecd91f5e742165893f86e3ab98d21f8ea548658eb9eef5f40" "checksum byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a019b10a2a7cdeb292db131fc8113e57ea2a908f6e7894b0c3c671893b65dbeb" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -"checksum cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)" = "5e5f3fee5eeb60324c2781f1e41286bdee933850fff9b3c672587fed5ec58c83" +"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" "checksum cexpr 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "42aac45e9567d97474a834efdee3081b3c942b2205be932092f53354ce503d6c" -"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878" "checksum clang-sys 0.23.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d7f7c04e52c35222fffcc3a115b5daf5f7e2bfb71c13c4e2321afe1fc71859c2" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" @@ -2746,12 +2750,12 @@ dependencies = [ "checksum crypto-mac 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7afa06d05a046c7a47c3a849907ec303504608c927f4e85f7bfff22b7180d971" "checksum csv 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7ef22b37c7a51c564a365892c012dc0271221fdcc64c69b19ba4d6fa8bd96d9c" "checksum ct-logs 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "95a4bf5107667e12bf6ce31a3a5066d67acc88942b6742117a41198734aaccaa" -"checksum ctrlc 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "630391922b1b893692c6334369ff528dcc3a9d8061ccf4c803aa8f83cb13db5e" +"checksum ctrlc 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5531b7f0698d9220b4729f8811931dbe0e91a05be2f7b3245fdc50dd856bae26" "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" "checksum digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "03b072242a8cbaf9c145665af9d250c59af3b958f83ed6824e13533cf76d5b90" "checksum dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" -"checksum dtoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6d301140eb411af13d3115f9a562c85cc6b541ade9dfa314132244aaee7489dd" -"checksum easy-jsonrpc 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cb424ab9ae1c46a5ee5a21f5a11a40b01b7d71a5bd45b12961974fd33701b93f" +"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e" +"checksum easy-jsonrpc 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d4a851f8e0ed5790b60ded487feb0dc3c7e7da52c4a0adc57c009bfc5af8ca1a" "checksum easy-jsonrpc-proc-macro 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d9fb33793846951f339a70580375734416898ff8ddbb74401865031e25ba6751" "checksum encode_unicode 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "90b2c9496c001e8cb61827acdefad780795c42264c137744cae6f7d9e3450abd" "checksum enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "be4551092f4d519593039259a9ed8daedf0da12e5109c5280338073eaeb81180" @@ -2764,22 +2768,22 @@ dependencies = [ "checksum fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" -"checksum futures 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)" = "62941eff9507c8177d448bd83a44d9b9760856e184081d8cd79ba9f03dd24981" +"checksum futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)" = "a2037ec1c6c1c4f79557762eab1f7eae1f64f6cb418ace90fae88f0942b60139" "checksum futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" "checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" -"checksum grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" -"checksum grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" -"checksum grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" -"checksum grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" -"checksum grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" +"checksum grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" "checksum grin_secp256k1zkp 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "75e9a265f3eeea4c204470f7262e2c6fe18f3d8ddf5fb24340cb550ac4f909c5" -"checksum grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" -"checksum grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin?tag=v1.1.0-beta.2)" = "" -"checksum h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "85ab6286db06040ddefb71641b50017c06874614001a134b423783e2db2920bd" +"checksum grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum h2 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "2b53def7bb0253af7718036fe9338c15defd209136819464384f3a553e07481b" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "733e1b3ac906631ca01ebb577e9bb0f5e37a454032b9036b5eaea4013ed6f99a" "checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" @@ -2790,12 +2794,11 @@ dependencies = [ "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" "checksum iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dbe6e417e7d0975db6512b90796e8ce223145ac4e33c377e4a42882a0e88bb08" -"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" +"checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum jsonrpc-core 10.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc15eef5f8b6bef5ac5f7440a957ff95d036e2f98706947741bfc93d1976db4c" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" -"checksum libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)" = "bedcc7a809076656486ffe045abeeac163da1b558e963a31e29fbfbeba916917" +"checksum libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)" = "42914d39aad277d9e176efbdad68acb1d5443ab65afe0e0e4f0d49352a950880" "checksum libgit2-sys 0.7.11 (registry+https://github.com/rust-lang/crates.io-index)" = "48441cb35dc255da8ae72825689a95368bf510659ae1ad55dc4aa88cb1789bf1" "checksum liblmdb-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "feed38a3a580f60bf61aaa067b0ff4123395966839adeaf67258a9e50c4d2e49" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" @@ -2813,16 +2816,16 @@ dependencies = [ "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" "checksum memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0f9dc261e2b62d7a622bf416ea3c5245cdd5d9a7fcc428c0d06804dfce1775b3" -"checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649" +"checksum miniz-sys 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9e3ae51cea1576ceba0dde3d484d30e6e5b86dee0b2d412fe3a16a15c98202" "checksum miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c468f2369f07d651a5d0bb2c9079f8488a66d5466efe42d0c5c6466edcb7f71e" "checksum miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fe927a42e3807ef71defb191dc87d4e24479b221e67015fe38ae2b7b447bab" -"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"checksum mio 0.6.19 (registry+https://github.com/rust-lang/crates.io-index)" = "83f51996a3ed004ef184e16818edc51fadffe8e7ca68be67f9dee67d84d0ff23" "checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum mortal 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "26153280e6a955881f761354b130aa7838f9983836f3de438ac0a8f22cfab1ff" "checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" -"checksum nix 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37e713a259ff641624b6cb20e3b12b2952313ba36b6823c0f16e6cfd9e5de17" +"checksum nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46f0f3210768d796e8fa79ec70ee6af172dacbe7147f5e69be5240a47778302b" "checksum nix 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a0d95c5fa8b641c10ad0b8887454ebaafa3c92b5cd5350f8fc693adafd178e7b" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum nom 3.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05aec50c70fd288702bcd93284a8444607f3292dbdf2a30de5ea5dcdbe72287b" @@ -2833,13 +2836,14 @@ dependencies = [ "checksum num-bigint 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "57450397855d951f1a41305e54851b1a7b8f5d2e349543a02a2effe25459f718" "checksum num-complex 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "b288631d7878aaf59442cffd36910ea604ecd7745c36054328595114001c9656" "checksum num-complex 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "107b9be86cd2481930688277b675b0114578227f034674726605b8a482d8baf8" -"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" -"checksum num-iter 0.1.37 (registry+https://github.com/rust-lang/crates.io-index)" = "af3fdbbc3291a5464dc57b03860ec37ca6bf915ed6ee385e7c6c052c422b2124" +"checksum num-integer 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)" = "b85e541ef8255f6cf42bbfe4ef361305c6c135d10919ecc26126c4e5ae94bc09" +"checksum num-iter 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "76bd5272412d173d6bf9afdf98db8612bbabc9a7a830b7bfc9c188911716132e" "checksum num-rational 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "ee314c74bd753fc86b4780aa9475da469155f3848473a261d2d18e35245a784e" "checksum num-rational 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4e96f040177bb3da242b5b1ecf3f54b5d5af3efbbfb18608977a5d2767b22f10" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" +"checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" "checksum odds 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)" = "4eae0151b9dacf24fcc170d9995e511669a082856a91f958a2fe380bfab3fb22" "checksum ordered-float 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "18869315e81473c951eb56ad5558bbc56978562d3ecfb87abb7a1e944cea4518" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" @@ -2859,7 +2863,7 @@ dependencies = [ "checksum pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3a029430f0d744bc3d15dd474d591bed2402b645d024583082b9f63bb936dac6" "checksum prettytable-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5511ca4c805aa35f0abff6be7923231d664408b60c09f44ef715f2bce106cd9e" "checksum proc-macro2 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "77997c53ae6edd6d187fec07ec41b207063b5ee6f33680e9fa86d405cdd313d4" -"checksum proc-macro2 0.4.27 (registry+https://github.com/rust-lang/crates.io-index)" = "4d317f9caece796be1980837fd5cb3dfec5613ebdb04ad0956deea83ce168915" +"checksum proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)" = "cf3d2011ab5c909338f7887f4fc896d35932e29146c12c8d01da6b22a80ba759" "checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" "checksum quote 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9949cfe66888ffe1d53e6ec9d9f3b70714083854be20fd5e271b232a017401e8" "checksum quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "faf4799c5d274f3868a4aae320a0a182cbd2baee377b378f080e16a23e9d80db" @@ -2872,7 +2876,7 @@ dependencies = [ "checksum rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0" "checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" "checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" -"checksum rand_jitter 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b9ea758282efe12823e0d952ddb269d2e1897227e464919a554f2a03ef1b832" +"checksum rand_jitter 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1166d5c91dc97b88d1decc3285bb0a99ed84b05cfd0bc2341bdf2d43fc41e39b" "checksum rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7b75f676a1e053fc562eafbb47838d67c84801e38fc1ba459e8f180deabd5071" "checksum rand_pcg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "abf9b09b01790cfe0364f52bf32995ea3c39f4d2dd011eac241d2914146d0b44" "checksum rand_xorshift 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "cbf7e9e623549b0e21f6e97cf8ecf247c1a8fd2e8a992ae265314300b2455d5c" @@ -2886,12 +2890,12 @@ dependencies = [ "checksum ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2c4db68a2e35f3497146b7e4563df7d4773a2433230c5e4b448328e31740458a" "checksum ripemd160 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "482aa56cc68aaeccdaaff1cc5a72c247da8bbad3beb174ca5741f274c22883fb" "checksum rpassword 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d37473170aedbe66ffa3ad3726939ba677d83c646ad4fd99e5b4bc38712f45ec" -"checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" +"checksum rustc-demangle 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f4dccf6f4891ebcc0c39f9b6eb1a83b9bf5d747cb439ec6fba4f3b977038af" "checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum rustc_version 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "c5f5376ea5e30ce23c03eb77cbe4962b988deead10910c372b226388b594c084" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rustls 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)" = "942b71057b31981152970d57399c25f72e27a6ee0d207a669d8304cabf44705b" -"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum ryu 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "b96a9549dc8d48f2c283938303c4b5a77aa29bfbc5b54b084fb1630408899a8f" "checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9" "checksum same-file 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267" "checksum scoped-tls 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" @@ -2901,11 +2905,11 @@ dependencies = [ "checksum semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "d4f410fedcf71af0345d7607d246e7ad15faaadd49d240ee3b24e5dc21a820ac" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "aa5f7c20820475babd2c077c3ab5f8c77a31c15e16ea38687b4c02d3e48680f4" +"checksum serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "a72e9b96fa45ce22a4bc23da3858dfccfd60acd28a25bcd328a98fdd6bea43fd" "checksum serde-value 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7a663f873dedc4eac1a559d4c6bc0d0b2c34dc5ac4702e105014b8281489e44f" -"checksum serde_derive 1.0.90 (registry+https://github.com/rust-lang/crates.io-index)" = "58fc82bec244f168b23d1963b45c8bf5726e9a15a9d146a067f9081aeed2de79" +"checksum serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)" = "101b495b109a3e3ca8c4cbe44cf62391527cdfb6ba15821c5ce80bcd5ea23f9f" "checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" -"checksum serde_yaml 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0887a8e097a69559b56aa2526bf7aff7c3048cf627dff781f0b56a6001534593" +"checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582" "checksum sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9eb6be24e4c23a84d7184280d2722f7f2731fcdd4a9d886efbfe4413e4847ea0" "checksum siphasher 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0b8de496cf83d4ed58b6be86c3a275b8602f6ffe98d3024a869e124147a9a3ac" "checksum slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c111b5bd5695e56cffe5129854aa230b39c93a305372fdbb2668ca2394eea9f8" @@ -2917,13 +2921,13 @@ dependencies = [ "checksum strum 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5d1c33039533f051704951680f1adfd468fd37ac46816ded0d9ee068e60f05f" "checksum strum_macros 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)" = "47cd23f5c7dee395a00fa20135e2ec0fffcdfa151c56182966d7a3261343432e" "checksum supercow 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "171758edb47aa306a78dfa4ab9aeb5167405bd4e3dc2b64e88f6a84bbe98bd63" -"checksum syn 0.15.32 (registry+https://github.com/rust-lang/crates.io-index)" = "846620ec526c1599c070eff393bfeeeb88a93afa2513fc3b49f1fea84cf7b0ed" -"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" -"checksum tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b86c784c88d98c801132806dadd3819ed29d8600836c4088e855cdf3e178ed8a" +"checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" +"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" +"checksum tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7dc4738f2e68ed2855de5ac9cdbe05c9216773ecde4739b2f095002ab03a13ef" "checksum term 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum terminfo 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8e51065bafd2abe106b6036483b69d1741f4a1ec56ce8a2378de341637de689e" -"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" +"checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" "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" @@ -2939,10 +2943,10 @@ dependencies = [ "checksum tokio-retry 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f05746ae87dca83a2016b4f5dba5b237b897dd12fd324f60afe282112f16969a" "checksum tokio-rustls 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "208d62fa3e015426e3c64039d9d20adf054a3c9b4d9445560f1c41c75bef3eab" "checksum tokio-service 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162" -"checksum tokio-sync 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fda385df506bf7546e70872767f71e81640f1f251bdf2fd8eb81a0eaec5fe022" +"checksum tokio-sync 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5b2f843ffdf8d6e1f90bddd48da43f99ab071660cd92b7ec560ef3cdfd7a409a" "checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" -"checksum tokio-threadpool 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "ec5759cf26cf9659555f36c431b515e3d05f66831741c85b4b5d5dfb9cf1323c" -"checksum tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2910970404ba6fa78c5539126a9ae2045d62e3713041e447f695f41405a120c6" +"checksum tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72558af20be886ea124595ea0f806dd5703b8958e4705429dd58b3d8231f72f2" +"checksum tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f2106812d500ed25a4f38235b9cae8f78a09edf43203e16e59c3b769a342a60e" "checksum tokio-udp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "66268575b80f4a4a710ef83d087fdfeeabdce9b74c797535fbac18a2cb906e92" "checksum tokio-uds 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "037ffc3ba0e12a0ab4aca92e5234e0dedeb48fddf6ccd260f1f150a36a9f2445" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" @@ -2953,7 +2957,7 @@ dependencies = [ "checksum ucd-util 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "535c204ee4d8434478593480b8f86ab45ec9aae0e83c568ca81abf0fd0e88f86" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" -"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" +"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unsafe-any 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f30360d7979f5e9c6e6cea48af192ea8fab4afb3cf72597154b8f08935bc9c7f" diff --git a/api/src/foreign_rpc.rs b/api/src/foreign_rpc.rs index 42ee6811c..8d363f2a3 100644 --- a/api/src/foreign_rpc.rs +++ b/api/src/foreign_rpc.rs @@ -95,7 +95,7 @@ pub trait ForeignRpc { "Ok": { "kernel": { "excess": "08dfe86d732f2dd24bac36aa7502685221369514197c26d33fac03041d47e4b490", - "excess_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f4f0471a33b6465cdb9e72b635f5611aa6c89ebd51aeee038f69b4cc598a02fe0", + "excess_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841be02fa098c54c9bf638e0ee1ad5eb896caa11565f632be7b9cd65643ba371044f", "features": "Coinbase", "fee": "0", "lock_height": "0" @@ -138,7 +138,7 @@ pub trait ForeignRpc { { "id": "0", "message": "my message", - "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f756f655333250204644c1cb169e7a78f21b57437930db91e808f39be58134c1d", + "message_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b1d4c1358be398f801eb90d933774b5218fa7e769b11c4c640402253353656f75", "part_sig": null, "public_blind_excess": "034b4df2f0558b73ea72a1ca5c4ab20217c66bbe0829056fca7abe76888e9349ee", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" @@ -172,8 +172,9 @@ pub trait ForeignRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "orig_version": 2, - "version": 2 + "orig_version": 2, + "version": 2, + "block_header_version": 1 } } ] @@ -210,7 +211,8 @@ pub trait ForeignRpc { { "version_info": { "version": 2, - "orig_version": 2 + "orig_version": 2, + "block_header_version": 1 }, "num_participants": 2, "id": "0436430c-2b02-624c-2032-570501212b00", @@ -290,8 +292,8 @@ pub trait ForeignRpc { { "id": "1", "message": "Thanks, Yeastplume", - "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078ff97f43f2eda0f695161ba23dc48db7a1bcbd7f131f1e21bdb4e1ad1eb2f1a130", - "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078ffc965b05962362aee43e5264bd3fd0f26dbd7092cfe070069e26d2df28bd352b", + "message_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b30a1f1b21eade1b4bd211e1f137fbdbca1b78dc43da21b1695f6a0edf2437ff9", + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b2b35bd28dfd2269e0670e0cf9270bd6df2d03fbd64523ee4ae622396055b96fc", "public_blind_excess": "038fe0443243dab173c068ef5fa891b242d2b5eb890ea09475e6e381170442ee16", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" } @@ -333,8 +335,9 @@ pub trait ForeignRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "orig_version": 2, - "version": 2 + "orig_version": 2, + "version": 2, + "block_header_version": 1 } } } @@ -366,7 +369,8 @@ pub trait ForeignRpc { "params": [{ "version_info": { "version": 2, - "orig_version": 2 + "orig_version": 2, + "block_header_version": 1 }, "num_participants": 2, "id": "0436430c-2b02-624c-2032-570501212b00", @@ -423,7 +427,7 @@ pub trait ForeignRpc { "id": "0", "public_blind_excess": "029f12f9f8c5489a18904de7cd46dc3384b79369d4cbc17cd74b299da8c2cf7445", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", - "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fe3cccc5ff1d832edb7e3cb3b1414b9e9d3d1d503294224b4c93bf3d59ed64018", + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b1840d69ed5f33bc9b424422903d5d1d3e9b914143bcbe3b7ed32d8f15fcccce3", "message": null, "message_sig": null } @@ -449,7 +453,7 @@ pub trait ForeignRpc { "id": "1", "message": null, "message_sig": null, - "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fc0e6f263f91010a6fea7099029c70eabdf75b48aefd977e14d1ed659b221eac9", + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841bc9ea21b259d61e4de177d9ef8ab475dfab0ec7299009a7fea61010f963f2e6c0", "public_blind_excess": "033bbe2a419ea2e9d6810a8d66552e709d1783ca50759a44dbaf63fc79c0164c4c", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" }, @@ -457,7 +461,7 @@ pub trait ForeignRpc { "id": "0", "message": null, "message_sig": null, - "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fe3cccc5ff1d832edb7e3cb3b1414b9e9d3d1d503294224b4c93bf3d59ed64018", + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b1840d69ed5f33bc9b424422903d5d1d3e9b914143bcbe3b7ed32d8f15fcccce3", "public_blind_excess": "029f12f9f8c5489a18904de7cd46dc3384b79369d4cbc17cd74b299da8c2cf7445", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" } @@ -477,7 +481,7 @@ pub trait ForeignRpc { "kernels": [ { "excess": "09bac6083b05a32a9d9b37710c70dd0a1ef9329fde0848558976b6f1b81d80ceed", - "excess_sig": "4d4b6cd1361032ca9bd2aeb9d900aa4d45d9ead80ac9423374c451a7254d0766a4b3bec3eae84394b68ad4cb3ddbc896f898aca769d2fc5a56886ba280c1e9a0", + "excess_sig": "66074d25a751c4743342c90ad8ead9454daa00d9b9aed29bca321036d16c4b4da0e9c180a26b88565afcd269a7ac98f896c8db3dcbd48ab69443e8eac3beb3a4", "features": "Plain", "fee": "7000000", "lock_height": "0" @@ -500,7 +504,8 @@ pub trait ForeignRpc { }, "version_info": { "orig_version": 2, - "version": 2 + "version": 2, + "block_header_version": 1 } } } diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index 244355ce4..4593faba8 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -355,7 +355,7 @@ pub trait OwnerRpc { { "id": "0", "message": "my message", - "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f756f655333250204644c1cb169e7a78f21b57437930db91e808f39be58134c1d", + "message_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b1d4c1358be398f801eb90d933774b5218fa7e769b11c4c640402253353656f75", "part_sig": null, "public_blind_excess": "034b4df2f0558b73ea72a1ca5c4ab20217c66bbe0829056fca7abe76888e9349ee", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" @@ -389,8 +389,9 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "orig_version": 2, - "version": 2 + "orig_version": 2, + "version": 2, + "block_header_version": 1 } } } @@ -439,7 +440,7 @@ pub trait OwnerRpc { { "id": "1", "message": "Please give me your grins", - "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078fd2599ab38942986602e943f684a85992893a6d34367dc7cc2b403a5dcfcdbcd9", + "message_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841bd9bccdcf5d3a402bccc77d36346d3a899259a884f643e90266984289b39a59d2", "part_sig": null, "public_blind_excess": "028e95921cc0d5be5922362265d352c9bdabe51a9e1502a3f0d4a10387f1893f40", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" @@ -469,7 +470,8 @@ pub trait OwnerRpc { }, "version_info": { "orig_version": 2, - "version": 2 + "version": 2, + "block_header_version": 1 } } } @@ -532,7 +534,8 @@ pub trait OwnerRpc { }, "version_info": { "orig_version": 2, - "version": 2 + "version": 2, + "block_header_version": 1 } }, { @@ -575,8 +578,8 @@ pub trait OwnerRpc { { "id": "0", "message": "Ok, here are your grins", - "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f463643727bf45004637269e9afb5f5fbd8cdcc1881a2ef9ec3ab0fb5f6e01ae9", - "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f19d37c475bc5cc495b732dfddb0fb5a5e782b7ae2797ef4904b66f6afb409d61", + "message_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841be91ae0f6b50fabc39eefa28118cccdd8fbf5b5afe96972630450f47b72433646", + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b619d40fb6a6fb60449ef9727aeb782e7a5b50fdbfd2d735b49ccc55b477cd319", "public_blind_excess": "0309e22f2adaa9b81f51414b775b86acd096e17794eb8159bfcfef27caa4bf5c90", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" } @@ -615,7 +618,8 @@ pub trait OwnerRpc { }, "version_info": { "orig_version": 2, - "version": 2 + "version": 2, + "block_header_version": 1 } } } @@ -648,7 +652,7 @@ pub trait OwnerRpc { { "id": "0", "message": "my message", - "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f756f655333250204644c1cb169e7a78f21b57437930db91e808f39be58134c1d", + "message_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b1d4c1358be398f801eb90d933774b5218fa7e769b11c4c640402253353656f75", "part_sig": null, "public_blind_excess": "034b4df2f0558b73ea72a1ca5c4ab20217c66bbe0829056fca7abe76888e9349ee", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" @@ -682,8 +686,9 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "orig_version": 2, - "version": 2 + "orig_version": 2, + "version": 2, + "block_header_version": 1 } }, 0 @@ -720,7 +725,8 @@ pub trait OwnerRpc { { "version_info": { "version": 2, - "orig_version": 2 + "orig_version": 2, + "block_header_version": 1 }, "num_participants": 2, "id": "0436430c-2b02-624c-2032-570501212b00", @@ -751,9 +757,9 @@ pub trait OwnerRpc { ], "kernels": [ { - "features": "HeightLocked", + "features": "Plain", "fee": "7000000", - "lock_height": "5", + "lock_height": "0", "excess": "000000000000000000000000000000000000000000000000000000000000000000", "excess_sig": "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" } @@ -763,7 +769,7 @@ pub trait OwnerRpc { "amount": "60000000000", "fee": "7000000", "height": "5", - "lock_height": "5", + "lock_height": "0", "participant_data": [ { "id": "0", @@ -776,8 +782,8 @@ pub trait OwnerRpc { { "id": "1", "public_blind_excess": "024f9bc78c984c78d6e916d3a00746aa30fa1172124c8dbc0cbddcb7b486719bc7", - "public_nonce": "0292a0baa95464d44b2c7155c7e2c69213bd3737f6217e60273af159b7f49812e3", - "part_sig": "92a0baa95464d44b2c7155c7e2c69213bd3737f6217e60273af159b7f49812e30d5ef73628c7de327a40dbc943ca227ab809b8edf954b18b69a4f9b333e7278c", + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f", + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841ba9c6dd6185c2b819799700fa1a69201f96cc6dfb9ca205a0ef7c35fb81d57dac", "message": null, "message_sig": null } @@ -797,14 +803,14 @@ pub trait OwnerRpc { "fee": "7000000", "height": "5", "id": "0436430c-2b02-624c-2032-570501212b00", - "lock_height": "5", + "lock_height": "0", "num_participants": 2, "participant_data": [ { "id": "0", "message": null, "message_sig": null, - "part_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f3127d36e8cc35aa76091a491e94fcffdd2f25d70d23e698ece2d8db14334670a", + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b38641aefa907a2fc1c051b1f73202794fffb6d422e328516a5c6b2ef41e935f8", "public_blind_excess": "033ac2158fa0077f087de60c19d8e431753baa5b63b6e1477f05a2a6e7190d4592", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" }, @@ -812,9 +818,9 @@ pub trait OwnerRpc { "id": "1", "message": null, "message_sig": null, - "part_sig": "92a0baa95464d44b2c7155c7e2c69213bd3737f6217e60273af159b7f49812e30d5ef73628c7de327a40dbc943ca227ab809b8edf954b18b69a4f9b333e7278c", + "part_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841ba9c6dd6185c2b819799700fa1a69201f96cc6dfb9ca205a0ef7c35fb81d57dac", "public_blind_excess": "024f9bc78c984c78d6e916d3a00746aa30fa1172124c8dbc0cbddcb7b486719bc7", - "public_nonce": "0292a0baa95464d44b2c7155c7e2c69213bd3737f6217e60273af159b7f49812e3" + "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" } ], "tx": { @@ -832,10 +838,10 @@ pub trait OwnerRpc { "kernels": [ { "excess": "09bac6083b05a32a9d9b37710c70dd0a1ef9329fde0848558976b6f1b81d80ceed", - "excess_sig": "4a1802e31b854d765bdd7e114cef33b852c3fed01436c50d70d7c662333272683e86caa4b58b38d9dad2805b2d19f2788afc165ecb931b1a37d28764771b8e96", - "features": "HeightLocked", + "excess_sig": "66074d25a751c4743342c90ad8ead9454daa00d9b9aed29bca321036d16c4b4da0e9c180a26b88565afcd269a7ac98f896c8db3dcbd48ab69443e8eac3beb3a4", + "features": "Plain", "fee": "7000000", - "lock_height": "5" + "lock_height": "0" } ], "outputs": [ @@ -855,7 +861,8 @@ pub trait OwnerRpc { }, "version_info": { "orig_version": 2, - "version": 2 + "version": 2, + "block_header_version": 1 } } } @@ -878,40 +885,40 @@ pub trait OwnerRpc { "method": "post_tx", "params": [ { + "offset": "d202964900000000d302964900000000d402964900000000d502964900000000", "body": { "inputs": [ { - "commit": "087df32304c5d4ae8b2af0bc31e700019d722910ef87dd4eec3197b80b207e3045", - "features": "Coinbase" + "features": "Coinbase", + "commit": "087df32304c5d4ae8b2af0bc31e700019d722910ef87dd4eec3197b80b207e3045" }, { - "commit": "08e1da9e6dc4d6e808a718b2f110a991dd775d65ce5ae408a4e1f002a4961aa9e7", - "features": "Coinbase" - } - ], - "kernels": [ - { - "excess": "09bac6083b05a32a9d9b37710c70dd0a1ef9329fde0848558976b6f1b81d80ceed", - "excess_sig": "4a1802e31b854d765bdd7e114cef33b852c3fed01436c50d70d7c662333272683e86caa4b58b38d9dad2805b2d19f2788afc165ecb931b1a37d28764771b8e96", - "features": "HeightLocked", - "fee": "7000000", - "lock_height": "5" + "features": "Coinbase", + "commit": "08e1da9e6dc4d6e808a718b2f110a991dd775d65ce5ae408a4e1f002a4961aa9e7" } ], "outputs": [ { - "commit": "099b48cfb1f80a2347dc89818449e68e76a3c6817a532a8e9ef2b4a5ccf4363850", "features": "Plain", + "commit": "099b48cfb1f80a2347dc89818449e68e76a3c6817a532a8e9ef2b4a5ccf4363850", "proof": "7ebcd2ed9bf5fb29854033ba3d0e720613bdf7dfacc586d2f6084c1cde0a2b72e955d4ce625916701dc7c347132f40d0f102a34e801d745ee54b49b765d08aae0bb801c60403e57cafade3b4b174e795b633ab9e402b5b1b6e1243fd10bbcf9368a75cb6a6c375c7bdf02da9e03b7f210df45d942e6fba2729cd512a372e6ed91a1b5c9c22831febea843e3f85adcf198f39ac9f7b73b70c60bfb474aa69878ea8d1d32fef30166b59caacaec3fd024de29a90f1587e08d2c36b3d5c560cabf658e212e0a40a4129b3e5c35557058def5551f4eb395759597ba808b3c34eac3bfb9716e4480d7931c5789c538463ec75be0eb807c894047fda6cbcd22682d3c6d3823cb330f090a2099e3510a3706b57d46c95224394d7f1c0a20d99cc314b8f1d9d02668e2e435f62e1194de0be6a1f50f72ed777ed51c8819f527a94918d1aa8df6461e98ed4c2b18210de50fbcf8c3df210bfe326d41f1dc0ad748cb0320ae28401c85ab4f7dcb99d88a052e95dc85b76d22b36cabd60e06ab84bb7e4ddfdab9c9730c8a986583237ed1ecbb323ee8e79b8cadca4b438b7c09531670b471dda6a2eb3e747916c88ce7d9d8e1b7f61660eeb9e5a13c60e4dfe89d1177d81d6f6570fda85158e646a15f1e8b9e977494dc19a339aab2e0e478670d80092d6ba37646e60714ef64eb4a3d37fe15f8f38b59114af34b235489eed3f69b7781c5fe496eb43ffe245c14bd740f745844a38cf0d904347aaa2b64f51add18822dac009d8b63fa3e4c9b1fa72187f9a4acba1ab315daa1b04c9a41f3be846ac420b37990e6c947a16cc9d5c0671b292bf77d7d8b8974d2ad3afae95ba7772c37432840f53a007f31e0195f3abdf100c4477723cc6c6d5da14894a73dfac342833731036487488fdade7b9d556c06f26173b6b67598d3769447ce2828d71dd45ac5af436c6b0" }, { - "commit": "0812276cc788e6870612296d926cba9f0e7b9810670710b5a6e6f1ba006d395774", "features": "Plain", + "commit": "0812276cc788e6870612296d926cba9f0e7b9810670710b5a6e6f1ba006d395774", "proof": "dcff6175390c602bfa92c2ffd1a9b2d84dcc9ea941f6f317bdd0f875244ef23e696fd17c71df79760ce5ce1a96aab1d15dd057358dc835e972febeb86d50ccec0dad7cfe0246d742eb753cf7b88c045d15bc7123f8cf7155647ccf663fca92a83c9a65d0ed756ea7ebffd2cac90c380a102ed9caaa355d175ed0bf58d3ac2f5e909d6c447dfc6b605e04925c2b17c33ebd1908c965a5541ea5d2ed45a0958e6402f89d7a56df1992e036d836e74017e73ccad5cb3a82b8e139e309792a31b15f3ffd72ed033253428c156c2b9799458a25c1da65b719780a22de7fe7f437ae2fccd22cf7ea357ab5aa66a5ef7d71fb0dc64aa0b5761f68278062bb39bb296c787e4cabc5e2a2933a416ce1c9a9696160386449c437e9120f7bb26e5b0e74d1f2e7d5bcd7aafb2a92b87d1548f1f911fb06af7bd6cc13cee29f7c9cb79021aed18186272af0e9d189ec107c81a8a3aeb4782b0d950e4881aa51b776bb6844b25bce97035b48a9bdb2aea3608687bcdd479d4fa998b5a839ff88558e4a29dff0ed13b55900abb5d439b70793d902ae9ad34587b18c919f6b875c91d14deeb1c373f5e76570d59a6549758f655f1128a54f162dfe8868e1587028e26ad91e528c5ae7ee9335fa58fb59022b5de29d80f0764a9917390d46db899acc6a5b416e25ecc9dccb7153646addcc81cadb5f0078febc7e05d7735aba494f39ef05697bbcc9b47b2ccc79595d75fc13c80678b5e237edce58d731f34c05b1ddcaa649acf2d865bbbc3ceda10508bcdd29d0496744644bf1c3516f6687dfeef5649c7dff90627d642739a59d91a8d1d0c4dc55d74a949e1074427664b467992c9e0f7d3af9d6ea79513e8946ddc0d356bac49878e64e6a95b0a30214214faf2ce317fa622ff3266b32a816e10a18e6d789a5da1f23e67b4f970a68a7bcd9e18825ee274b0483896a40" } + ], + "kernels": [ + { + "features": "Plain", + "fee": "7000000", + "lock_height": "0", + "excess": "09bac6083b05a32a9d9b37710c70dd0a1ef9329fde0848558976b6f1b81d80ceed", + "excess_sig": "66074d25a751c4743342c90ad8ead9454daa00d9b9aed29bca321036d16c4b4da0e9c180a26b88565afcd269a7ac98f896c8db3dcbd48ab69443e8eac3beb3a4" + } ] - }, - "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" + } }, false ] @@ -1078,7 +1085,7 @@ pub trait OwnerRpc { { "id": "0", "message": "my message", - "message_sig": "1b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f756f655333250204644c1cb169e7a78f21b57437930db91e808f39be58134c1d", + "message_sig": "8f07ddd5e9f5179cff19486034181ed76505baaad53e5d994064127b56c5841b1d4c1358be398f801eb90d933774b5218fa7e769b11c4c640402253353656f75", "part_sig": null, "public_blind_excess": "034b4df2f0558b73ea72a1ca5c4ab20217c66bbe0829056fca7abe76888e9349ee", "public_nonce": "031b84c5567b126440995d3ed5aaba0565d71e1834604819ff9c17f5e9d5dd078f" @@ -1112,8 +1119,9 @@ pub trait OwnerRpc { "offset": "d202964900000000d302964900000000d402964900000000d502964900000000" }, "version_info": { - "orig_version": 2, - "version": 2 + "orig_version": 2, + "version": 2, + "block_header_version": 1 } } ] @@ -1403,20 +1411,24 @@ pub fn run_doctest_owner( ..Default::default() }; let mut slate = api_impl::owner::init_send_tx(&mut *w, args, true).unwrap(); + println!("INITIAL SLATE"); + println!("{}", serde_json::to_string_pretty(&slate).unwrap()); { let mut w2 = wallet2.lock(); w2.open_with_credentials().unwrap(); slate = api_impl::foreign::receive_tx(&mut *w2, &slate, None, None, true).unwrap(); w2.close().unwrap(); } - println!("RECIPIENT SLATE"); // Spit out slate for input to finalize_tx - println!("{}", serde_json::to_string_pretty(&slate).unwrap()); if lock_tx { api_impl::owner::tx_lock_outputs(&mut *w, &slate, 0).unwrap(); } + println!("RECEIPIENT SLATE"); + println!("{}", serde_json::to_string_pretty(&slate).unwrap()); if finalize_tx { - api_impl::owner::finalize_tx(&mut *w, &slate).unwrap(); + slate = api_impl::owner::finalize_tx(&mut *w, &slate).unwrap(); + error!("FINALIZED TX SLATE"); + println!("{}", serde_json::to_string_pretty(&slate).unwrap()); } w.close().unwrap(); } diff --git a/controller/src/command.rs b/controller/src/command.rs index 4c57c3c8f..9a13731c0 100644 --- a/controller/src/command.rs +++ b/controller/src/command.rs @@ -359,7 +359,7 @@ pub fn receive( let send_tx = format!("{}.response", args.input); adapter.send_tx_async(&send_tx, &slate)?; info!( - "Response file {}.response generated, sending it back to the transaction originator.", + "Response file {}.response generated, and can be sent back to the transaction originator.", args.input ); Ok(()) @@ -462,7 +462,6 @@ pub struct ProcessInvoiceArgs { pub method: String, pub dest: String, pub max_outputs: usize, - pub target_slate_version: Option, pub input: String, pub estimate_selection_strategies: bool, } @@ -504,7 +503,6 @@ pub fn process_invoice( num_change_outputs: 1u32, selection_strategy_is_use_all: args.selection_strategy == "all", message: args.message.clone(), - target_slate_version: args.target_slate_version, send_args: None, ..Default::default() }; diff --git a/impls/src/node_clients/http.rs b/impls/src/node_clients/http.rs index 6a30acbd3..3b7ba806a 100644 --- a/impls/src/node_clients/http.rs +++ b/impls/src/node_clients/http.rs @@ -40,6 +40,11 @@ impl HTTPNodeClient { node_api_secret: node_api_secret, } } + + /// Allow returning the chain height without needing a wallet instantiated + pub fn chain_height(&self) -> Result { + self.get_chain_height() + } } impl NodeClient for HTTPNodeClient { diff --git a/libwallet/src/api_impl/owner.rs b/libwallet/src/api_impl/owner.rs index 51f03293a..c580ecc67 100644 --- a/libwallet/src/api_impl/owner.rs +++ b/libwallet/src/api_impl/owner.rs @@ -259,6 +259,10 @@ where batch.commit()?; } + if let Some(v) = args.target_slate_version { + slate.version_info.orig_version = v; + } + Ok(slate) } @@ -333,6 +337,10 @@ where batch.commit()?; } + if let Some(v) = args.target_slate_version { + ret_slate.version_info.orig_version = v; + } + Ok(ret_slate) } diff --git a/libwallet/src/slate.rs b/libwallet/src/slate.rs index f044664f4..0cc284077 100644 --- a/libwallet/src/slate.rs +++ b/libwallet/src/slate.rs @@ -45,7 +45,7 @@ use crate::slate_versions::v2::{ InputV2, OutputV2, ParticipantDataV2, SlateV2, TransactionBodyV2, TransactionV2, TxKernelV2, VersionCompatInfoV2, }; -use crate::slate_versions::CURRENT_SLATE_VERSION; +use crate::slate_versions::{CURRENT_SLATE_VERSION, GRIN_BLOCK_HEADER_VERSION}; /// Public data for each participant in the slate #[derive(Serialize, Deserialize, Debug, Clone)] @@ -185,6 +185,8 @@ pub struct VersionCompatInfo { pub version: u16, /// Original version this slate was converted from pub orig_version: u16, + /// The grin block header version this slate is intended for + pub block_header_version: u16, } /// Helper just to facilitate serialization @@ -238,6 +240,7 @@ impl Slate { version_info: VersionCompatInfo { version: CURRENT_SLATE_VERSION, orig_version: CURRENT_SLATE_VERSION, + block_header_version: GRIN_BLOCK_HEADER_VERSION, }, } } @@ -813,12 +816,15 @@ impl From<&VersionCompatInfo> for VersionCompatInfoV2 { let VersionCompatInfo { version, orig_version, + block_header_version, } = data; let version = *version; let orig_version = *orig_version; + let block_header_version = *block_header_version; VersionCompatInfoV2 { version, orig_version, + block_header_version, } } } @@ -963,12 +969,15 @@ impl From<&VersionCompatInfoV2> for VersionCompatInfo { let VersionCompatInfoV2 { version, orig_version, + block_header_version, } = data; let version = *version; let orig_version = *orig_version; + let block_header_version = *block_header_version; VersionCompatInfo { version, orig_version, + block_header_version, } } } diff --git a/libwallet/src/slate_versions/mod.rs b/libwallet/src/slate_versions/mod.rs index 859137526..96f66977f 100644 --- a/libwallet/src/slate_versions/mod.rs +++ b/libwallet/src/slate_versions/mod.rs @@ -29,6 +29,9 @@ pub mod v2; /// The most recent version of the slate pub const CURRENT_SLATE_VERSION: u16 = 2; +/// The grin block header this slate is intended to be compatible with +pub const GRIN_BLOCK_HEADER_VERSION: u16 = 1; + /// Existing versions of the slate #[derive(EnumIter, Serialize, Deserialize, Clone, Debug, PartialEq, PartialOrd, Eq, Ord)] pub enum SlateVersion { diff --git a/libwallet/src/slate_versions/v2.rs b/libwallet/src/slate_versions/v2.rs index aac54292d..3643f4c94 100644 --- a/libwallet/src/slate_versions/v2.rs +++ b/libwallet/src/slate_versions/v2.rs @@ -32,7 +32,8 @@ //! * version field removed //! * VersionCompatInfo struct created with fields and added to beginning of struct //! version: u16 -//! orig_verion: u16, +//! orig_version: u16, +//! block_header_version: u16, use crate::grin_core::core::transaction::{KernelFeatures, OutputFeatures}; use crate::grin_core::libtx::secp_ser; @@ -83,6 +84,8 @@ pub struct VersionCompatInfoV2 { pub version: u16, /// Original version this slate was converted from pub orig_version: u16, + /// Version of grin block header this slate is compatible with + pub block_header_version: u16, } #[derive(Serialize, Deserialize, Debug, Clone)] @@ -336,10 +339,12 @@ impl From for SlateV2 { let tx = TransactionV2::from(tx); let version = 2; let orig_version = orig_version as u16; + let block_header_version = 1; let participant_data = map_vec!(participant_data, |data| ParticipantDataV2::from(data)); let version_info = VersionCompatInfoV2 { version, orig_version, + block_header_version, }; SlateV2 { num_participants, diff --git a/libwallet/tests/slates/v2.slate b/libwallet/tests/slates/v2.slate index 840091705..d55bf122c 100644 --- a/libwallet/tests/slates/v2.slate +++ b/libwallet/tests/slates/v2.slate @@ -2,7 +2,7 @@ "version_info": { "version": 2, "orig_version": 2, - "min_compat_version": 0 + "block_header_version": 1 }, "num_participants": 2, "id": "e0c69803-db50-40d9-a968-496e86660cd4", diff --git a/src/bin/cmd/wallet.rs b/src/bin/cmd/wallet.rs index 19cd3a0e6..96246b093 100644 --- a/src/bin/cmd/wallet.rs +++ b/src/bin/cmd/wallet.rs @@ -44,6 +44,29 @@ pub fn wallet_command(wallet_args: &ArgMatches<'_>, config: GlobalWalletConfig) let wallet_config = config.members.unwrap().wallet; let node_client = HTTPNodeClient::new(&wallet_config.check_node_api_http_addr, None); + + // TODO: Very temporary code to obsolete grin wallet for the first hard fork + // All tx operations call get_chain_height as a first order of business, + // so this is the most non-intrusive place to put this + match node_client.clone().chain_height() { + Ok(h) => { + if h >= 262080 { + let err_str = "This version of grin-wallet is obsolete as of block 252080. Please download v2.0.0 from https://github.com/mimblewimble/grin-wallet/releases"; + error!("{}", err_str); + println!(); + println!("**************"); + println!("{}", err_str); + println!("**************"); + println!("(You can still view your balances by disconnecting from the grin node, however you will not be able to transact until you upgrade)"); + println!(); + return 1; + } + } + // just continue if can't connect to node, as user won't be able to do + // anything meaninful anyhow + Err(_) => {} + } + let res = wallet_args::wallet_command(wallet_args, wallet_config, node_client); // we need to give log output a chance to catch up before exiting diff --git a/src/bin/cmd/wallet_args.rs b/src/bin/cmd/wallet_args.rs index cfba47a27..6e56c6403 100644 --- a/src/bin/cmd/wallet_args.rs +++ b/src/bin/cmd/wallet_args.rs @@ -21,10 +21,9 @@ use failure::Fail; use grin_wallet_config::WalletConfig; use grin_wallet_controller::command; use grin_wallet_controller::{Error, ErrorKind}; -use grin_wallet_impls::{instantiate_wallet, FileWalletCommAdapter, WalletSeed}; -use grin_wallet_libwallet::{IssueInvoiceTxArgs, NodeClient, Slate, WalletInst}; +use grin_wallet_impls::{instantiate_wallet, WalletSeed}; +use grin_wallet_libwallet::{IssueInvoiceTxArgs, NodeClient, WalletInst}; use grin_wallet_util::grin_core as core; -use grin_wallet_util::grin_core::core::amount_to_hr_string; use grin_wallet_util::grin_keychain as keychain; use linefeed::terminal::Signal; use linefeed::{Interface, ReadResult}; @@ -32,6 +31,14 @@ use rpassword; use std::path::Path; use std::sync::Arc; +// shut up test compilation warnings +#[cfg(not(test))] +use grin_wallet_impls::FileWalletCommAdapter; +#[cfg(not(test))] +use grin_wallet_libwallet::Slate; +#[cfg(not(test))] +use grin_wallet_util::grin_core::core::amount_to_hr_string; + // define what to do on argument error macro_rules! arg_parse { ( $r:expr ) => { @@ -141,6 +148,7 @@ fn prompt_recovery_phrase() -> Result { Ok(phrase) } +#[cfg(not(test))] fn prompt_pay_invoice(slate: &Slate, method: &str, dest: &str) -> Result { let interface = Arc::new(Interface::new("pay")?); let amount = amount_to_hr_string(slate.amount, false); @@ -459,7 +467,7 @@ pub fn parse_send_args(args: &ArgMatches) -> Result None, + false => Some(0), } }; @@ -610,23 +618,14 @@ pub fn parse_process_invoice_args( // max_outputs let max_outputs = 500; - // target slate version to create/send - let target_slate_version = { - match args.is_present("slate_version") { - true => { - let v = parse_required(args, "slate_version")?; - Some(parse_u64(v, "slate_version")? as u16) - } - false => None, - } - }; - // file input only let tx_file = parse_required(args, "input")?; // Now we need to prompt the user whether they want to do this, // which requires reading the slate + #[cfg(not(test))] let adapter = FileWalletCommAdapter::new(); + #[cfg(not(test))] let slate = match adapter.receive_tx_async(&tx_file) { Ok(s) => s, Err(e) => return Err(ParseError::ArgumentError(format!("{}", e))), @@ -643,7 +642,6 @@ pub fn parse_process_invoice_args( method: method.to_owned(), dest: dest.to_owned(), max_outputs: max_outputs, - target_slate_version: target_slate_version, input: tx_file.to_owned(), }) } diff --git a/util/Cargo.toml b/util/Cargo.toml index d73a29fa6..420b9d9be 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -25,20 +25,20 @@ dirs = "1.0.3" #grin_store = "1.1.0-beta.1" # For beta release -grin_core = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } -grin_keychain = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } -grin_chain = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } -grin_util = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } -grin_api = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } -grin_store = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +# grin_core = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +# grin_keychain = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +# grin_chain = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +# grin_util = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +# grin_api = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } +# grin_store = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } # For bleeding edge -#grin_core = { git = "https://github.com/mimblewimble/grin", branch = "master" } -#grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "master" } -#grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "master" } -#grin_util = { git = "https://github.com/mimblewimble/grin", branch = "master" } -#grin_api = { git = "https://github.com/mimblewimble/grin", branch = "master" } -#grin_store = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_core = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_util = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_api = { git = "https://github.com/mimblewimble/grin", branch = "master" } +grin_store = { git = "https://github.com/mimblewimble/grin", branch = "master" } # For local testing #grin_core = { path = "../../grin/core", version= "1.1.0-beta.2"} From 9a7243fdddd1b65c00c716161a1cc04e47670d70 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Fri, 31 May 2019 08:41:20 +0100 Subject: [PATCH 28/36] version bump for beta.4 --- Cargo.toml | 14 +++++++------- api/Cargo.toml | 10 +++++----- config/Cargo.toml | 4 ++-- controller/Cargo.toml | 12 ++++++------ impls/Cargo.toml | 8 ++++---- libwallet/Cargo.toml | 6 +++--- util/Cargo.toml | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 68f219c63..3a6fbbfc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" authors = ["Grin Developers "] description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -29,13 +29,13 @@ prettytable-rs = "0.7" log = "0.4" linefeed = "0.5" -grin_wallet_api = { path = "./api", version = "1.1.0-beta.3" } -grin_wallet_impls = { path = "./impls", version = "1.1.0-beta.3" } -grin_wallet_libwallet = { path = "./libwallet", version = "1.1.0-beta.3" } -grin_wallet_controller = { path = "./controller", version = "1.1.0-beta.3" } -grin_wallet_config = { path = "./config", version = "1.1.0-beta.3" } +grin_wallet_api = { path = "./api", version = "1.1.0-beta.4" } +grin_wallet_impls = { path = "./impls", version = "1.1.0-beta.4" } +grin_wallet_libwallet = { path = "./libwallet", version = "1.1.0-beta.4" } +grin_wallet_controller = { path = "./controller", version = "1.1.0-beta.4" } +grin_wallet_config = { path = "./config", version = "1.1.0-beta.4" } -grin_wallet_util = { path = "./util", version = "1.1.0-beta.3" } +grin_wallet_util = { path = "./util", version = "1.1.0-beta.4" } [build-dependencies] built = "0.3" diff --git a/api/Cargo.toml b/api/Cargo.toml index 746c58def..4cedccce8 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_api" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" authors = ["Grin Developers "] description = "Grin Wallet API" license = "Apache-2.0" @@ -18,11 +18,11 @@ serde_json = "1" easy-jsonrpc = "0.5.1" chrono = { version = "0.4.4", features = ["serde"] } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.3" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.3" } -grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.3" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.4" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.4" } +grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.4" } -grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } [dev-dependencies] serde_json = "1" diff --git a/config/Cargo.toml b/config/Cargo.toml index cc3d4d0ae..a69012070 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_config" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" authors = ["Grin Developers "] description = "Configuration for grin wallet , a simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -16,7 +16,7 @@ serde_derive = "1" toml = "0.4" dirs = "1.0.3" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } [dev-dependencies] pretty_assertions = "0.5.1" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index 84d001c86..ed02206f4 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_controller" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" authors = ["Grin Developers "] description = "Controllers for grin wallet instantiation" license = "Apache-2.0" @@ -32,9 +32,9 @@ chrono = { version = "0.4.4", features = ["serde"] } easy-jsonrpc = "0.5.1" lazy_static = "1" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } -grin_wallet_api = { path = "../api", version = "1.1.0-beta.3" } -grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.3" } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.3" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.3" } +grin_wallet_api = { path = "../api", version = "1.1.0-beta.4" } +grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.4" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.4" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.4" } diff --git a/impls/Cargo.toml b/impls/Cargo.toml index aa83b40fb..0abe62482 100644 --- a/impls/Cargo.toml +++ b/impls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_impls" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" authors = ["Grin Developers "] description = "Concrete types derived from libwallet traits" license = "Apache-2.0" @@ -26,7 +26,7 @@ tokio-retry = "0.1" uuid = { version = "0.7", features = ["serde", "v4"] } chrono = { version = "0.4.4", features = ["serde"] } -grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.3" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.3" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.4" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.4" } diff --git a/libwallet/Cargo.toml b/libwallet/Cargo.toml index 55ece25ba..5ca1a2786 100644 --- a/libwallet/Cargo.toml +++ b/libwallet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_libwallet" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" authors = ["Grin Developers "] description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -25,7 +25,7 @@ lazy_static = "1" strum = "0.15" strum_macros = "0.15" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.3" } +grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } [dev-dependencies] -grin_wallet_config = { path = "../config", version = "1.1.0-beta.3" } +grin_wallet_config = { path = "../config", version = "1.1.0-beta.4" } diff --git a/util/Cargo.toml b/util/Cargo.toml index 420b9d9be..a9cdb4f1c 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_util" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" authors = ["Grin Developers "] description = "Util, for generic utilities and to re-export grin crates" license = "Apache-2.0" From 36ab7855891a2dc5da3e68d08736188946953575 Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Sat, 1 Jun 2019 10:46:45 +0800 Subject: [PATCH 29/36] cargo.lock crate version update, and remove 3 build warning from cargo 1.35.0 --- Cargo.lock | 56 ++++++++++++++++++------------------ api/src/foreign_rpc.rs | 1 - api/src/owner_rpc.rs | 1 - libwallet/src/internal/tx.rs | 2 +- 4 files changed, 29 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 11f3e9b92..1991a8afd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -753,19 +753,19 @@ dependencies = [ [[package]] name = "grin_wallet" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" dependencies = [ "built 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_api 1.1.0-beta.3", - "grin_wallet_config 1.1.0-beta.3", - "grin_wallet_controller 1.1.0-beta.3", - "grin_wallet_impls 1.1.0-beta.3", - "grin_wallet_libwallet 1.1.0-beta.3", - "grin_wallet_util 1.1.0-beta.3", + "grin_wallet_api 1.1.0-beta.4", + "grin_wallet_config 1.1.0-beta.4", + "grin_wallet_controller 1.1.0-beta.4", + "grin_wallet_impls 1.1.0-beta.4", + "grin_wallet_libwallet 1.1.0-beta.4", + "grin_wallet_util 1.1.0-beta.4", "linefeed 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "prettytable-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -774,16 +774,16 @@ dependencies = [ [[package]] name = "grin_wallet_api" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "easy-jsonrpc 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.3", - "grin_wallet_impls 1.1.0-beta.3", - "grin_wallet_libwallet 1.1.0-beta.3", - "grin_wallet_util 1.1.0-beta.3", + "grin_wallet_config 1.1.0-beta.4", + "grin_wallet_impls 1.1.0-beta.4", + "grin_wallet_libwallet 1.1.0-beta.4", + "grin_wallet_util 1.1.0-beta.4", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -792,10 +792,10 @@ dependencies = [ [[package]] name = "grin_wallet_config" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_util 1.1.0-beta.3", + "grin_wallet_util 1.1.0-beta.4", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", @@ -805,18 +805,18 @@ dependencies = [ [[package]] name = "grin_wallet_controller" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "easy-jsonrpc 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_api 1.1.0-beta.3", - "grin_wallet_config 1.1.0-beta.3", - "grin_wallet_impls 1.1.0-beta.3", - "grin_wallet_libwallet 1.1.0-beta.3", - "grin_wallet_util 1.1.0-beta.3", + "grin_wallet_api 1.1.0-beta.4", + "grin_wallet_config 1.1.0-beta.4", + "grin_wallet_impls 1.1.0-beta.4", + "grin_wallet_libwallet 1.1.0-beta.4", + "grin_wallet_util 1.1.0-beta.4", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -836,16 +836,16 @@ dependencies = [ [[package]] name = "grin_wallet_impls" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.3", - "grin_wallet_libwallet 1.1.0-beta.3", - "grin_wallet_util 1.1.0-beta.3", + "grin_wallet_config 1.1.0-beta.4", + "grin_wallet_libwallet 1.1.0-beta.4", + "grin_wallet_util 1.1.0-beta.4", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -860,14 +860,14 @@ dependencies = [ [[package]] name = "grin_wallet_libwallet" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.3", - "grin_wallet_util 1.1.0-beta.3", + "grin_wallet_config 1.1.0-beta.4", + "grin_wallet_util 1.1.0-beta.4", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -881,7 +881,7 @@ dependencies = [ [[package]] name = "grin_wallet_util" -version = "1.1.0-beta.3" +version = "1.1.0-beta.4" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", diff --git a/api/src/foreign_rpc.rs b/api/src/foreign_rpc.rs index 8d363f2a3..f7ae06c0b 100644 --- a/api/src/foreign_rpc.rs +++ b/api/src/foreign_rpc.rs @@ -567,7 +567,6 @@ pub fn run_doctest_foreign( init_tx: bool, init_invoice_tx: bool, ) -> Result, String> { - use crate::{Foreign, ForeignRpc}; use easy_jsonrpc::Handler; use grin_wallet_impls::test_framework::{self, LocalWalletClient, WalletProxy}; use grin_wallet_libwallet::api_impl; diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index 4593faba8..5ce710260 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -1336,7 +1336,6 @@ pub fn run_doctest_owner( lock_tx: bool, finalize_tx: bool, ) -> Result, String> { - use crate::{Owner, OwnerRpc}; use easy_jsonrpc::Handler; use grin_wallet_impls::test_framework::{self, LocalWalletClient, WalletProxy}; use grin_wallet_libwallet::api_impl; diff --git a/libwallet/src/internal/tx.rs b/libwallet/src/internal/tx.rs index d18f84aee..d6084fd6f 100644 --- a/libwallet/src/internal/tx.rs +++ b/libwallet/src/internal/tx.rs @@ -23,7 +23,7 @@ use crate::slate::Slate; use crate::types::{Context, NodeClient, TxLogEntryType, WalletBackend}; use crate::{Error, ErrorKind}; -/// static for incrementing test UUIDs +// static for incrementing test UUIDs lazy_static! { static ref SLATE_COUNTER: Mutex = { Mutex::new(0) }; } From 03ab8ad8bd1f798c9f2e4994a59e1cf4d3cb57be Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Sat, 1 Jun 2019 10:37:33 +0100 Subject: [PATCH 30/36] Fix for API secret on node API startup (#131) * fix for api_secret when reading node height * rustfmt * remove macro export * trigger ci again --- src/bin/cmd/wallet.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/bin/cmd/wallet.rs b/src/bin/cmd/wallet.rs index 96246b093..707b97985 100644 --- a/src/bin/cmd/wallet.rs +++ b/src/bin/cmd/wallet.rs @@ -17,6 +17,7 @@ use crate::config::GlobalWalletConfig; use clap::ArgMatches; use grin_wallet_config::WalletConfig; use grin_wallet_impls::{HTTPNodeClient, WalletSeed, SEED_FILE}; +use grin_wallet_libwallet::NodeClient; use std::path::PathBuf; use std::thread; use std::time::Duration; @@ -43,20 +44,23 @@ pub fn wallet_command(wallet_args: &ArgMatches<'_>, config: GlobalWalletConfig) // just get defaults from the global config let wallet_config = config.members.unwrap().wallet; - let node_client = HTTPNodeClient::new(&wallet_config.check_node_api_http_addr, None); - // TODO: Very temporary code to obsolete grin wallet for the first hard fork // All tx operations call get_chain_height as a first order of business, // so this is the most non-intrusive place to put this + let mut node_client = HTTPNodeClient::new(&wallet_config.check_node_api_http_addr, None); + let global_wallet_args = wallet_args::parse_global_args(&wallet_config, &wallet_args) + .expect("Can't read configuration file"); + node_client.set_node_api_secret(global_wallet_args.node_api_secret.clone()); + match node_client.clone().chain_height() { Ok(h) => { if h >= 262080 { let err_str = "This version of grin-wallet is obsolete as of block 252080. Please download v2.0.0 from https://github.com/mimblewimble/grin-wallet/releases"; error!("{}", err_str); println!(); - println!("**************"); + println!("***************"); println!("{}", err_str); - println!("**************"); + println!("***************"); println!("(You can still view your balances by disconnecting from the grin node, however you will not be able to transact until you upgrade)"); println!(); return 1; From 42befd2340c179ef1ec8d8a5cc17850d6a6522ca Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Tue, 4 Jun 2019 16:48:04 +0100 Subject: [PATCH 31/36] More helpful error message on recover when `wallet_data` dir doesn't exist (#134) * make recover error message when wallet doesn't exist more helpful * rustfmt --- impls/src/error.rs | 4 ++++ impls/src/seed.rs | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/impls/src/error.rs b/impls/src/error.rs index 85ee501d3..aadb2bd73 100644 --- a/impls/src/error.rs +++ b/impls/src/error.rs @@ -57,6 +57,10 @@ pub enum ErrorKind { #[fail(display = "Wallet seed doesn't exist error")] WalletSeedDoesntExist, + /// Wallet seed doesn't exist + #[fail(display = "Wallet doesn't exist at {}. {}", _0, _1)] + WalletDoesntExist(String, String), + /// Enc/Decryption Error #[fail(display = "Enc/Decryption error (check password?)")] Encryption, diff --git a/impls/src/seed.rs b/impls/src/seed.rs index 4770da334..485f5e604 100644 --- a/impls/src/seed.rs +++ b/impls/src/seed.rs @@ -138,6 +138,13 @@ impl WalletSeed { if WalletSeed::seed_file_exists(wallet_config).is_err() { WalletSeed::backup_seed(wallet_config)?; } + if !Path::new(&wallet_config.data_file_dir).exists() { + return Err(ErrorKind::WalletDoesntExist( + wallet_config.data_file_dir.clone(), + "To create a new wallet from a recovery phrase, use 'grin-wallet init -r'" + .to_owned(), + ))?; + } let seed = WalletSeed::from_mnemonic(word_list)?; let enc_seed = EncryptedWalletSeed::from_seed(&seed, password)?; let enc_seed_json = serde_json::to_string_pretty(&enc_seed).context(ErrorKind::Format)?; From ea4849a05f0df62ad834c91b975a0ab04fda111d Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Wed, 5 Jun 2019 22:35:11 +0100 Subject: [PATCH 32/36] fixes and version update for final 1.0.0 build --- Cargo.lock | 184 ++++++++++++++++++-------------- Cargo.toml | 14 +-- api/Cargo.toml | 10 +- config/Cargo.toml | 4 +- controller/Cargo.toml | 12 +-- impls/Cargo.toml | 8 +- impls/src/test_framework/mod.rs | 2 +- libwallet/Cargo.toml | 6 +- libwallet/src/slate.rs | 6 +- util/Cargo.toml | 26 ++--- 10 files changed, 147 insertions(+), 125 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1991a8afd..1d835ae1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -553,18 +553,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "grin_api" -version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_chain 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_core 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_p2p 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_pool 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_store 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_util 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-rustls 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -585,8 +585,8 @@ dependencies = [ [[package]] name = "grin_chain" -version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -594,10 +594,10 @@ dependencies = [ "croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_keychain 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_store 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_util 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -608,8 +608,8 @@ dependencies = [ [[package]] name = "grin_core" -version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -618,8 +618,8 @@ dependencies = [ "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_keychain 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_util 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "lru-cache 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -634,13 +634,13 @@ dependencies = [ [[package]] name = "grin_keychain" -version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "digest 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_util 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -652,21 +652,22 @@ dependencies = [ "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", + "zeroize 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "grin_p2p" -version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "enum_primitive 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_chain 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_core 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_store 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_util 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -678,17 +679,17 @@ dependencies = [ [[package]] name = "grin_pool" -version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_keychain 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_store 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_util 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (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.91 (registry+https://github.com/rust-lang/crates.io-index)", @@ -711,16 +712,16 @@ dependencies = [ [[package]] name = "grin_store" -version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "croaring 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_core 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_util 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "lmdb-zero 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -732,8 +733,8 @@ dependencies = [ [[package]] name = "grin_util" -version = "1.1.0-beta.2" -source = "git+https://github.com/mimblewimble/grin#25a2ee1233d9de3ab68be4e109f0ac0005dd4ed3" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "backtrace 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -753,19 +754,19 @@ dependencies = [ [[package]] name = "grin_wallet" -version = "1.1.0-beta.4" +version = "1.1.0" dependencies = [ "built 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "ctrlc 3.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_api 1.1.0-beta.4", - "grin_wallet_config 1.1.0-beta.4", - "grin_wallet_controller 1.1.0-beta.4", - "grin_wallet_impls 1.1.0-beta.4", - "grin_wallet_libwallet 1.1.0-beta.4", - "grin_wallet_util 1.1.0-beta.4", + "grin_wallet_api 1.1.0", + "grin_wallet_config 1.1.0", + "grin_wallet_controller 1.1.0", + "grin_wallet_impls 1.1.0", + "grin_wallet_libwallet 1.1.0", + "grin_wallet_util 1.1.0", "linefeed 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "prettytable-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -774,16 +775,16 @@ dependencies = [ [[package]] name = "grin_wallet_api" -version = "1.1.0-beta.4" +version = "1.1.0" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "easy-jsonrpc 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.4", - "grin_wallet_impls 1.1.0-beta.4", - "grin_wallet_libwallet 1.1.0-beta.4", - "grin_wallet_util 1.1.0-beta.4", + "grin_wallet_config 1.1.0", + "grin_wallet_impls 1.1.0", + "grin_wallet_libwallet 1.1.0", + "grin_wallet_util 1.1.0", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -792,10 +793,10 @@ dependencies = [ [[package]] name = "grin_wallet_config" -version = "1.1.0-beta.4" +version = "1.1.0" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_util 1.1.0-beta.4", + "grin_wallet_util 1.1.0", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", @@ -805,18 +806,18 @@ dependencies = [ [[package]] name = "grin_wallet_controller" -version = "1.1.0-beta.4" +version = "1.1.0" dependencies = [ "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "easy-jsonrpc 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_api 1.1.0-beta.4", - "grin_wallet_config 1.1.0-beta.4", - "grin_wallet_impls 1.1.0-beta.4", - "grin_wallet_libwallet 1.1.0-beta.4", - "grin_wallet_util 1.1.0-beta.4", + "grin_wallet_api 1.1.0", + "grin_wallet_config 1.1.0", + "grin_wallet_impls 1.1.0", + "grin_wallet_libwallet 1.1.0", + "grin_wallet_util 1.1.0", "hyper 0.12.19 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -836,16 +837,16 @@ dependencies = [ [[package]] name = "grin_wallet_impls" -version = "1.1.0-beta.4" +version = "1.1.0" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.4", - "grin_wallet_libwallet 1.1.0-beta.4", - "grin_wallet_util 1.1.0-beta.4", + "grin_wallet_config 1.1.0", + "grin_wallet_libwallet 1.1.0", + "grin_wallet_util 1.1.0", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "ring 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -860,14 +861,14 @@ dependencies = [ [[package]] name = "grin_wallet_libwallet" -version = "1.1.0-beta.4" +version = "1.1.0" dependencies = [ "blake2-rfc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_wallet_config 1.1.0-beta.4", - "grin_wallet_util 1.1.0-beta.4", + "grin_wallet_config 1.1.0", + "grin_wallet_util 1.1.0", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -881,15 +882,15 @@ dependencies = [ [[package]] name = "grin_wallet_util" -version = "1.1.0-beta.4" +version = "1.1.0" dependencies = [ "dirs 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", - "grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", - "grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)", + "grin_api 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_chain 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_core 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_keychain 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_store 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "grin_util 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "pretty_assertions 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2695,6 +2696,25 @@ name = "zeroize" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "zeroize" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "zeroize_derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "zeroize_derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", + "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", + "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "zip" version = "0.4.2" @@ -2774,15 +2794,15 @@ dependencies = [ "checksum generic-array 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef25c5683767570c2bbd7deba372926a55eaae9982d7726ee2a1050239d45b9d" "checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" -"checksum grin_api 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_chain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_core 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_keychain 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_p2p 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_pool 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_api 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9720b56619eb854e6d1ed4221a50cf669f39b7ee7c7519e9bf5bd45872665dea" +"checksum grin_chain 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfd7dde76b0c0a6da1151d4d14dd19c3dff882f45205ca8c7c348ff37d18a317" +"checksum grin_core 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b08d46a558ba1c6451b343deb2fd607e1829965969bdc9a09417a60e3c615015" +"checksum grin_keychain 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "aef5c2b6175877f42052e3095c2dbf0bf6b7136aa0f92398fa7914a6ee6e0d99" +"checksum grin_p2p 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f8b7826739d7d3d64d31ff6eda890d4e1efe56f82e53b97613c7c74c85c0fff2" +"checksum grin_pool 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2d19f91334fdb70d95164f00dba4b77bf10321740a446ff81223f2bffe4ce417" "checksum grin_secp256k1zkp 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "75e9a265f3eeea4c204470f7262e2c6fe18f3d8ddf5fb24340cb550ac4f909c5" -"checksum grin_store 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" -"checksum grin_util 1.1.0-beta.2 (git+https://github.com/mimblewimble/grin)" = "" +"checksum grin_store 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4ac5c8b11f0bbc7ad319e6b5d3a99d96bd4dd96dcfbb093e0cae2499fa19559c" +"checksum grin_util 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7504d23ede1fa7fb48dda4a6996ab8bb2cf4da7ee4c9f5944ab5402ec17eceff" "checksum h2 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "2b53def7bb0253af7718036fe9338c15defd209136819464384f3a553e07481b" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hmac 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "733e1b3ac906631ca01ebb577e9bb0f5e37a454032b9036b5eaea4013ed6f99a" @@ -2986,4 +3006,6 @@ dependencies = [ "checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" "checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d" "checksum zeroize 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8ddfeb6eee2fb3b262ef6e0898a52b7563bb8e0d5955a313b3cf2f808246ea14" +"checksum zeroize 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b60a6c572b91d8ecb0a460950d84fe5b40699edd07d65f73789b31237afc8f66" +"checksum zeroize_derive 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9dac4b660d969bff9c3fe1847a891cacaa8b21dd5f2aae6e0a3e0975aea96431" "checksum zip 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "36b9e08fb518a65cf7e08a1e482573eb87a2f4f8c6619316612a3c1f162fe822" diff --git a/Cargo.toml b/Cargo.toml index 3a6fbbfc2..40a647701 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet" -version = "1.1.0-beta.4" +version = "1.1.0" authors = ["Grin Developers "] description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -29,13 +29,13 @@ prettytable-rs = "0.7" log = "0.4" linefeed = "0.5" -grin_wallet_api = { path = "./api", version = "1.1.0-beta.4" } -grin_wallet_impls = { path = "./impls", version = "1.1.0-beta.4" } -grin_wallet_libwallet = { path = "./libwallet", version = "1.1.0-beta.4" } -grin_wallet_controller = { path = "./controller", version = "1.1.0-beta.4" } -grin_wallet_config = { path = "./config", version = "1.1.0-beta.4" } +grin_wallet_api = { path = "./api", version = "1.1.0" } +grin_wallet_impls = { path = "./impls", version = "1.1.0" } +grin_wallet_libwallet = { path = "./libwallet", version = "1.1.0" } +grin_wallet_controller = { path = "./controller", version = "1.1.0" } +grin_wallet_config = { path = "./config", version = "1.1.0" } -grin_wallet_util = { path = "./util", version = "1.1.0-beta.4" } +grin_wallet_util = { path = "./util", version = "1.1.0" } [build-dependencies] built = "0.3" diff --git a/api/Cargo.toml b/api/Cargo.toml index 4cedccce8..571cbbfac 100644 --- a/api/Cargo.toml +++ b/api/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_api" -version = "1.1.0-beta.4" +version = "1.1.0" authors = ["Grin Developers "] description = "Grin Wallet API" license = "Apache-2.0" @@ -18,11 +18,11 @@ serde_json = "1" easy-jsonrpc = "0.5.1" chrono = { version = "0.4.4", features = ["serde"] } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.4" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.4" } -grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.4" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0" } +grin_wallet_config = { path = "../config", version = "1.1.0" } +grin_wallet_impls = { path = "../impls", version = "1.1.0" } -grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } +grin_wallet_util = { path = "../util", version = "1.1.0" } [dev-dependencies] serde_json = "1" diff --git a/config/Cargo.toml b/config/Cargo.toml index a69012070..af34723cc 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_config" -version = "1.1.0-beta.4" +version = "1.1.0" authors = ["Grin Developers "] description = "Configuration for grin wallet , a simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -16,7 +16,7 @@ serde_derive = "1" toml = "0.4" dirs = "1.0.3" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } +grin_wallet_util = { path = "../util", version = "1.1.0" } [dev-dependencies] pretty_assertions = "0.5.1" diff --git a/controller/Cargo.toml b/controller/Cargo.toml index ed02206f4..c48857e2d 100644 --- a/controller/Cargo.toml +++ b/controller/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_controller" -version = "1.1.0-beta.4" +version = "1.1.0" authors = ["Grin Developers "] description = "Controllers for grin wallet instantiation" license = "Apache-2.0" @@ -32,9 +32,9 @@ chrono = { version = "0.4.4", features = ["serde"] } easy-jsonrpc = "0.5.1" lazy_static = "1" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } +grin_wallet_util = { path = "../util", version = "1.1.0" } -grin_wallet_api = { path = "../api", version = "1.1.0-beta.4" } -grin_wallet_impls = { path = "../impls", version = "1.1.0-beta.4" } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.4" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.4" } +grin_wallet_api = { path = "../api", version = "1.1.0" } +grin_wallet_impls = { path = "../impls", version = "1.1.0" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0" } +grin_wallet_config = { path = "../config", version = "1.1.0" } diff --git a/impls/Cargo.toml b/impls/Cargo.toml index 0abe62482..eb3499ff1 100644 --- a/impls/Cargo.toml +++ b/impls/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_impls" -version = "1.1.0-beta.4" +version = "1.1.0" authors = ["Grin Developers "] description = "Concrete types derived from libwallet traits" license = "Apache-2.0" @@ -26,7 +26,7 @@ tokio-retry = "0.1" uuid = { version = "0.7", features = ["serde", "v4"] } chrono = { version = "0.4.4", features = ["serde"] } -grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } +grin_wallet_util = { path = "../util", version = "1.1.0" } -grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0-beta.4" } -grin_wallet_config = { path = "../config", version = "1.1.0-beta.4" } +grin_wallet_libwallet = { path = "../libwallet", version = "1.1.0" } +grin_wallet_config = { path = "../config", version = "1.1.0" } diff --git a/impls/src/test_framework/mod.rs b/impls/src/test_framework/mod.rs index 9aac68292..ca07b8879 100644 --- a/impls/src/test_framework/mod.rs +++ b/impls/src/test_framework/mod.rs @@ -70,7 +70,7 @@ fn get_outputs_by_pmmr_index_local( outputs: outputs .2 .iter() - .map(|x| api::OutputPrintable::from_output(x, chain.clone(), None, true).unwrap()) + .map(|x| api::OutputPrintable::from_output(x, chain.clone(), None, true, false).unwrap()) .collect(), } } diff --git a/libwallet/Cargo.toml b/libwallet/Cargo.toml index 5ca1a2786..0ec93ecd5 100644 --- a/libwallet/Cargo.toml +++ b/libwallet/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_libwallet" -version = "1.1.0-beta.4" +version = "1.1.0" authors = ["Grin Developers "] description = "Simple, private and scalable cryptocurrency implementation based on the MimbleWimble chain format." license = "Apache-2.0" @@ -25,7 +25,7 @@ lazy_static = "1" strum = "0.15" strum_macros = "0.15" -grin_wallet_util = { path = "../util", version = "1.1.0-beta.4" } +grin_wallet_util = { path = "../util", version = "1.1.0" } [dev-dependencies] -grin_wallet_config = { path = "../config", version = "1.1.0-beta.4" } +grin_wallet_config = { path = "../config", version = "1.1.0" } diff --git a/libwallet/src/slate.rs b/libwallet/src/slate.rs index 0cc284077..7798dd16d 100644 --- a/libwallet/src/slate.rs +++ b/libwallet/src/slate.rs @@ -483,7 +483,7 @@ impl Slate { let blind_offset = keychain.blind_sum( &BlindSum::new() .add_blinding_factor(BlindingFactor::from_secret_key(sec_key.clone())) - .sub_blinding_factor(self.tx.offset), + .sub_blinding_factor(self.tx.offset.clone()), )?; *sec_key = blind_offset.secret_key(&keychain.secp())?; Ok(()) @@ -631,7 +631,7 @@ impl Slate { where K: Keychain, { - let kernel_offset = self.tx.offset; + let kernel_offset = &self.tx.offset; self.check_fees()?; @@ -840,7 +840,7 @@ impl From for TransactionV2 { impl From<&Transaction> for TransactionV2 { fn from(tx: &Transaction) -> TransactionV2 { let Transaction { offset, body } = tx; - let offset = *offset; + let offset = offset.clone(); let body = TransactionBodyV2::from(body); TransactionV2 { offset, body } } diff --git a/util/Cargo.toml b/util/Cargo.toml index a9cdb4f1c..e0ee0bfd8 100644 --- a/util/Cargo.toml +++ b/util/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "grin_wallet_util" -version = "1.1.0-beta.4" +version = "1.1.0" authors = ["Grin Developers "] description = "Util, for generic utilities and to re-export grin crates" license = "Apache-2.0" @@ -17,12 +17,12 @@ toml = "0.4" dirs = "1.0.3" # For Release -#grin_core = "1.1.0-beta.1" -#grin_keychain = "1.1.0-beta.1" -#grin_chain = "1.1.0-beta.1" -#grin_util = "1.1.0-beta.1" -#grin_api = "1.1.0-beta.1" -#grin_store = "1.1.0-beta.1" +grin_core = "1.1.0" +grin_keychain = "1.1.0" +grin_chain = "1.1.0" +grin_util = "1.1.0" +grin_api = "1.1.0" +grin_store = "1.1.0" # For beta release # grin_core = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } @@ -33,12 +33,12 @@ dirs = "1.0.3" # grin_store = { git = "https://github.com/mimblewimble/grin", tag = "v1.1.0-beta.2" } # For bleeding edge -grin_core = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_util = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_api = { git = "https://github.com/mimblewimble/grin", branch = "master" } -grin_store = { git = "https://github.com/mimblewimble/grin", branch = "master" } +# grin_core = { git = "https://github.com/mimblewimble/grin", branch = "master" } +# grin_keychain = { git = "https://github.com/mimblewimble/grin", branch = "master" } +# grin_chain = { git = "https://github.com/mimblewimble/grin", branch = "master" } +# grin_util = { git = "https://github.com/mimblewimble/grin", branch = "master" } +# grin_api = { git = "https://github.com/mimblewimble/grin", branch = "master" } +# grin_store = { git = "https://github.com/mimblewimble/grin", branch = "master" } # For local testing #grin_core = { path = "../../grin/core", version= "1.1.0-beta.2"} From 313681283131a5b93cf3e232a81f3485c6d7d308 Mon Sep 17 00:00:00 2001 From: Yeastplume Date: Wed, 5 Jun 2019 22:35:23 +0100 Subject: [PATCH 33/36] fixes and version update for final 1.0.0 build --- impls/src/test_framework/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/impls/src/test_framework/mod.rs b/impls/src/test_framework/mod.rs index ca07b8879..948f9a0e1 100644 --- a/impls/src/test_framework/mod.rs +++ b/impls/src/test_framework/mod.rs @@ -70,7 +70,9 @@ fn get_outputs_by_pmmr_index_local( outputs: outputs .2 .iter() - .map(|x| api::OutputPrintable::from_output(x, chain.clone(), None, true, false).unwrap()) + .map(|x| { + api::OutputPrintable::from_output(x, chain.clone(), None, true, false).unwrap() + }) .collect(), } } From 00fe54c99a4eb3647b16ca6300f98f37edbca498 Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Sun, 9 Jun 2019 17:50:38 +0800 Subject: [PATCH 34/36] rustfmt --- libwallet/src/api_impl/foreign.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libwallet/src/api_impl/foreign.rs b/libwallet/src/api_impl/foreign.rs index 887f083be..e49d1ecdd 100644 --- a/libwallet/src/api_impl/foreign.rs +++ b/libwallet/src/api_impl/foreign.rs @@ -19,8 +19,8 @@ use crate::grin_keychain::Keychain; use crate::internal::{tx, updater}; use crate::slate_versions::SlateVersion; use crate::{ - BlockFees, CbData, Error, ErrorKind, NodeClient, Slate, TxLogEntryType, - VersionInfo, WalletBackend, + BlockFees, CbData, Error, ErrorKind, NodeClient, Slate, TxLogEntryType, VersionInfo, + WalletBackend, }; const FOREIGN_API_VERSION: u16 = 2; From bbef157a7413982d25be37365929115c5615e708 Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Sun, 9 Jun 2019 18:00:42 +0800 Subject: [PATCH 35/36] get back the travis-ci scripts --- .ci/release-jobs | 122 +++++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 84 ++++++++++++++++++++++++++++++++ 2 files changed, 206 insertions(+) create mode 100644 .ci/release-jobs create mode 100644 .travis.yml diff --git a/.ci/release-jobs b/.ci/release-jobs new file mode 100644 index 000000000..8e4ab070a --- /dev/null +++ b/.ci/release-jobs @@ -0,0 +1,122 @@ +#!/usr/bin/env bash + +# Copyright 2019 The Grin Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script contains release-related jobs. + +# Redeclare CI and VCP specific environment variables +# to make future migration to other providers easier. +readonly JOB_ID="${TRAVIS_JOB_ID}" +readonly OS_NAME="${TRAVIS_OS_NAME}" +readonly TEST_RESULT="${TRAVIS_TEST_RESULT}" +readonly VCP_AUTH_TOKEN="${GITHUB_TOKEN}" + +case "${CI_JOB}" in + "release") + # The release can only be triggered after successful completion of all tests. + [[ "${TEST_RESULT}" != 0 ]] && exit 1 + + readonly REPO_TAG="$(git describe --tags --exact-match 2> /dev/null || git symbolic-ref -q --short HEAD)" + + case "${OS_NAME}" in + "linux") + cargo clean && \ + cargo build --release + readonly ARCHIVE_CMD="tar zcf" + readonly BIN_SUFFIX="" + readonly PKG_NAME="grin-wallet-${REPO_TAG}-${JOB_ID}-linux-amd64" + readonly PKG_SUFFIX=".tgz" + ;; + + "osx") + brew update + cargo clean && \ + cargo build --release + readonly ARCHIVE_CMD="tar zcf" + readonly BIN_SUFFIX="" + readonly PKG_NAME="grin-wallet-${REPO_TAG}-${JOB_ID}-osx" + readonly PKG_SUFFIX=".tgz" + ;; + + "windows") + cargo clean && \ + cargo build --release + readonly ARCHIVE_CMD="7z a -tzip" + readonly BIN_SUFFIX=".exe" + readonly PKG_NAME="grin-wallet-${REPO_TAG}-${JOB_ID}-win-x64" + readonly PKG_SUFFIX=".zip" + ;; + + *) + printf "Error! Unknown \$OS_NAME: \`%s\`" "${OS_NAME}" + exit 1 + esac + + printf "creating package \`%s\` for the release binary...\n" "${PKG_NAME}${PKG_SUFFIX}" + + cd ./target/release/ || exit 1 + rm -f -- *"${PKG_SUFFIX}" + ${ARCHIVE_CMD} "${PKG_NAME}${PKG_SUFFIX}" "grin-wallet${BIN_SUFFIX}" + ls -ls -- *.tgz | cut -d' ' -f6- + openssl md5 "${PKG_NAME}${PKG_SUFFIX}" > "${PKG_NAME}${PKG_SUFFIX}-md5sum.txt" + ls -ls -- *-md5sum.txt | cut -d' ' -f6- + cd - > /dev/null || exit 1 + + printf "%s package \`%s\` generated\n" "${OS_NAME}" "${PKG_NAME}${PKG_SUFFIX}" + + # Generate changelog only on the Linux platform to avoid duplication. + [[ "${OS_NAME}" != "linux" ]] && exit 0 + + # Generate CHANGELOG.md + readonly REPO_SLUG="mimblewimble/grin-wallet" + readonly REPO_BRANCH="$(git symbolic-ref -q --short HEAD)" + readonly REPO_PREV_RELEASE_TAG="$(git describe --abbrev=0 --tags "$(git rev-list --tags --skip=0 --max-count=1)")" + + gem install github_changelog_generator + + # Needed by github_changelog_generator. + export CHANGELOG_GITHUB_TOKEN="${VCP_AUTH_TOKEN}" + + github_changelog_generator \ + --user "$(cut -d "/" -f1 <<< ${REPO_SLUG})" \ + --project "$(cut -d "/" -f2 <<< ${REPO_SLUG})" \ + --since-tag "${REPO_PREV_RELEASE_TAG}" + + readonly CHANGELOG_CONTENT="$( CHANGELOG.md + + readonly HEADERS="Authorization: token ${VCP_AUTH_TOKEN}" + readonly RELEASE_URL="https://api.github.com/repos/${REPO_SLUG}/releases" + readonly RELEASE_ID="$(curl -0 --request GET -H "${HEADERS}" "${RELEASE_URL}/tags/${REPO_TAG}" 2> /dev/null | grep id | head -n 1 | sed 's/ *"id": *\(.*\),/\1/')" + + printf "updating release changelog %s for repo: %s, branch: %s, release id: %s\n" "${REPO_TAG}" "${REPO_SLUG}" "${REPO_BRANCH}" "${RELEASE_ID}" + curl -H "${HEADERS}" --request PATCH --data @CHANGELOG.md "${RELEASE_URL}/${RELEASE_ID}" + printf "changelog uploaded.\n" + ;; +esac \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..23b20d92c --- /dev/null +++ b/.travis.yml @@ -0,0 +1,84 @@ +# Copyright 2019 The Grin Developers +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +dist: trusty +sudo: required + +language: rust + +rust: + - stable + +git: + depth: false + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-5 + - cmake + - libcurl4-openssl-dev + - libelf-dev + - libdw-dev + - cmake + - gcc + - binutils-dev + +cache: + cargo: true + timeout: 240 + directories: + - $HOME/.cargo + - $TRAVIS_BUILD_DIR/target + +env: + global: + - RUST_BACKTRACE="1" + - RUST_FLAGS="-C debug-assertions" + +matrix: + include: + - os: linux + env: CI_JOB="test" CI_JOB_ARGS="config libwallet api" + - os: linux + env: CI_JOB="test" CI_JOB_ARGS="impls" + - os: linux + env: CI_JOB="test" CI_JOB_ARGS="controller ." + - os: linux + env: CI_JOB="release" CI_JOB_ARGS= + - os: osx + env: CI_JOB="release" CI_JOB_ARGS= +# - os: windows +# env: CI_JOB="release" CI_JOB_ARGS= + +script: .ci/general-jobs + +before_cache: + - rm -rf $TRAVIS_BUILD_DIR/target/tmp + +before_deploy: + - bash .ci/release-jobs + +deploy: + provider: releases + api_key: + secure: G2OxRSOSGAYq1mcQTYKliOiUaT8mGLp/ZFPTAjL7ByWa0OVxdlK+WEhzN7FrStdbcb1q8DNi/Mie9b2CurVjFGyqeGSCboTdYT77TDT1Wvxp9fPLG4xbgTRwAChq8o7TxOAqeC2J56HXz2Ed2529omJmn4ems6vqI9cHQ+NfpBfh6CKbPXRD7t6Ul6FygAuggYLJE5/e4ws6pRAaD0pFn3vhSab4Ka3L4LFcxffFzH2xt2fEzoA0/NjRxgD/w8wmq6om61+Jir6Zx41HH04R7zLSn7eWVxrw15o5CD4EPqhCRwYUf1kHAabaLiRcmIz9l7jtpcgzFo68A89bFROZ/GyTHazjjobLMSvo1zZnXPGyjx1MiIfOGLBo0842BuvGCEUD2ACiDoZge0+J7mzkdIVSKVx3y2sR3S7W6z4w0YZaS9pjyukhRfIYITomPUhFcJ6xTj1EsYyEAxr+Ohg5nDZgBpy9yjOmJyBKoQgdk8IMadbBO3dhCjkrw7HO4kdtwayEo/W87UH5b2thxbTsd7EWorMh+aCyzcRdRlNBUXI4pWTaP7vZPZGaBAzRYk4ETbUgxpFVxFFNlyie2TzSPz0/j/0JcG1IZxIh9eAI89ebGVKpVgFm6TQvb58J502g3dHwoGxL8lBQTc7DUQAAVBaNEnM5floFw04igQb6VQs= + file_glob: true + file: target/release/grin-wallet-*.* + skip_cleanup: true + on: + repo: mimblewimble/grin-wallet + tags: true From 9201a751e3e6bb100548c79ba99c22189ab3aa2c Mon Sep 17 00:00:00 2001 From: Gary Yu Date: Sun, 9 Jun 2019 21:37:19 +0800 Subject: [PATCH 36/36] fix the test --- api/src/owner_rpc.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/api/src/owner_rpc.rs b/api/src/owner_rpc.rs index fc6c3e0fa..84bdc08ff 100644 --- a/api/src/owner_rpc.rs +++ b/api/src/owner_rpc.rs @@ -160,6 +160,7 @@ pub trait OwnerRpc { "mmr_index": null, "n_child": 0, "root_key_id": "0200000000000000000000000000000000", + "slate_id": null, "status": "Unspent", "tx_log_entry": 0, "value": "60000000000" @@ -176,6 +177,7 @@ pub trait OwnerRpc { "mmr_index": null, "n_child": 1, "root_key_id": "0200000000000000000000000000000000", + "slate_id": null, "status": "Unspent", "tx_log_entry": 1, "value": "60000000000" @@ -544,7 +546,7 @@ pub trait OwnerRpc { "minimum_confirmations": 2, "max_outputs": 500, "num_change_outputs": 1, - "selection_strategy_is_use_all": true, + "selection_strategy": "all", "message": "Ok, here are your grins", "target_slate_version": null, "send_args": null