From 4956972bcd096c980098e3a1cdb9e88daadb9cfd Mon Sep 17 00:00:00 2001 From: Jimmy Chen Date: Fri, 1 Nov 2024 12:00:13 +1100 Subject: [PATCH] Stub `network` crate (#43) Co-authored-by: Age Manning --- Cargo.lock | 1091 ++++++++++++----- Cargo.toml | 11 +- anchor/client/Cargo.toml | 9 +- anchor/client/src/cli.rs | 86 +- anchor/client/src/config.rs | 190 ++- anchor/client/src/lib.rs | 8 +- anchor/common/version/Cargo.toml | 11 + .../version.rs => common/version/src/lib.rs} | 0 anchor/network/Cargo.toml | 20 + anchor/network/src/behaviour.rs | 12 + anchor/network/src/config.rs | 101 ++ anchor/network/src/keypair_utils.rs | 51 + anchor/network/src/lib.rs | 12 + anchor/network/src/network.rs | 173 +++ anchor/network/src/transport.rs | 41 + anchor/network/src/types.rs | 1 + anchor/network/src/types/gossip_kind.rs | 3 + anchor/src/environment.rs | 6 +- 18 files changed, 1519 insertions(+), 307 deletions(-) create mode 100644 anchor/common/version/Cargo.toml rename anchor/{client/src/version.rs => common/version/src/lib.rs} (100%) create mode 100644 anchor/network/Cargo.toml create mode 100644 anchor/network/src/behaviour.rs create mode 100644 anchor/network/src/config.rs create mode 100644 anchor/network/src/keypair_utils.rs create mode 100644 anchor/network/src/lib.rs create mode 100644 anchor/network/src/network.rs create mode 100644 anchor/network/src/transport.rs create mode 100644 anchor/network/src/types.rs create mode 100644 anchor/network/src/types/gossip_kind.rs diff --git a/Cargo.lock b/Cargo.lock index b1d2c75..7b41410 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7,7 +7,7 @@ name = "account_utils" version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ - "directory", + "directory 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "eth2_keystore", "eth2_wallet", "filesystem", @@ -17,16 +17,16 @@ dependencies = [ "serde", "serde_yaml", "slog", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "validator_dir", "zeroize", ] [[package]] name = "addr2line" -version = "0.24.2" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" dependencies = [ "gimli", ] @@ -169,9 +169,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.10" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8edae627382349b56cd6a7a2106f4fd69b243a9233e560c55c2e03cabb7e1d3c" +checksum = "260d3ff3bff0bb84599f032a2f2c6828180b0ea0cd41fdaf44f39cef3ba41861" dependencies = [ "alloy-rlp", "arbitrary", @@ -180,9 +180,8 @@ dependencies = [ "const-hex", "derive_arbitrary", "derive_more 1.0.0", - "foldhash", "getrandom", - "hashbrown 0.15.0", + "hashbrown 0.14.5", "hex-literal", "indexmap", "itoa", @@ -201,9 +200,9 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.9" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0822426598f95e45dd1ea32a738dac057529a709ee645fcc516ffa4cbde08f" +checksum = "26154390b1d205a4a7ac7352aa2eb4f81f391399d4e2f546fb81a2f8bb383f62" dependencies = [ "alloy-rlp-derive", "arrayvec", @@ -212,13 +211,13 @@ dependencies = [ [[package]] name = "alloy-rlp-derive" -version = "0.3.9" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f" +checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -231,9 +230,9 @@ dependencies = [ "dirs 5.0.1", "futures", "regex", - "sensitive_url", + "sensitive_url 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", - "task_executor 0.1.0 (git+https://github.com/sigp/lighthouse?branch=anchor)", + "task_executor 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "tokio", "tracing", "tracing-subscriber", @@ -256,9 +255,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.17" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a1e53f0f5d86382dafe1cf314783b2044280f406e7e1506368220ad11b1338" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -271,36 +270,36 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.9" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8365de52b16c035ff4fcafe0092ba9390540e3e352870ac09933bebcaa2c8c56" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.6" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.1.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.6" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2109dbce0e72be3ec00bed26e6a7479ca384ad226efdd66db8fa2e3a38c83125" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -493,7 +492,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", "synstructure", ] @@ -505,7 +504,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -538,7 +537,7 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix 0.38.38", + "rustix 0.38.37", "slab", "tracing", "windows-sys 0.59.0", @@ -563,7 +562,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -598,7 +597,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -620,7 +619,7 @@ dependencies = [ "http 1.1.0", "http-body 1.0.1", "http-body-util", - "hyper 1.5.0", + "hyper 1.4.1", "hyper-util", "itoa", "matchit", @@ -726,11 +725,11 @@ source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a68 dependencies = [ "alloy-primitives", "bitvec 1.0.1", - "bls", + "bls 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "derivative", "eth1", "eth2", - "eth2_network_config", + "eth2_network_config 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "ethereum_hashing", "ethereum_serde_utils", "ethereum_ssz", @@ -740,13 +739,13 @@ dependencies = [ "futures", "genesis", "hex", - "int_to_bytes", + "int_to_bytes 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "itertools 0.10.5", - "kzg", - "lighthouse_version", - "logging", + "kzg 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "lighthouse_version 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "logging 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "lru", - "merkle_proof", + "merkle_proof 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "oneshot_broadcast", "operation_pool", @@ -754,8 +753,8 @@ dependencies = [ "proto_array", "rand", "rayon", - "safe_arith", - "sensitive_url", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "sensitive_url 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "serde_json", "slasher", @@ -776,7 +775,7 @@ dependencies = [ "tokio-stream", "tree_hash", "tree_hash_derive", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -884,10 +883,30 @@ dependencies = [ "ethereum_hashing", "ethereum_serde_utils", "ethereum_ssz", - "fixed_bytes", + "fixed_bytes 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "hex", + "rand", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "serde", + "tree_hash", + "zeroize", +] + +[[package]] +name = "bls" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "alloy-primitives", + "arbitrary", + "blst", + "ethereum_hashing", + "ethereum_serde_utils", + "ethereum_ssz", + "fixed_bytes 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "hex", "rand", - "safe_arith", + "safe_arith 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "serde", "tree_hash", "zeroize", @@ -936,9 +955,9 @@ version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "eth2", - "lighthouse_version", + "lighthouse_version 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "reqwest", - "sensitive_url", + "sensitive_url 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", ] @@ -962,9 +981,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.8.0" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" dependencies = [ "serde", ] @@ -1007,9 +1026,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.31" +version = "1.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +checksum = "812acba72f0a070b003d3697490d2b55b837230ae7c6c6497f05cc2ddbb8d938" dependencies = [ "jobserver", "libc", @@ -1086,9 +1105,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.20" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "7be5744db7978a28d9df86a214130d106a89ce49644cbc4e3f0c22c3fba30615" dependencies = [ "clap_builder", "clap_derive", @@ -1096,9 +1115,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "a5fbc17d3ef8278f55b282b2a2e75ae6f6c7d4bb70ed3d0382375104bfafdb4b" dependencies = [ "anstream", "anstyle", @@ -1116,7 +1135,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -1133,13 +1152,30 @@ dependencies = [ "alloy-primitives", "clap", "dirs 3.0.2", - "eth2_network_config", + "eth2_network_config 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "ethereum_ssz", "hex", "serde", "serde_json", "serde_yaml", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", +] + +[[package]] +name = "clap_utils" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "alloy-primitives", + "clap", + "dirs 3.0.2", + "eth2_network_config 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "ethereum_ssz", + "hex", + "serde", + "serde_json", + "serde_yaml", + "types 0.2.1 (git+https://github.com/sigp/lighthouse?branch=unstable)", ] [[package]] @@ -1150,19 +1186,19 @@ dependencies = [ "dirs 5.0.1", "ethereum_hashing", "fdlimit", - "git-version", "http_api", "http_metrics", - "hyper 1.5.0", + "hyper 1.4.1", + "network", "parking_lot 0.12.3", - "regex", - "sensitive_url", + "sensitive_url 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "strum", - "target_info", - "task_executor 0.1.0 (git+https://github.com/sigp/lighthouse?branch=anchor)", + "task_executor 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "tokio", "tracing", + "unused_port 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "version", ] [[package]] @@ -1176,9 +1212,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.3" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "compare_fields" @@ -1188,6 +1224,14 @@ dependencies = [ "itertools 0.10.5", ] +[[package]] +name = "compare_fields" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "itertools 0.10.5", +] + [[package]] name = "compare_fields_derive" version = "0.2.0" @@ -1197,6 +1241,15 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "compare_fields_derive" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "concurrent-queue" version = "2.5.0" @@ -1482,7 +1535,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -1530,7 +1583,7 @@ dependencies = [ "proc-macro2", "quote", "strsim 0.11.1", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -1552,7 +1605,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core 0.20.10", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -1623,6 +1676,17 @@ dependencies = [ "tokio-util", ] +[[package]] +name = "delay_map" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df941644b671f05f59433e481ba0d31ac10e3667de725236a4c0d587c496fba1" +dependencies = [ + "futures", + "tokio", + "tokio-util", +] + [[package]] name = "deposit_contract" version = "0.2.0" @@ -1635,7 +1699,7 @@ dependencies = [ "serde_json", "sha2 0.9.9", "tree_hash", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -1701,7 +1765,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -1712,7 +1776,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -1733,7 +1797,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", "unicode-xid", ] @@ -1764,8 +1828,18 @@ version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "clap", - "clap_utils", - "eth2_network_config", + "clap_utils 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "eth2_network_config 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", +] + +[[package]] +name = "directory" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "clap", + "clap_utils 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "eth2_network_config 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", ] [[package]] @@ -1841,7 +1915,7 @@ dependencies = [ "alloy-rlp", "arrayvec", "ctr 0.9.2", - "delay_map", + "delay_map 0.3.0", "enr", "fnv", "futures", @@ -1859,7 +1933,38 @@ dependencies = [ "socket2 0.4.10", "tokio", "tracing", - "uint", + "uint 0.9.5", + "zeroize", +] + +[[package]] +name = "discv5" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e6b70634e26c909d1edbb3142b3eaf3b89da0e52f284f00ca7c80d9901ad9e" +dependencies = [ + "aes 0.8.4", + "aes-gcm", + "alloy-rlp", + "arrayvec", + "ctr 0.9.2", + "delay_map 0.4.0", + "enr", + "fnv", + "futures", + "hashlink 0.9.1", + "hex", + "hkdf", + "lazy_static", + "lru", + "more-asserts", + "parking_lot 0.12.3", + "rand", + "smallvec", + "socket2 0.5.7", + "tokio", + "tracing", + "uint 0.10.0", "zeroize", ] @@ -1871,7 +1976,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -2013,7 +2118,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -2023,10 +2128,10 @@ source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a68 dependencies = [ "async-channel", "ctrlc", - "eth2_config", - "eth2_network_config", + "eth2_config 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "eth2_network_config 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "futures", - "logging", + "logging 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "slog", "slog-async", @@ -2035,7 +2140,7 @@ dependencies = [ "sloggers", "task_executor 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "tokio", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -2083,11 +2188,11 @@ dependencies = [ "ethereum_ssz_derive", "execution_layer", "futures", - "logging", - "merkle_proof", + "logging 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "merkle_proof 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "parking_lot 0.12.3", - "sensitive_url", + "sensitive_url 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "slog", "state_processing", @@ -2095,7 +2200,7 @@ dependencies = [ "task_executor 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "tokio", "tree_hash", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -2113,21 +2218,21 @@ dependencies = [ "futures", "futures-util", "libsecp256k1", - "lighthouse_network", + "lighthouse_network 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "mediatype", - "pretty_reqwest_error", + "pretty_reqwest_error 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "procfs", "proto_array", "psutil", "reqwest", "ring 0.16.20", - "sensitive_url", + "sensitive_url 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "serde_json", "slashing_protection", "ssz_types", "store", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -2136,7 +2241,16 @@ version = "0.2.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "paste", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", +] + +[[package]] +name = "eth2_config" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "paste", + "types 0.2.1 (git+https://github.com/sigp/lighthouse?branch=unstable)", ] [[package]] @@ -2144,7 +2258,20 @@ name = "eth2_interop_keypairs" version = "0.2.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ - "bls", + "bls 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "ethereum_hashing", + "hex", + "num-bigint", + "serde", + "serde_yaml", +] + +[[package]] +name = "eth2_interop_keypairs" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "bls 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "ethereum_hashing", "hex", "num-bigint", @@ -2157,7 +2284,7 @@ name = "eth2_key_derivation" version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ - "bls", + "bls 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "num-bigint-dig", "ring 0.16.20", "sha2 0.9.9", @@ -2170,7 +2297,7 @@ version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "aes 0.7.5", - "bls", + "bls 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "eth2_key_derivation", "hex", "hmac 0.11.0", @@ -2192,17 +2319,38 @@ version = "0.2.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "bytes", - "discv5", - "eth2_config", - "kzg", - "logging", - "pretty_reqwest_error", + "discv5 0.7.0", + "eth2_config 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "kzg 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "logging 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "pretty_reqwest_error 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "reqwest", - "sensitive_url", + "sensitive_url 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde_yaml", "sha2 0.9.9", "slog", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "url", + "zip", +] + +[[package]] +name = "eth2_network_config" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "bytes", + "discv5 0.7.0", + "eth2_config 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "kzg 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "logging 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "pretty_reqwest_error 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "reqwest", + "sensitive_url 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "serde_yaml", + "sha2 0.9.9", + "slog", + "types 0.2.1 (git+https://github.com/sigp/lighthouse?branch=unstable)", "url", "zip", ] @@ -2234,7 +2382,7 @@ dependencies = [ "serde_json", "sha3 0.9.1", "thiserror", - "uint", + "uint 0.9.5", ] [[package]] @@ -2251,7 +2399,7 @@ dependencies = [ "serde_json", "sha3 0.10.8", "thiserror", - "uint", + "uint 0.9.5", ] [[package]] @@ -2293,7 +2441,7 @@ dependencies = [ "impl-rlp", "impl-serde 0.3.2", "primitive-types 0.10.1", - "uint", + "uint 0.9.5", ] [[package]] @@ -2309,7 +2457,7 @@ dependencies = [ "impl-serde 0.4.0", "primitive-types 0.12.2", "scale-info", - "uint", + "uint 0.9.5", ] [[package]] @@ -2356,7 +2504,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -2424,27 +2572,27 @@ dependencies = [ "builder_client", "bytes", "eth2", - "eth2_network_config", + "eth2_network_config 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "ethereum_serde_utils", "ethereum_ssz", "ethers-core", - "fixed_bytes", + "fixed_bytes 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "fork_choice", "hash-db", "hash256-std-hasher", "hex", "jsonwebtoken", "keccak-hash", - "kzg", - "lighthouse_version", - "logging", + "kzg 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "lighthouse_version 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "logging 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "lru", "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "parking_lot 0.12.3", - "pretty_reqwest_error", + "pretty_reqwest_error 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "rand", "reqwest", - "sensitive_url", + "sensitive_url 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "serde_json", "sha2 0.9.9", @@ -2461,7 +2609,7 @@ dependencies = [ "tree_hash", "tree_hash_derive", "triehash", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "warp", "zeroize", ] @@ -2587,7 +2735,16 @@ version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "alloy-primitives", - "safe_arith", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", +] + +[[package]] +name = "fixed_bytes" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "alloy-primitives", + "safe_arith 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", ] [[package]] @@ -2639,7 +2796,7 @@ dependencies = [ "proto_array", "slog", "state_processing", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -2675,9 +2832,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -2700,9 +2857,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -2710,15 +2867,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -2728,15 +2885,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" -version = "2.4.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f1fa2f9765705486b33fd2acf1577f8ec449c2ba1f318ae5447697b7c08d210" +checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" dependencies = [ "futures-core", "pin-project-lite", @@ -2744,13 +2901,13 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -2760,21 +2917,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f2f12607f92c69b12ed746fabf9ca4f5c482cba46679c1a75b874ed7c26adb" dependencies = [ "futures-io", - "rustls 0.23.16", + "rustls 0.23.15", "rustls-pki-types", ] [[package]] name = "futures-sink" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-ticker" @@ -2795,9 +2952,9 @@ checksum = "f288b0a4f20f9a56b5d1da57e2227c661b7b16168e2f72365f57b63326e29b24" [[package]] name = "futures-util" -version = "0.3.31" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -2832,14 +2989,14 @@ dependencies = [ "ethereum_hashing", "ethereum_ssz", "futures", - "int_to_bytes", - "merkle_proof", + "int_to_bytes 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "merkle_proof 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "rayon", "slog", "state_processing", "tokio", "tree_hash", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -2867,9 +3024,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.31.1" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" [[package]] name = "git-version" @@ -2888,7 +3045,7 @@ checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -2927,6 +3084,36 @@ dependencies = [ "web-time", ] +[[package]] +name = "gossipsub" +version = "0.5.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "async-channel", + "asynchronous-codec", + "base64 0.21.7", + "byteorder", + "bytes", + "either", + "fnv", + "futures", + "futures-ticker", + "futures-timer", + "getrandom", + "hashlink 0.9.1", + "hex_fmt", + "libp2p", + "prometheus-client", + "quick-protobuf", + "quick-protobuf-codec", + "rand", + "regex", + "sha2 0.10.8", + "tracing", + "void", + "web-time", +] + [[package]] name = "group" version = "0.12.1" @@ -2993,6 +3180,7 @@ checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", + "serde", ] [[package]] @@ -3004,7 +3192,6 @@ dependencies = [ "allocator-api2", "equivalent", "foldhash", - "serde", ] [[package]] @@ -3263,7 +3450,7 @@ dependencies = [ "axum", "serde", "slot_clock", - "task_executor 0.1.0 (git+https://github.com/sigp/lighthouse?branch=anchor)", + "task_executor 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "tokio", "tracing", ] @@ -3321,9 +3508,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.5.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", @@ -3367,15 +3554,15 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.10" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df2dcfbe0677734ab2f3ffa7fa7bfd4706bfdc1ef393f2ee30184aed67e631b4" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-util", "http 1.1.0", "http-body 1.0.1", - "hyper 1.5.0", + "hyper 1.4.1", "pin-project-lite", "tokio", "tower-service", @@ -3392,7 +3579,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows-core 0.52.0", + "windows-core", ] [[package]] @@ -3572,6 +3759,14 @@ dependencies = [ "bytes", ] +[[package]] +name = "int_to_bytes" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "bytes", +] + [[package]] name = "integer-sqrt" version = "0.1.5" @@ -3759,6 +3954,25 @@ dependencies = [ "tree_hash", ] +[[package]] +name = "kzg" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "arbitrary", + "c-kzg", + "derivative", + "ethereum_hashing", + "ethereum_serde_utils", + "ethereum_ssz", + "ethereum_ssz_derive", + "hex", + "rust_eth_kzg", + "serde", + "serde_json", + "tree_hash", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -3793,9 +4007,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.161" +version = "0.2.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" +checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" [[package]] name = "libflate" @@ -3823,9 +4037,9 @@ dependencies = [ [[package]] name = "libm" -version = "0.2.11" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libp2p" @@ -3842,11 +4056,13 @@ dependencies = [ "libp2p-connection-limits", "libp2p-core", "libp2p-dns", + "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", "libp2p-mdns", "libp2p-metrics", "libp2p-noise", + "libp2p-ping", "libp2p-plaintext", "libp2p-quic", "libp2p-swarm", @@ -3927,6 +4143,37 @@ dependencies = [ "tracing", ] +[[package]] +name = "libp2p-gossipsub" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4e830fdf24ac8c444c12415903174d506e1e077fbe3875c404a78c5935a8543" +dependencies = [ + "asynchronous-codec", + "base64 0.22.1", + "byteorder", + "bytes", + "either", + "fnv", + "futures", + "futures-ticker", + "getrandom", + "hex_fmt", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "prometheus-client", + "quick-protobuf", + "quick-protobuf-codec", + "rand", + "regex", + "sha2 0.10.8", + "smallvec", + "tracing", + "void", + "web-time", +] + [[package]] name = "libp2p-identify" version = "0.45.0" @@ -4002,8 +4249,10 @@ checksum = "77ebafa94a717c8442d8db8d3ae5d1c6a15e30f2d347e0cd31d057ca72e42566" dependencies = [ "futures", "libp2p-core", + "libp2p-gossipsub", "libp2p-identify", "libp2p-identity", + "libp2p-ping", "libp2p-swarm", "pin-project", "prometheus-client", @@ -4055,6 +4304,24 @@ dependencies = [ "zeroize", ] +[[package]] +name = "libp2p-ping" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "005a34420359223b974ee344457095f027e51346e992d1e0dcd35173f4cdd422" +dependencies = [ + "either", + "futures", + "futures-timer", + "libp2p-core", + "libp2p-identity", + "libp2p-swarm", + "rand", + "tracing", + "void", + "web-time", +] + [[package]] name = "libp2p-plaintext" version = "0.42.0" @@ -4088,7 +4355,7 @@ dependencies = [ "quinn", "rand", "ring 0.17.8", - "rustls 0.23.16", + "rustls 0.23.15", "socket2 0.5.7", "thiserror", "tokio", @@ -4128,7 +4395,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -4160,7 +4427,7 @@ dependencies = [ "libp2p-identity", "rcgen", "ring 0.17.8", - "rustls 0.23.16", + "rustls 0.23.15", "rustls-webpki 0.101.7", "thiserror", "x509-parser", @@ -4286,24 +4553,24 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "bytes", - "delay_map", - "directory", + "delay_map 0.3.0", + "directory 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "dirs 3.0.2", - "discv5", + "discv5 0.7.0", "either", "error-chain", "ethereum_ssz", "ethereum_ssz_derive", "fnv", "futures", - "gossipsub", + "gossipsub 0.5.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "hex", "itertools 0.10.5", "libp2p", "libp2p-mplex", - "lighthouse_version", + "lighthouse_version 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "lru", - "lru_cache", + "lru_cache 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "parking_lot 0.12.3", "prometheus-client", @@ -4322,9 +4589,59 @@ dependencies = [ "tokio", "tokio-io-timeout", "tokio-util", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "unsigned-varint 0.8.0", + "unused_port 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "void", +] + +[[package]] +name = "lighthouse_network" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "bytes", + "delay_map 0.3.0", + "directory 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "dirs 3.0.2", + "discv5 0.7.0", + "either", + "error-chain", + "ethereum_ssz", + "ethereum_ssz_derive", + "fnv", + "futures", + "gossipsub 0.5.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "hex", + "itertools 0.10.5", + "libp2p", + "libp2p-mplex", + "lighthouse_version 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "lru", + "lru_cache 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "metrics 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "parking_lot 0.12.3", + "prometheus-client", + "rand", + "regex", + "serde", + "sha2 0.9.9", + "slog", + "smallvec", + "snap", + "ssz_types", + "strum", + "superstruct", + "task_executor 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "tiny-keccak", + "tokio", + "tokio-io-timeout", + "tokio-util", + "types 0.2.1 (git+https://github.com/sigp/lighthouse?branch=unstable)", "unsigned-varint 0.8.0", - "unused_port", + "unused_port 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "void", ] @@ -4337,6 +4654,15 @@ dependencies = [ "target_info", ] +[[package]] +name = "lighthouse_version" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "git-version", + "target_info", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -4401,6 +4727,28 @@ dependencies = [ "tracing-subscriber", ] +[[package]] +name = "logging" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "chrono", + "metrics 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "parking_lot 0.12.3", + "serde", + "serde_json", + "slog", + "slog-term", + "sloggers", + "take_mut", + "tokio", + "tracing", + "tracing-appender", + "tracing-core", + "tracing-log", + "tracing-subscriber", +] + [[package]] name = "lru" version = "0.12.5" @@ -4427,6 +4775,14 @@ dependencies = [ "fnv", ] +[[package]] +name = "lru_cache" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "fnv", +] + [[package]] name = "mach2" version = "0.4.2" @@ -4491,8 +4847,19 @@ source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a68 dependencies = [ "alloy-primitives", "ethereum_hashing", - "fixed_bytes", - "safe_arith", + "fixed_bytes 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", +] + +[[package]] +name = "merkle_proof" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "fixed_bytes 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "safe_arith 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", ] [[package]] @@ -4521,7 +4888,7 @@ dependencies = [ [[package]] name = "metrics" version = "0.2.0" -source = "git+https://github.com/sigp/lighthouse?branch=anchor#73743a53d1255f342a928092f801013662d2a5bf" +source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "prometheus", ] @@ -4529,7 +4896,7 @@ dependencies = [ [[package]] name = "metrics" version = "0.2.0" -source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" dependencies = [ "prometheus", ] @@ -4638,12 +5005,12 @@ dependencies = [ [[package]] name = "multihash" -version = "0.19.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc41f430805af9d1cf4adae4ed2149c759b877b01d909a1f40256188d09345d2" +checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492" dependencies = [ "core2", - "unsigned-varint 0.8.0", + "unsigned-varint 0.7.2", ] [[package]] @@ -4743,6 +5110,23 @@ dependencies = [ "tokio", ] +[[package]] +name = "network" +version = "0.1.0" +dependencies = [ + "async-channel", + "dirs 5.0.1", + "discv5 0.8.0", + "futures", + "libp2p", + "lighthouse_network 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "serde", + "task_executor 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "tokio", + "tracing", + "version", +] + [[package]] name = "nix" version = "0.24.3" @@ -4868,9 +5252,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.5" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -4886,9 +5270,12 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.2" +version = "1.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" +checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1" +dependencies = [ + "portable-atomic", +] [[package]] name = "oneshot_broadcast" @@ -4952,7 +5339,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -5000,7 +5387,7 @@ dependencies = [ "serde", "state_processing", "store", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -5207,9 +5594,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.14" +version = "2.7.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +checksum = "fdbef9d1d47087a895abd220ed25eb4ad973a5e26f6a4367b038c25e28dfc2d9" dependencies = [ "memchr", "thiserror", @@ -5218,29 +5605,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.7" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be57f64e946e500c8ee36ef6331845d40a93055567ec57e8fae13efd33759b95" +checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.7" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c0f5fad0874fc7abcd4d750e76917eaebbecaa2c20bde22e1dbeeba8beb758c" +checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] name = "pin-project-lite" -version = "0.2.15" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" +checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" [[package]] name = "pin-utils" @@ -5290,7 +5677,7 @@ dependencies = [ "concurrent-queue", "hermit-abi 0.4.0", "pin-project-lite", - "rustix 0.38.38", + "rustix 0.38.37", "tracing", "windows-sys 0.59.0", ] @@ -5318,6 +5705,12 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "portable-atomic" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2" + [[package]] name = "powerfmt" version = "0.2.0" @@ -5339,7 +5732,16 @@ version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "reqwest", - "sensitive_url", + "sensitive_url 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", +] + +[[package]] +name = "pretty_reqwest_error" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "reqwest", + "sensitive_url 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", ] [[package]] @@ -5361,7 +5763,7 @@ dependencies = [ "impl-codec 0.5.1", "impl-rlp", "impl-serde 0.3.2", - "uint", + "uint 0.9.5", ] [[package]] @@ -5375,7 +5777,7 @@ dependencies = [ "impl-rlp", "impl-serde 0.4.0", "scale-info", - "uint", + "uint 0.9.5", ] [[package]] @@ -5399,9 +5801,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -5456,7 +5858,7 @@ checksum = "440f724eba9f6996b75d63681b0a92b06947f1457076d503a4d2e2c8f56442b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -5487,7 +5889,7 @@ checksum = "6ff7ff745a347b87471d859a377a9a404361e7efc2a971d73424a6d183c0fc77" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -5497,11 +5899,11 @@ source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a68 dependencies = [ "ethereum_ssz", "ethereum_ssz_derive", - "safe_arith", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "serde_yaml", "superstruct", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -5580,7 +5982,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustls 0.23.15", "socket2 0.5.7", "thiserror", "tokio", @@ -5597,7 +5999,7 @@ dependencies = [ "rand", "ring 0.17.8", "rustc-hash 2.0.0", - "rustls 0.23.16", + "rustls 0.23.15", "slab", "thiserror", "tinyvec", @@ -5606,11 +6008,10 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.6" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e346e016eacfff12233c243718197ca12f148c84e1e84268a896699b41c71780" +checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" dependencies = [ - "cfg_aliases", "libc", "once_cell", "socket2 0.5.7", @@ -6099,9 +6500,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.38" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa260229e6538e52293eeb577aabd09945a09d6d9cc0fc550ed7529056c2e32a" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", @@ -6138,9 +6539,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.16" +version = "0.23.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee87ff5d9b36712a58574e12e9f0ea80f915a5b0ac518d322b24a465617925e" +checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" dependencies = [ "once_cell", "ring 0.17.8", @@ -6197,9 +6598,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.18" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "rusty-fork" @@ -6235,6 +6636,11 @@ name = "safe_arith" version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" +[[package]] +name = "safe_arith" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" + [[package]] name = "salsa20" version = "0.8.1" @@ -6265,7 +6671,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -6404,11 +6810,20 @@ dependencies = [ "url", ] +[[package]] +name = "sensitive_url" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "serde", + "url", +] + [[package]] name = "serde" -version = "1.0.214" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] @@ -6425,20 +6840,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.214" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] name = "serde_json" -version = "1.0.132" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -6464,7 +6879,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -6640,14 +7055,14 @@ dependencies = [ "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "parking_lot 0.12.3", "rand", - "safe_arith", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "slog", "ssz_types", "strum", "tree_hash", "tree_hash_derive", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -6664,7 +7079,7 @@ dependencies = [ "serde", "serde_json", "tempfile", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -6776,7 +7191,7 @@ source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a68 dependencies = [ "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "parking_lot 0.12.3", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -6893,24 +7308,24 @@ version = "0.2.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "arbitrary", - "bls", + "bls 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "derivative", "ethereum_hashing", "ethereum_ssz", "ethereum_ssz_derive", - "int_to_bytes", + "int_to_bytes 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "integer-sqrt", "itertools 0.10.5", - "merkle_proof", + "merkle_proof 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "rand", "rayon", - "safe_arith", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "smallvec", "ssz_types", - "test_random_derive", + "test_random_derive 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "tree_hash", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -6925,7 +7340,7 @@ version = "0.2.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "db-key", - "directory", + "directory 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "ethereum_ssz", "ethereum_ssz_derive", "itertools 0.10.5", @@ -6933,13 +7348,13 @@ dependencies = [ "lru", "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "parking_lot 0.12.3", - "safe_arith", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "slog", "sloggers", "state_processing", "strum", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -7003,7 +7418,17 @@ source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a68 dependencies = [ "alloy-primitives", "ethereum_hashing", - "fixed_bytes", + "fixed_bytes 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", +] + +[[package]] +name = "swap_or_not_shuffle" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "alloy-primitives", + "ethereum_hashing", + "fixed_bytes 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", ] [[package]] @@ -7019,9 +7444,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.85" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", @@ -7048,7 +7473,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -7093,27 +7518,30 @@ checksum = "c63f48baada5c52e65a29eef93ab4f8982681b67f9e8d29c7b05abcfec2b9ffe" [[package]] name = "task_executor" version = "0.1.0" -source = "git+https://github.com/sigp/lighthouse?branch=anchor#73743a53d1255f342a928092f801013662d2a5bf" +source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ "async-channel", "futures", - "metrics 0.2.0 (git+https://github.com/sigp/lighthouse?branch=anchor)", + "logging 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "slog", + "sloggers", "tokio", - "tracing", ] [[package]] name = "task_executor" version = "0.1.0" -source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" dependencies = [ "async-channel", "futures", - "logging", - "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "logging 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "metrics 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "slog", "sloggers", "tokio", + "tracing", ] [[package]] @@ -7125,7 +7553,7 @@ dependencies = [ "cfg-if", "fastrand", "once_cell", - "rustix 0.38.38", + "rustix 0.38.37", "windows-sys 0.59.0", ] @@ -7146,7 +7574,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f599bd7ca042cfdf8f4512b277c02ba102247820f9d9d4a9f521f496751a6ef" dependencies = [ - "rustix 0.38.38", + "rustix 0.38.37", "windows-sys 0.59.0", ] @@ -7159,24 +7587,33 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "test_random_derive" +version = "0.2.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "quote", + "syn 1.0.109", +] + [[package]] name = "thiserror" -version = "1.0.65" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.65" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -7274,9 +7711,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", @@ -7307,7 +7744,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -7470,7 +7907,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -7551,7 +7988,7 @@ dependencies = [ "darling 0.20.10", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -7566,9 +8003,9 @@ dependencies = [ [[package]] name = "triomphe" -version = "0.1.14" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef8f7726da4807b58ea5c96fdc122f80702030edc33b35aff9190a51148ccc85" +checksum = "e6631e42e10b40c0690bf92f404ebcfe6e1fdb480391d15f17cc8e96eeed5369" dependencies = [ "serde", "stable_deref_trait", @@ -7594,23 +8031,23 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "arbitrary", - "bls", - "compare_fields", - "compare_fields_derive", + "bls 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "compare_fields 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "compare_fields_derive 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "derivative", - "eth2_interop_keypairs", + "eth2_interop_keypairs 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "ethereum_hashing", "ethereum_serde_utils", "ethereum_ssz", "ethereum_ssz_derive", - "fixed_bytes", + "fixed_bytes 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "hex", - "int_to_bytes", + "int_to_bytes 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "itertools 0.10.5", - "kzg", + "kzg 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "log", "maplit", - "merkle_proof", + "merkle_proof 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "metastruct", "milhouse", "parking_lot 0.12.3", @@ -7620,7 +8057,7 @@ dependencies = [ "regex", "rpds", "rusqlite", - "safe_arith", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "serde_json", "serde_yaml", @@ -7628,9 +8065,58 @@ dependencies = [ "smallvec", "ssz_types", "superstruct", - "swap_or_not_shuffle", + "swap_or_not_shuffle 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "tempfile", - "test_random_derive", + "test_random_derive 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "tree_hash", + "tree_hash_derive", +] + +[[package]] +name = "types" +version = "0.2.1" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "arbitrary", + "bls 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "compare_fields 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "compare_fields_derive 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "derivative", + "eth2_interop_keypairs 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "ethereum_hashing", + "ethereum_serde_utils", + "ethereum_ssz", + "ethereum_ssz_derive", + "fixed_bytes 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "hex", + "int_to_bytes 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "itertools 0.10.5", + "kzg 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "log", + "maplit", + "merkle_proof 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "metastruct", + "milhouse", + "parking_lot 0.12.3", + "rand", + "rand_xorshift", + "rayon", + "regex", + "rpds", + "rusqlite", + "safe_arith 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "serde", + "serde_json", + "serde_yaml", + "slog", + "smallvec", + "ssz_types", + "superstruct", + "swap_or_not_shuffle 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", + "tempfile", + "test_random_derive 0.2.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "tree_hash", "tree_hash_derive", ] @@ -7653,6 +8139,18 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "uint" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "909988d098b2f738727b161a106cfc7cab00c539c2687a8836f8e565976fb53e" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "unarray" version = "0.1.4" @@ -7673,9 +8171,9 @@ checksum = "7e51b68083f157f853b6379db119d1c1be0e6e4dec98101079dec41f6f5cf6df" [[package]] name = "unicode-bidi" -version = "0.3.17" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -7754,7 +8252,16 @@ name = "unused_port" version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ - "lru_cache", + "lru_cache 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", + "parking_lot 0.12.3", +] + +[[package]] +name = "unused_port" +version = "0.1.0" +source = "git+https://github.com/sigp/lighthouse?branch=unstable#e31ac508d404700c35d99936028a5fd74749c335" +dependencies = [ + "lru_cache 0.1.0 (git+https://github.com/sigp/lighthouse?branch=unstable)", "parking_lot 0.12.3", ] @@ -7790,17 +8297,17 @@ name = "validator_dir" version = "0.1.0" source = "git+https://github.com/agemanning/lighthouse?branch=modularize-vc#3a6800fa8b220125b3b420d679aad59a82980e07" dependencies = [ - "bls", + "bls 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "deposit_contract", "derivative", - "directory", + "directory 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "eth2_keystore", "filesystem", "hex", "lockfile", "rand", "tree_hash", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", ] [[package]] @@ -7829,6 +8336,15 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" +[[package]] +name = "version" +version = "0.1.0" +dependencies = [ + "git-version", + "regex", + "target_info", +] + [[package]] name = "version_check" version = "0.9.5" @@ -7898,13 +8414,13 @@ dependencies = [ "eth2", "headers", "metrics 0.2.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", - "safe_arith", + "safe_arith 0.1.0 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "serde", "serde_array_query", "serde_json", "state_processing", "tokio", - "types", + "types 0.2.1 (git+https://github.com/agemanning/lighthouse?branch=modularize-vc)", "warp", ] @@ -7936,7 +8452,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", "wasm-bindgen-shared", ] @@ -7970,7 +8486,7 @@ checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -7983,9 +8499,9 @@ checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "wasm-streams" -version = "0.4.2" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15053d8d85c7eccdbefef60f06769760a563c7f0a9d6902a13d35c7800b0ad65" +checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd" dependencies = [ "futures-util", "js-sys", @@ -8060,7 +8576,7 @@ version = "0.51.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" dependencies = [ - "windows-core 0.51.1", + "windows-core", "windows-targets 0.48.5", ] @@ -8085,15 +8601,6 @@ dependencies = [ "windows-targets 0.48.5", ] -[[package]] -name = "windows-core" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" -dependencies = [ - "windows-targets 0.52.6", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -8453,7 +8960,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] @@ -8473,7 +8980,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.85", + "syn 2.0.79", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index e37da0e..bbdc34b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,6 +6,8 @@ members = [ "anchor/http_api", "anchor/http_metrics", "anchor/qbft", + "anchor/network", + "anchor/common/version" ] resolver = "2" @@ -17,18 +19,23 @@ client = { path = "anchor/client" } qbft = { path = "anchor/qbft" } http_api = { path = "anchor/http_api" } http_metrics = { path = "anchor/http_metrics" } -task_executor = { git = "https://github.com/sigp/lighthouse", branch = "anchor", default-features = false, features = [ "tracing", ] } +network = { path ="anchor/network"} +version = { path ="anchor/common/version"} +lighthouse_network = { git = "https://github.com/sigp/lighthouse", branch = "unstable"} +task_executor = { git = "https://github.com/sigp/lighthouse", branch = "unstable", default-features = false, features = [ "tracing", ] } metrics = { git = "https://github.com/agemanning/lighthouse", branch = "modularize-vc" } validator_metrics = { git = "https://github.com/agemanning/lighthouse", branch = "modularize-vc" } sensitive_url = { git = "https://github.com/agemanning/lighthouse", branch = "modularize-vc" } slot_clock = { git = "https://github.com/agemanning/lighthouse", branch = "modularize-vc" } +unused_port = { git = "https://github.com/sigp/lighthouse", branch = "unstable" } derive_more = { version = "1.0.0", features = ["full"] } async-channel = "1.9" axum = "0.7.7" clap = { version = "4.5.15", features = ["derive", "wrap_help"]} +discv5 = "0.8.0" dirs = "5.0.1" +either = "1.13.0" futures = "0.3.30" -# dirs = "3" tower-http = {version = "0.6", features = ["cors"] } hyper = "1.4" parking_lot = "0.12" diff --git a/anchor/client/Cargo.toml b/anchor/client/Cargo.toml index 2501341..d96eca8 100644 --- a/anchor/client/Cargo.toml +++ b/anchor/client/Cargo.toml @@ -11,6 +11,7 @@ path = "src/lib.rs" [dependencies] task_executor = { workspace = true } http_api = { workspace = true } +version = { workspace = true } http_metrics = { workspace = true } clap = { workspace = true } serde = { workspace = true } @@ -19,14 +20,10 @@ sensitive_url = { workspace = true } dirs = { workspace = true } hyper = { workspace = true } tracing = { workspace = true } +network = { workspace = true } +unused_port = { workspace = true } tokio = { workspace = true } parking_lot = { workspace = true } # Local dependencies fdlimit = "0.3" ethereum_hashing = "0.7.0" -git-version = "0.3.9" -target_info = "0.1.0" - -[dev-dependencies] -regex = "1.11" - diff --git a/anchor/client/src/cli.rs b/anchor/client/src/cli.rs index b7ac5bd..41081c0 100644 --- a/anchor/client/src/cli.rs +++ b/anchor/client/src/cli.rs @@ -1,14 +1,14 @@ use clap::builder::styling::*; -use clap::builder::ArgPredicate; +use clap::builder::{ArgAction, ArgPredicate}; use clap::{Parser, ValueEnum}; use serde::{Deserialize, Serialize}; use strum::Display; // use clap_utils::{get_color_style, FLAG_HEADER}; -use crate::version::VERSION; use ethereum_hashing::have_sha_extensions; use std::net::IpAddr; use std::path::PathBuf; use std::sync::LazyLock; +use version::VERSION; pub static SHORT_VERSION: LazyLock = LazyLock::new(|| VERSION.replace("Anchor/", "")); pub static LONG_VERSION: LazyLock = LazyLock::new(|| { @@ -210,6 +210,88 @@ pub struct Anchor { )] pub http_allow_origin: Option, + /* Network related arguments */ + #[clap( + long, + value_name = "ADDRESS", + help = "The address anchor will listen for UDP and TCP connections. To listen \ + over IpV4 and IpV6 set this flag twice with the different values.\n\ + Examples:\n\ + - --listen-addresses '0.0.0.0' will listen over IPv4.\n\ + - --listen-addresses '::' will listen over IPv6.\n\ + - --listen-addresses '0.0.0.0' --listen-addresses '::' will listen over both \ + IPv4 and IPv6. The order of the given addresses is not relevant. However, \ + multiple IPv4, or multiple IPv6 addresses will not be accepted.", + num_args(0..=2), + action = ArgAction::Append, + default_value = "0.0.0.0", + )] + pub listen_addresses: Vec, + + #[clap( + long, + value_name = "PORT", + help = "The TCP/UDP ports to listen on. There are two UDP ports. \ + The discovery UDP port will be set to this value and the Quic UDP port will be set to this value + 1. The discovery port can be modified by the \ + --discovery-port flag and the quic port can be modified by the --quic-port flag. If listening over both IPv4 and IPv6 the --port flag \ + will apply to the IPv4 address and --port6 to the IPv6 address.", + default_value = "9100", + action = ArgAction::Set, + )] + pub port: u16, + + #[clap( + long, + value_name = "PORT", + help = "The TCP/UDP ports to listen on over IPv6 when listening over both IPv4 and \ + IPv6. The Quic UDP port will be set to this value + 1.", + action = ArgAction::Set, + )] + pub port6: Option, + + #[clap( + long, + value_name = "PORT", + help = "The UDP port that discovery will listen on. Defaults to `port`", + action = ArgAction::Set, + )] + pub discovery_port: Option, + + #[clap( + long, + value_name = "PORT", + help = "The UDP port that discovery will listen on over IPv6 if listening over \ + both IPv4 and IPv6. Defaults to `port6`", + action = ArgAction::Set, + )] + pub discovery_port6: Option, + + #[clap( + long, + value_name = "PORT", + help = "The UDP port that quic will listen on. Defaults to `port` + 1", + action = ArgAction::Set, + )] + pub quic_port: Option, + + #[clap( + long, + value_name = "PORT", + help = "The UDP port that quic will listen on over IPv6 if listening over \ + both IPv4 and IPv6. Defaults to `port6` + 1", + action = ArgAction::Set, + )] + pub quic_port6: Option, + + #[clap( + long, + help = "Sets all listening TCP/UDP ports to 0, allowing the OS to choose some \ + arbitrary free ports.", + action = ArgAction::SetTrue, + hide = true, + )] + pub use_zero_ports: bool, + /* Prometheus metrics HTTP server related arguments */ #[clap( long, diff --git a/anchor/client/src/config.rs b/anchor/client/src/config.rs index a41eb9f..a1e0f9c 100644 --- a/anchor/client/src/config.rs +++ b/anchor/client/src/config.rs @@ -1,12 +1,14 @@ // use crate::{http_api, http_metrics}; // use clap_utils::{flags::DISABLE_MALLOC_TUNING_FLAG, parse_optional, parse_required}; +use crate::cli::Anchor; +use network::{ListenAddr, ListenAddress}; use sensitive_url::SensitiveUrl; use serde::{Deserialize, Serialize}; use std::fs; +use std::net::IpAddr; use std::path::PathBuf; - -use crate::cli::Anchor; +use tracing::warn; pub const DEFAULT_BEACON_NODE: &str = "http://localhost:5052/"; pub const DEFAULT_EXECUTION_NODE: &str = "http://localhost:8545/"; @@ -34,6 +36,8 @@ pub struct Config { pub allow_unsynced_beacon_node: bool, /// Configuration for the HTTP REST API. pub http_api: http_api::Config, + /// Configuration for the network stack. + pub network: network::Config, /// Configuration for the HTTP REST API. pub http_metrics: http_metrics::Config, /// A list of custom certificates that the validator client will additionally use when @@ -67,6 +71,7 @@ impl Default for Config { allow_unsynced_beacon_node: false, http_api: <_>::default(), http_metrics: <_>::default(), + network: <_>::default(), beacon_nodes_tls_certs: None, execution_nodes_tls_certs: None, } @@ -118,6 +123,11 @@ pub fn from_cli(cli_args: &Anchor) -> Result { .map_err(|e| format!("Unable to parse execution node URL: {:?}", e))?; } + /* + * Network related + */ + config.network.listen_addresses = parse_listening_addresses(cli_args)?; + config.beacon_nodes_tls_certs = cli_args.beacon_nodes_tls_certs.clone(); config.execution_nodes_tls_certs = cli_args.execution_nodes_tls_certs.clone(); @@ -169,6 +179,182 @@ pub fn from_cli(cli_args: &Anchor) -> Result { Ok(config) } +/// Gets the listening_addresses for lighthouse based on the cli options. +pub fn parse_listening_addresses(cli_args: &Anchor) -> Result { + // parse the possible ips + let mut maybe_ipv4 = None; + let mut maybe_ipv6 = None; + for addr in cli_args.listen_addresses.iter() { + match addr { + IpAddr::V4(v4_addr) => match &maybe_ipv4 { + Some(first_ipv4_addr) => { + return Err(format!( + "When setting the --listen-address option twice, use an IpV4 address and an Ipv6 address. \ + Got two IpV4 addresses {first_ipv4_addr} and {v4_addr}" + )); + } + None => maybe_ipv4 = Some(v4_addr), + }, + IpAddr::V6(v6_addr) => match &maybe_ipv6 { + Some(first_ipv6_addr) => { + return Err(format!( + "When setting the --listen-address option twice, use an IpV4 address and an Ipv6 address. \ + Got two IpV6 addresses {first_ipv6_addr} and {v6_addr}" + )); + } + None => maybe_ipv6 = Some(v6_addr), + }, + } + } + + // Now put everything together + let listening_addresses = match (maybe_ipv4, maybe_ipv6) { + (None, None) => { + // This should never happen unless clap is broken + return Err("No listening addresses provided".into()); + } + (None, Some(ipv6)) => { + // A single ipv6 address was provided. Set the ports + if cli_args.port6.is_some() { + warn!("When listening only over IPv6, use the --port flag. The value of --port6 will be ignored."); + } + + if cli_args.discovery_port6.is_some() { + warn!("When listening only over IPv6, use the --discovery-port flag. The value of --discovery-port6 will be ignored.") + } + + if cli_args.quic_port6.is_some() { + warn!("When listening only over IPv6, use the --quic-port flag. The value of --quic-port6 will be ignored.") + } + + // use zero ports if required. If not, use the given port. + let tcp_port = cli_args + .use_zero_ports + .then(unused_port::unused_tcp6_port) + .transpose()? + .unwrap_or(cli_args.port); + + // use zero ports if required. If not, use the specific udp port. If none given, use + // the tcp port. + let disc_port = cli_args + .use_zero_ports + .then(unused_port::unused_udp6_port) + .transpose()? + .or(cli_args.discovery_port) + .unwrap_or(tcp_port); + + let quic_port = cli_args + .use_zero_ports + .then(unused_port::unused_udp6_port) + .transpose()? + .or(cli_args.quic_port) + .unwrap_or(if tcp_port == 0 { 0 } else { tcp_port + 1 }); + + ListenAddress::V6(ListenAddr { + addr: *ipv6, + quic_port, + disc_port, + tcp_port, + }) + } + (Some(ipv4), None) => { + // A single ipv4 address was provided. Set the ports + + // use zero ports if required. If not, use the given port. + let tcp_port = cli_args + .use_zero_ports + .then(unused_port::unused_tcp4_port) + .transpose()? + .unwrap_or(cli_args.port); + // use zero ports if required. If not, use the specific discovery port. If none given, use + // the tcp port. + let disc_port = cli_args + .use_zero_ports + .then(unused_port::unused_udp4_port) + .transpose()? + .or(cli_args.discovery_port) + .unwrap_or(tcp_port); + // use zero ports if required. If not, use the specific quic port. If none given, use + // the tcp port + 1. + let quic_port = cli_args + .use_zero_ports + .then(unused_port::unused_udp4_port) + .transpose()? + .or(cli_args.quic_port) + .unwrap_or(if tcp_port == 0 { 0 } else { tcp_port + 1 }); + + ListenAddress::V4(ListenAddr { + addr: *ipv4, + disc_port, + quic_port, + tcp_port, + }) + } + (Some(ipv4), Some(ipv6)) => { + let ipv4_tcp_port = cli_args + .use_zero_ports + .then(unused_port::unused_tcp4_port) + .transpose()? + .unwrap_or(cli_args.port); + let ipv4_disc_port = cli_args + .use_zero_ports + .then(unused_port::unused_udp4_port) + .transpose()? + .or(cli_args.discovery_port) + .unwrap_or(ipv4_tcp_port); + let ipv4_quic_port = cli_args + .use_zero_ports + .then(unused_port::unused_udp4_port) + .transpose()? + .or(cli_args.quic_port) + .unwrap_or(if ipv4_tcp_port == 0 { + 0 + } else { + ipv4_tcp_port + 1 + }); + + let ipv6_tcp_port = cli_args + .use_zero_ports + .then(unused_port::unused_tcp6_port) + .transpose()? + .unwrap_or(cli_args.port); + let ipv6_disc_port = cli_args + .use_zero_ports + .then(unused_port::unused_udp6_port) + .transpose()? + .or(cli_args.discovery_port6) + .unwrap_or(ipv6_tcp_port); + let ipv6_quic_port = cli_args + .use_zero_ports + .then(unused_port::unused_udp6_port) + .transpose()? + .or(cli_args.quic_port6) + .unwrap_or(if ipv6_tcp_port == 0 { + 0 + } else { + ipv6_tcp_port + 1 + }); + + ListenAddress::DualStack( + ListenAddr { + addr: *ipv4, + disc_port: ipv4_disc_port, + quic_port: ipv4_quic_port, + tcp_port: ipv4_tcp_port, + }, + ListenAddr { + addr: *ipv6, + disc_port: ipv6_disc_port, + quic_port: ipv6_quic_port, + tcp_port: ipv6_tcp_port, + }, + ) + } + }; + + Ok(listening_addresses) +} + #[cfg(test)] mod tests { use super::*; diff --git a/anchor/client/src/lib.rs b/anchor/client/src/lib.rs index 4ffaac6..e6ad275 100644 --- a/anchor/client/src/lib.rs +++ b/anchor/client/src/lib.rs @@ -2,10 +2,10 @@ mod cli; pub mod config; -mod version; pub use cli::Anchor; use config::Config; +use network::Network; use parking_lot::RwLock; use std::net::SocketAddr; use std::sync::Arc; @@ -68,6 +68,12 @@ impl Client { error!(error, "Failed to run HTTP API"); return Err("HTTP API Failed".to_string()); } + + // Start the p2p network + let network = Network::try_new(&config.network, executor.clone()).await?; + // Spawn the network listening task + executor.spawn(network.run(), "network"); + Ok(()) } } diff --git a/anchor/common/version/Cargo.toml b/anchor/common/version/Cargo.toml new file mode 100644 index 0000000..a893e3c --- /dev/null +++ b/anchor/common/version/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "version" +version = "0.1.0" +edition = "2021" + +[dependencies] +git-version = "0.3.9" +target_info = "0.1.0" + +[dev-dependencies] +regex = "1.11" \ No newline at end of file diff --git a/anchor/client/src/version.rs b/anchor/common/version/src/lib.rs similarity index 100% rename from anchor/client/src/version.rs rename to anchor/common/version/src/lib.rs diff --git a/anchor/network/Cargo.toml b/anchor/network/Cargo.toml new file mode 100644 index 0000000..73801a6 --- /dev/null +++ b/anchor/network/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "network" +version = "0.1.0" +edition = { workspace = true } +authors = ["Sigma Prime "] + +[dependencies] +tokio = { workspace = true } +libp2p = { version = "0.54", default-features = false, features = ["identify", "yamux", "noise", "secp256k1", "tcp", "tokio", "macros", "gossipsub", "quic", "ping"] } +futures = { workspace = true } +task_executor = { workspace = true } +version = { workspace = true } +lighthouse_network = { workspace = true} +discv5 = { workspace = true } +dirs = { workspace = true } +serde = { workspace = true } +tracing = { workspace = true } + +[dev-dependencies] +async-channel = { workspace = true } \ No newline at end of file diff --git a/anchor/network/src/behaviour.rs b/anchor/network/src/behaviour.rs new file mode 100644 index 0000000..23e88fe --- /dev/null +++ b/anchor/network/src/behaviour.rs @@ -0,0 +1,12 @@ +use libp2p::swarm::NetworkBehaviour; +use libp2p::{identify, ping}; + +#[derive(NetworkBehaviour)] +pub struct AnchorBehaviour { + /// Provides IP addresses and peer information. + pub identify: identify::Behaviour, + /// Used for connection health checks. + pub ping: ping::Behaviour, + // /// The routing pub-sub mechanism for Anchor. + // pub gossipsub: gossipsub::Behaviour, +} diff --git a/anchor/network/src/config.rs b/anchor/network/src/config.rs new file mode 100644 index 0000000..921c663 --- /dev/null +++ b/anchor/network/src/config.rs @@ -0,0 +1,101 @@ +use discv5::Enr; +use libp2p::Multiaddr; +use lighthouse_network::types::GossipKind; +use lighthouse_network::{ListenAddr, ListenAddress}; +use serde::{Deserialize, Serialize}; +use std::net::{Ipv4Addr, Ipv6Addr}; +use std::num::NonZeroU16; +use std::path::PathBuf; + +/// This is a default network directory, but it will be overridden by the cli defaults. +const DEFAULT_NETWORK_DIR: &str = ".anchor/network"; + +pub const DEFAULT_IPV4_ADDRESS: Ipv4Addr = Ipv4Addr::UNSPECIFIED; +pub const DEFAULT_TCP_PORT: u16 = 9100u16; +pub const DEFAULT_DISC_PORT: u16 = 9100u16; +pub const DEFAULT_QUIC_PORT: u16 = 9101u16; + +/// Configuration for setting up the p2p network. +#[derive(Clone, Serialize, Deserialize)] +pub struct Config { + /// Data directory where node's keyfile is stored + pub network_dir: PathBuf, + + /// IP addresses to listen on. + pub listen_addresses: ListenAddress, + + /// The address to broadcast to peers about which address we are listening on. None indicates + /// that no discovery address has been set in the CLI args. + pub enr_address: (Option, Option), + + /// The udp ipv4 port to broadcast to peers in order to reach back for discovery. + pub enr_udp4_port: Option, + + /// The quic ipv4 port to broadcast to peers in order to reach back for libp2p services. + pub enr_quic4_port: Option, + + /// The tcp ipv4 port to broadcast to peers in order to reach back for libp2p services. + pub enr_tcp4_port: Option, + + /// The udp ipv6 port to broadcast to peers in order to reach back for discovery. + pub enr_udp6_port: Option, + + /// The tcp ipv6 port to broadcast to peers in order to reach back for libp2p services. + pub enr_tcp6_port: Option, + + /// The quic ipv6 port to broadcast to peers in order to reach back for libp2p services. + pub enr_quic6_port: Option, + + /// List of nodes to initially connect to. + pub boot_nodes_enr: Vec, + + /// List of nodes to initially connect to, on Multiaddr format. + pub boot_nodes_multiaddr: Vec, + + /// Disables peer scoring altogether. + pub disable_peer_scoring: bool, + + /// Disables quic support. + pub disable_quic_support: bool, + + /// List of extra topics to initially subscribe to as strings. + pub topics: Vec, + + /// Target number of connected peers. + pub target_peers: usize, +} + +impl Default for Config { + fn default() -> Self { + // WARNING: this directory default should be always overwritten with parameters + // from cli for specific networks. + let network_dir = dirs::home_dir() + .unwrap_or_else(|| PathBuf::from(".")) + .join(DEFAULT_NETWORK_DIR); + + let listen_addresses = ListenAddress::V4(ListenAddr { + addr: DEFAULT_IPV4_ADDRESS, + disc_port: DEFAULT_DISC_PORT, + quic_port: DEFAULT_QUIC_PORT, + tcp_port: DEFAULT_TCP_PORT, + }); + + Self { + network_dir, + listen_addresses, + enr_address: (None, None), + enr_udp4_port: None, + enr_quic4_port: None, + enr_tcp4_port: None, + enr_udp6_port: None, + enr_tcp6_port: None, + enr_quic6_port: None, + target_peers: 50, + boot_nodes_enr: vec![], + boot_nodes_multiaddr: vec![], + disable_peer_scoring: false, + disable_quic_support: false, + topics: vec![], + } + } +} diff --git a/anchor/network/src/keypair_utils.rs b/anchor/network/src/keypair_utils.rs new file mode 100644 index 0000000..dcb3f90 --- /dev/null +++ b/anchor/network/src/keypair_utils.rs @@ -0,0 +1,51 @@ +use libp2p::identity::{secp256k1, Keypair}; +use std::fs::File; +use std::io::{Read, Write}; +use std::path::PathBuf; +use tracing::{debug, warn}; + +pub const NETWORK_KEY_FILENAME: &str = "key"; + +/// Loads a private key from disk. If this fails, a new key is +/// generated and is then saved to disk. +/// +/// Currently only secp256k1 keys are allowed, as these are the only keys supported by discv5. +pub fn load_private_key(network_dir: &PathBuf) -> Keypair { + // check for key from disk + let network_key_f = network_dir.join(NETWORK_KEY_FILENAME); + if let Ok(mut network_key_file) = File::open(network_key_f.clone()) { + let mut key_bytes: Vec = Vec::with_capacity(36); + match network_key_file.read_to_end(&mut key_bytes) { + Err(_) => debug!("Could not read network key file"), + Ok(_) => { + // only accept secp256k1 keys for now + if let Ok(secret_key) = secp256k1::SecretKey::try_from_bytes(&mut key_bytes) { + let kp: secp256k1::Keypair = secret_key.into(); + debug!("Loaded network key from disk."); + return kp.into(); + } else { + debug!("Network key file is not a valid secp256k1 key"); + } + } + } + } + + // if a key could not be loaded from disk, generate a new one and save it + let local_private_key = secp256k1::Keypair::generate(); + let _ = std::fs::create_dir_all(network_dir); + match File::create(network_key_f.clone()) + .and_then(|mut f| f.write_all(&local_private_key.secret().to_bytes())) + { + Ok(_) => { + debug!("New network key generated and written to disk"); + } + Err(e) => { + warn!( + file = ?network_key_f, + error = ?e, + "Could not write node key to file" + ); + } + } + local_private_key.into() +} diff --git a/anchor/network/src/lib.rs b/anchor/network/src/lib.rs new file mode 100644 index 0000000..161c096 --- /dev/null +++ b/anchor/network/src/lib.rs @@ -0,0 +1,12 @@ +#![allow(dead_code)] + +mod behaviour; +mod config; +mod keypair_utils; +mod network; +mod transport; +mod types; + +pub use config::Config; +pub use lighthouse_network::{ListenAddr, ListenAddress}; +pub use network::Network; diff --git a/anchor/network/src/network.rs b/anchor/network/src/network.rs new file mode 100644 index 0000000..1b4192b --- /dev/null +++ b/anchor/network/src/network.rs @@ -0,0 +1,173 @@ +use crate::behaviour::AnchorBehaviour; +use crate::keypair_utils::load_private_key; +use crate::transport::build_transport; +use crate::Config; +use futures::StreamExt; +use libp2p::core::muxing::StreamMuxerBox; +use libp2p::core::transport::Boxed; +use libp2p::identity::Keypair; +use libp2p::multiaddr::Protocol; +use libp2p::{futures, identify, ping, PeerId, Swarm, SwarmBuilder}; +use std::num::{NonZeroU8, NonZeroUsize}; +use std::pin::Pin; +use task_executor::TaskExecutor; +use tracing::info; + +pub struct Network { + swarm: Swarm, + peer_id: PeerId, +} + +impl Network { + // Creates an instance of the Network struct to start sending and receiving information on the + // p2p network. + pub async fn try_new(config: &Config, executor: TaskExecutor) -> Result { + let local_keypair: Keypair = load_private_key(&config.network_dir); + let transport = build_transport(local_keypair.clone(), !config.disable_quic_support); + let behaviour = build_anchor_behaviour(local_keypair.clone()); + let peer_id = local_keypair.public().to_peer_id(); + + let mut network = Network { + swarm: build_swarm( + executor.clone(), + local_keypair, + transport, + behaviour, + config, + ), + peer_id, + }; + + info!(%peer_id, "Network starting"); + + for listen_multiaddr in config.listen_addresses.libp2p_addresses() { + // If QUIC is disabled, ignore listening on QUIC ports + if config.disable_quic_support && listen_multiaddr.iter().any(|v| v == Protocol::QuicV1) + { + continue; + } + + network + .swarm + .listen_on(listen_multiaddr.clone()) + .map_err(|e| { + format!( + "Unable to listen on libp2p address: {} : {}", + listen_multiaddr, e + ) + })?; + let mut log_address = listen_multiaddr; + log_address.push(Protocol::P2p(peer_id)); + info!(address = %log_address, "Listening established"); + } + /* + TODO + - Dial peers + - Subscribe gossip topics + */ + + // TODO: Return channels for input/output + Ok(network) + } + + /// Main loop for polling and handling swarm and channels. + pub async fn run(mut self) { + loop { + tokio::select! { + _swarm_message = self.swarm.select_next_some() => { + // TODO handle and match swarm messages + } + // TODO match input channels + } + } + } +} + +fn build_anchor_behaviour(local_keypair: Keypair) -> AnchorBehaviour { + // setup gossipsub + // discv5 + let identify = { + let local_public_key = local_keypair.public(); + let identify_config = identify::Config::new("anchor".into(), local_public_key) + .with_agent_version(version::version_with_platform()) + .with_cache_size(0); + identify::Behaviour::new(identify_config) + }; + + AnchorBehaviour { + identify, + ping: ping::Behaviour::default(), + // gossipsub: gossipsub::Behaviour::default(), + } +} + +fn build_swarm( + executor: TaskExecutor, + local_keypair: Keypair, + transport: Boxed<(PeerId, StreamMuxerBox)>, + behaviour: AnchorBehaviour, + _config: &Config, +) -> Swarm { + // use the executor for libp2p + struct Executor(task_executor::TaskExecutor); + impl libp2p::swarm::Executor for Executor { + fn exec(&self, f: Pin + Send>>) { + self.0.spawn(f, "libp2p"); + } + } + + // TODO: revisit once peer manager is integrated + // let connection_limits = { + // let limits = libp2p::connection_limits::ConnectionLimits::default() + // .with_max_pending_incoming(Some(5)) + // .with_max_pending_outgoing(Some(16)) + // .with_max_established_incoming(Some( + // (config.target_peers as f32 + // * (1.0 + PEER_EXCESS_FACTOR - MIN_OUTBOUND_ONLY_FACTOR)) + // .ceil() as u32, + // )) + // .with_max_established_outgoing(Some( + // (config.target_peers as f32 * (1.0 + PEER_EXCESS_FACTOR)).ceil() as u32, + // )) + // .with_max_established(Some( + // (config.target_peers as f32 * (1.0 + PEER_EXCESS_FACTOR + PRIORITY_PEER_EXCESS)) + // .ceil() as u32, + // )) + // .with_max_established_per_peer(Some(1)); + // + // libp2p::connection_limits::Behaviour::new(limits) + // }; + + let swarm_config = libp2p::swarm::Config::with_executor(Executor(executor)) + .with_notify_handler_buffer_size(NonZeroUsize::new(7).expect("Not zero")) + .with_per_connection_event_buffer_size(4) + .with_dial_concurrency_factor(NonZeroU8::new(1).unwrap()); + + // TODO Add metrics later + SwarmBuilder::with_existing_identity(local_keypair) + .with_tokio() + .with_other_transport(|_key| transport) + .expect("infalible") + .with_behaviour(|_| behaviour) + .expect("infalible") + .with_swarm_config(|_| swarm_config) + .build() +} + +#[cfg(test)] +mod test { + use crate::network::Network; + use crate::Config; + use task_executor::TaskExecutor; + + #[tokio::test] + async fn create_network() { + let handle = tokio::runtime::Handle::current(); + let (_signal, exit) = async_channel::bounded(1); + let (shutdown_tx, _) = futures::channel::mpsc::channel(1); + let task_executor = TaskExecutor::new(handle, exit, shutdown_tx); + assert!(Network::try_new(&Config::default(), task_executor) + .await + .is_ok()); + } +} diff --git a/anchor/network/src/transport.rs b/anchor/network/src/transport.rs new file mode 100644 index 0000000..3d9581b --- /dev/null +++ b/anchor/network/src/transport.rs @@ -0,0 +1,41 @@ +use futures::future::Either; +use libp2p::core::muxing::StreamMuxerBox; +use libp2p::core::transport::Boxed; +use libp2p::identity::Keypair; +use libp2p::{noise, quic, tcp, yamux, PeerId, Transport}; +use std::time::Duration; + +/// The implementation supports TCP/IP, QUIC over UDP, noise as the encryption layer, and +/// yamux as the multiplexing layer (when using TCP). +pub(crate) fn build_transport( + local_private_key: Keypair, + quic_support: bool, +) -> Boxed<(PeerId, StreamMuxerBox)> { + let yamux_config = yamux::Config::default(); + + let tcp = tcp::tokio::Transport::new(tcp::Config::default().nodelay(true)) + .upgrade(libp2p::core::upgrade::Version::V1) + .authenticate(generate_noise_config(&local_private_key)) + .multiplex(yamux_config) + .timeout(Duration::from_secs(10)); + + if quic_support { + let quic_config = quic::Config::new(&local_private_key); + let quic = quic::tokio::Transport::new(quic_config); + let transport = tcp + .or_transport(quic) + .map(|either_output, _| match either_output { + Either::Left((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)), + Either::Right((peer_id, muxer)) => (peer_id, StreamMuxerBox::new(muxer)), + }); + transport.boxed() + } else { + tcp.boxed() + } + // TODO: Enable DNS over the transport +} + +/// Generate authenticated XX Noise config from identity keys +fn generate_noise_config(identity_keypair: &Keypair) -> noise::Config { + noise::Config::new(identity_keypair).expect("signing can fail only once during starting a node") +} diff --git a/anchor/network/src/types.rs b/anchor/network/src/types.rs new file mode 100644 index 0000000..7608df2 --- /dev/null +++ b/anchor/network/src/types.rs @@ -0,0 +1 @@ +mod gossip_kind; diff --git a/anchor/network/src/types/gossip_kind.rs b/anchor/network/src/types/gossip_kind.rs new file mode 100644 index 0000000..381c833 --- /dev/null +++ b/anchor/network/src/types/gossip_kind.rs @@ -0,0 +1,3 @@ +pub enum GossipKind { + SsvTopic, +} diff --git a/anchor/src/environment.rs b/anchor/src/environment.rs index ca216c8..716b131 100644 --- a/anchor/src/environment.rs +++ b/anchor/src/environment.rs @@ -7,6 +7,7 @@ use std::sync::Arc; use task_executor::{ShutdownReason, TaskExecutor}; use tokio::runtime::{Builder as RuntimeBuilder, Runtime}; use tracing::{error, info, warn}; +use tracing_subscriber::EnvFilter; use { futures::Future, std::{pin::Pin, task::Context, task::Poll}, @@ -33,8 +34,9 @@ impl Default for Environment { /// /// If a more fine-grained executor is required, a more general function should be built. fn default() -> Self { - // Default logging for the time being - tracing_subscriber::fmt::init(); + // Default logging to `debug` for the time being + let env_filter = EnvFilter::new("debug"); + tracing_subscriber::fmt().with_env_filter(env_filter).init(); // Create a multi-threaded task executor let runtime = match RuntimeBuilder::new_multi_thread().enable_all().build() {