diff --git a/Cargo.lock b/Cargo.lock index 77010ac2c5..ee8d21b704 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -146,7 +146,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -254,7 +254,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "feature-probe 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -332,7 +332,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.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -445,8 +445,8 @@ dependencies = [ "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "publicsuffix 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "try_from 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -712,8 +712,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" 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)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -839,7 +839,7 @@ name = "generic-array" version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1050,9 +1050,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "hyper 0.10.15 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-native-tls 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1092,9 +1092,9 @@ 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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1130,7 +1130,7 @@ dependencies = [ "jsonrpc-core 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1935,8 +1935,8 @@ dependencies = [ "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", "mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "tokio 0.1.21 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1983,7 +1983,7 @@ dependencies = [ [[package]] name = "ryu" -version = "0.2.7" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2059,15 +2059,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "serde_derive" -version = "1.0.92" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.29 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2077,12 +2077,12 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.39" +version = "1.0.40" 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.92 (registry+https://github.com/rust-lang/crates.io-index)", + "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2092,7 +2092,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2103,7 +2103,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2197,9 +2197,9 @@ dependencies = [ "reed-solomon-erasure 3.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)", "rocksdb 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "solana-budget-api 0.16.3", "solana-budget-program 0.16.3", "solana-chacha-sys 0.16.3", @@ -2241,9 +2241,9 @@ dependencies = [ "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", "solana 0.16.3", "solana-client 0.16.3", @@ -2276,9 +2276,9 @@ dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", "solana 0.16.3", "solana-client 0.16.3", @@ -2298,7 +2298,7 @@ dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.58 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", "solana-sdk 0.16.3", "solana_rbpf 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2338,8 +2338,8 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "solana-runtime 0.16.3", "solana-sdk 0.16.3", ] @@ -2373,9 +2373,9 @@ dependencies = [ "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.18 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", "solana-netutil 0.16.3", "solana-sdk 0.16.3", @@ -2387,8 +2387,8 @@ version = "0.16.3" dependencies = [ "bincode 1.1.4 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", "solana-runtime 0.16.3", "solana-sdk 0.16.3", @@ -2413,8 +2413,8 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", "solana-metrics 0.16.3", "solana-sdk 0.16.3", @@ -2440,8 +2440,8 @@ version = "0.16.3" dependencies = [ "bincode 1.1.4 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", "solana-metrics 0.16.3", "solana-runtime 0.16.3", @@ -2474,9 +2474,9 @@ dependencies = [ "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", "solana 0.16.3", "solana-bpf-loader-api 0.16.3", @@ -2529,8 +2529,8 @@ dependencies = [ "nix 0.14.1 (registry+https://github.com/rust-lang/crates.io-index)", "reqwest 0.9.18 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)", "solana-client 0.16.3", "solana-config-api 0.16.3", @@ -2562,8 +2562,8 @@ dependencies = [ "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.7.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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2573,7 +2573,7 @@ version = "0.16.3" dependencies = [ "assert_cmd 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "solana 0.16.3", "solana-logger 0.16.3", "solana-runtime 0.16.3", @@ -2660,9 +2660,9 @@ dependencies = [ "memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "solana-bpf-loader-api 0.16.3", "solana-bpf-loader-program 0.16.3", "solana-logger 0.16.3", @@ -2695,9 +2695,9 @@ dependencies = [ "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "sha2 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "solana-ed25519-dalek 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", @@ -2711,8 +2711,8 @@ dependencies = [ "bincode 1.1.4 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", "solana-metrics 0.16.3", "solana-sdk 0.16.3", @@ -2739,8 +2739,8 @@ dependencies = [ "num-derive 0.2.5 (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.6.5 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", "solana-sdk 0.16.3", ] @@ -2766,8 +2766,8 @@ dependencies = [ "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-derive 0.2.5 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", "solana-sdk 0.16.3", ] @@ -2787,7 +2787,7 @@ name = "solana-upload-perf" version = "0.16.3" dependencies = [ "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)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "solana-metrics 0.16.3", ] @@ -2797,7 +2797,7 @@ version = "0.16.3" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "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)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "solana 0.16.3", "solana-drone 0.16.3", "solana-logger 0.16.3", @@ -2809,14 +2809,30 @@ dependencies = [ "solana-vote-signer 0.16.3", ] +[[package]] +name = "solana-validator-info" +version = "0.16.3" +dependencies = [ + "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", + "dirs 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", + "solana-client 0.16.3", + "solana-config-api 0.16.3", + "solana-sdk 0.16.3", + "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "solana-vote-api" version = "0.16.3" dependencies = [ "bincode 1.1.4 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", "solana-logger 0.16.3", "solana-metrics 0.16.3", "solana-sdk 0.16.3", @@ -2842,8 +2858,8 @@ dependencies = [ "jsonrpc-derive 12.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "jsonrpc-http-server 12.0.0 (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.92 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "solana-metrics 0.16.3", "solana-sdk 0.16.3", ] @@ -2859,7 +2875,7 @@ dependencies = [ "dirs 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "solana 0.16.3", "solana-budget-api 0.16.3", "solana-budget-program 0.16.3", @@ -3226,7 +3242,7 @@ name = "toml" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -3709,7 +3725,7 @@ dependencies = [ "checksum rocksdb 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f1651697fefd273bfb4fd69466cc2a9d20de557a0213b97233b22b5e95924b5e" "checksum rustc-demangle 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "adacaae16d02b6ec37fdc7acfcddf365978de76d1983d3ee22afc260e1ca9619" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -"checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" +"checksum ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c92464b447c0ee8c4fb3824ecc8383b81717b9f1e74ba2e72540aef7b9f82997" "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 schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f2f6abf258d99c3c1c5c2131d99d064e94b7b3dd5f416483057f308fea253339" @@ -3720,9 +3736,9 @@ dependencies = [ "checksum security-framework-sys 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3d6696852716b589dff9e886ff83778bb635150168e83afa8ac6b8a78cb82abc" "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.92 (registry+https://github.com/rust-lang/crates.io-index)" = "32746bf0f26eab52f06af0d0aa1984f641341d06d8d673c693871da2d188c9be" -"checksum serde_derive 1.0.92 (registry+https://github.com/rust-lang/crates.io-index)" = "46a3223d0c9ba936b61c0d2e3e559e3217dbfb8d65d06d26e8b3c25de38bae3e" -"checksum serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)" = "5a23aa71d4a4d43fdbfaac00eff68ba8a06a51759a89ac3304323e800c4dd40d" +"checksum serde 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "076a696fdea89c19d3baed462576b8f6d663064414b5c793642da8dfeb99475b" +"checksum serde_derive 1.0.94 (registry+https://github.com/rust-lang/crates.io-index)" = "ef45eb79d6463b22f5f9e16d283798b7c0175ba6050bc25c1a946c122727fe7b" +"checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum serde_urlencoded 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d48f9f99cd749a2de71d29da5f948de7f2764cc5a9d7f3c97e3514d4ee6eabf2" "checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582" "checksum sha-1 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "23962131a91661d643c98940b20fcaffe62d776a823247be80a48fcb8b6fce68" diff --git a/Cargo.toml b/Cargo.toml index d7be71e524..d285d81fc3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,7 @@ members = [ "runtime", "sdk", "upload-perf", + "validator-info", "vote-signer", "wallet", ] diff --git a/book/src/testnet-participation.md b/book/src/testnet-participation.md index 208234532a..ee786c3e01 100644 --- a/book/src/testnet-participation.md +++ b/book/src/testnet-participation.md @@ -240,3 +240,18 @@ A local InfluxDB and Grafana instance is now running on your machine. Define `start.sh` output and restart your validator. Metrics should now be streaming and visible from your local Grafana dashboard. + +#### Publishing Validator Info + +You can publish your validator information to the chain to be publicly visible +to other users. + +Run the solana-validator-info CLI to populate a validator-info account: +```bash +$ solana-validator-info publish -k ~/validator-keypair.json +``` +Available fields for VALIDATOR_INFO_ARGS: +* Name (required) +* Website +* Keybase ID +* Details diff --git a/client/src/rpc_client.rs b/client/src/rpc_client.rs index ee1aa73ea9..3b45f47f82 100644 --- a/client/src/rpc_client.rs +++ b/client/src/rpc_client.rs @@ -274,6 +274,40 @@ impl RpcClient { self.get_account(pubkey).map(|account| account.lamports) } + pub fn get_program_accounts(&self, pubkey: &Pubkey) -> io::Result> { + let params = json!([format!("{}", pubkey)]); + let response = self + .client + .send(&RpcRequest::GetProgramAccounts, Some(params), 0) + .map_err(|err| { + io::Error::new( + io::ErrorKind::Other, + format!("AccountNotFound: pubkey={}: {}", pubkey, err), + ) + })?; + + let accounts: Vec<(String, Account)> = + serde_json::from_value::>(response).map_err(|err| { + io::Error::new( + io::ErrorKind::Other, + format!("GetProgramAccounts parse failure: {:?}", err), + ) + })?; + println!("{:?}", accounts); + + let mut pubkey_accounts: Vec<(Pubkey, Account)> = Vec::new(); + for (string, account) in accounts.into_iter() { + let pubkey = string.parse().map_err(|err| { + io::Error::new( + io::ErrorKind::Other, + format!("GetProgramAccounts parse failure: {:?}", err), + ) + })?; + pubkey_accounts.push((pubkey, account)); + } + Ok(pubkey_accounts) + } + /// Request the transaction count. If the response packet is dropped by the network, /// this method will try again 5 times. pub fn get_transaction_count(&self) -> io::Result { diff --git a/client/src/rpc_request.rs b/client/src/rpc_request.rs index 321858c1bc..5a83866b2e 100644 --- a/client/src/rpc_request.rs +++ b/client/src/rpc_request.rs @@ -10,6 +10,7 @@ pub enum RpcRequest { GetBalance, GetClusterNodes, GetNumBlocksSinceSignatureConfirmation, + GetProgramAccounts, GetRecentBlockhash, GetSignatureStatus, GetSlot, @@ -38,6 +39,7 @@ impl RpcRequest { RpcRequest::GetNumBlocksSinceSignatureConfirmation => { "getNumBlocksSinceSignatureConfirmation" } + RpcRequest::GetProgramAccounts => "getProgramAccounts", RpcRequest::GetRecentBlockhash => "getRecentBlockhash", RpcRequest::GetSignatureStatus => "getSignatureStatus", RpcRequest::GetSlot => "getSlot", diff --git a/install/src/command.rs b/install/src/command.rs index 590ef5e40f..d17f515c0b 100644 --- a/install/src/command.rs +++ b/install/src/command.rs @@ -6,7 +6,7 @@ use console::{style, Emoji}; use indicatif::{ProgressBar, ProgressStyle}; use ring::digest::{Context, Digest, SHA256}; use solana_client::rpc_client::RpcClient; -use solana_config_api::config_instruction; +use solana_config_api::config_instruction::{self, ConfigKeys}; use solana_sdk::message::Message; use solana_sdk::pubkey::Pubkey; use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil, Signable}; @@ -203,7 +203,8 @@ fn new_update_manifest( let new_account = config_instruction::create_account::( &from_keypair.pubkey(), &update_manifest_keypair.pubkey(), - 1, // lamports + 1, // lamports + vec![], // additional keys ); let mut transaction = Transaction::new_unsigned_instructions(vec![new_account]); transaction.sign(&[from_keypair], recent_blockhash); @@ -225,6 +226,8 @@ fn store_update_manifest( let signers = [from_keypair, update_manifest_keypair]; let instruction = config_instruction::store::( &update_manifest_keypair.pubkey(), + true, // update_manifest_keypair is signer + vec![], // additional keys update_manifest, ); @@ -239,9 +242,10 @@ fn get_update_manifest( rpc_client: &RpcClient, update_manifest_pubkey: &Pubkey, ) -> Result { - let data = rpc_client + let mut data = rpc_client .get_account_data(update_manifest_pubkey) .map_err(|err| format!("Unable to fetch update manifest: {}", err))?; + data.split_off(ConfigKeys::serialized_size(vec![])); let signed_update_manifest = SignedUpdateManifest::deserialize(update_manifest_pubkey, &data) diff --git a/programs/config_api/Cargo.toml b/programs/config_api/Cargo.toml index c40ad44272..a376f1f714 100644 --- a/programs/config_api/Cargo.toml +++ b/programs/config_api/Cargo.toml @@ -22,4 +22,3 @@ solana-runtime = { path = "../../runtime", version = "0.16.3" } [lib] crate-type = ["lib"] name = "solana_config_api" - diff --git a/programs/config_api/src/config_instruction.rs b/programs/config_api/src/config_instruction.rs index c1690a6b3c..bae5644bf7 100644 --- a/programs/config_api/src/config_instruction.rs +++ b/programs/config_api/src/config_instruction.rs @@ -1,26 +1,59 @@ use crate::id; use crate::ConfigState; +use bincode::serialize; +use serde_derive::{Deserialize, Serialize}; use solana_sdk::instruction::{AccountMeta, Instruction}; use solana_sdk::pubkey::Pubkey; +use solana_sdk::short_vec; use solana_sdk::system_instruction; +/// A collection of keys to be stored in Config account data. +#[derive(Debug, Default, Deserialize, Serialize)] +pub struct ConfigKeys { + // Each key tuple comprises a unique `Pubkey` identifier, + // and `bool` whether that key is a signer of the data + #[serde(with = "short_vec")] + pub keys: Vec<(Pubkey, bool)>, +} + +impl ConfigKeys { + pub fn serialized_size(keys: Vec<(Pubkey, bool)>) -> usize { + serialize(&ConfigKeys { keys }) + .unwrap_or_else(|_| vec![]) + .len() + } +} + /// Create a new, empty configuration account pub fn create_account( from_account_pubkey: &Pubkey, config_account_pubkey: &Pubkey, lamports: u64, + keys: Vec<(Pubkey, bool)>, ) -> Instruction { + let space = T::max_space() + ConfigKeys::serialized_size(keys) as u64; system_instruction::create_account( from_account_pubkey, config_account_pubkey, lamports, - T::max_space(), + space, &id(), ) } /// Store new data in a configuration account -pub fn store(config_account_pubkey: &Pubkey, data: &T) -> Instruction { - let account_metas = vec![AccountMeta::new(*config_account_pubkey, true)]; - Instruction::new(id(), data, account_metas) +pub fn store( + config_account_pubkey: &Pubkey, + is_config_signer: bool, + keys: Vec<(Pubkey, bool)>, + data: &T, +) -> Instruction { + let mut account_metas = vec![AccountMeta::new(*config_account_pubkey, is_config_signer)]; + for (signer_pubkey, _) in keys.iter().filter(|(_, is_signer)| *is_signer) { + if signer_pubkey != config_account_pubkey { + account_metas.push(AccountMeta::new(*signer_pubkey, true)); + } + } + let account_data = (ConfigKeys { keys }, data); + Instruction::new(id(), &account_data, account_metas) } diff --git a/programs/config_api/src/config_processor.rs b/programs/config_api/src/config_processor.rs index ffe157696e..04dadb711e 100644 --- a/programs/config_api/src/config_processor.rs +++ b/programs/config_api/src/config_processor.rs @@ -1,5 +1,7 @@ //! Config program +use crate::config_instruction::ConfigKeys; +use bincode::deserialize; use log::*; use solana_sdk::account::KeyedAccount; use solana_sdk::instruction::InstructionError; @@ -10,8 +12,81 @@ pub fn process_instruction( keyed_accounts: &mut [KeyedAccount], data: &[u8], ) -> Result<(), InstructionError> { - if keyed_accounts[0].signer_key().is_none() { - error!("account[0].signer_key().is_none()"); + let key_list: ConfigKeys = deserialize(data).map_err(|err| { + error!("Invalid ConfigKeys data: {:?} {:?}", data, err); + InstructionError::InvalidInstructionData + })?; + + let current_data: ConfigKeys = deserialize(&keyed_accounts[0].account.data).map_err(|err| { + error!("Invalid data in account[0]: {:?} {:?}", data, err); + InstructionError::InvalidAccountData + })?; + let current_signer_keys: Vec = current_data + .keys + .iter() + .filter(|(_, is_signer)| *is_signer) + .map(|(pubkey, _)| *pubkey) + .collect(); + + if current_signer_keys.is_empty() { + // Config account keypair must be a signer on account initilization, + // or when no signers specified in Config data + if keyed_accounts[0].signer_key().is_none() { + error!("account[0].signer_key().is_none()"); + Err(InstructionError::MissingRequiredSignature)?; + } + } + + let mut counter = 0; + for (i, (signer, _)) in key_list + .keys + .iter() + .filter(|(_, is_signer)| *is_signer) + .enumerate() + { + counter += 1; + if signer != keyed_accounts[0].unsigned_key() { + let account_index = i + 1; + let signer_account = keyed_accounts.get(account_index); + if signer_account.is_none() { + error!("account {:?} is not in account list", signer); + Err(InstructionError::MissingRequiredSignature)?; + } + let signer_key = signer_account.unwrap().signer_key(); + if signer_key.is_none() { + error!("account {:?} signer_key().is_none()", signer); + Err(InstructionError::MissingRequiredSignature)?; + } + if signer_key.unwrap() != signer { + error!( + "account[{:?}].signer_key() does not match Config data)", + account_index + ); + Err(InstructionError::MissingRequiredSignature)?; + } + // If Config account is already initialized, update signatures must match Config data + if !current_data.keys.is_empty() + && current_signer_keys + .iter() + .find(|&pubkey| pubkey == signer) + .is_none() + { + error!("account {:?} is not in stored signer list", signer); + Err(InstructionError::MissingRequiredSignature)?; + } + } else if keyed_accounts[0].signer_key().is_none() { + error!("account[0].signer_key().is_none()"); + Err(InstructionError::MissingRequiredSignature)?; + } + } + + // Check for Config data signers not present in incoming account update + if current_signer_keys.len() > counter { + error!( + "too few signers: {:?}; expected: {:?}", + counter, + current_signer_keys.len() + ); Err(InstructionError::MissingRequiredSignature)?; } @@ -20,7 +95,7 @@ pub fn process_instruction( Err(InstructionError::InvalidInstructionData)?; } - keyed_accounts[0].account.data[0..data.len()].copy_from_slice(data); + keyed_accounts[0].account.data[0..data.len()].copy_from_slice(&data); Ok(()) } @@ -64,7 +139,11 @@ mod tests { (bank, mint_keypair) } - fn create_config_account(bank: Bank, mint_keypair: &Keypair) -> (BankClient, Keypair) { + fn create_config_account( + bank: Bank, + mint_keypair: &Keypair, + keys: Vec<(Pubkey, bool)>, + ) -> (BankClient, Keypair) { let config_keypair = Keypair::new(); let config_pubkey = config_keypair.pubkey(); @@ -76,6 +155,7 @@ mod tests { &mint_keypair.pubkey(), &config_pubkey, 1, + keys, ), ) .expect("new_account"); @@ -87,7 +167,7 @@ mod tests { fn test_process_create_ok() { solana_logger::setup(); let (bank, mint_keypair) = create_bank(10_000); - let (bank_client, config_keypair) = create_config_account(bank, &mint_keypair); + let (bank_client, config_keypair) = create_config_account(bank, &mint_keypair, vec![]); let config_account_data = bank_client .get_account_data(&config_keypair.pubkey()) .unwrap() @@ -102,13 +182,16 @@ mod tests { fn test_process_store_ok() { solana_logger::setup(); let (bank, mint_keypair) = create_bank(10_000); - let (bank_client, config_keypair) = create_config_account(bank, &mint_keypair); + let keys = vec![]; + let (bank_client, config_keypair) = + create_config_account(bank, &mint_keypair, keys.clone()); let config_pubkey = config_keypair.pubkey(); let my_config = MyConfig::new(42); - let instruction = config_instruction::store(&config_pubkey, &my_config); + let instruction = config_instruction::store(&config_pubkey, true, keys.clone(), &my_config); let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + bank_client .send_message(&[&mint_keypair, &config_keypair], message) .unwrap(); @@ -117,6 +200,8 @@ mod tests { .get_account_data(&config_pubkey) .unwrap() .unwrap(); + let meta_length = ConfigKeys::serialized_size(keys); + let config_account_data = &config_account_data[meta_length..config_account_data.len()]; assert_eq!( my_config, MyConfig::deserialize(&config_account_data).unwrap() @@ -127,12 +212,12 @@ mod tests { fn test_process_store_fail_instruction_data_too_large() { solana_logger::setup(); let (bank, mint_keypair) = create_bank(10_000); - let (bank_client, config_keypair) = create_config_account(bank, &mint_keypair); + let (bank_client, config_keypair) = create_config_account(bank, &mint_keypair, vec![]); let config_pubkey = config_keypair.pubkey(); let my_config = MyConfig::new(42); - let mut instruction = config_instruction::store(&config_pubkey, &my_config); + let mut instruction = config_instruction::store(&config_pubkey, true, vec![], &my_config); instruction.data = vec![0; 123]; // <-- Replace data with a vector that's too large let message = Message::new(vec![instruction]); bank_client @@ -148,13 +233,14 @@ mod tests { let system_pubkey = system_keypair.pubkey(); bank.transfer(42, &mint_keypair, &system_pubkey).unwrap(); - let (bank_client, config_keypair) = create_config_account(bank, &mint_keypair); + let (bank_client, config_keypair) = create_config_account(bank, &mint_keypair, vec![]); let config_pubkey = config_keypair.pubkey(); let transfer_instruction = system_instruction::transfer(&system_pubkey, &Pubkey::new_rand(), 42); let my_config = MyConfig::new(42); - let mut store_instruction = config_instruction::store(&config_pubkey, &my_config); + let mut store_instruction = + config_instruction::store(&config_pubkey, true, vec![], &my_config); store_instruction.accounts[0].is_signer = false; // <----- not a signer let message = Message::new(vec![transfer_instruction, store_instruction]); @@ -162,4 +248,232 @@ mod tests { .send_message(&[&system_keypair], message) .unwrap_err(); } + + #[test] + fn test_process_store_with_additional_signers() { + solana_logger::setup(); + let (bank, mint_keypair) = create_bank(10_000); + let pubkey = Pubkey::new_rand(); + let signer0 = Keypair::new(); + let signer1 = Keypair::new(); + let keys = vec![ + (pubkey, false), + (signer0.pubkey(), true), + (signer1.pubkey(), true), + ]; + let (bank_client, config_keypair) = + create_config_account(bank, &mint_keypair, keys.clone()); + let config_pubkey = config_keypair.pubkey(); + + let my_config = MyConfig::new(42); + + let instruction = config_instruction::store(&config_pubkey, true, keys.clone(), &my_config); + let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + + bank_client + .send_message( + &[&mint_keypair, &config_keypair, &signer0, &signer1], + message, + ) + .unwrap(); + + let config_account_data = bank_client + .get_account_data(&config_pubkey) + .unwrap() + .unwrap(); + let meta_length = ConfigKeys::serialized_size(keys.clone()); + let meta_data: ConfigKeys = deserialize(&config_account_data[0..meta_length]).unwrap(); + assert_eq!(meta_data.keys, keys); + let config_account_data = &config_account_data[meta_length..config_account_data.len()]; + assert_eq!( + my_config, + MyConfig::deserialize(&config_account_data).unwrap() + ); + } + + #[test] + fn test_process_store_without_config_signer() { + solana_logger::setup(); + let (bank, mint_keypair) = create_bank(10_000); + let pubkey = Pubkey::new_rand(); + let signer0 = Keypair::new(); + let keys = vec![(pubkey, false), (signer0.pubkey(), true)]; + let (bank_client, config_keypair) = + create_config_account(bank, &mint_keypair, keys.clone()); + let config_pubkey = config_keypair.pubkey(); + + let my_config = MyConfig::new(42); + + let instruction = + config_instruction::store(&config_pubkey, false, keys.clone(), &my_config); + let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + + bank_client + .send_message(&[&mint_keypair, &signer0], message) + .unwrap_err(); + } + + #[test] + fn test_process_store_with_bad_additional_signer() { + solana_logger::setup(); + let (bank, mint_keypair) = create_bank(10_000); + let signer0 = Keypair::new(); + let signer1 = Keypair::new(); + let keys = vec![(signer0.pubkey(), true)]; + let (bank_client, config_keypair) = + create_config_account(bank, &mint_keypair, keys.clone()); + let config_pubkey = config_keypair.pubkey(); + + let my_config = MyConfig::new(42); + + // Config-data pubkey doesn't match signer + let instruction = config_instruction::store(&config_pubkey, true, keys.clone(), &my_config); + let mut message = + Message::new_with_payer(vec![instruction.clone()], Some(&mint_keypair.pubkey())); + message.account_keys[2] = signer1.pubkey(); + bank_client + .send_message(&[&mint_keypair, &config_keypair, &signer1], message) + .unwrap_err(); + + // Config-data pubkey not a signer + let mut message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + message.header.num_required_signatures = 2; + bank_client + .send_message(&[&mint_keypair, &config_keypair], message) + .unwrap_err(); + } + + #[test] + fn test_config_updates() { + solana_logger::setup(); + let (bank, mint_keypair) = create_bank(10_000); + let pubkey = Pubkey::new_rand(); + let signer0 = Keypair::new(); + let signer1 = Keypair::new(); + let keys = vec![ + (pubkey, false), + (signer0.pubkey(), true), + (signer1.pubkey(), true), + ]; + let (bank_client, config_keypair) = + create_config_account(bank, &mint_keypair, keys.clone()); + let config_pubkey = config_keypair.pubkey(); + + let my_config = MyConfig::new(42); + + let instruction = config_instruction::store(&config_pubkey, true, keys.clone(), &my_config); + let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + + bank_client + .send_message( + &[&mint_keypair, &config_keypair, &signer0, &signer1], + message, + ) + .unwrap(); + + // Update with expected signatures + let new_config = MyConfig::new(84); + let instruction = + config_instruction::store(&config_pubkey, false, keys.clone(), &new_config); + let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + bank_client + .send_message(&[&mint_keypair, &signer0, &signer1], message) + .unwrap(); + + let config_account_data = bank_client + .get_account_data(&config_pubkey) + .unwrap() + .unwrap(); + let meta_length = ConfigKeys::serialized_size(keys.clone()); + let meta_data: ConfigKeys = deserialize(&config_account_data[0..meta_length]).unwrap(); + assert_eq!(meta_data.keys, keys); + let config_account_data = &config_account_data[meta_length..config_account_data.len()]; + assert_eq!( + new_config, + MyConfig::deserialize(&config_account_data).unwrap() + ); + + // Attempt update with incomplete signatures + let keys = vec![(pubkey, false), (signer0.pubkey(), true)]; + let instruction = + config_instruction::store(&config_pubkey, false, keys.clone(), &my_config); + let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + bank_client + .send_message(&[&mint_keypair, &signer0], message) + .unwrap_err(); + + // Attempt update with incorrect signatures + let signer2 = Keypair::new(); + let keys = vec![ + (pubkey, false), + (signer0.pubkey(), true), + (signer2.pubkey(), true), + ]; + let instruction = + config_instruction::store(&config_pubkey, false, keys.clone(), &my_config); + let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + bank_client + .send_message(&[&mint_keypair, &signer0, &signer2], message) + .unwrap_err(); + } + + #[test] + fn test_config_updates_requiring_config() { + solana_logger::setup(); + let (bank, mint_keypair) = create_bank(10_000); + let pubkey = Pubkey::new_rand(); + let signer0 = Keypair::new(); + let keys = vec![ + (pubkey, false), + (signer0.pubkey(), true), + (signer0.pubkey(), true), + ]; // Dummy keys for account sizing + let (bank_client, config_keypair) = + create_config_account(bank, &mint_keypair, keys.clone()); + let config_pubkey = config_keypair.pubkey(); + let keys = vec![ + (pubkey, false), + (signer0.pubkey(), true), + (config_keypair.pubkey(), true), + ]; + + let my_config = MyConfig::new(42); + + let instruction = config_instruction::store(&config_pubkey, true, keys.clone(), &my_config); + let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + + bank_client + .send_message(&[&mint_keypair, &config_keypair, &signer0], message) + .unwrap(); + + // Update with expected signatures + let new_config = MyConfig::new(84); + let instruction = + config_instruction::store(&config_pubkey, true, keys.clone(), &new_config); + let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + bank_client + .send_message(&[&mint_keypair, &config_keypair, &signer0], message) + .unwrap(); + + let config_account_data = bank_client + .get_account_data(&config_pubkey) + .unwrap() + .unwrap(); + let meta_length = ConfigKeys::serialized_size(keys.clone()); + let meta_data: ConfigKeys = deserialize(&config_account_data[0..meta_length]).unwrap(); + assert_eq!(meta_data.keys, keys); + let config_account_data = &config_account_data[meta_length..config_account_data.len()]; + assert_eq!( + new_config, + MyConfig::deserialize(&config_account_data).unwrap() + ); + + // Attempt update with incomplete signatures + let keys = vec![(pubkey, false), (config_keypair.pubkey(), true)]; + let instruction = config_instruction::store(&config_pubkey, true, keys.clone(), &my_config); + let message = Message::new_with_payer(vec![instruction], Some(&mint_keypair.pubkey())); + bank_client + .send_message(&[&mint_keypair, &config_keypair], message) + .unwrap_err(); + } } diff --git a/runtime/append_vec_serialize b/runtime/append_vec_serialize new file mode 100644 index 0000000000..9e0f96a2a2 Binary files /dev/null and b/runtime/append_vec_serialize differ diff --git a/scripts/cargo-install-all.sh b/scripts/cargo-install-all.sh index f9853174d7..3a25937e0d 100755 --- a/scripts/cargo-install-all.sh +++ b/scripts/cargo-install-all.sh @@ -38,6 +38,7 @@ BIN_CRATES=( ledger-tool replicator validator + validator-info wallet bench-exchange bench-tps diff --git a/validator-info/.gitignore b/validator-info/.gitignore new file mode 100644 index 0000000000..b83d22266a --- /dev/null +++ b/validator-info/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/validator-info/Cargo.toml b/validator-info/Cargo.toml new file mode 100644 index 0000000000..e7e3a9eb83 --- /dev/null +++ b/validator-info/Cargo.toml @@ -0,0 +1,29 @@ +[package] +name = "solana-validator-info" +version = "0.16.3" +description = "Solana validator registration tool" +authors = ["Solana Maintainers "] +repository = "https://github.com/solana-labs/solana" +license = "Apache-2.0" +homepage = "https://solana.com/" +edition = "2018" + +[features] +cuda = [] + + +[dependencies] +bincode = "1.1.4" +clap = "2.33" +dirs = "2.0.1" +serde = "1.0.94" +serde_derive = "1.0.94" +serde_json = "1.0.40" +solana-client = { path = "../client", version = "0.16.3" } +solana-config-api = { path = "../programs/config_api", version = "0.16.3" } +solana-sdk = { path = "../sdk", version = "0.16.3" } +url = "1.7.2" + +[[bin]] +name = "solana-validator-info" +path = "src/validator_info.rs" diff --git a/validator-info/src/validator_info.rs b/validator-info/src/validator_info.rs new file mode 100644 index 0000000000..384569e922 --- /dev/null +++ b/validator-info/src/validator_info.rs @@ -0,0 +1,481 @@ +use bincode::deserialize; +use clap::{ + crate_description, crate_name, crate_version, App, AppSettings, Arg, ArgMatches, SubCommand, +}; +use serde_derive::{Deserialize, Serialize}; +use serde_json::{Map, Value}; +use solana_client::rpc_client::RpcClient; +use solana_config_api::{config_instruction, config_instruction::ConfigKeys, ConfigState}; +use solana_sdk::message::Message; +use solana_sdk::pubkey::Pubkey; +use solana_sdk::signature::{read_keypair, Keypair, KeypairUtil}; +use solana_sdk::transaction::Transaction; +use std::error; +use std::process::exit; + +pub const MAX_SHORT_FIELD_LENGTH: usize = 70; +pub const MAX_LONG_FIELD_LENGTH: usize = 300; +pub const MAX_VALIDATOR_INFO: u64 = 570; +pub const JSON_RPC_URL: &str = "https://api.testnet.solana.com/"; + +// Config account key: Va1idator1nfo111111111111111111111111111111 +pub const REGISTER_CONFIG_KEY: [u8; 32] = [ + 7, 81, 151, 1, 116, 72, 242, 172, 93, 194, 60, 158, 188, 122, 199, 140, 10, 39, 37, 122, 198, + 20, 69, 141, 224, 164, 241, 111, 128, 0, 0, 0, +]; + +solana_sdk::solana_name_id!( + REGISTER_CONFIG_KEY, + "Va1idator1nfo111111111111111111111111111111" +); + +#[derive(Debug, Deserialize, Serialize)] +struct ValidatorInfo { + info: String, +} + +impl ConfigState for ValidatorInfo { + fn max_space() -> u64 { + MAX_VALIDATOR_INFO + } +} + +// Return an error if a pubkey cannot be parsed. +fn is_pubkey(string: String) -> Result<(), String> { + match string.parse::() { + Ok(_) => Ok(()), + Err(err) => Err(format!("{:?}", err)), + } +} + +// Return an error if a url cannot be parsed. +fn is_url(string: String) -> Result<(), String> { + match url::Url::parse(&string) { + Ok(url) => { + if url.has_host() { + Ok(()) + } else { + Err("no host provided".to_string()) + } + } + Err(err) => Err(format!("{:?}", err)), + } +} + +// Return an error if url field is too long or cannot be parsed. +fn check_url(string: String) -> Result<(), String> { + is_url(string.clone())?; + if string.len() > MAX_SHORT_FIELD_LENGTH { + Err(format!( + "url longer than {:?}-byte limit", + MAX_SHORT_FIELD_LENGTH + )) + } else { + Ok(()) + } +} + +// Return an error if a validator field is longer than the max length. +fn is_short_field(string: String) -> Result<(), String> { + if string.len() > MAX_SHORT_FIELD_LENGTH { + Err(format!( + "validator field longer than {:?}-byte limit", + MAX_SHORT_FIELD_LENGTH + )) + } else { + Ok(()) + } +} + +// Return an error if a validator details are longer than the max length. +fn check_details_length(string: String) -> Result<(), String> { + if string.len() > MAX_LONG_FIELD_LENGTH { + Err(format!( + "validator details longer than {:?}-byte limit", + MAX_LONG_FIELD_LENGTH + )) + } else { + Ok(()) + } +} + +fn parse_args(matches: &ArgMatches<'_>) -> Result> { + let mut map = Map::new(); + map.insert( + "name".to_string(), + Value::String(matches.value_of("name").unwrap().to_string()), + ); + if let Some(url) = matches.value_of("website") { + map.insert("website".to_string(), Value::String(url.to_string())); + } + if let Some(details) = matches.value_of("details") { + map.insert("details".to_string(), Value::String(details.to_string())); + } + if let Some(keybase_id) = matches.value_of("keybase_id") { + map.insert( + "keybaseId".to_string(), + Value::String(keybase_id.to_string()), + ); + } + let string = serde_json::to_string(&Value::Object(map))?; + Ok(string) +} + +fn parse_validator_info(account_data: &[u8]) -> Result<(Pubkey, String), Box> { + let key_list: ConfigKeys = deserialize(&account_data)?; + let (validator_pubkey, _) = key_list.keys[1]; + let meta_length = ConfigKeys::serialized_size(key_list.keys); + let validator_info: String = deserialize(&account_data[meta_length..])?; + Ok((validator_pubkey, validator_info)) +} + +fn main() -> Result<(), Box> { + let matches = App::new(crate_name!()) + .about(crate_description!()) + .version(crate_version!()) + .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand( + SubCommand::with_name("publish") + .about("Publish Validator info on Solana") + .setting(AppSettings::DisableVersion) + .arg( + Arg::with_name("json_rpc_url") + .short("u") + .long("url") + .value_name("URL") + .takes_value(true) + .default_value(JSON_RPC_URL) + .validator(is_url) + .help("JSON RPC URL for the solana cluster"), + ) + .arg( + Arg::with_name("validator_keypair") + .short("v") + .long("validator-keypair") + .value_name("PATH") + .takes_value(true) + .required(true) + .help("/path/to/id.json"), + ) + .arg( + Arg::with_name("info_pubkey") + .short("p") + .long("info-pubkey") + .value_name("PUBKEY") + .takes_value(true) + .validator(is_pubkey) + .help("The pubkey of the Validator info account to update"), + ) + .arg( + Arg::with_name("name") + .short("n") + .long("name") + .value_name("STRING") + .takes_value(true) + .required(true) + .validator(is_short_field) + .help("Validator name"), + ) + .arg( + Arg::with_name("website") + .short("w") + .long("website") + .value_name("URL") + .takes_value(true) + .validator(check_url) + .help("Validator website url"), + ) + .arg( + Arg::with_name("keybase_id") + .short("k") + .long("keybase") + .value_name("STRING") + .takes_value(true) + .validator(is_short_field) + .help("Validator Keybase id"), + ) + .arg( + Arg::with_name("details") + .short("d") + .long("details") + .value_name("STRING") + .takes_value(true) + .validator(check_details_length) + .help(&format!( + "Validator description, max characters: {}", + MAX_LONG_FIELD_LENGTH + )), + ), + ) + .subcommand( + SubCommand::with_name("get") + .about("Get and parse Solana Validator info") + .setting(AppSettings::DisableVersion) + .arg( + Arg::with_name("json_rpc_url") + .short("u") + .long("url") + .value_name("URL") + .takes_value(true) + .default_value(JSON_RPC_URL) + .validator(is_url) + .help("JSON RPC URL for the solana cluster"), + ) + .arg( + Arg::with_name("info_pubkey") + .short("p") + .long("info-pubkey") + .value_name("PUBKEY") + .takes_value(true) + .required_unless("all") + .conflicts_with("all") + .validator(is_pubkey) + .help("The pubkey of the Validator info account"), + ) + .arg( + Arg::with_name("all") + .short("a") + .long("all") + .required_unless("info_pubkey") + .help("Return all current Validator info"), + ), + ) + .get_matches(); + + match matches.subcommand() { + ("publish", Some(matches)) => { + let json_rpc_url = matches.value_of("json_rpc_url").unwrap(); + let rpc_client = RpcClient::new(json_rpc_url.to_string()); + + // Load validator-keypair + let mut path = dirs::home_dir().expect("home directory"); + let id_path = if matches.is_present("validator_keypair") { + matches.value_of("validator_keypair").unwrap() + } else { + path.extend(&[".config", "solana", "validator-keypair.json"]); + if !path.exists() { + println!("No validator keypair file found. Run solana-keygen to create one."); + exit(1); + } + path.to_str().unwrap() + }; + let validator_keypair = read_keypair(id_path)?; + + // Create validator-info keypair to use if info_pubkey no provided or does not exist + let info_keypair = Keypair::new(); + let mut info_pubkey = if let Some(pubkey) = matches.value_of("info_pubkey") { + pubkey.parse::().unwrap() + } else { + info_keypair.pubkey() + }; + + // Prepare validator info + let keys = vec![(id(), false), (validator_keypair.pubkey(), true)]; + let validator_info = parse_args(&matches)?; + let validator_info = ValidatorInfo { + info: validator_info, + }; + + // Check existence of validator-info account + let balance = rpc_client.poll_get_balance(&info_pubkey).unwrap_or(0); + + let (message, signers): (Message, Vec<&Keypair>) = if balance == 0 { + if info_pubkey != info_keypair.pubkey() { + println!( + "Account {:?} does not exist. Generating new keypair...", + info_pubkey + ); + info_pubkey = info_keypair.pubkey(); + } + println!( + "Publishing info for Validator {:?}", + validator_keypair.pubkey() + ); + let instructions = vec![ + config_instruction::create_account::( + &validator_keypair.pubkey(), + &info_keypair.pubkey(), + 1, + keys.clone(), + ), + config_instruction::store(&info_keypair.pubkey(), true, keys, &validator_info), + ]; + let signers = vec![&validator_keypair, &info_keypair]; + let message = Message::new(instructions); + (message, signers) + } else { + println!( + "Updating Validator {:?} info at: {:?}", + validator_keypair.pubkey(), + info_pubkey + ); + let instructions = vec![config_instruction::store( + &info_pubkey, + false, + keys, + &validator_info, + )]; + let message = + Message::new_with_payer(instructions, Some(&validator_keypair.pubkey())); + let signers = vec![&validator_keypair]; + (message, signers) + }; + + // Submit transaction + let (recent_blockhash, _fee_calculator) = rpc_client.get_recent_blockhash()?; + let mut transaction = Transaction::new(&signers, message, recent_blockhash); + let signature_str = + rpc_client.send_and_confirm_transaction(&mut transaction, &signers)?; + + println!("Success! Validator info published at: {:?}", info_pubkey); + println!("{}", signature_str); + } + ("get", Some(matches)) => { + let json_rpc_url = matches.value_of("json_rpc_url").unwrap(); + let rpc_client = RpcClient::new(json_rpc_url.to_string()); + + if matches.is_present("all") { + let all_validator_info = + rpc_client.get_program_accounts(&solana_config_api::id())?; + for (info_pubkey, account) in all_validator_info.iter().filter(|(_, account)| { + let key_list: ConfigKeys = + deserialize(&account.data).map_err(|_| false).unwrap(); + key_list.keys.contains(&(id(), false)) + }) { + println!("Validator info from {:?}", info_pubkey); + let (validator_pubkey, validator_info) = parse_validator_info(&account.data)?; + println!(" Validator pubkey: {:?}", validator_pubkey); + println!(" Info: {}", validator_info); + } + } else { + let info_pubkey = if let Some(keypair) = matches.value_of("info_keypair") { + read_keypair(keypair)?.pubkey() + } else if let Some(pubkey) = matches.value_of("info_pubkey") { + pubkey.parse::().unwrap() + } else { + Pubkey::default() // unreachable + }; + let validator_info_data = rpc_client.get_account_data(&info_pubkey)?; + let (validator_pubkey, validator_info) = + parse_validator_info(&validator_info_data)?; + println!("Validator pubkey: {:?}", validator_pubkey); + println!("Info: {}", validator_info); + } + } + _ => unreachable!(), + } + + Ok(()) +} + +#[cfg(test)] +mod tests { + use super::*; + use bincode::{serialize, serialized_size}; + use serde_json::json; + + #[test] + fn test_check_url() { + let url = "http://test.com"; + assert_eq!(check_url(url.to_string()), Ok(())); + let long_url = "http://7cLvFwLCbyHuXQ1RGzhCMobAWYPMSZ3VbUml1qWi1nkc3FD7zj9hzTZzMvYJ.com"; + assert!(check_url(long_url.to_string()).is_err()); + let non_url = "not parseable"; + assert!(check_url(non_url.to_string()).is_err()); + } + + #[test] + fn test_is_short_field() { + let name = "Alice Validator"; + assert_eq!(is_short_field(name.to_string()), Ok(())); + let long_name = "Alice 7cLvFwLCbyHuXQ1RGzhCMobAWYPMSZ3VbUml1qWi1nkc3FD7zj9hzTZzMvYJt6rY9"; + assert!(is_short_field(long_name.to_string()).is_err()); + } + + #[test] + fn test_parse_args() { + let matches = App::new("test") + .arg(Arg::with_name("name").short("n").takes_value(true)) + .arg(Arg::with_name("website").short("w").takes_value(true)) + .arg(Arg::with_name("keybase_id").short("k").takes_value(true)) + .arg(Arg::with_name("details").short("d").takes_value(true)) + .get_matches_from(vec!["test", "-n", "Alice", "-k", "464bb0f2956f7e83"]); + let expected_string = serde_json::to_string(&json!({ + "name": "Alice", + "keybaseId": "464bb0f2956f7e83", + })) + .unwrap(); + assert_eq!(parse_args(&matches).unwrap(), expected_string); + } + + #[test] + fn test_validator_info_serde() { + let mut info = Map::new(); + info.insert("name".to_string(), Value::String("Alice".to_string())); + let info_string = serde_json::to_string(&Value::Object(info)).unwrap(); + + let validator_info = ValidatorInfo { + info: info_string.clone(), + }; + + assert_eq!(serialized_size(&validator_info).unwrap(), 24); + assert_eq!( + serialize(&validator_info).unwrap(), + vec![ + 16, 0, 0, 0, 0, 0, 0, 0, 123, 34, 110, 97, 109, 101, 34, 58, 34, 65, 108, 105, 99, + 101, 34, 125 + ] + ); + + let deserialized: ValidatorInfo = deserialize(&[ + 16, 0, 0, 0, 0, 0, 0, 0, 123, 34, 110, 97, 109, 101, 34, 58, 34, 65, 108, 105, 99, 101, + 34, 125, + ]) + .unwrap(); + assert_eq!(deserialized.info, info_string); + } + + #[test] + fn test_parse_validator_info() { + let pubkey = Pubkey::new_rand(); + let keys = vec![(id(), false), (pubkey, true)]; + let config = ConfigKeys { keys }; + + let mut info = Map::new(); + info.insert("name".to_string(), Value::String("Alice".to_string())); + let info_string = serde_json::to_string(&Value::Object(info)).unwrap(); + let validator_info = ValidatorInfo { + info: info_string.clone(), + }; + let data = serialize(&(config, validator_info)).unwrap(); + + assert_eq!(parse_validator_info(&data).unwrap(), (pubkey, info_string)); + } + + #[test] + fn test_validator_info_max_space() { + // 70-character string + let max_short_string = + "Max Length String KWpP299aFCBWvWg1MHpSuaoTsud7cv8zMJsh99aAtP8X1s26yrR1".to_string(); + // 300-character string + let max_long_string = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut libero quam, volutpat et aliquet eu, varius in mi. Aenean vestibulum ex in tristique faucibus. Maecenas in imperdiet turpis. Nullam feugiat aliquet erat. Morbi malesuada turpis sed dui pulvinar lobortis. Pellentesque a lectus eu leo nullam.".to_string(); + let mut info = Map::new(); + info.insert("name".to_string(), Value::String(max_short_string.clone())); + info.insert( + "website".to_string(), + Value::String(max_short_string.clone()), + ); + info.insert("keybaseId".to_string(), Value::String(max_short_string)); + info.insert("details".to_string(), Value::String(max_long_string)); + let info_string = serde_json::to_string(&Value::Object(info)).unwrap(); + + let validator_info = ValidatorInfo { + info: info_string.clone(), + }; + + assert_eq!( + serialized_size(&validator_info).unwrap(), + ValidatorInfo::max_space() + ); + } +}