From aa5fe5bf68b20cc2def0392cbab71f8bcdad0060 Mon Sep 17 00:00:00 2001 From: Joy Wang <108701016+joyqvq@users.noreply.github.com> Date: Fri, 30 Dec 2022 11:44:07 +0800 Subject: [PATCH] crypto: Load keypairs from file path (#7011) tested with ``` cargo build --bin sui target/debug/sui genesis -f target/debug/sui start ``` --- Cargo.lock | 587 +++++++++--------- Cargo.toml | 4 +- crates/sui-config/Cargo.toml | 1 + crates/sui-config/data/fullnode-template.yaml | 8 + crates/sui-config/src/builder.rs | 18 +- crates/sui-config/src/node.rs | 254 +++++++- crates/sui-config/src/swarm.rs | 29 +- ...ests__network_config_snapshot_matches.snap | 98 ++- .../src/unit_tests/narwhal_manager_tests.rs | 2 +- crates/sui-keys/src/keypair_file.rs | 52 ++ crates/sui-keys/src/lib.rs | 1 + crates/sui-node/src/lib.rs | 7 +- crates/sui-types/src/crypto.rs | 2 +- crates/sui/src/genesis_ceremony.rs | 4 +- crates/sui/src/keytool.rs | 58 +- crates/workspace-hack/Cargo.toml | 28 +- 16 files changed, 698 insertions(+), 455 deletions(-) create mode 100644 crates/sui-keys/src/keypair_file.rs diff --git a/Cargo.lock b/Cargo.lock index 96d83143e7951..99ad0e313010c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,9 +10,9 @@ checksum = "fe438c63458706e03479442743baae6c88256498e6431708f6dfc520a26515d3" [[package]] name = "addr2line" -version = "0.17.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ecd88a8c8378ca913a680cd98f0f13ac67383d35993f86c90a70e3f137816b" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" dependencies = [ "gimli", ] @@ -158,9 +158,9 @@ version = "0.0.0" source = "git+https://github.com/mystenlabs/anemo.git?rev=ccfb77628ec1883121079f1ae9c65e9c716709c8#ccfb77628ec1883121079f1ae9c65e9c716709c8" dependencies = [ "prettyplease", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -194,9 +194,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6" +checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" dependencies = [ "backtrace", ] @@ -291,7 +291,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" dependencies = [ "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -303,7 +303,7 @@ dependencies = [ "num-bigint", "num-traits 0.2.15", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -365,9 +365,9 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8dd4e5f0bf8285d5ed538d27fab7411f3e297908fd93c62195de8bee3f199e82" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -432,9 +432,9 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "726535892e8eae7e70657b4c8ea93d26b8553afb1ce617caee529ef96d7dee6c" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", "synstructure", ] @@ -444,9 +444,9 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2777730b2039ac0f95f093556e61b6d26cebed5393ca6f152717777cec3a42ed" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -455,7 +455,7 @@ version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa3d466004a8b4cb1bc34044240a2fd29d17607e2e3bd613eb44fd48e8100da3" dependencies = [ - "bstr 1.0.1", + "bstr 1.1.0", "doc-comment", "predicates", "predicates-core", @@ -493,9 +493,9 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2cda8f4bcc10624c4e85bc66b3f452cca98cfa5ca002dc83a16aad2367641bea" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -514,9 +514,9 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "10f203db73a71dfa2fb6dd22763990fa26f3d2625a6da2da900d23b87d26be27" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -526,13 +526,13 @@ source = "git+https://github.com/mystenmark/async-task?rev=4e45b26e11126b191701b [[package]] name = "async-trait" -version = "0.1.59" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" +checksum = "677d1d8ab452a3936018a687b20e6f7cf5363d713b732b8884001317b0e48aa3" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -560,7 +560,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -710,15 +710,15 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide 0.5.4", + "miniz_oxide", "object", "rustc-demangle", ] @@ -781,9 +781,9 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3deeecb812ca5300b7d3f66f730cc2ebd3511c3d36c691dd79c165d5b19a26e3" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -813,7 +813,7 @@ dependencies = [ "lazy_static 1.4.0", "lazycell", "peeking_take_while", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "regex", "rustc-hash", @@ -911,9 +911,9 @@ dependencies = [ [[package]] name = "blake2" -version = "0.10.5" +version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ "digest 0.10.6", ] @@ -1020,9 +1020,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca0852af221f458706eb0725c03e4ed6c46af9ac98e6a689d5e634215d594dd" +checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b" dependencies = [ "memchr", "once_cell", @@ -1132,7 +1132,7 @@ checksum = "982a0cf6a99c350d7246035613882e376d58cebe571785abc5da4f648d53ac0a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.14", + "semver 1.0.16", "serde 1.0.151", "serde_json", "thiserror", @@ -1161,9 +1161,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.77" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" dependencies = [ "jobserver", ] @@ -1319,9 +1319,9 @@ checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" dependencies = [ "heck 0.4.0", "proc-macro-error", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -1804,7 +1804,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" dependencies = [ "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -1859,9 +1859,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdf07d07d6531bfcdbe9b8b739b104610c6508dcc4d63b410585faf338241daf" +checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" dependencies = [ "cc", "cxxbridge-flags", @@ -1871,34 +1871,34 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2eb5b96ecdc99f72657332953d4d9c50135af1bac34277801cc3937906ebd39" +checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" dependencies = [ "cc", "codespan-reporting", "once_cell", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "scratch", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] name = "cxxbridge-flags" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac040a39517fd1674e0f32177648334b0f4074625b5588a64519804ba0553b12" +checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" [[package]] name = "cxxbridge-macro" -version = "1.0.83" +version = "1.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1362b0ddcfc4eb0a1f57b68bd77dd99f0e826958a96abd0ae9bd092e114ffed6" +checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -1919,10 +1919,10 @@ checksum = "a784d2ccaf7c98501746bf0be29b2022ba41fd62a2e622af997a03e9f972859f" dependencies = [ "fnv", "ident_case", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "strsim 0.10.0", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -1933,7 +1933,7 @@ checksum = "7618812407e9402654622dd402b0a89dff9ba93badd6540781526117b92aab7e" dependencies = [ "darling_core", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -1972,7 +1972,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" dependencies = [ "data-encoding", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -2003,9 +2003,9 @@ dependencies = [ [[package]] name = "der" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" dependencies = [ "const-oid", "zeroize", @@ -2031,9 +2031,9 @@ version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -2042,9 +2042,9 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e79116f119dd1dba1abf1f3405f03b9b0e79a27a3883864bfebded8a3dc768cd" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -2063,9 +2063,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" dependencies = [ "darling", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -2075,7 +2075,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" dependencies = [ "derive_builder_core", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -2085,10 +2085,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "rustc_version 0.4.0", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -2137,9 +2137,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "143b758c91dbc3fe1fdcb0dba5bd13276c6a66422f2ef5795b58488248a310aa" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -2254,16 +2254,16 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bf95dc3f046b9da4f2d51833c0d3547d8564ef6910f5c1ed130306a75b92886" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] name = "dissimilar" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c97b9233581d84b8e1e689cdd3a47b6f69770084fc246e86a7f78b0d9c1d4a5" +checksum = "bd5f0c7e4bd266b8ab2550e6238d2e74977c23c15536ac7be45e9c95e2e3fbbb" [[package]] name = "doc-comment" @@ -2305,9 +2305,9 @@ dependencies = [ [[package]] name = "dyn-clone" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f94fa09c2aeea5b8839e414b7b841bf429fd25b9c522116ac97ee87856d88b2" +checksum = "c9b0705efd4599c15a38151f4721f7bc388306f61084d3bfd50bd07fbca5cb60" [[package]] name = "ecdsa" @@ -2431,9 +2431,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eb359f1476bf611266ac1f5355bc14aeca37b299d0ebccc038ee7058891c9cb" dependencies = [ "once_cell", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -2537,14 +2537,14 @@ dependencies = [ [[package]] name = "fastcrypto" version = "0.1.4" -source = "git+https://github.com/MystenLabs/fastcrypto?rev=2dcf24facddfd15e83325ab714e3b6cb9cd63afe#2dcf24facddfd15e83325ab714e3b6cb9cd63afe" +source = "git+https://github.com/MystenLabs/fastcrypto?rev=8d07cc5a60856163829911e5aeedede35e90174a#8d07cc5a60856163829911e5aeedede35e90174a" dependencies = [ "aes", "aes-gcm", "auto_ops", "base64ct", "bincode", - "blake2 0.10.5", + "blake2 0.10.6", "blake3", "blst", "bs58", @@ -2584,17 +2584,17 @@ dependencies = [ [[package]] name = "fastcrypto-derive" version = "0.1.2" -source = "git+https://github.com/MystenLabs/fastcrypto?rev=2dcf24facddfd15e83325ab714e3b6cb9cd63afe#2dcf24facddfd15e83325ab714e3b6cb9cd63afe" +source = "git+https://github.com/MystenLabs/fastcrypto?rev=8d07cc5a60856163829911e5aeedede35e90174a#8d07cc5a60856163829911e5aeedede35e90174a" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] name = "fastcrypto-zkp" version = "0.1.0" -source = "git+https://github.com/MystenLabs/fastcrypto?rev=2dcf24facddfd15e83325ab714e3b6cb9cd63afe#2dcf24facddfd15e83325ab714e3b6cb9cd63afe" +source = "git+https://github.com/MystenLabs/fastcrypto?rev=8d07cc5a60856163829911e5aeedede35e90174a#8d07cc5a60856163829911e5aeedede35e90174a" dependencies = [ "ark-bls12-381", "ark-ec", @@ -2696,7 +2696,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" dependencies = [ "crc32fast", - "miniz_oxide 0.6.2", + "miniz_oxide", ] [[package]] @@ -2857,9 +2857,9 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -2957,9 +2957,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.26.2" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" +checksum = "dec7af912d60cdbd3677c1af9352ebae6fb8394d165568a2234df0fa00f87793" [[package]] name = "glob" @@ -3067,7 +3067,7 @@ dependencies = [ "pathdiff", "petgraph 0.6.2", "rayon", - "semver 1.0.14", + "semver 1.0.16", "serde 1.0.151", "serde_json", "smallvec", @@ -3086,7 +3086,7 @@ dependencies = [ "cfg-if", "diffus", "guppy-workspace-hack", - "semver 1.0.14", + "semver 1.0.16", "serde 1.0.151", "toml", ] @@ -3218,6 +3218,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "hex" version = "0.4.3" @@ -3341,9 +3350,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.1" +version = "0.23.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59df7c4e19c950e6e0e868dcc0a300b09a9b88e9ec55bd879ca819087a77355d" +checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" dependencies = [ "http", "hyper", @@ -3482,9 +3491,9 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -3503,7 +3512,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", ] @@ -3566,9 +3575,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.22.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197f4e300af8b23664d4077bf5c40e0afa9ba66a567bb5a51d3def3c7b287d1c" +checksum = "e48b08a091dfe5b09a6a9688c468fdd5b4396e92ce09e2eb932f0884b02788a4" dependencies = [ "console", "lazy_static 1.4.0", @@ -3620,9 +3629,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.5.1" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f88c5561171189e69df9d98bcf18fd5f9558300f7ea7b801eb8a0fd748bd8745" +checksum = "11b0d96e660696543b251e58030cf9787df56da39dab19ad60eae7353040917e" [[package]] name = "iri-string" @@ -3644,9 +3653,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc" +checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" [[package]] name = "jemalloc-ctl" @@ -3787,9 +3796,9 @@ source = "git+https://github.com/patrickkuo/jsonrpsee.git?rev=adc19a124ed7045744 dependencies = [ "heck 0.4.0", "proc-macro-crate", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -3908,9 +3917,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.138" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libloading" @@ -3978,9 +3987,9 @@ dependencies = [ [[package]] name = "link-cplusplus" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" dependencies = [ "cc", ] @@ -3993,9 +4002,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" [[package]] name = "lock_api" @@ -4102,15 +4111,6 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" -[[package]] -name = "miniz_oxide" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96590ba8f175222643a85693f33d26e9c8a015f599c216509b1a6894af675d34" -dependencies = [ - "adler", -] - [[package]] name = "miniz_oxide" version = "0.6.2" @@ -4176,9 +4176,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "832663583d5fa284ca8810bf7015e46c9fff9622d3cf34bd1eea5003fec06dd0" dependencies = [ "cfg-if", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -4912,9 +4912,9 @@ version = "0.1.0" source = "git+https://github.com/MystenLabs/mysten-sim.git?rev=465f7d6c351e83003da9c9b77e8e3e352be7621e#465f7d6c351e83003da9c9b77e8e3e352be7621e" dependencies = [ "darling", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -4965,9 +4965,9 @@ checksum = "1d6d4752e6230d8ef7adf7bd5d8c4b1f6561c1014c5ba9a37445ccefe18aa1db" dependencies = [ "proc-macro-crate", "proc-macro-error", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", "synstructure", ] @@ -5035,8 +5035,8 @@ dependencies = [ name = "mysten-util-mem-derive" version = "0.1.0" dependencies = [ - "proc-macro2 1.0.47", - "syn 1.0.105", + "proc-macro2 1.0.49", + "syn 1.0.107", "synstructure", "workspace-hack", ] @@ -5760,11 +5760,11 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" +checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -5784,9 +5784,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce" dependencies = [ "proc-macro-crate", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -5806,18 +5806,18 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "object" -version = "0.29.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" +checksum = "239da7f290cfa979f43f85a8efeee9a8a76d0827c356d37f9d3d7254d6b537fb" dependencies = [ "memchr", ] [[package]] name = "oid-registry" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d4bda43fd1b844cbc6e6e54b5444e2b1bc7838bce59ad205902cccbb26d6761" +checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" dependencies = [ "asn1-rs", ] @@ -5842,9 +5842,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.43" +version = "0.10.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020433887e44c27ff16365eaa2d380547a94544ad509aff6eb5b6e3e0b27b376" +checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" dependencies = [ "bitflags", "cfg-if", @@ -5861,9 +5861,9 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -5874,9 +5874,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.78" +version = "0.9.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07d5c8cb6e57b3a3612064d7b18b117912b4ce70955c2504d4b741c9e244b132" +checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" dependencies = [ "autocfg", "cc", @@ -6032,9 +6032,9 @@ checksum = "03f2cb802b5bdfdf52f1ffa0b54ce105e4d346e91990dd571f86c91321ad49e2" dependencies = [ "Inflector", "proc-macro-error", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -6045,9 +6045,9 @@ checksum = "4a0d9d1a6191c4f391f87219d1ea42b23f09ee84d64763cd05ee6ea88d9f384d" dependencies = [ "Inflector", "proc-macro-error", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -6103,9 +6103,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" dependencies = [ "proc-macro-crate", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -6122,7 +6122,7 @@ checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" dependencies = [ "instant", "lock_api", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", ] [[package]] @@ -6137,9 +6137,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +checksum = "60a2cfe6f0ad2bfc16aefa463b497d5c7a5ecd44a23efa72aa342d90177356dc" dependencies = [ "cfg-if", "instant", @@ -6173,9 +6173,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" [[package]] name = "pathdiff" @@ -6218,9 +6218,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0" +checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4" dependencies = [ "thiserror", "ucd-trie", @@ -6228,9 +6228,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdc078600d06ff90d4ed238f0119d84ab5d43dbaad278b0e33a8820293b32344" +checksum = "96504449aa860c8dcde14f9fba5c58dc6658688ca1fe363589d6327b8662c603" dependencies = [ "pest", "pest_generator", @@ -6238,22 +6238,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28a1af60b1c4148bb269006a750cff8e2ea36aff34d2d96cf7be0b14d1bed23c" +checksum = "798e0220d1111ae63d66cb66a5dcb3fc2d986d520b98e49e1852bfdb11d7c5e7" dependencies = [ "pest", "pest_meta", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] name = "pest_meta" -version = "2.5.1" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fec8605d59fc2ae0c6c1aefc0c7c7a9769732017c0ce07f7a9cfffa7b4404f20" +checksum = "984298b75898e30a843e278a9f2452c31e349a073a0ce6fd950a12a74464e065" dependencies = [ "once_cell", "pest", @@ -6334,9 +6334,9 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -6409,9 +6409,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "0.3.15" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15eb2c6e362923af47e13c23ca5afb859e83d54452c55b0b9ac763b8f7c1ac16" +checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b" [[package]] name = "pprof" @@ -6504,12 +6504,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51" +checksum = "2c8992a85d8e93a28bdf76137db888d3874e3b230dee5ed8bebac4c9f7617773" dependencies = [ - "proc-macro2 1.0.47", - "syn 1.0.105", + "proc-macro2 1.0.49", + "syn 1.0.107", ] [[package]] @@ -6541,9 +6541,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", "version_check", ] @@ -6553,7 +6553,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "version_check", ] @@ -6569,9 +6569,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725" +checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" dependencies = [ "unicode-ident", ] @@ -6634,9 +6634,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.11.3" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0b18e655c21ff5ac2084a5ad0611e827b3f92badf79f4910b5a5c58f4d87ff0" +checksum = "c01db6702aa05baa3f57dec92b8eeeeb4cb19e894e73996b32a4093289e54592" dependencies = [ "bytes", "prost-derive", @@ -6644,9 +6644,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.3" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e330bf1316db56b12c2bcfa399e8edddd4821965ea25ddb2c134b610b1c1c604" +checksum = "cb5320c680de74ba083512704acb90fe00f28f79207286a848e730c45dd73ed6" dependencies = [ "bytes", "heck 0.4.0", @@ -6659,29 +6659,29 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 1.0.105", + "syn 1.0.107", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "164ae68b6587001ca506d3bf7f1000bfa248d0e1217b618108fba4ec1d0cc306" +checksum = "c8842bad1a5419bca14eac663ba798f6bc19c413c2fdceb5f3ba3b0932d96720" dependencies = [ "anyhow", "itertools", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] name = "prost-types" -version = "0.11.2" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747761bc3dc48f9a34553bf65605cf6cb6288ba219f3450b4275dbd81539551a" +checksum = "017f79637768cde62820bc2d4fe0e45daaa027755c323ad077767c6c5f173091" dependencies = [ "bytes", "prost", @@ -6804,7 +6804,7 @@ version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", ] [[package]] @@ -6941,11 +6941,10 @@ dependencies = [ [[package]] name = "rayon" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b" +checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" dependencies = [ - "crossbeam-deque", "either", "rayon-core", ] @@ -7037,13 +7036,13 @@ dependencies = [ [[package]] name = "readonly" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c0e08c3b00fcae55ee1dac341e1b9b5bc942e7e1931957436ab00b4a5e8dc18" +checksum = "d78725e4e53781014168628ef49b2dc2fc6ae8d01a08769a5064685d34ee116c" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -7087,22 +7086,22 @@ dependencies = [ [[package]] name = "ref-cast" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b15debb4f9d60d767cd8ca9ef7abb2452922f3214671ff052defc7f3502c44" +checksum = "8c78fb8c9293bcd48ef6fce7b4ca950ceaf21210de6e105a883ee280c0f7b9ed" dependencies = [ "ref-cast-impl", ] [[package]] name = "ref-cast-impl" -version = "1.0.13" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfa8511e9e94fd3de6585a3d3cd00e01ed556dc9814829280af0e8dc72a8f36" +checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -7267,10 +7266,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7229b505ae0706e64f37ffc54a9c163e11022a6636d58fe1f3f52018257ff9f7" dependencies = [ "cfg-if", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "rustc_version 0.4.0", - "syn 1.0.105", + "syn 1.0.107", "unicode-ident", ] @@ -7323,7 +7322,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.14", + "semver 1.0.16", ] [[package]] @@ -7384,9 +7383,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" +checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70" [[package]] name = "rusty-fork" @@ -7430,16 +7429,16 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "107c3d5d7f370ac09efa62a78375f94d94b8a33c61d8c278b96683fb4dbf2d8d" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] name = "ryu" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09" +checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" [[package]] name = "same-file" @@ -7488,10 +7487,10 @@ version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f188d036977451159430f3b8dc82ec76364a42b7e289c2b18a9a18f4470058e9" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "serde_derive_internals", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -7502,9 +7501,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" +checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" [[package]] name = "sct" @@ -7584,9 +7583,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.14" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4" +checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" dependencies = [ "serde 1.0.151", ] @@ -7666,9 +7665,9 @@ dependencies = [ [[package]] name = "serde_bytes" -version = "0.11.7" +version = "0.11.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfc50e8183eeeb6178dcb167ae34a8051d63535023ae38b5d8d12beae193d37b" +checksum = "718dc5fff5b36f99093fc49b280cfc96ce6fc824317783bff5a1fed0c7a64819" dependencies = [ "serde 1.0.151", ] @@ -7679,9 +7678,9 @@ version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "255abe9a125a985c05190d687b320c12f9b1f0b99445e608c21ba0782c719ad8" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -7690,16 +7689,16 @@ version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" dependencies = [ "indexmap", "itoa", @@ -7709,20 +7708,20 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca" +checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] name = "serde_test" -version = "1.0.149" +version = "1.0.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3434c4787dcd7c8c0837ffbb01e6e34091f8983b2df9655e66393a867f99f7aa" +checksum = "f8f77be7305dac4f250891d2f7444276315f3c288176d35746b6a4ca786dacb3" dependencies = [ "serde 1.0.151", ] @@ -7762,9 +7761,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3452b4c0f6c1e357f73fdb87cd1efabaa12acf328c7a528e252893baeb3f4aa" dependencies = [ "darling", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -8119,12 +8118,12 @@ dependencies = [ "either", "heck 0.4.0", "once_cell", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "sha2 0.10.6", "sqlx-core", "sqlx-rt", - "syn 1.0.105", + "syn 1.0.107", "url", ] @@ -8212,9 +8211,9 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck 0.3.3", "proc-macro-error", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -8233,10 +8232,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck 0.4.0", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "rustversion", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -8469,6 +8468,7 @@ dependencies = [ "serde_yaml", "sui-adapter", "sui-framework", + "sui-keys", "sui-simulator", "sui-types", "tempfile", @@ -8821,9 +8821,9 @@ name = "sui-macros" version = "0.7.0" dependencies = [ "msim-macros", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", "workspace-hack", ] @@ -8920,9 +8920,9 @@ version = "0.1.0" dependencies = [ "derive-syn-parse", "itertools", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", "unescape", "workspace-hack", ] @@ -9331,11 +9331,11 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "unicode-ident", ] @@ -9352,9 +9352,9 @@ version = "0.12.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", "unicode-xid 0.2.4", ] @@ -9493,7 +9493,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a9186daca5c58cb307d09731e0ba06b13fd6c036c90672b9bfc31cecf76cf689" dependencies = [ "cargo_metadata", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "serde 1.0.151", "strum_macros", @@ -9508,10 +9508,10 @@ dependencies = [ "darling", "if_chain", "lazy_static 1.4.0", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "subprocess", - "syn 1.0.105", + "syn 1.0.107", "test-fuzz-internal", "toolchain_find", "unzip-n", @@ -9590,22 +9590,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -9758,9 +9758,9 @@ name = "tokio-macros" version = "1.8.0" source = "git+https://github.com/mystenmark/tokio-madsim-fork.git?rev=bb463863b8155543731bdf7850057c083cf1b427#bb463863b8155543731bdf7850057c083cf1b427" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -9769,9 +9769,9 @@ version = "1.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -9852,9 +9852,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.9" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7" +checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f" dependencies = [ "indexmap", "serde 1.0.151", @@ -9913,10 +9913,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4" dependencies = [ "prettyplease", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "prost-build", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -10039,9 +10039,9 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -10166,7 +10166,7 @@ checksum = "744324b12d69a9fc1edea4b38b7b1311295b662d161ad5deac17bb1358224a08" dependencies = [ "lazy_static 1.4.0", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -10215,14 +10215,14 @@ dependencies = [ "hdrhistogram", "num_cpus", "once_cell", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "prometheus", "quote 1.0.23", "rand 0.8.5", "rocksdb", "rstest", "serde 1.0.151", - "syn 1.0.105", + "syn 1.0.107", "tap", "tempfile", "thiserror", @@ -10237,10 +10237,10 @@ name = "typed-store-derive" version = "0.3.0" dependencies = [ "eyre", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", "rocksdb", - "syn 1.0.105", + "syn 1.0.107", "tempfile", "tokio", "typed-store", @@ -10353,9 +10353,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" [[package]] name = "unicode-ident" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3" +checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" [[package]] name = "unicode-linebreak" @@ -10440,9 +10440,9 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e7e85a0596447f0f2ac090e16bc4c516c6fe91771fb0c0ccf7fa3dae896b9c" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -10485,7 +10485,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae2faf80ac463422992abf4de234731279c058aaf33171ca70277c98406b124" dependencies = [ "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", ] [[package]] @@ -10523,7 +10523,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", ] @@ -10600,9 +10600,9 @@ dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", "wasm-bindgen-shared", ] @@ -10634,9 +10634,9 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -10669,9 +10669,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "368bfe657969fb01238bb756d351dcade285e0f6fcbd36dcb23359a5169975be" +checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" dependencies = [ "webpki", ] @@ -10926,7 +10926,7 @@ dependencies = [ "bitmaps", "bitvec 0.19.6", "bitvec 0.20.4", - "blake2 0.10.5", + "blake2 0.10.6", "blake2 0.9.2", "blake3", "block-buffer 0.10.3", @@ -10938,7 +10938,7 @@ dependencies = [ "brotli-decompressor", "bs58", "bstr 0.2.17", - "bstr 1.0.1", + "bstr 1.1.0", "bulletproofs", "bumpalo", "byte-slice-cast", @@ -11219,8 +11219,7 @@ dependencies = [ "mime", "mime_guess", "minimal-lexical", - "miniz_oxide 0.5.4", - "miniz_oxide 0.6.2", + "miniz_oxide", "mio 0.7.14", "mio 0.8.5", "mockall", @@ -11324,7 +11323,7 @@ dependencies = [ "parking", "parking_lot 0.11.2", "parking_lot 0.12.1", - "parking_lot_core 0.8.5", + "parking_lot_core 0.8.6", "parking_lot_core 0.9.5", "parse-zoneinfo", "paste", @@ -11368,7 +11367,7 @@ dependencies = [ "proc-macro-error", "proc-macro-error-attr", "proc-macro2 0.4.30", - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "prometheus", "proptest", "proptest-derive", @@ -11453,7 +11452,7 @@ dependencies = [ "security-framework", "security-framework-sys", "semver 0.11.0", - "semver 1.0.14", + "semver 1.0.16", "semver-parser", "send_wrapper", "serde 0.8.23", @@ -11522,7 +11521,7 @@ dependencies = [ "symbolic-common", "symbolic-demangle", "syn 0.15.44", - "syn 1.0.105", + "syn 1.0.107", "sync_wrapper", "synstructure", "tabular", @@ -11708,9 +11707,9 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "yasna" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "346d34a236c9d3e5f3b9b74563f238f955bbd05fa0b8b4efa53c130c43982f4c" +checksum = "aed2e7a52e3744ab4d0c05c20aa065258e84c49fd4226f5191b2ed29712710b4" dependencies = [ "time 0.3.15", ] @@ -11730,9 +11729,9 @@ version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ - "proc-macro2 1.0.47", + "proc-macro2 1.0.49", "quote 1.0.23", - "syn 1.0.105", + "syn 1.0.107", "synstructure", ] diff --git a/Cargo.toml b/Cargo.toml index 03e797ec49105..8215af6252454 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -125,8 +125,8 @@ move-prover-boogie-backend = { git = "https://github.com/move-language/move", re move-stackless-bytecode = { git = "https://github.com/move-language/move", rev = "265e8792ff2935db8246ddb308b36b893d507851" } move-symbol-pool = { git = "https://github.com/move-language/move", rev = "265e8792ff2935db8246ddb308b36b893d507851" } -fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "2dcf24facddfd15e83325ab714e3b6cb9cd63afe" } -fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "2dcf24facddfd15e83325ab714e3b6cb9cd63afe", package = "fastcrypto-zkp" } +fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "8d07cc5a60856163829911e5aeedede35e90174a" } +fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "8d07cc5a60856163829911e5aeedede35e90174a", package = "fastcrypto-zkp" } # anemo dependencies anemo = { git = "https://github.com/mystenlabs/anemo.git", rev = "ccfb77628ec1883121079f1ae9c65e9c716709c8" } diff --git a/crates/sui-config/Cargo.toml b/crates/sui-config/Cargo.toml index a308379f632bd..7062a3ce33bfd 100644 --- a/crates/sui-config/Cargo.toml +++ b/crates/sui-config/Cargo.toml @@ -32,6 +32,7 @@ narwhal-crypto = { path = "../../narwhal/crypto" } sui-framework = { path = "../sui-framework" } sui-adapter = { path = "../sui-adapter" } sui-types = { path = "../sui-types" } +sui-keys = { path = "../sui-keys" } workspace-hack.workspace = true [target.'cfg(msim)'.dependencies] diff --git a/crates/sui-config/data/fullnode-template.yaml b/crates/sui-config/data/fullnode-template.yaml index 995c1c62cb48b..f6c8560f100c5 100644 --- a/crates/sui-config/data/fullnode-template.yaml +++ b/crates/sui-config/data/fullnode-template.yaml @@ -10,3 +10,11 @@ enable-event-processing: true genesis: # Update this to the location of where the genesis file is stored genesis-file-location: "genesis.blob" +protocol-key-pair: + path: "protocol.key" +network-key-pair: + path: "network.key" +account-key-pair: + path: "account.key" +worker-key-pair: + path: "worker.key" \ No newline at end of file diff --git a/crates/sui-config/src/builder.rs b/crates/sui-config/src/builder.rs index c046385243d4e..457a6b3b0145c 100644 --- a/crates/sui-config/src/builder.rs +++ b/crates/sui-config/src/builder.rs @@ -1,7 +1,7 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -use crate::node::default_checkpoints_per_epoch; +use crate::node::{default_checkpoints_per_epoch, AuthorityKeyPairWithPath, KeyPairWithPath}; use crate::{ genesis, genesis_config::{GenesisConfig, ValidatorConfigInfo, ValidatorGenesisInfo}, @@ -16,7 +16,6 @@ use rand::rngs::OsRng; use std::{ num::NonZeroUsize, path::{Path, PathBuf}, - sync::Arc, }; use sui_types::crypto::{ generate_proof_of_possession, get_key_pair_from_rng, AccountKeyPair, AuthorityKeyPair, @@ -309,10 +308,16 @@ impl ConfigBuilder { }; NodeConfig { - protocol_key_pair: Arc::new(validator.genesis_info.key_pair), - worker_key_pair: Arc::new(validator.genesis_info.worker_key_pair), - account_key_pair: Arc::new(validator.genesis_info.account_key_pair), - network_key_pair: Arc::new(validator.genesis_info.network_key_pair), + protocol_key_pair: AuthorityKeyPairWithPath::new( + validator.genesis_info.key_pair, + ), + network_key_pair: KeyPairWithPath::new(SuiKeyPair::Ed25519( + validator.genesis_info.network_key_pair, + )), + account_key_pair: KeyPairWithPath::new(validator.genesis_info.account_key_pair), + worker_key_pair: KeyPairWithPath::new(SuiKeyPair::Ed25519( + validator.genesis_info.worker_key_pair, + )), db_path, network_address, metrics_address: utils::available_local_socket_address(), @@ -332,7 +337,6 @@ impl ConfigBuilder { } }) .collect(); - NetworkConfig { validator_configs, genesis, diff --git a/crates/sui-config/src/node.rs b/crates/sui-config/src/node.rs index dee6718daef41..d78fba6b4b35e 100644 --- a/crates/sui-config/src/node.rs +++ b/crates/sui-config/src/node.rs @@ -7,23 +7,24 @@ use crate::Config; use anyhow::Result; use multiaddr::Multiaddr; use narwhal_config::Parameters as ConsensusParameters; +use once_cell::sync::OnceCell; +use rand::rngs::OsRng; use serde::{Deserialize, Serialize}; use serde_with::serde_as; use std::collections::BTreeMap; use std::net::SocketAddr; use std::path::{Path, PathBuf}; use std::sync::Arc; +use sui_keys::keypair_file::{read_authority_keypair_from_file, read_keypair_from_file}; use sui_types::base_types::SuiAddress; use sui_types::committee::StakeUnit; -use sui_types::crypto::AccountKeyPair; -use sui_types::crypto::AuthorityKeyPair; use sui_types::crypto::AuthorityPublicKeyBytes; use sui_types::crypto::KeypairTraits; use sui_types::crypto::NetworkKeyPair; use sui_types::crypto::NetworkPublicKey; use sui_types::crypto::PublicKey as AccountsPublicKey; use sui_types::crypto::SuiKeyPair; -use sui_types::sui_serde::KeyPairBase64; +use sui_types::crypto::{get_key_pair_from_rng, AccountKeyPair, AuthorityKeyPair}; // Default max number of concurrent requests served pub const DEFAULT_GRPC_CONCURRENCY_LIMIT: usize = 20000000000; @@ -32,20 +33,15 @@ pub const DEFAULT_GRPC_CONCURRENCY_LIMIT: usize = 20000000000; #[derive(Clone, Debug, Deserialize, Serialize)] #[serde(rename_all = "kebab-case")] pub struct NodeConfig { - /// The keypair that is used to deal with consensus transactions + #[serde(default = "default_authority_key_pair")] + pub protocol_key_pair: AuthorityKeyPairWithPath, #[serde(default = "default_key_pair")] - #[serde_as(as = "Arc")] - pub protocol_key_pair: Arc, - /// The keypair that is used by the narwhal worker. - #[serde(default = "default_worker_key_pair")] - #[serde_as(as = "Arc")] - pub worker_key_pair: Arc, - /// The keypair that the authority uses to receive payments - #[serde(default = "default_sui_key_pair")] - pub account_key_pair: Arc, - #[serde(default = "default_worker_key_pair")] - #[serde_as(as = "Arc")] - pub network_key_pair: Arc, + pub worker_key_pair: KeyPairWithPath, + #[serde(default = "default_key_pair")] + pub account_key_pair: KeyPairWithPath, + #[serde(default = "default_key_pair")] + pub network_key_pair: KeyPairWithPath, + pub db_path: PathBuf, #[serde(default = "default_grpc_address")] pub network_address: Multiaddr, @@ -89,18 +85,6 @@ pub struct NodeConfig { pub authority_store_pruning_config: AuthorityStorePruningConfig, } -fn default_key_pair() -> Arc { - Arc::new(sui_types::crypto::get_key_pair().1) -} - -fn default_worker_key_pair() -> Arc { - Arc::new(sui_types::crypto::get_key_pair().1) -} - -fn default_sui_key_pair() -> Arc { - Arc::new((sui_types::crypto::get_key_pair::().1).into()) -} - fn default_authority_store_pruning_config() -> AuthorityStorePruningConfig { AuthorityStorePruningConfig::default() } @@ -109,6 +93,17 @@ fn default_grpc_address() -> Multiaddr { use multiaddr::multiaddr; multiaddr!(Ip4([0, 0, 0, 0]), Tcp(8080u16)) } +fn default_authority_key_pair() -> AuthorityKeyPairWithPath { + AuthorityKeyPairWithPath::new(get_key_pair_from_rng::(&mut OsRng).1) +} + +fn default_key_pair() -> KeyPairWithPath { + KeyPairWithPath::new( + get_key_pair_from_rng::(&mut OsRng) + .1 + .into(), + ) +} fn default_metrics_address() -> SocketAddr { use std::net::{IpAddr, Ipv4Addr}; @@ -145,23 +140,33 @@ impl Config for NodeConfig {} impl NodeConfig { pub fn protocol_key_pair(&self) -> &AuthorityKeyPair { - &self.protocol_key_pair + self.protocol_key_pair.authority_keypair() } pub fn worker_key_pair(&self) -> &NetworkKeyPair { - &self.worker_key_pair + match self.worker_key_pair.keypair() { + SuiKeyPair::Ed25519(kp) => kp, + _ => panic!("Invalid keypair type"), + } } pub fn network_key_pair(&self) -> &NetworkKeyPair { - &self.network_key_pair + match self.network_key_pair.keypair() { + SuiKeyPair::Ed25519(kp) => kp, + _ => panic!("Invalid keypair type"), + } + } + + pub fn account_key_pair(&self) -> &SuiKeyPair { + self.account_key_pair.keypair() } pub fn protocol_public_key(&self) -> AuthorityPublicKeyBytes { - self.protocol_key_pair.public().into() + self.protocol_key_pair().public().into() } pub fn sui_address(&self) -> SuiAddress { - (&self.account_key_pair.public()).into() + (&self.account_key_pair().public()).into() } pub fn db_path(&self) -> &Path { @@ -388,8 +393,144 @@ enum GenesisLocation { }, } +/// Wrapper struct for SuiKeyPair that can be deserialized from a file path. Used by network, worker, and account keypair. +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +pub struct KeyPairWithPath { + #[serde(flatten)] + location: KeyPairLocation, + + #[serde(skip)] + keypair: OnceCell>, +} + +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq)] +#[serde_as] +#[serde(untagged)] +enum KeyPairLocation { + InPlace { + #[serde_as(as = "Arc")] + value: Arc, + }, + File { + #[serde(rename = "path")] + path: PathBuf, + }, +} + +impl KeyPairWithPath { + pub fn new(kp: SuiKeyPair) -> Self { + let cell: OnceCell> = OnceCell::new(); + let arc_kp = Arc::new(kp); + // OK to unwrap panic because authority should not start without all keypairs loaded. + cell.set(arc_kp.clone()).expect("Failed to set keypair"); + Self { + location: KeyPairLocation::InPlace { value: arc_kp }, + keypair: cell, + } + } + + pub fn new_from_path(path: PathBuf) -> Self { + let cell: OnceCell> = OnceCell::new(); + // OK to unwrap panic because authority should not start without all keypairs loaded. + cell.set(Arc::new(read_keypair_from_file(&path).unwrap_or_else( + |_| panic!("Invalid keypair file at path {:?}", &path), + ))) + .expect("Failed to set keypair"); + Self { + location: KeyPairLocation::File { path }, + keypair: cell, + } + } + + pub fn keypair(&self) -> &SuiKeyPair { + self.keypair + .get_or_init(|| match &self.location { + KeyPairLocation::InPlace { value } => value.clone(), + KeyPairLocation::File { path } => { + // OK to unwrap panic because authority should not start without all keypairs loaded. + Arc::new( + read_keypair_from_file(path) + .unwrap_or_else(|_| panic!("Invalid keypair file")), + ) + } + }) + .as_ref() + } +} + +/// Wrapper struct for AuthorityKeyPair that can be deserialized from a file path. +#[derive(Clone, Debug, PartialEq, Eq, Deserialize, Serialize)] +pub struct AuthorityKeyPairWithPath { + #[serde(flatten)] + location: AuthorityKeyPairLocation, + + #[serde(skip)] + keypair: OnceCell>, +} + +#[derive(Debug, Clone, PartialEq, Deserialize, Serialize, Eq)] +#[serde_as] +#[serde(untagged)] +enum AuthorityKeyPairLocation { + InPlace { value: Arc }, + File { path: PathBuf }, +} + +impl AuthorityKeyPairWithPath { + pub fn new(kp: AuthorityKeyPair) -> Self { + let cell: OnceCell> = OnceCell::new(); + let arc_kp = Arc::new(kp); + // OK to unwrap panic because authority should not start without all keypairs loaded. + cell.set(arc_kp.clone()) + .expect("Failed to set authority keypair"); + Self { + location: AuthorityKeyPairLocation::InPlace { value: arc_kp }, + keypair: cell, + } + } + + pub fn new_from_path(path: PathBuf) -> Self { + let cell: OnceCell> = OnceCell::new(); + // OK to unwrap panic because authority should not start without all keypairs loaded. + cell.set(Arc::new( + read_authority_keypair_from_file(&path) + .unwrap_or_else(|_| panic!("Invalid authority keypair file at path {:?}", &path)), + )) + .expect("Failed to set authority keypair"); + Self { + location: AuthorityKeyPairLocation::File { path }, + keypair: cell, + } + } + + pub fn authority_keypair(&self) -> &AuthorityKeyPair { + self.keypair + .get_or_init(|| match &self.location { + AuthorityKeyPairLocation::InPlace { value } => value.clone(), + AuthorityKeyPairLocation::File { path } => { + // OK to unwrap panic because authority should not start without all keypairs loaded. + Arc::new( + read_authority_keypair_from_file(path).unwrap_or_else(|_| { + panic!("Invalid authority keypair file {:?}", &path) + }), + ) + } + }) + .as_ref() + } +} + #[cfg(test)] mod tests { + use std::path::PathBuf; + + use fastcrypto::traits::KeyPair; + use rand::{rngs::StdRng, SeedableRng}; + use sui_keys::keypair_file::{write_authority_keypair_to_file, write_keypair_to_file}; + use sui_types::crypto::{ + get_key_pair_from_rng, AccountKeyPair, AuthorityKeyPair, NetworkKeyPair, SuiKeyPair, + }; + use super::Genesis; use crate::{genesis, NodeConfig}; @@ -435,4 +576,51 @@ mod tests { let _template: NodeConfig = serde_yaml::from_str(TEMPLATE).unwrap(); } + + #[test] + fn load_key_pairs_to_node_config() { + let protocol_key_pair: AuthorityKeyPair = + get_key_pair_from_rng(&mut StdRng::from_seed([0; 32])).1; + let worker_key_pair: NetworkKeyPair = + get_key_pair_from_rng(&mut StdRng::from_seed([0; 32])).1; + let account_key_pair: SuiKeyPair = + get_key_pair_from_rng::(&mut StdRng::from_seed([0; 32])) + .1 + .into(); + let network_key_pair: NetworkKeyPair = + get_key_pair_from_rng(&mut StdRng::from_seed([0; 32])).1; + + write_authority_keypair_to_file(&protocol_key_pair, &PathBuf::from("protocol.key")) + .unwrap(); + write_keypair_to_file( + &SuiKeyPair::Ed25519(worker_key_pair.copy()), + &PathBuf::from("worker.key"), + ) + .unwrap(); + write_keypair_to_file( + &SuiKeyPair::Ed25519(network_key_pair.copy()), + &PathBuf::from("network.key"), + ) + .unwrap(); + write_keypair_to_file(&account_key_pair, &PathBuf::from("account.key")).unwrap(); + + const TEMPLATE: &str = include_str!("../data/fullnode-template.yaml"); + let template: NodeConfig = serde_yaml::from_str(TEMPLATE).unwrap(); + assert_eq!( + template.protocol_key_pair().public(), + protocol_key_pair.public() + ); + assert_eq!( + template.network_key_pair().public(), + network_key_pair.public() + ); + assert_eq!( + template.account_key_pair().public(), + account_key_pair.public() + ); + assert_eq!( + template.worker_key_pair().public(), + worker_key_pair.public() + ); + } } diff --git a/crates/sui-config/src/swarm.rs b/crates/sui-config/src/swarm.rs index 76c359841dbc4..b2cfe37e7b9b3 100644 --- a/crates/sui-config/src/swarm.rs +++ b/crates/sui-config/src/swarm.rs @@ -1,8 +1,8 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -use crate::node::default_checkpoints_per_epoch; use crate::node::AuthorityStorePruningConfig; +use crate::node::{default_checkpoints_per_epoch, AuthorityKeyPairWithPath, KeyPairWithPath}; use crate::p2p::{P2pConfig, SeedPeer}; use crate::{builder, genesis, utils, Config, NodeConfig, ValidatorInfo}; use fastcrypto::traits::KeyPair; @@ -13,7 +13,6 @@ use serde_with::serde_as; use std::net::{IpAddr, SocketAddr}; use std::num::NonZeroUsize; use std::path::{Path, PathBuf}; -use std::sync::Arc; use sui_types::committee::Committee; use sui_types::crypto::{ get_key_pair_from_rng, AccountKeyPair, AuthorityKeyPair, NetworkKeyPair, SuiKeyPair, @@ -130,15 +129,10 @@ impl<'a> FullnodeConfigBuilder<'a> { } pub fn build(self) -> Result { - let protocol_key_pair: Arc = - Arc::new(get_key_pair_from_rng(&mut OsRng).1); - let worker_key_pair: Arc = Arc::new(get_key_pair_from_rng(&mut OsRng).1); - let account_key_pair: Arc = Arc::new( - get_key_pair_from_rng::(&mut OsRng) - .1 - .into(), - ); - let network_key_pair: Arc = Arc::new(get_key_pair_from_rng(&mut OsRng).1); + let protocol_key_pair = get_key_pair_from_rng::(&mut OsRng).1; + let worker_key_pair = get_key_pair_from_rng::(&mut OsRng).1; + let account_key_pair = get_key_pair_from_rng::(&mut OsRng).1; + let network_key_pair = get_key_pair_from_rng::(&mut OsRng).1; let validator_configs = &self.network_config.validator_configs; let validator_config = &validator_configs[0]; @@ -165,7 +159,9 @@ impl<'a> FullnodeConfigBuilder<'a> { let seed_peers = validator_configs .iter() .map(|config| SeedPeer { - peer_id: Some(anemo::PeerId(config.network_key_pair.public().0.to_bytes())), + peer_id: Some(anemo::PeerId( + config.network_key_pair().public().0.to_bytes(), + )), address: config.p2p_config.external_address.clone().unwrap(), }) .collect(); @@ -185,10 +181,11 @@ impl<'a> FullnodeConfigBuilder<'a> { let json_rpc_address: SocketAddr = jsonrpc_server_url.parse().unwrap(); Ok(NodeConfig { - protocol_key_pair, - worker_key_pair, - account_key_pair, - network_key_pair, + protocol_key_pair: AuthorityKeyPairWithPath::new(protocol_key_pair), + account_key_pair: KeyPairWithPath::new(SuiKeyPair::Ed25519(account_key_pair)), + worker_key_pair: KeyPairWithPath::new(SuiKeyPair::Ed25519(worker_key_pair)), + network_key_pair: KeyPairWithPath::new(SuiKeyPair::Ed25519(network_key_pair)), + db_path: db_path.join(dir_name), network_address, metrics_address: utils::available_local_socket_address(), diff --git a/crates/sui-config/tests/snapshots/snapshot_tests__network_config_snapshot_matches.snap b/crates/sui-config/tests/snapshots/snapshot_tests__network_config_snapshot_matches.snap index eef8a2d9b2fa5..4903daed7faca 100644 --- a/crates/sui-config/tests/snapshots/snapshot_tests__network_config_snapshot_matches.snap +++ b/crates/sui-config/tests/snapshots/snapshot_tests__network_config_snapshot_matches.snap @@ -3,10 +3,16 @@ source: crates/sui-config/tests/snapshot_tests.rs expression: network_config --- validator_configs: - - protocol-key-pair: VTDx4HjVmRBqdqBWg2zN+zcFE20io3CrBchGy/iV1lqZ8l72H4AyuRRjZGCYLFzG8TTvHdrnZlfyy/7B6/yNCXN0CA32/PDcuLxLDY4K9dgOu/8rTFmfVPQtYxLfwxQnYHjBzDR+u77FGYviWFE/OGuTDQLCdJqAPiMwlV69GhA= - worker-key-pair: fsz863qJR38mPjuvloaZBE4vbibFPgrwQXUa+OGTTNMfKnkBqELk02I7xhzhwXF9LnaOD9ct+DQa9WYVuRbwOA== - account-key-pair: AJTkqEkxROnmliCMvtACWebdtW+Xm5HDKWdWCYW+YZCbZeUwqtiSP4IuiO1U/Br2sTVBQpkckD5caF+BanumitE= - network-key-pair: KUrb+C2JL5zKk+XaKXpgLj08mCQegCCekpnR0SLAhTC+ODDLDFddhaGYhOUoOWrDb5Dh27EywDr6A1haMSoZgA== + - protocol-key-pair: + value: + name: mfJe9h+AMrkUY2RgmCxcxvE07x3a52ZX8sv+wev8jQlzdAgN9vzw3Li8Sw2OCvXYDrv/K0xZn1T0LWMS38MUJ2B4wcw0fru+xRmL4lhRPzhrkw0CwnSagD4jMJVevRoQ + secret: VTDx4HjVmRBqdqBWg2zN+zcFE20io3CrBchGy/iV1lo= + worker-key-pair: + value: AB8qeQGoQuTTYjvGHOHBcX0udo4P1y34NBr1ZhW5FvA4fsz863qJR38mPjuvloaZBE4vbibFPgrwQXUa+OGTTNM= + account-key-pair: + value: AJTkqEkxROnmliCMvtACWebdtW+Xm5HDKWdWCYW+YZCbZeUwqtiSP4IuiO1U/Br2sTVBQpkckD5caF+BanumitE= + network-key-pair: + value: AL44MMsMV12FoZiE5Sg5asNvkOHbsTLAOvoDWFoxKhmAKUrb+C2JL5zKk+XaKXpgLj08mCQegCCekpnR0SLAhTA= db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" @@ -55,10 +61,16 @@ validator_configs: objects-num-latest-versions-to-retain: 2 objects-pruning-period-secs: 43200 objects-pruning-initial-delay-secs: 3600 - - protocol-key-pair: avYcyVgYMXTyaUYh9IRwLK0gSzl7YF6ZQDAbrS1BhvqNz/bRVQQKZW9IGbExEbUsV0aoa6cvOV+6/i7DhH0egUDmJKdR/fa18gULxyBc+dMABMkLDHQK/9Mmzmc8wrI6LSTVPir+sobfxmj9QGAInW0rF7eZ3Tb5DTMuVKejONQ= - worker-key-pair: pPBKumCrkESEmAiG/7UfSMyIlAyKCQaysBb0RA9oxIjUlkEGAVZiydeHbfhB9gYL7kzDBgkDW+FtKKCCdkKJrw== - account-key-pair: ACxHMS0iupHOTDgHm2HYa+f/ft9OjvxBk5+C7f/APsXUezeV+HwuWFqdYT/NOM6oMWQ2IMvai7GOMn5YNPn+FWA= - network-key-pair: 25MXKYkbDqXWtIZXl27gbhE44t3hp1Qi3HFWHLfWWc02Qa/dLNgUCurzqAJUBNJX3l41lsEQSc4BU7HWKBcBww== + - protocol-key-pair: + value: + name: jc/20VUECmVvSBmxMRG1LFdGqGunLzlfuv4uw4R9HoFA5iSnUf32tfIFC8cgXPnTAATJCwx0Cv/TJs5nPMKyOi0k1T4q/rKG38Zo/UBgCJ1tKxe3md02+Q0zLlSnozjU + secret: avYcyVgYMXTyaUYh9IRwLK0gSzl7YF6ZQDAbrS1Bhvo= + worker-key-pair: + value: ANSWQQYBVmLJ14dt+EH2BgvuTMMGCQNb4W0ooIJ2QomvpPBKumCrkESEmAiG/7UfSMyIlAyKCQaysBb0RA9oxIg= + account-key-pair: + value: ACxHMS0iupHOTDgHm2HYa+f/ft9OjvxBk5+C7f/APsXUezeV+HwuWFqdYT/NOM6oMWQ2IMvai7GOMn5YNPn+FWA= + network-key-pair: + value: ADZBr90s2BQK6vOoAlQE0lfeXjWWwRBJzgFTsdYoFwHD25MXKYkbDqXWtIZXl27gbhE44t3hp1Qi3HFWHLfWWc0= db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" @@ -107,10 +119,16 @@ validator_configs: objects-num-latest-versions-to-retain: 2 objects-pruning-period-secs: 43200 objects-pruning-initial-delay-secs: 3600 - - protocol-key-pair: OXnx3yM1C/ppgnDMx/o1d49fJs7E05kq11mXNae/O+Kt3u+U2JjIjkDb3v+RxfEF+c8sdH+28rw37APWyR7bLhpXjPVEvosJMeJfJD1ZsMMNmKFs47odbPHX9QQmmS6wrbMTSwVb6BQNLbXyX7ANg/jkIivwH9ask6H/TXnaWPI= - worker-key-pair: 1Dh27FOw52h9QAd9IijyRq42PtJGYtmCZ2RvXYPDEXq1VgdNLiQC+WWvRST+Sy8o3vw/3KhkD6LkKgSI3cA21A== - account-key-pair: ANoED1MVNxaUbvcp8K7QXQLx/JQAamix308cQdCKwKu2YYJojLU7C+8u2vatwd7CUkkEgsvOGsRqjhCYXQPZRPM= - network-key-pair: oUiBY+hNlv3/NS7/U/zAW3EMNi45uTXGv9BrFnYfjyL3DKDUcV6AMIaYPpJDgVBG5KinqsQjwmcuxI+1bSHPXg== + - protocol-key-pair: + value: + name: rd7vlNiYyI5A297/kcXxBfnPLHR/tvK8N+wD1ske2y4aV4z1RL6LCTHiXyQ9WbDDDZihbOO6HWzx1/UEJpkusK2zE0sFW+gUDS218l+wDYP45CIr8B/WrJOh/0152ljy + secret: OXnx3yM1C/ppgnDMx/o1d49fJs7E05kq11mXNae/O+I= + worker-key-pair: + value: ALVWB00uJAL5Za9FJP5LLyje/D/cqGQPouQqBIjdwDbU1Dh27FOw52h9QAd9IijyRq42PtJGYtmCZ2RvXYPDEXo= + account-key-pair: + value: ANoED1MVNxaUbvcp8K7QXQLx/JQAamix308cQdCKwKu2YYJojLU7C+8u2vatwd7CUkkEgsvOGsRqjhCYXQPZRPM= + network-key-pair: + value: APcMoNRxXoAwhpg+kkOBUEbkqKeqxCPCZy7Ej7VtIc9eoUiBY+hNlv3/NS7/U/zAW3EMNi45uTXGv9BrFnYfjyI= db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" @@ -159,10 +177,16 @@ validator_configs: objects-num-latest-versions-to-retain: 2 objects-pruning-period-secs: 43200 objects-pruning-initial-delay-secs: 3600 - - protocol-key-pair: CyNkjqNVr3HrHTH7f/NLs7u5lUHJzuPAw0PqMTD2y2uz/V77XIckA6StE/EZlRNgbSM1SoRSSa6hV1ZMI/88FcbJ5lK3LXQOjKy5PLzAaGsOwMwMHHYL+0K0NlGfxagFS3ZTOpep8jmH0JfvlrHyUmuyBz+hCncZlBdyNH7ydPQ= - worker-key-pair: EHX7HidEWjJgbesq5yxWacBkHUx/wALB90Mm8SiaEZbxwBkF+0PK7tSN8SKVyFzxOP/rMtxd+udylT/0hBBhPA== - account-key-pair: AEgi5sKIaNYxb+8Vr0MKLUWpdrRfjLPiCeYy4hQTtSBHkXLa5CsQhIUzlhFBEFTP1eKxJ6lBGRYzNkOjrDamlU8= - network-key-pair: jQ5isfeCs5cO8kQfRoNiE6Ex250niEtXCH7U4Y3Khd6oQCQy7u0KEQ5fzh2GiqaHnTSuv58CtSk5zSJ3oCPwCA== + - protocol-key-pair: + value: + name: s/1e+1yHJAOkrRPxGZUTYG0jNUqEUkmuoVdWTCP/PBXGyeZSty10DoysuTy8wGhrDsDMDBx2C/tCtDZRn8WoBUt2UzqXqfI5h9CX75ax8lJrsgc/oQp3GZQXcjR+8nT0 + secret: CyNkjqNVr3HrHTH7f/NLs7u5lUHJzuPAw0PqMTD2y2s= + worker-key-pair: + value: APHAGQX7Q8ru1I3xIpXIXPE4/+sy3F3653KVP/SEEGE8EHX7HidEWjJgbesq5yxWacBkHUx/wALB90Mm8SiaEZY= + account-key-pair: + value: AEgi5sKIaNYxb+8Vr0MKLUWpdrRfjLPiCeYy4hQTtSBHkXLa5CsQhIUzlhFBEFTP1eKxJ6lBGRYzNkOjrDamlU8= + network-key-pair: + value: AKhAJDLu7QoRDl/OHYaKpoedNK6/nwK1KTnNInegI/AIjQ5isfeCs5cO8kQfRoNiE6Ex250niEtXCH7U4Y3Khd4= db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" @@ -211,10 +235,16 @@ validator_configs: objects-num-latest-versions-to-retain: 2 objects-pruning-period-secs: 43200 objects-pruning-initial-delay-secs: 3600 - - protocol-key-pair: X/I/kM+KvHcxAKEf2UU6Sr7SpN3bhiE9nP5CuM/iIY2LKRqlcXQ8gPmO3CO3s3dl0lrqWlZovhKpzENp8u9pfBsBwUrId0LiiiqQmP5hlGIVXp7GiO2wX9ApVqo6d7/nZNYB3hOX5NaeinAfDxN4Q6VzStZNxQS3bN/CiKF3/iE= - worker-key-pair: UkqY1k2SrJLzldSoAqzDZp1vudV6MzAZqojam0XY2ZMLuRQO9Y+pqy4+d18HnybxccBJ0Peox1wNntUCw83jtg== - account-key-pair: AB86G1ccGVVMFPrc3src2g3fB3NMyEcsS5pzI+Yr6cyKJ0hDQggulPK2ZTpGNWrch+vg73OQ9lWfRXu9uN+Qo88= - network-key-pair: UqrQzLuBAdMMbnxVAxgiaFTXz6PaV70e0XTyeF6Fu8oK9Zu9eLjNEPIBuXXKvlrVfhuwWWfvZo8RITUz+oGi4A== + - protocol-key-pair: + value: + name: iykapXF0PID5jtwjt7N3ZdJa6lpWaL4SqcxDafLvaXwbAcFKyHdC4ooqkJj+YZRiFV6exojtsF/QKVaqOne/52TWAd4Tl+TWnopwHw8TeEOlc0rWTcUEt2zfwoihd/4h + secret: X/I/kM+KvHcxAKEf2UU6Sr7SpN3bhiE9nP5CuM/iIY0= + worker-key-pair: + value: AAu5FA71j6mrLj53XwefJvFxwEnQ96jHXA2e1QLDzeO2UkqY1k2SrJLzldSoAqzDZp1vudV6MzAZqojam0XY2ZM= + account-key-pair: + value: AB86G1ccGVVMFPrc3src2g3fB3NMyEcsS5pzI+Yr6cyKJ0hDQggulPK2ZTpGNWrch+vg73OQ9lWfRXu9uN+Qo88= + network-key-pair: + value: AAr1m714uM0Q8gG5dcq+WtV+G7BZZ+9mjxEhNTP6gaLgUqrQzLuBAdMMbnxVAxgiaFTXz6PaV70e0XTyeF6Fu8o= db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" @@ -263,10 +293,16 @@ validator_configs: objects-num-latest-versions-to-retain: 2 objects-pruning-period-secs: 43200 objects-pruning-initial-delay-secs: 3600 - - protocol-key-pair: N272EiFDyKtxRbDKbyN6ujenJ+skPcRoc/XolpOLGnWEMb3Jb7ZvUxW7p0L15A9+Ny8jfF4iDYHfNhg7BiZTXnhH7PRqjjRKWiGtteU4i5UBGlk8bfQSL3/irX6AKKlrCeq9hDdpJepQFWPVhieWLV0wwgqu0wIbxNDn2/0eHJU= - worker-key-pair: Hloy4pnf8pWEHGP+4OFsXz56bLdIJhkD2O+OdKMqCA7wMp6899Qoe0RPBXQsG+CDt54MPp/xImMAyKkV3ZKPbQ== - account-key-pair: AHH6sQEDMUJH0Spm5nDLrKbFAUcBHYL/VIORf2ervCbbpvMScjoMR/DaN0M5IOxS2VpGC59N6kv6gDm63ufLQ5w= - network-key-pair: tPu3gzoWoFbHbnuaUp1whWKFV7mtDVfOtTHDWWR2ZoXf5b5cvKkChqZePWeh13cAvg+1CyvrtPB1cQOBhwx4vw== + - protocol-key-pair: + value: + name: hDG9yW+2b1MVu6dC9eQPfjcvI3xeIg2B3zYYOwYmU154R+z0ao40SlohrbXlOIuVARpZPG30Ei9/4q1+gCipawnqvYQ3aSXqUBVj1YYnli1dMMIKrtMCG8TQ59v9HhyV + secret: N272EiFDyKtxRbDKbyN6ujenJ+skPcRoc/XolpOLGnU= + worker-key-pair: + value: APAynrz31Ch7RE8FdCwb4IO3ngw+n/EiYwDIqRXdko9tHloy4pnf8pWEHGP+4OFsXz56bLdIJhkD2O+OdKMqCA4= + account-key-pair: + value: AHH6sQEDMUJH0Spm5nDLrKbFAUcBHYL/VIORf2ervCbbpvMScjoMR/DaN0M5IOxS2VpGC59N6kv6gDm63ufLQ5w= + network-key-pair: + value: AN/lvly8qQKGpl49Z6HXdwC+D7ULK+u08HVxA4GHDHi/tPu3gzoWoFbHbnuaUp1whWKFV7mtDVfOtTHDWWR2ZoU= db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" @@ -315,10 +351,16 @@ validator_configs: objects-num-latest-versions-to-retain: 2 objects-pruning-period-secs: 43200 objects-pruning-initial-delay-secs: 3600 - - protocol-key-pair: a74f03IOjL8ZFSWFChFVEi+wiMwHNwNCPDGIYkGfgjuVqZ6UqSbldl5MDBHXjF3VHT99e6CgZTuSXpFCRSfw+GMYVuQEwO09WVY8511moRYTuFgfR51108NKCT8re+ppKiuqitxb4BlONYsg4CavliJXCWosawcKZDcea7D6Fe0= - worker-key-pair: 5RWlYF22jS9i76zLl8jP2D3D8GC5ht+IP1dWUBGZxi993DP7RJ8jr9I9OXm/Mf3nxvRozBZQnRUoPY8tvhMCGA== - account-key-pair: AKHC3Gr1i6u+zAK1Yj1vys0hB83qha4jRCfzoHqLAo6FQ5EkvCcy5cw1JKStwSs0v/QByW0I8JXCqdnagoupCMg= - network-key-pair: +EEIX4hOQB79xqDr8Cp0UGNNC4sEE849/ORTGY1iwxe4WYJPZ9nNye8f+ObULC/wnR4X87tIAH4wvXsZ8OKWwQ== + - protocol-key-pair: + value: + name: lamelKkm5XZeTAwR14xd1R0/fXugoGU7kl6RQkUn8PhjGFbkBMDtPVlWPOddZqEWE7hYH0edddPDSgk/K3vqaSorqorcW+AZTjWLIOAmr5YiVwlqLGsHCmQ3Hmuw+hXt + secret: a74f03IOjL8ZFSWFChFVEi+wiMwHNwNCPDGIYkGfgjs= + worker-key-pair: + value: AH3cM/tEnyOv0j05eb8x/efG9GjMFlCdFSg9jy2+EwIY5RWlYF22jS9i76zLl8jP2D3D8GC5ht+IP1dWUBGZxi8= + account-key-pair: + value: AKHC3Gr1i6u+zAK1Yj1vys0hB83qha4jRCfzoHqLAo6FQ5EkvCcy5cw1JKStwSs0v/QByW0I8JXCqdnagoupCMg= + network-key-pair: + value: ALhZgk9n2c3J7x/45tQsL/CdHhfzu0gAfjC9exnw4pbB+EEIX4hOQB79xqDr8Cp0UGNNC4sEE849/ORTGY1iwxc= db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" diff --git a/crates/sui-core/src/unit_tests/narwhal_manager_tests.rs b/crates/sui-core/src/unit_tests/narwhal_manager_tests.rs index 670695e9d375c..d2dc8f7d4f13f 100644 --- a/crates/sui-core/src/unit_tests/narwhal_manager_tests.rs +++ b/crates/sui-core/src/unit_tests/narwhal_manager_tests.rs @@ -85,7 +85,7 @@ async fn test_narwhal_manager() { let narwhal_config = NarwhalConfiguration { primary_keypair: config.protocol_key_pair().copy(), - network_keypair: config.network_key_pair.copy(), + network_keypair: config.network_key_pair().copy(), worker_ids_and_keypairs: vec![(0, config.worker_key_pair().copy())], storage_base_path: consensus_config.db_path().to_path_buf(), parameters: consensus_config.narwhal_config().to_owned(), diff --git a/crates/sui-keys/src/keypair_file.rs b/crates/sui-keys/src/keypair_file.rs new file mode 100644 index 0000000000000..13db82ea36fec --- /dev/null +++ b/crates/sui-keys/src/keypair_file.rs @@ -0,0 +1,52 @@ +// Copyright (c) Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + +use anyhow::anyhow; +use fastcrypto::traits::EncodeDecodeBase64; +use sui_types::crypto::{AuthorityKeyPair, NetworkKeyPair, SuiKeyPair}; + +/// Write Base64 encoded `flag || privkey || pubkey` to file +pub fn write_keypair_to_file>( + keypair: &SuiKeyPair, + path: P, +) -> anyhow::Result<()> { + let contents = keypair.encode_base64(); + std::fs::write(path, contents)?; + Ok(()) +} + +/// Write Base64 encoded `privkey || pubkey` to file +pub fn write_authority_keypair_to_file>( + keypair: &AuthorityKeyPair, + path: P, +) -> anyhow::Result<()> { + let contents = keypair.encode_base64(); + std::fs::write(path, contents)?; + Ok(()) +} + +/// Read from file as Base64 encoded `privkey || pubkey` and return AuthorityKeyPair +pub fn read_authority_keypair_from_file>( + path: P, +) -> anyhow::Result { + let contents = std::fs::read_to_string(path)?; + AuthorityKeyPair::decode_base64(contents.as_str().trim()).map_err(|e| anyhow!(e)) +} + +/// Read from file as Base64 encoded `flag || privkey || pubkey` and return SuiKeyapir +pub fn read_keypair_from_file>(path: P) -> anyhow::Result { + let contents = std::fs::read_to_string(path)?; + SuiKeyPair::decode_base64(contents.as_str().trim()).map_err(|e| anyhow!(e)) +} + +/// Read from file as Base64 encoded `flag || privkey || pubkey` and return NetworkKeyPair using the SuiKeyPair scheme enum. +pub fn read_network_keypair_from_file>( + path: P, +) -> anyhow::Result { + let kp = read_keypair_from_file(path)?; + if let SuiKeyPair::Ed25519(kp) = kp { + Ok(kp) + } else { + Err(anyhow!("Invalid scheme for network keypair")) + } +} diff --git a/crates/sui-keys/src/lib.rs b/crates/sui-keys/src/lib.rs index 9f7b1a32ba02b..e8755c06ba496 100644 --- a/crates/sui-keys/src/lib.rs +++ b/crates/sui-keys/src/lib.rs @@ -2,4 +2,5 @@ // SPDX-License-Identifier: Apache-2.0 pub mod key_derive; +pub mod keypair_file; pub mod keystore; diff --git a/crates/sui-node/src/lib.rs b/crates/sui-node/src/lib.rs index bdbe928d65b33..c38aef7e3ea53 100644 --- a/crates/sui-node/src/lib.rs +++ b/crates/sui-node/src/lib.rs @@ -304,7 +304,8 @@ impl SuiNode { // TODO only configure validators as seed/preferred peers for validators and not for // fullnodes once we've had a chance to re-work fullnode configuration generation. let mut p2p_config = config.p2p_config.clone(); - let our_network_public_key = config.network_key_pair.public(); + let network_kp = config.network_key_pair(); + let our_network_public_key = network_kp.public(); let other_validators = config .genesis()? .validator_set() @@ -354,7 +355,7 @@ impl SuiNode { let network = Network::bind(config.p2p_config.listen_address) .server_name("sui") - .private_key(config.network_key_pair.copy().private().0.to_bytes()) + .private_key(config.network_key_pair().copy().private().0.to_bytes()) .config(config.p2p_config.anemo_config.clone().unwrap_or_default()) .outbound_request_layer(outbound_layer) .start(service)?; @@ -481,7 +482,7 @@ impl SuiNode { )); let narwhal_config = NarwhalConfiguration { primary_keypair: config.protocol_key_pair().copy(), - network_keypair: config.network_key_pair.copy(), + network_keypair: config.network_key_pair().copy(), worker_ids_and_keypairs: vec![(0, config.worker_key_pair().copy())], storage_base_path: consensus_config.db_path().to_path_buf(), parameters: consensus_config.narwhal_config().to_owned(), diff --git a/crates/sui-types/src/crypto.rs b/crates/sui-types/src/crypto.rs index d292917853d3d..9f62abbb9c42f 100644 --- a/crates/sui-types/src/crypto.rs +++ b/crates/sui-types/src/crypto.rs @@ -92,7 +92,7 @@ pub fn generate_proof_of_possession( /// #[allow(clippy::large_enum_variant)] -#[derive(Debug, From)] +#[derive(Debug, From, PartialEq, Eq)] pub enum SuiKeyPair { Ed25519(Ed25519KeyPair), Secp256k1(Secp256k1KeyPair), diff --git a/crates/sui/src/genesis_ceremony.rs b/crates/sui/src/genesis_ceremony.rs index 3d5fe700a6471..0681085a39605 100644 --- a/crates/sui/src/genesis_ceremony.rs +++ b/crates/sui/src/genesis_ceremony.rs @@ -22,7 +22,7 @@ use sui_types::{ object::Object, }; -use crate::keytool::{ +use sui_keys::keypair_file::{ read_authority_keypair_from_file, read_keypair_from_file, read_network_keypair_from_file, }; @@ -269,9 +269,9 @@ pub fn run(cmd: Ceremony) -> Result<()> { #[cfg(test)] mod test { use super::*; - use crate::keytool::{write_authority_keypair_to_file, write_keypair_to_file}; use anyhow::Result; use sui_config::{utils, ValidatorInfo}; + use sui_keys::keypair_file::{write_authority_keypair_to_file, write_keypair_to_file}; use sui_types::crypto::{get_key_pair_from_rng, AccountKeyPair, AuthorityKeyPair, SuiKeyPair}; #[test] diff --git a/crates/sui/src/keytool.rs b/crates/sui/src/keytool.rs index 3b126f8d7c218..46c5456308979 100644 --- a/crates/sui/src/keytool.rs +++ b/crates/sui/src/keytool.rs @@ -8,19 +8,18 @@ use anyhow::anyhow; use bip32::DerivationPath; use clap::*; use fastcrypto::encoding::{decode_bytes_hex, Base64, Encoding}; -use fastcrypto::traits::{ToFromBytes, VerifyingKey}; use sui_keys::key_derive::generate_new_key; +use sui_keys::keypair_file::{ + read_authority_keypair_from_file, read_keypair_from_file, write_authority_keypair_to_file, + write_keypair_to_file, +}; use sui_types::intent::Intent; use sui_types::messages::TransactionData; use tracing::info; -use fastcrypto::ed25519::{Ed25519KeyPair, Ed25519PrivateKey, Ed25519PublicKey}; use sui_keys::keystore::{AccountKeystore, Keystore}; use sui_types::base_types::SuiAddress; -use sui_types::crypto::{ - get_authority_key_pair, AuthorityKeyPair, Ed25519SuiSignature, EncodeDecodeBase64, - NetworkKeyPair, SignatureScheme, SuiKeyPair, SuiSignatureInner, -}; +use sui_types::crypto::{get_authority_key_pair, EncodeDecodeBase64, SignatureScheme, SuiKeyPair}; #[cfg(test)] #[path = "unit_tests/keytool_tests.rs"] mod keytool_tests; @@ -194,50 +193,3 @@ fn store_and_print_keypair(address: SuiAddress, keypair: SuiKeyPair) { path.to_str().unwrap() ); } - -pub fn write_keypair_to_file>( - keypair: &SuiKeyPair, - path: P, -) -> anyhow::Result<()> { - let contents = keypair.encode_base64(); - std::fs::write(path, contents)?; - Ok(()) -} - -pub fn write_authority_keypair_to_file>( - keypair: &AuthorityKeyPair, - path: P, -) -> anyhow::Result<()> { - let contents = keypair.encode_base64(); - std::fs::write(path, contents)?; - Ok(()) -} - -pub fn read_authority_keypair_from_file>( - path: P, -) -> anyhow::Result { - let contents = std::fs::read_to_string(path)?; - AuthorityKeyPair::decode_base64(contents.as_str().trim()).map_err(|e| anyhow!(e)) -} - -pub fn read_keypair_from_file>(path: P) -> anyhow::Result { - let contents = std::fs::read_to_string(path)?; - SuiKeyPair::decode_base64(contents.as_str().trim()).map_err(|e| anyhow!(e)) -} - -pub fn read_network_keypair_from_file>( - path: P, -) -> anyhow::Result { - let value = std::fs::read_to_string(path)?; - let bytes = Base64::decode(value.as_str()).map_err(|e| anyhow::anyhow!(e))?; - if let Some(flag) = bytes.first() { - if flag == &Ed25519SuiSignature::SCHEME.flag() { - let priv_key_bytes = bytes - .get(1 + Ed25519PublicKey::LENGTH..) - .ok_or_else(|| anyhow!("Invalid length"))?; - let sk = Ed25519PrivateKey::from_bytes(priv_key_bytes)?; - return Ok(>::from(sk)); - } - } - Err(anyhow!("Invalid bytes")) -} diff --git a/crates/workspace-hack/Cargo.toml b/crates/workspace-hack/Cargo.toml index 349da64f0d09b..d1c50e5e85066 100644 --- a/crates/workspace-hack/Cargo.toml +++ b/crates/workspace-hack/Cargo.toml @@ -15,7 +15,7 @@ publish = false ### BEGIN HAKARI SECTION [dependencies] -addr2line = { version = "0.17", default-features = false } +addr2line = { version = "0.19", default-features = false } adler = { version = "1", default-features = false } aead = { version = "0.5", default-features = false, features = ["alloc", "getrandom", "rand_core"] } aes = { version = "0.8", default-features = false } @@ -194,8 +194,8 @@ event-listener = { version = "2", default-features = false } eyre = { version = "0.6", features = ["auto-install", "track-caller"] } fail-9fbad63c4bcf4a8f = { package = "fail", version = "0.4", default-features = false } fail-d8f496e17d97b5cb = { package = "fail", version = "0.5", default-features = false } -fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "2dcf24facddfd15e83325ab714e3b6cb9cd63afe", features = ["copy_key", "secure"] } -fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "2dcf24facddfd15e83325ab714e3b6cb9cd63afe", default-features = false } +fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "8d07cc5a60856163829911e5aeedede35e90174a", features = ["copy_key", "secure"] } +fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "8d07cc5a60856163829911e5aeedede35e90174a", default-features = false } fastrand = { version = "1", default-features = false } fd-lock = { version = "3", default-features = false } fdlimit = { version = "0.2", default-features = false } @@ -229,7 +229,7 @@ gethostname = { version = "0.2", default-features = false } getrandom-c65f7effa3be6d31 = { package = "getrandom", version = "0.1", default-features = false, features = ["std"] } getrandom-6f8ce4dd05d13bba = { package = "getrandom", version = "0.2", default-features = false, features = ["std"] } ghash = { version = "0.5", default-features = false } -gimli = { version = "0.26", default-features = false, features = ["read", "read-core"] } +gimli = { version = "0.27", default-features = false, features = ["read", "read-core"] } glob = { version = "0.3", default-features = false } globset = { version = "0.4", features = ["log"] } globwalk = { version = "0.8", default-features = false } @@ -315,8 +315,7 @@ merlin = { version = "3", features = ["std"] } mime = { version = "0.3", default-features = false } mime_guess = { version = "2", default-features = false } minimal-lexical = { version = "0.2", default-features = false, features = ["std"] } -miniz_oxide-d8f496e17d97b5cb = { package = "miniz_oxide", version = "0.5", default-features = false } -miniz_oxide-3b31131e45eafb45 = { package = "miniz_oxide", version = "0.6", default-features = false, features = ["with-alloc"] } +miniz_oxide = { version = "0.6", default-features = false, features = ["with-alloc"] } mio-c38e5c1d305a1b54 = { package = "mio", version = "0.8", features = ["net", "os-ext", "os-poll"] } mockall = { version = "0.11", default-features = false } more-asserts = { version = "0.3", default-features = false } @@ -379,7 +378,7 @@ num-traits-6f8ce4dd05d13bba = { package = "num-traits", version = "0.2", feature num_cpus = { version = "1", default-features = false } num_enum = { version = "0.5", features = ["std"] } number_prefix = { version = "0.4", features = ["std"] } -object = { version = "0.29", default-features = false, features = ["archive", "coff", "elf", "macho", "pe", "read_core", "unaligned"] } +object = { version = "0.30", default-features = false, features = ["archive", "coff", "elf", "macho", "pe", "read_core", "unaligned"] } oid-registry = { version = "0.6", features = ["crypto", "kdf", "nist_algs", "pkcs1", "pkcs12", "pkcs7", "pkcs9", "registry", "x509", "x962"] } once_cell = { version = "1", features = ["alloc", "race", "std"] } oorandom = { version = "11", default-features = false } @@ -648,7 +647,7 @@ zstd-sys = { version = "2", features = ["legacy", "zdict_builder"] } [build-dependencies] Inflector = { version = "0.11", default-features = false } -addr2line = { version = "0.17", default-features = false } +addr2line = { version = "0.19", default-features = false } adler = { version = "1", default-features = false } aead = { version = "0.5", default-features = false, features = ["alloc", "getrandom", "rand_core"] } aes = { version = "0.8", default-features = false } @@ -858,9 +857,9 @@ event-listener = { version = "2", default-features = false } eyre = { version = "0.6", features = ["auto-install", "track-caller"] } fail-9fbad63c4bcf4a8f = { package = "fail", version = "0.4", default-features = false } fail-d8f496e17d97b5cb = { package = "fail", version = "0.5", default-features = false } -fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "2dcf24facddfd15e83325ab714e3b6cb9cd63afe", features = ["copy_key", "secure"] } -fastcrypto-derive = { git = "https://github.com/MystenLabs/fastcrypto", rev = "2dcf24facddfd15e83325ab714e3b6cb9cd63afe", default-features = false } -fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "2dcf24facddfd15e83325ab714e3b6cb9cd63afe", default-features = false } +fastcrypto = { git = "https://github.com/MystenLabs/fastcrypto", rev = "8d07cc5a60856163829911e5aeedede35e90174a", features = ["copy_key", "secure"] } +fastcrypto-derive = { git = "https://github.com/MystenLabs/fastcrypto", rev = "8d07cc5a60856163829911e5aeedede35e90174a", default-features = false } +fastcrypto-zkp = { git = "https://github.com/MystenLabs/fastcrypto", rev = "8d07cc5a60856163829911e5aeedede35e90174a", default-features = false } fastrand = { version = "1", default-features = false } fd-lock = { version = "3", default-features = false } fdlimit = { version = "0.2", default-features = false } @@ -895,7 +894,7 @@ gethostname = { version = "0.2", default-features = false } getrandom-c65f7effa3be6d31 = { package = "getrandom", version = "0.1", default-features = false, features = ["std"] } getrandom-6f8ce4dd05d13bba = { package = "getrandom", version = "0.2", default-features = false, features = ["std"] } ghash = { version = "0.5", default-features = false } -gimli = { version = "0.26", default-features = false, features = ["read", "read-core"] } +gimli = { version = "0.27", default-features = false, features = ["read", "read-core"] } glob = { version = "0.3", default-features = false } globset = { version = "0.4", features = ["log"] } globwalk = { version = "0.8", default-features = false } @@ -992,8 +991,7 @@ merlin = { version = "3", features = ["std"] } mime = { version = "0.3", default-features = false } mime_guess = { version = "2", default-features = false } minimal-lexical = { version = "0.2", default-features = false, features = ["std"] } -miniz_oxide-d8f496e17d97b5cb = { package = "miniz_oxide", version = "0.5", default-features = false } -miniz_oxide-3b31131e45eafb45 = { package = "miniz_oxide", version = "0.6", default-features = false, features = ["with-alloc"] } +miniz_oxide = { version = "0.6", default-features = false, features = ["with-alloc"] } mio-c38e5c1d305a1b54 = { package = "mio", version = "0.8", features = ["net", "os-ext", "os-poll"] } mockall = { version = "0.11", default-features = false } mockall_derive = { version = "0.11", default-features = false } @@ -1060,7 +1058,7 @@ num_cpus = { version = "1", default-features = false } num_enum = { version = "0.5", features = ["std"] } num_enum_derive = { version = "0.5", default-features = false, features = ["proc-macro-crate", "std"] } number_prefix = { version = "0.4", features = ["std"] } -object = { version = "0.29", default-features = false, features = ["archive", "coff", "elf", "macho", "pe", "read_core", "unaligned"] } +object = { version = "0.30", default-features = false, features = ["archive", "coff", "elf", "macho", "pe", "read_core", "unaligned"] } oid-registry = { version = "0.6", features = ["crypto", "kdf", "nist_algs", "pkcs1", "pkcs12", "pkcs7", "pkcs9", "registry", "x509", "x962"] } once_cell = { version = "1", features = ["alloc", "race", "std"] } oorandom = { version = "11", default-features = false }