From 6312460a3f847e2fdbfe5fe99b20b1d010494890 Mon Sep 17 00:00:00 2001 From: eric tu Date: Tue, 12 Oct 2021 14:09:30 +0200 Subject: [PATCH 01/10] update to libp2p 0.38 --- Cargo.lock | 568 +++++++++++++++++----------- blockchain/chain_sync/Cargo.toml | 2 +- forest/Cargo.toml | 2 +- ipld/graphsync/Cargo.toml | 2 +- node/forest_libp2p/Cargo.toml | 7 +- node/forest_libp2p/src/behaviour.rs | 10 +- node/forest_libp2p/src/discovery.rs | 10 +- node/forest_libp2p/src/service.rs | 21 +- node/rpc-api/Cargo.toml | 2 +- vm/actor/Cargo.toml | 2 +- vm/actor_interface/Cargo.toml | 2 +- vm/state_migration/Cargo.toml | 2 +- 12 files changed, 374 insertions(+), 256 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 359ea7a1e178..cce358500b50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -22,7 +22,7 @@ dependencies = [ "forest_json_utils", "forest_vm", "ipld_blockstore", - "libp2p 0.35.1", + "libp2p", "serde", ] @@ -51,14 +51,12 @@ dependencies = [ ] [[package]] -name = "aes" -version = "0.5.0" +name = "aead" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd2bc6d3f370b5666245ff421e231cba4353df936e26986d2918e61a8fd6aef6" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" dependencies = [ - "aes-soft 0.5.0", - "aesni 0.8.0", - "block-cipher", + "generic-array 0.14.4", ] [[package]] @@ -67,22 +65,21 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" dependencies = [ - "aes-soft 0.6.4", - "aesni 0.10.0", - "cipher", + "aes-soft", + "aesni", + "cipher 0.2.5", ] [[package]] -name = "aes-gcm" -version = "0.7.0" +name = "aes" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0301c9e9c443494d970a07885e8cf3e587bae8356a1d5abd0999068413f7205f" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" dependencies = [ - "aead", - "aes 0.5.0", - "block-cipher", - "ghash", - "subtle 2.4.1", + "cfg-if 1.0.0", + "cipher 0.3.0", + "cpufeatures 0.2.1", + "opaque-debug 0.3.0", ] [[package]] @@ -91,23 +88,26 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5278b5fabbb9bd46e24aa69b2fdea62c99088e0a950a9be40e3e0101298f88da" dependencies = [ - "aead", + "aead 0.3.2", "aes 0.6.0", - "cipher", - "ctr", - "ghash", + "cipher 0.2.5", + "ctr 0.6.0", + "ghash 0.3.1", "subtle 2.4.1", ] [[package]] -name = "aes-soft" -version = "0.5.0" +name = "aes-gcm" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63dd91889c49327ad7ef3b500fd1109dbd3c509a03db0d4a9ce413b79f575cb6" +checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" dependencies = [ - "block-cipher", - "byteorder 1.4.3", - "opaque-debug 0.3.0", + "aead 0.4.3", + "aes 0.7.5", + "cipher 0.3.0", + "ctr 0.8.0", + "ghash 0.4.4", + "subtle 2.4.1", ] [[package]] @@ -116,17 +116,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" dependencies = [ - "cipher", - "opaque-debug 0.3.0", -] - -[[package]] -name = "aesni" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a6fe808308bb07d393e2ea47780043ec47683fcf19cf5efc8ca51c50cc8c68a" -dependencies = [ - "block-cipher", + "cipher 0.2.5", "opaque-debug 0.3.0", ] @@ -136,7 +126,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" dependencies = [ - "cipher", + "cipher 0.2.5", "opaque-debug 0.3.0", ] @@ -214,22 +204,9 @@ checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" [[package]] name = "asn1_der" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fce6b6a0ffdafebd82c87e79e3f40e8d2c523e5fea5566ff6b90509bf98d638" -dependencies = [ - "asn1_der_derive", -] - -[[package]] -name = "asn1_der_derive" -version = "0.1.2" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d0864d84b8e07b145449be9a8537db86bf9de5ce03b913214694643b4743502" -dependencies = [ - "quote 1.0.9", - "syn 1.0.73", -] +checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" [[package]] name = "async-attributes" @@ -462,6 +439,20 @@ dependencies = [ "wasm-bindgen-futures", ] +[[package]] +name = "async-std-resolver" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed4e2c3da14d8ad45acb1e3191db7a918e9505b6f155b218e70a7c9a1a48c638" +dependencies = [ + "async-std", + "async-trait", + "futures-io", + "futures-util", + "pin-utils", + "trust-dns-resolver", +] + [[package]] name = "async-task" version = "4.0.3" @@ -754,15 +745,6 @@ dependencies = [ "generic-array 0.14.4", ] -[[package]] -name = "block-cipher" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f337a3e6da609650eb74e02bc9fac7b735049f7623ab12f2e4c719316fcc7e80" -dependencies = [ - "generic-array 0.14.4", -] - [[package]] name = "block-modes" version = "0.7.0" @@ -770,7 +752,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" dependencies = [ "block-padding 0.2.1", - "cipher", + "cipher 0.2.5", ] [[package]] @@ -973,24 +955,26 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chacha20" -version = "0.5.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "244fbce0d47e97e8ef2f63b81d5e05882cb518c68531eb33194990d7b7e85845" +checksum = "f08493fa7707effc63254c66c6ea908675912493cd67952eda23c09fae2610b1" dependencies = [ - "stream-cipher", + "cfg-if 1.0.0", + "cipher 0.3.0", + "cpufeatures 0.2.1", "zeroize", ] [[package]] name = "chacha20poly1305" -version = "0.6.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bf18d374d66df0c05cdddd528a7db98f78c28e2519b120855c4f84c5027b1f5" +checksum = "b6547abe025f4027edacd9edaa357aded014eecec42a5070d9b885c3c334aba2" dependencies = [ - "aead", + "aead 0.4.3", "chacha20", + "cipher 0.3.0", "poly1305", - "stream-cipher", "zeroize", ] @@ -1069,7 +1053,7 @@ dependencies = [ "ipld_blockstore", "ipld_hamt 2.0.0", "lazy_static", - "libp2p 0.35.1", + "libp2p", "log", "lru", "message_pool", @@ -1121,6 +1105,15 @@ dependencies = [ "generic-array 0.14.4", ] +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array 0.14.4", +] + [[package]] name = "clang-sys" version = "1.2.0" @@ -1266,6 +1259,15 @@ dependencies = [ "libc", ] +[[package]] +name = "cpufeatures" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +dependencies = [ + "libc", +] + [[package]] name = "cpuid-bool" version = "0.1.2" @@ -1484,7 +1486,16 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" dependencies = [ - "cipher", + "cipher 0.2.5", +] + +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher 0.3.0", ] [[package]] @@ -1735,6 +1746,18 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "enum-as-inner" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" +dependencies = [ + "heck", + "proc-macro2 1.0.27", + "quote 1.0.9", + "syn 1.0.73", +] + [[package]] name = "env_logger" version = "0.7.1" @@ -2068,7 +2091,7 @@ dependencies = [ "ipld_blockstore", "jsonrpc-v2", "key_management", - "libp2p 0.35.1", + "libp2p", "log", "message_pool", "metrics", @@ -2257,7 +2280,7 @@ dependencies = [ "ipld_blockstore", "ipld_hamt 2.0.0", "lazy_static", - "libp2p 0.35.1", + "libp2p", "log", "num-derive", "num-traits", @@ -2470,7 +2493,7 @@ dependencies = [ "git-version", "ipld_blockstore", "lazy_static", - "libp2p 0.35.1", + "libp2p", "libp2p-bitswap", "log", "multihash", @@ -2799,7 +2822,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "97304e4cd182c3846f7575ced3890c53012ce534ad9114046b0a9e00bb30a375" dependencies = [ "opaque-debug 0.3.0", - "polyval", + "polyval 0.4.5", +] + +[[package]] +name = "ghash" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +dependencies = [ + "opaque-debug 0.3.0", + "polyval 0.5.3", ] [[package]] @@ -2976,6 +3009,17 @@ dependencies = [ "hmac 0.7.1", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi 0.3.9", +] + [[package]] name = "http" version = "0.2.4" @@ -3079,9 +3123,9 @@ dependencies = [ [[package]] name = "if-watch" -version = "0.1.8" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b8538953a3f0d0d3868f0a706eb4273535e10d72acb5c82c1c23ae48835c85" +checksum = "ae8ab7f67bad3240049cb24fb9cb0b4c2c6af4c245840917fbbdededeee91179" dependencies = [ "async-io", "futures", @@ -3176,6 +3220,18 @@ dependencies = [ "state_tree", ] +[[package]] +name = "ipconfig" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" +dependencies = [ + "socket2 0.3.19", + "widestring", + "winapi 0.3.9", + "winreg", +] + [[package]] name = "ipld_amt" version = "0.2.1" @@ -3520,9 +3576,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.98" +version = "0.2.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320cfe77175da3a483efed4bc0adc1968ca050b098ce4f2f1c13a56626128790" +checksum = "dd8f7255a17a627354f321ef0055d63b898c6fb27eff628af4d1b66b7331edf6" [[package]] name = "libloading" @@ -3552,29 +3608,9 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5133112ce42be9482f6a87be92a605dd6bbc9e93c297aee77d172ff06908f3a" -dependencies = [ - "atomic", - "bytes 1.0.1", - "futures", - "lazy_static", - "libp2p-core", - "libp2p-core-derive", - "libp2p-swarm", - "parity-multiaddr", - "parking_lot", - "pin-project 1.0.7", - "smallvec", - "wasm-timer", -] - -[[package]] -name = "libp2p" -version = "0.35.1" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adc225a49973cf9ab10d0cdd6a4b8f0cda299df9b760824bbb623f15f8f0c95a" +checksum = "ebbb17eece4aec5bb970880c73825c16ca59ca05a4e41803751e68c7e5f0c618" dependencies = [ "atomic", "bytes 1.0.1", @@ -3605,15 +3641,14 @@ dependencies = [ [[package]] name = "libp2p-bitswap" version = "0.6.1" -source = "git+https://github.com/ChainSafe/libp2p-bitswap?rev=1ee048077cfdfc0a3bb16b236c0c308b1c4b52fa#1ee048077cfdfc0a3bb16b236c0c308b1c4b52fa" dependencies = [ "async-std", "fnv", "futures", - "libp2p 0.34.0", + "libp2p", "log", - "prost 0.7.0", - "prost-build 0.6.1", + "prost 0.8.0", + "prost-build 0.8.0", "thiserror", "tiny-cid", "tiny-multihash", @@ -3622,9 +3657,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.27.1" +version = "0.28.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a2d56aadc2c2bf22cd7797f86e56a65b5b3994a0136b65be3106938acae7a26" +checksum = "554d3e7e9e65f939d66b75fd6a4c67f258fe250da61b91f46c545fc4a89b51d9" dependencies = [ "asn1_der", "bs58", @@ -3654,32 +3689,25 @@ dependencies = [ "zeroize", ] -[[package]] -name = "libp2p-core-derive" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4bc40943156e42138d22ed3c57ff0e1a147237742715937622a99b10fbe0156" -dependencies = [ - "quote 1.0.9", - "syn 1.0.73", -] - [[package]] name = "libp2p-dns" -version = "0.27.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5153b6db68fd4baa3b304e377db744dd8fea8ff4e4504509ee636abcde88d3e3" +checksum = "62e63dab8b5ff35e0c101a3e51e843ba782c07bbb1682f5fd827622e0d02b98b" dependencies = [ + "async-std-resolver", "futures", "libp2p-core", "log", + "smallvec", + "trust-dns-resolver", ] [[package]] name = "libp2p-gossipsub" -version = "0.28.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "502dc5fcbfec4aa1c63ef3f7307ffe20e90c1a1387bf23ed0bec087f2dde58a1" +checksum = "e562308761818b0c52f2a81a0544b9c22d0cf56d7b2d928a0ff61382404498ce" dependencies = [ "asynchronous-codec", "base64 0.13.0", @@ -3703,9 +3731,9 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.27.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b40fb36a059b7a8cce1514bd8b546fa612e006c9937caa7f5950cb20021fe91e" +checksum = "5f668f00efd9883e8b7bcc582eaf0164615792608f886f6577da18bcbeea0a46" dependencies = [ "futures", "libp2p-core", @@ -3719,9 +3747,9 @@ dependencies = [ [[package]] name = "libp2p-kad" -version = "0.28.1" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3da6c9acbcc05f93235d201d7d45ef4e8b88a45d8836f98becd8b4d443f066" +checksum = "b07312ebe5ee4fd2404447a0609814574df55c65d4e20838b957bbd34907d820" dependencies = [ "arrayvec", "asynchronous-codec", @@ -3745,9 +3773,9 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.28.1" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e9e6374814d1b118d97ccabdfc975c8910bd16dc38a8bc058eeb08bf2080fe1" +checksum = "4efa70c1c3d2d91237f8546e27aeb85e287d62c066a7b4f3ea6a696d43ced714" dependencies = [ "async-io", "data-encoding", @@ -3758,17 +3786,17 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "rand 0.7.3", + "rand 0.8.4", "smallvec", - "socket2 0.3.19", + "socket2 0.4.0", "void", ] [[package]] name = "libp2p-mplex" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "350ce8b3923594aedabd5d6e3f875d058435052a29c3f32df378bc70d10be464" +checksum = "85e9b544335d1ed30af71daa96edbefadef6f19c7a55f078b9fc92c87163105d" dependencies = [ "asynchronous-codec", "bytes 1.0.1", @@ -3784,9 +3812,9 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.29.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aca322b52a0c5136142a7c3971446fb1e9964923a526c9cc6ef3b7c94e57778" +checksum = "57a2aa6fc4e6855eaf9ea1941a14f7ec4df35636fb6b85951e17481df8dcecf6" dependencies = [ "bytes 1.0.1", "curve25519-dalek", @@ -3796,7 +3824,7 @@ dependencies = [ "log", "prost 0.7.0", "prost-build 0.7.0", - "rand 0.7.3", + "rand 0.8.4", "sha2 0.9.5", "snow", "static_assertions", @@ -3806,9 +3834,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.27.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3813276d0708c8db0f500d8beda1bda9ad955723b9cb272c41f4727256f73c" +checksum = "bf4bfaffac63bf3c7ec11ed9d8879d455966ddea7e78ee14737f0b6dce0d1cd1" dependencies = [ "futures", "libp2p-core", @@ -3821,9 +3849,9 @@ dependencies = [ [[package]] name = "libp2p-request-response" -version = "0.9.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10e5552827c33d8326502682da73a0ba4bfa40c1b55b216af3c303f32169dd89" +checksum = "1cdbe172f08e6d0f95fa8634e273d4c4268c4063de2e33e7435194b0130c62e3" dependencies = [ "async-trait", "bytes 1.0.1", @@ -3841,9 +3869,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.27.2" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7955b973e1fd2bd61ffd43ce261c1223f61f4aacd5bae362a924993f9a25fd98" +checksum = "1e04d8e1eef675029ec728ba14e8d0da7975d84b6679b699b4ae91a1de9c3a92" dependencies = [ "either", "futures", @@ -3857,9 +3885,9 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c564ebaa36a64839f51eaddb0243aaaa29ce64affb56129193cc3248b72af273" +checksum = "365b0a699fea5168676840567582a012ea297b1ca02eee467e58301b9c9c5eed" dependencies = [ "quote 1.0.9", "syn 1.0.73", @@ -3867,9 +3895,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.27.1" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88a5aef80e519a6cb8e2663605142f97baaaea1a252eecbf8756184765f7471b" +checksum = "2b1a27d21c477951799e99d5c105d78868258502ce092988040a808d5a19bbd9" dependencies = [ "async-io", "futures", @@ -3879,14 +3907,14 @@ dependencies = [ "libc", "libp2p-core", "log", - "socket2 0.3.19", + "socket2 0.4.0", ] [[package]] name = "libp2p-websocket" -version = "0.28.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3b1c6a3431045da8b925ed83384e4c5163e14b990572307fca9c507435d4d22" +checksum = "cace60995ef6f637e4752cccbb2590f6bc358e8741a0d066307636c69a4b3a74" dependencies = [ "either", "futures", @@ -3902,9 +3930,9 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.30.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4819358c542a86ff95f6ae691efb4b94ddaf477079b01a686f5705b79bfc232a" +checksum = "f35da42cfc6d5cb0dcf3ad6881bc68d146cdf38f98655e09e33fbba4d13eabc4" dependencies = [ "futures", "libp2p-core", @@ -3965,6 +3993,12 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "linked-hash-map" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3" + [[package]] name = "lock_api" version = "0.4.4" @@ -4002,6 +4036,15 @@ dependencies = [ "hashbrown 0.9.1", ] +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "mapr" version = "0.8.0" @@ -4012,6 +4055,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matches" version = "0.1.8" @@ -4140,9 +4189,9 @@ dependencies = [ [[package]] name = "minicbor" -version = "0.7.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c2b2c73f9640fccab53947e2b3474d5071fcbc8f82cac51ddf6c8041a30a9ea" +checksum = "51aa5bb0ca22415daca596a227b507f880ad1b2318a87fa9325312a5d285ca0d" dependencies = [ "minicbor-derive", ] @@ -4728,11 +4777,12 @@ dependencies = [ [[package]] name = "poly1305" -version = "0.6.2" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b7456bc1ad2d4cf82b3a016be4c2ac48daf11bf990c1603ebd447fe6f30fca8" +checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" dependencies = [ - "cpuid-bool 0.2.0", + "cpufeatures 0.2.1", + "opaque-debug 0.3.0", "universal-hash", ] @@ -4747,6 +4797,18 @@ dependencies = [ "universal-hash", ] +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures 0.2.1", + "opaque-debug 0.3.0", + "universal-hash", +] + [[package]] name = "positioned-io" version = "0.2.2" @@ -4893,68 +4955,68 @@ dependencies = [ [[package]] name = "prost" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce49aefe0a6144a45de32927c77bd2859a5f7677b55f220ae5b744e87389c212" +checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" dependencies = [ - "bytes 0.5.6", - "prost-derive 0.6.1", + "bytes 1.0.1", + "prost-derive 0.7.0", ] [[package]] name = "prost" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ "bytes 1.0.1", - "prost-derive 0.7.0", + "prost-derive 0.8.0", ] [[package]] name = "prost-build" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b10678c913ecbd69350e8535c3aef91a8676c0773fc1d7b95cdd196d7f2f26" +checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" dependencies = [ - "bytes 0.5.6", + "bytes 1.0.1", "heck", - "itertools 0.8.2", + "itertools 0.9.0", "log", "multimap", "petgraph", - "prost 0.6.1", - "prost-types 0.6.1", + "prost 0.7.0", + "prost-types 0.7.0", "tempfile", - "which 3.1.1", + "which", ] [[package]] name = "prost-build" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" +checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" dependencies = [ "bytes 1.0.1", "heck", - "itertools 0.9.0", + "itertools 0.10.1", "log", "multimap", "petgraph", - "prost 0.7.0", - "prost-types 0.7.0", + "prost 0.8.0", + "prost-types 0.8.0", "tempfile", - "which 4.1.0", + "which", ] [[package]] name = "prost-derive" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537aa19b95acde10a12fec4301466386f757403de4cd4e5b4fa78fb5ecb18f72" +checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" dependencies = [ "anyhow", - "itertools 0.8.2", + "itertools 0.9.0", "proc-macro2 1.0.27", "quote 1.0.9", "syn 1.0.73", @@ -4962,12 +5024,12 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" dependencies = [ "anyhow", - "itertools 0.9.0", + "itertools 0.10.1", "proc-macro2 1.0.27", "quote 1.0.9", "syn 1.0.73", @@ -4975,22 +5037,22 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.6.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1834f67c0697c001304b75be76f67add9c89742eda3a085ad8ee0bb38c3417aa" +checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" dependencies = [ - "bytes 0.5.6", - "prost 0.6.1", + "bytes 1.0.1", + "prost 0.7.0", ] [[package]] name = "prost-types" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" dependencies = [ "bytes 1.0.1", - "prost 0.7.0", + "prost 0.8.0", ] [[package]] @@ -5269,6 +5331,16 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + [[package]] name = "ring" version = "0.16.20" @@ -5383,7 +5455,7 @@ dependencies = [ "ipld_blockstore", "jsonrpc-v2", "key_management", - "libp2p 0.35.1", + "libp2p", "message_pool", "once_cell", "serde", @@ -5435,6 +5507,15 @@ dependencies = [ "semver 0.9.0", ] +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + [[package]] name = "rustc_version" version = "0.4.0" @@ -5673,7 +5754,7 @@ checksum = "1a0c8611594e2ab4ebbf06ec7cbbf0a99450b8570e96cbf5188b5d5f6ef18d81" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpufeatures", + "cpufeatures 0.1.5", "digest 0.9.0", "opaque-debug 0.3.0", ] @@ -5704,7 +5785,7 @@ checksum = "b362ae5752fd2137731f9fa25fd4d9058af34666ca1966fb969119cc35719f12" dependencies = [ "block-buffer 0.9.0", "cfg-if 1.0.0", - "cpufeatures", + "cpufeatures 0.1.5", "digest 0.9.0", "opaque-debug 0.3.0", "sha2-asm", @@ -5860,17 +5941,17 @@ checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "snow" -version = "0.7.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "795dd7aeeee24468e5a32661f6d27f7b5cbed802031b2d7640c7b10f8fb2dd50" +checksum = "6142f7c25e94f6fd25a32c3348ec230df9109b463f59c8c7acc4bd34936babb7" dependencies = [ - "aes-gcm 0.7.0", + "aes-gcm 0.9.4", "blake2", "chacha20poly1305", - "rand 0.7.3", - "rand_core 0.5.1", + "rand 0.8.4", + "rand_core 0.6.3", "ring", - "rustc_version 0.2.3", + "rustc_version 0.3.3", "sha2 0.9.5", "subtle 2.4.1", "x25519-dalek", @@ -6022,7 +6103,7 @@ dependencies = [ "forest_vm", "futures", "ipld_blockstore", - "libp2p 0.35.1", + "libp2p", "log", "num_cpus", "rayon", @@ -6242,16 +6323,6 @@ dependencies = [ "storage-proofs-core", ] -[[package]] -name = "stream-cipher" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c80e15f898d8d8f25db24c253ea615cc14acf418ff307822995814e7d42cfa89" -dependencies = [ - "block-cipher", - "generic-array 0.14.4", -] - [[package]] name = "strobe-rs" version = "0.5.4" @@ -6698,6 +6769,49 @@ dependencies = [ "tracing", ] +[[package]] +name = "trust-dns-proto" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0d7f5db438199a6e2609debe3f69f808d074e0a2888ee0bccb45fe234d03f4" +dependencies = [ + "async-trait", + "cfg-if 1.0.0", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "lazy_static", + "log", + "rand 0.8.4", + "smallvec", + "thiserror", + "tinyvec", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ad17b608a64bd0735e67bde16b0636f8aa8591f831a25d18443ed00a699770" +dependencies = [ + "cfg-if 1.0.0", + "futures-util", + "ipconfig", + "lazy_static", + "log", + "lru-cache", + "parking_lot", + "resolv-conf", + "smallvec", + "thiserror", + "trust-dns-proto", +] + [[package]] name = "tungstenite" version = "0.13.0" @@ -7058,15 +7172,6 @@ dependencies = [ "cc", ] -[[package]] -name = "which" -version = "3.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d011071ae14a2f6671d0b74080ae0cd8ebf3a6f8c9589a2cd45f23126fe29724" -dependencies = [ - "libc", -] - [[package]] name = "which" version = "4.1.0" @@ -7077,6 +7182,12 @@ dependencies = [ "libc", ] +[[package]] +name = "widestring" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" + [[package]] name = "winapi" version = "0.2.8" @@ -7120,6 +7231,15 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "winreg" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "x25519-dalek" version = "1.1.1" @@ -7133,15 +7253,15 @@ dependencies = [ [[package]] name = "yamux" -version = "0.8.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cc7bd8c983209ed5d527f44b01c41b7dc146fd960c61cf9e1d25399841dc271" +checksum = "e7d9028f208dd5e63c614be69f115c1b53cacc1111437d4c765185856666c107" dependencies = [ "futures", "log", "nohash-hasher", "parking_lot", - "rand 0.7.3", + "rand 0.8.4", "static_assertions", ] @@ -7163,9 +7283,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.4.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeafe61337cb2c879d328b74aa6cd9d794592c82da6be559fdf11493f02a2d18" +checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" dependencies = [ "zeroize_derive", ] diff --git a/blockchain/chain_sync/Cargo.toml b/blockchain/chain_sync/Cargo.toml index ea2b7918fc38..4b90f7fbf519 100644 --- a/blockchain/chain_sync/Cargo.toml +++ b/blockchain/chain_sync/Cargo.toml @@ -13,7 +13,7 @@ blocks = { package = "forest_blocks", path = "../blocks", features = ["json"] } beacon = { path = "../beacon" } db = { package = "forest_db", version = "0.1" } encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.35", default-features = false } +libp2p = { version = "0.38", default-features = false } cid = { package = "forest_cid", version = "0.3" } ipld_blockstore = "0.1" chain = { path = "../chain" } diff --git a/forest/Cargo.toml b/forest/Cargo.toml index 4279aac0dae7..73cfa4b7d13f 100644 --- a/forest/Cargo.toml +++ b/forest/Cargo.toml @@ -12,7 +12,7 @@ base64 = "0.13" forest_libp2p = { path = "../node/forest_libp2p" } utils = { path = "../node/utils" } db = { package = "forest_db", version = "0.1" } -libp2p = { version = "0.35", default-features = false, features = ["identify"] } +libp2p = { version = "0.38", default-features = false, features = ["identify"] } futures = "0.3.5" log = "0.4.8" async-log = "2.0.0" diff --git a/ipld/graphsync/Cargo.toml b/ipld/graphsync/Cargo.toml index f961d04458c8..e2fd5e207766 100644 --- a/ipld/graphsync/Cargo.toml +++ b/ipld/graphsync/Cargo.toml @@ -10,7 +10,7 @@ cid = { package = "forest_cid", version = "0.3" } forest_ipld = "0.1.1" fnv = "1.0.6" encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.35", default-features = false } +libp2p = { version = "0.38", default-features = false } futures = "0.3.5" futures-util = "0.3.5" futures_codec = "0.4.0" diff --git a/node/forest_libp2p/Cargo.toml b/node/forest_libp2p/Cargo.toml index 41b8063db6f8..87994ba86680 100644 --- a/node/forest_libp2p/Cargo.toml +++ b/node/forest_libp2p/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] utils = { path = "../utils" } networks = { path = "../../types/networks" } -libp2p = { version = "0.35", default-features = false, features = [ +libp2p = { version = "0.38", default-features = false, features = [ "gossipsub", "kad", "identify", @@ -16,7 +16,7 @@ libp2p = { version = "0.35", default-features = false, features = [ "noise", "yamux", "tcp-async-io", - "dns", + "dns-async-std", "mplex", "request-response", "websocket" @@ -40,7 +40,8 @@ clock = { package = "fil_clock", path = "../clock" } db = { package = "forest_db", version = "0.1" } forest_car = { path = "../../ipld/car" } num-bigint = { path = "../../utils/bigint", package = "forest_bigint" } -libp2p-bitswap = { git = "https://github.com/ChainSafe/libp2p-bitswap", rev = "1ee048077cfdfc0a3bb16b236c0c308b1c4b52fa" } +# libp2p-bitswap = { git = "https://github.com/ChainSafe/libp2p-bitswap", rev = "1ee048077cfdfc0a3bb16b236c0c308b1c4b52fa" } +libp2p-bitswap = { path = "../../../../libp2p-bitswap" } tiny-cid = "0.2.0" ipld_blockstore = "0.1" async-trait = "0.1" diff --git a/node/forest_libp2p/src/behaviour.rs b/node/forest_libp2p/src/behaviour.rs index db32390d7ef6..9046c2236bef 100644 --- a/node/forest_libp2p/src/behaviour.rs +++ b/node/forest_libp2p/src/behaviour.rs @@ -19,7 +19,7 @@ use forest_encoding::blake2b_256; use futures::channel::oneshot::{self, Sender as OneShotSender}; use futures::{prelude::*, stream::FuturesUnordered}; use git_version::git_version; -use libp2p::identify::{Identify, IdentifyEvent}; +use libp2p::identify::{Identify, IdentifyConfig, IdentifyEvent}; use libp2p::ping::{ handler::{PingFailure, PingSuccess}, Ping, PingEvent, @@ -214,16 +214,16 @@ impl NetworkBehaviourEventProcess for ForestBehaviour { IdentifyEvent::Received { peer_id, info, - observed_addr, } => { trace!("Identified Peer {}", peer_id); trace!("protocol_version {}", info.protocol_version); trace!("agent_version {}", info.agent_version); trace!("listening_ addresses {:?}", info.listen_addrs); - trace!("observed_address {}", observed_addr); + trace!("observed_address {}", info.observed_addr); trace!("protocols {:?}", info.protocols); } IdentifyEvent::Sent { .. } => (), + IdentifyEvent::Pushed{ .. } => (), IdentifyEvent::Error { .. } => (), } } @@ -471,9 +471,7 @@ impl ForestBehaviour { discovery: discovery_config.finish(), ping: Ping::default(), identify: Identify::new( - "ipfs/0.1.0".into(), - format!("forest-{}-{}", *VERSION, *CURRENT_COMMIT), - local_key.public(), + IdentifyConfig::new("ipfs/0.1.0".into(), local_key.public()) ), bitswap, hello: RequestResponse::new(HelloCodec::default(), hp, req_res_config.clone()), diff --git a/node/forest_libp2p/src/discovery.rs b/node/forest_libp2p/src/discovery.rs index f8c8f11b7f8c..6560f1ec29e6 100644 --- a/node/forest_libp2p/src/discovery.rs +++ b/node/forest_libp2p/src/discovery.rs @@ -143,7 +143,7 @@ impl<'a> DiscoveryConfig<'a> { let mdns_opt = if enable_mdns { Some(task::block_on(async { - Mdns::new().await.expect("Could not start mDNS") + Mdns::new(Default::default()).await.expect("Could not start mDNS") })) } else { None @@ -309,16 +309,16 @@ impl NetworkBehaviour for DiscoveryBehaviour { self.kademlia.inject_new_external_addr(addr) } - fn inject_expired_listen_addr(&mut self, addr: &Multiaddr) { - self.kademlia.inject_expired_listen_addr(addr); + fn inject_expired_listen_addr(&mut self, id: ListenerId, addr: &Multiaddr) { + self.kademlia.inject_expired_listen_addr(id, addr); } fn inject_dial_failure(&mut self, peer_id: &PeerId) { self.kademlia.inject_dial_failure(peer_id) } - fn inject_new_listen_addr(&mut self, addr: &Multiaddr) { - self.kademlia.inject_new_listen_addr(addr) + fn inject_new_listen_addr(&mut self, id: ListenerId, addr: &Multiaddr) { + self.kademlia.inject_new_listen_addr(id, addr) } fn inject_listener_error(&mut self, id: ListenerId, err: &(dyn std::error::Error + 'static)) { diff --git a/node/forest_libp2p/src/service.rs b/node/forest_libp2p/src/service.rs index 74588fcafec0..fe904828bbde 100644 --- a/node/forest_libp2p/src/service.rs +++ b/node/forest_libp2p/src/service.rs @@ -163,11 +163,11 @@ where // Subscribe to gossipsub topics with the network name suffix for topic in PUBSUB_TOPICS.iter() { let t = Topic::new(format!("{}/{}", topic, network_name)); - swarm.subscribe(&t).unwrap(); + swarm.behaviour_mut().subscribe(&t).unwrap(); } // Bootstrap with Kademlia - if let Err(e) = swarm.bootstrap() { + if let Err(e) = swarm.behaviour_mut().bootstrap() { warn!("Failed to bootstrap with Kademlia: {}", e); } @@ -282,7 +282,7 @@ where }, ForestBehaviourEvent::BitswapReceivedWant(peer_id, cid,) => match self.cs.blockstore().get(&cid) { Ok(Some(data)) => { - match swarm_stream.get_mut().send_block(&peer_id, cid, data) { + match swarm_stream.get_mut().behaviour_mut().send_block(&peer_id, cid, data) { Ok(_) => { trace!("Sent bitswap message successfully"); }, @@ -305,18 +305,18 @@ where // Inbound messages Some(message) => match message { NetworkMessage::PubsubMessage { topic, message } => { - if let Err(e) = swarm_stream.get_mut().publish(topic, message) { + if let Err(e) = swarm_stream.get_mut().behaviour_mut().publish(topic, message) { warn!("Failed to send gossipsub message: {:?}", e); } } NetworkMessage::HelloRequest { peer_id, request, response_channel } => { - swarm_stream.get_mut().send_hello_request(&peer_id, request, response_channel); + swarm_stream.get_mut().behaviour_mut().send_hello_request(&peer_id, request, response_channel); } NetworkMessage::ChainExchangeRequest { peer_id, request, response_channel } => { - swarm_stream.get_mut().send_chain_exchange_request(&peer_id, request, response_channel); + swarm_stream.get_mut().behaviour_mut().send_chain_exchange_request(&peer_id, request, response_channel); } NetworkMessage::BitswapRequest { cid, response_channel } => { - if let Err(e) = swarm_stream.get_mut().want_block(cid, 1000) { + if let Err(e) = swarm_stream.get_mut().behaviour_mut().want_block(cid, 1000) { warn!("Failed to send a bitswap want_block: {}", e.to_string()); } else if let Some(chans) = self.bitswap_response_channels.get_mut(&cid) { chans.push(response_channel); @@ -335,7 +335,7 @@ where } } NetRPCMethods::NetPeers(response_channel) => { - let peer_addresses: &HashMap> = swarm_stream.get_mut().peer_addresses(); + let peer_addresses: &HashMap> = swarm_stream.get_mut().behaviour_mut().peer_addresses(); if response_channel.send(peer_addresses.to_owned()).is_err() { warn!("Failed to get Libp2p peers"); @@ -372,7 +372,7 @@ where }, interval_event = interval.next() => if interval_event.is_some() { // Print peer count on an interval. - info!("Peers connected: {}", swarm_stream.get_mut().peers().len()); + info!("Peers connected: {}", swarm_stream.get_mut().behaviour_mut().peers().len()); } }; } @@ -399,8 +399,7 @@ async fn emit_event(sender: &Sender, event: NetworkEvent) { pub fn build_transport(local_key: Keypair) -> Boxed<(PeerId, StreamMuxerBox)> { let transport = libp2p::tcp::TcpConfig::new().nodelay(true); let transport = libp2p::websocket::WsConfig::new(transport.clone()).or_transport(transport); - let transport = libp2p::dns::DnsConfig::new(transport).unwrap(); - + let transport = async_std::task::block_on(libp2p::dns::DnsConfig::system(transport)).unwrap(); let auth_config = { let dh_keys = noise::Keypair::::new() .into_authentic(&local_key) diff --git a/node/rpc-api/Cargo.toml b/node/rpc-api/Cargo.toml index 1cd59d6ff198..def65597a7fa 100644 --- a/node/rpc-api/Cargo.toml +++ b/node/rpc-api/Cargo.toml @@ -31,7 +31,7 @@ async-std = { version = "1.9", features = ["attributes"] } once_cell = "1.7.2" serde = { version = "1.0.101", default-features = false, features = ["derive"] } serde_json = "1.0" -libp2p = { version = "0.35", default-features = false } +libp2p = { version = "0.38", default-features = false } [dependencies.jsonrpc-v2] version = "0.10.1" diff --git a/vm/actor/Cargo.toml b/vm/actor/Cargo.toml index 547dc4364fb0..e69969d4239e 100644 --- a/vm/actor/Cargo.toml +++ b/vm/actor/Cargo.toml @@ -39,7 +39,7 @@ indexmap = { version = "1.7.0", features = ["serde-1"] } derive_builder = "0.9" db = { package = "forest_db", version = "0.1" } hex = "0.4.2" -libp2p = { version = "0.35", default-features = false } +libp2p = { version = "0.38", default-features = false } [features] devnet = [] diff --git a/vm/actor_interface/Cargo.toml b/vm/actor_interface/Cargo.toml index f4187f561bd8..35c1856ea112 100644 --- a/vm/actor_interface/Cargo.toml +++ b/vm/actor_interface/Cargo.toml @@ -19,7 +19,7 @@ serde = { version = "1.0", features = ["derive"] } cid = { package = "forest_cid", version = "0.3", features = ["json"] } clock = { package = "fil_clock", version = "0.1" } encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.35", default-features = false } +libp2p = { version = "0.38", default-features = false } forest_bitfield = "0.1" num-bigint = { version = "0.1.1", package = "forest_bigint", features = ["json"] } forest_hash_utils = "0.1" diff --git a/vm/state_migration/Cargo.toml b/vm/state_migration/Cargo.toml index c4030e5f4c77..f11aeb4b3377 100644 --- a/vm/state_migration/Cargo.toml +++ b/vm/state_migration/Cargo.toml @@ -13,7 +13,7 @@ serde = { version = "1.0", features = ["derive"] } cid = { package = "forest_cid", version = "0.3", features = ["json"] } clock = { package = "fil_clock", version = "0.1" } encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.35", default-features = false } +libp2p = { version = "0.38", default-features = false } forest_bitfield = "0.1" num-bigint = { version = "0.1.1", package = "forest_bigint", features = ["json"] } forest_hash_utils = "0.1" From 849aab3a508feb553c6f6cadc08c1e9cebcad3af Mon Sep 17 00:00:00 2001 From: eric tu Date: Fri, 15 Oct 2021 13:49:47 +0200 Subject: [PATCH 02/10] update to 0.40.0-rc1 --- Cargo.lock | 578 +++++++++++++++++++++------- blockchain/chain_sync/Cargo.toml | 2 +- forest/Cargo.toml | 2 +- ipld/graphsync/Cargo.toml | 2 +- node/forest_libp2p/Cargo.toml | 5 +- node/forest_libp2p/src/behaviour.rs | 66 +++- node/forest_libp2p/src/discovery.rs | 64 +-- node/forest_libp2p/src/service.rs | 22 +- node/rpc-api/Cargo.toml | 2 +- vm/actor/Cargo.toml | 2 +- vm/actor_interface/Cargo.toml | 2 +- vm/state_migration/Cargo.toml | 2 +- 12 files changed, 559 insertions(+), 190 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cce358500b50..cd972944476e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -157,6 +157,17 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "991984e3fd003e7ba02eb724f87a0f997b78677c46c0e91f8424ad7394c9886a" +dependencies = [ + "getrandom 0.2.3", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -625,6 +636,12 @@ dependencies = [ "yastl", ] +[[package]] +name = "bimap" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50ae17cabbc8a38a1e3e4c1a6a664e9a09672dc14d0896fa8d865d3a5a446b07" + [[package]] name = "bincode" version = "1.3.3" @@ -1007,8 +1024,8 @@ dependencies = [ "lazy_static", "lockfree", "log", - "lru", - "multihash", + "lru 0.6.5", + "multihash 0.13.2", "networks", "num-traits", "rayon", @@ -1055,7 +1072,7 @@ dependencies = [ "lazy_static", "libp2p", "log", - "lru", + "lru 0.6.5", "message_pool", "networks", "num-traits", @@ -1092,7 +1109,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff0e3bc0b6446b3f9663c1a6aba6ef06c5aeaa1bc92bd18077be337198ab9768" dependencies = [ "multibase 0.8.0", - "multihash", + "multihash 0.13.2", "unsigned-varint 0.5.1", ] @@ -1508,6 +1525,17 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "cuckoofilter" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b810a8449931679f64cd7eef1bbd0fa315801b6d5d9cdc1ace2804d6529eee18" +dependencies = [ + "byteorder 1.4.3", + "fnv", + "rand 0.7.3", +] + [[package]] name = "curl" version = "0.4.38" @@ -1708,6 +1736,12 @@ dependencies = [ "quick-error", ] +[[package]] +name = "dtoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" + [[package]] name = "ed25519" version = "1.1.1" @@ -2009,6 +2043,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" +[[package]] +name = "fixedbitset" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "398ea4fabe40b9b0d885340a2a991a44c8a645624075ad966d21f88688e2b69e" + [[package]] name = "flate2" version = "1.0.20" @@ -2385,7 +2425,7 @@ dependencies = [ "generic-array 0.14.4", "integer-encoding 3.0.2", "multibase 0.9.1", - "multihash", + "multihash 0.13.2", "serde", "serde_json", ] @@ -2398,7 +2438,7 @@ dependencies = [ "bls-signatures", "forest_address", "forest_encoding", - "libsecp256k1", + "libsecp256k1 0.3.5", "num-derive", "num-traits", "rand 0.7.3", @@ -2496,7 +2536,7 @@ dependencies = [ "libp2p", "libp2p-bitswap", "log", - "multihash", + "multihash 0.13.2", "networks", "serde", "smallvec", @@ -2927,6 +2967,9 @@ name = "hashbrown" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" +dependencies = [ + "ahash 0.7.5", +] [[package]] name = "heck" @@ -3009,6 +3052,17 @@ dependencies = [ "hmac 0.7.1", ] +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array 0.14.4", + "hmac 0.8.1", +] + [[package]] name = "hostname" version = "0.3.1" @@ -3523,7 +3577,7 @@ dependencies = [ "forest_address", "forest_crypto", "forest_encoding", - "libsecp256k1", + "libsecp256k1 0.3.5", "log", "rand 0.7.3", "serde", @@ -3608,30 +3662,39 @@ dependencies = [ [[package]] name = "libp2p" -version = "0.38.0" +version = "0.40.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebbb17eece4aec5bb970880c73825c16ca59ca05a4e41803751e68c7e5f0c618" +checksum = "8f428eafa931a28f3aaac8d35d03df815f4dca34b7333b12db2f04ae729a7bee" dependencies = [ "atomic", "bytes 1.0.1", "futures", "lazy_static", "libp2p-core", + "libp2p-deflate", "libp2p-dns", + "libp2p-floodsub", "libp2p-gossipsub", "libp2p-identify", "libp2p-kad", "libp2p-mdns", + "libp2p-metrics", "libp2p-mplex", "libp2p-noise", "libp2p-ping", + "libp2p-plaintext", + "libp2p-pnet", + "libp2p-relay", + "libp2p-rendezvous", "libp2p-request-response", "libp2p-swarm", "libp2p-swarm-derive", "libp2p-tcp", + "libp2p-uds", + "libp2p-wasm-ext", "libp2p-websocket", "libp2p-yamux", - "parity-multiaddr", + "multiaddr", "parking_lot", "pin-project 1.0.7", "smallvec", @@ -3641,6 +3704,7 @@ dependencies = [ [[package]] name = "libp2p-bitswap" version = "0.6.1" +source = "git+https://github.com/ChainSafe/libp2p-bitswap?rev=8d3913ea7fc1e693776c83eecc7a9675c3426446#8d3913ea7fc1e693776c83eecc7a9675c3426446" dependencies = [ "async-std", "fnv", @@ -3657,9 +3721,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.28.3" +version = "0.30.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "554d3e7e9e65f939d66b75fd6a4c67f258fe250da61b91f46c545fc4a89b51d9" +checksum = "79b64b3e139714a65dbae2462e77fe7e46de160a9bd10d973b383313a1054a47" dependencies = [ "asn1_der", "bs58", @@ -3669,15 +3733,15 @@ dependencies = [ "futures", "futures-timer", "lazy_static", - "libsecp256k1", + "libsecp256k1 0.6.0", "log", - "multihash", + "multiaddr", + "multihash 0.14.0", "multistream-select", - "parity-multiaddr", "parking_lot", "pin-project 1.0.7", - "prost 0.7.0", - "prost-build 0.7.0", + "prost 0.9.0", + "prost-build 0.9.0", "rand 0.7.3", "ring", "rw-stream-sink", @@ -3689,11 +3753,22 @@ dependencies = [ "zeroize", ] +[[package]] +name = "libp2p-deflate" +version = "0.30.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ca0b876d0629bd9aa2dbb2b370d602581b2d732e2b965534208b25c378319f6" +dependencies = [ + "flate2", + "futures", + "libp2p-core", +] + [[package]] name = "libp2p-dns" -version = "0.28.1" +version = "0.30.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e63dab8b5ff35e0c101a3e51e843ba782c07bbb1682f5fd827622e0d02b98b" +checksum = "3a3756d04f91224c95ca24d2894e6b180f5465f1ed0f03d070f77bfd74c527b9" dependencies = [ "async-std-resolver", "futures", @@ -3703,11 +3778,29 @@ dependencies = [ "trust-dns-resolver", ] +[[package]] +name = "libp2p-floodsub" +version = "0.31.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea3b04ed3ff6c94d0cac858e1dd2c79e214cc6269b0e61d1ff57c6daaa1be904" +dependencies = [ + "cuckoofilter", + "fnv", + "futures", + "libp2p-core", + "libp2p-swarm", + "log", + "prost 0.9.0", + "prost-build 0.9.0", + "rand 0.7.3", + "smallvec", +] + [[package]] name = "libp2p-gossipsub" -version = "0.31.0" +version = "0.33.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e562308761818b0c52f2a81a0544b9c22d0cf56d7b2d928a0ff61382404498ce" +checksum = "d02524892b942932f1aa59f729ecc1781ed0680379e6752d5e6e373791f4bd16" dependencies = [ "asynchronous-codec", "base64 0.13.0", @@ -3719,8 +3812,8 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "prost 0.7.0", - "prost-build 0.7.0", + "prost 0.9.0", + "prost-build 0.9.0", "rand 0.7.3", "regex", "sha2 0.9.5", @@ -3731,25 +3824,26 @@ dependencies = [ [[package]] name = "libp2p-identify" -version = "0.29.0" +version = "0.31.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f668f00efd9883e8b7bcc582eaf0164615792608f886f6577da18bcbeea0a46" +checksum = "f5171764e0957b37a8ba85cbd146b7acde0479d9fa5f293658e470c443171bd3" dependencies = [ "futures", "libp2p-core", "libp2p-swarm", "log", - "prost 0.7.0", - "prost-build 0.7.0", + "lru 0.6.5", + "prost 0.9.0", + "prost-build 0.9.0", "smallvec", "wasm-timer", ] [[package]] name = "libp2p-kad" -version = "0.30.0" +version = "0.32.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b07312ebe5ee4fd2404447a0609814574df55c65d4e20838b957bbd34907d820" +checksum = "9e1ef3be40e0b26c24ba27fabf30fec1b464d64d16e0e71a5b33bb4bd2772db4" dependencies = [ "arrayvec", "asynchronous-codec", @@ -3760,8 +3854,8 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "prost 0.7.0", - "prost-build 0.7.0", + "prost 0.9.0", + "prost-build 0.9.0", "rand 0.7.3", "sha2 0.9.5", "smallvec", @@ -3773,9 +3867,9 @@ dependencies = [ [[package]] name = "libp2p-mdns" -version = "0.30.2" +version = "0.32.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4efa70c1c3d2d91237f8546e27aeb85e287d62c066a7b4f3ea6a696d43ced714" +checksum = "0e0b09025310a86ffc63d92f26b86d15599c984c708f39feb01c6e970d4309f1" dependencies = [ "async-io", "data-encoding", @@ -3792,11 +3886,25 @@ dependencies = [ "void", ] +[[package]] +name = "libp2p-metrics" +version = "0.1.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20d8a654f4b4da33d2dd1fa4e060c7ac09e34b01882b08aa114176a40ec371c6" +dependencies = [ + "libp2p-core", + "libp2p-identify", + "libp2p-kad", + "libp2p-ping", + "libp2p-swarm", + "open-metrics-client", +] + [[package]] name = "libp2p-mplex" -version = "0.28.0" +version = "0.30.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85e9b544335d1ed30af71daa96edbefadef6f19c7a55f078b9fc92c87163105d" +checksum = "c7f221b185fa4e0b49510699e886072a646e31214d1b76d03d3220f5cd48f603" dependencies = [ "asynchronous-codec", "bytes 1.0.1", @@ -3812,9 +3920,9 @@ dependencies = [ [[package]] name = "libp2p-noise" -version = "0.31.0" +version = "0.33.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a2aa6fc4e6855eaf9ea1941a14f7ec4df35636fb6b85951e17481df8dcecf6" +checksum = "8ce91ef34c441d507745b137d51f00a49fb83a3229ec560ecb1c0fe7fde5a65b" dependencies = [ "bytes 1.0.1", "curve25519-dalek", @@ -3822,8 +3930,8 @@ dependencies = [ "lazy_static", "libp2p-core", "log", - "prost 0.7.0", - "prost-build 0.7.0", + "prost 0.9.0", + "prost-build 0.9.0", "rand 0.8.4", "sha2 0.9.5", "snow", @@ -3834,9 +3942,9 @@ dependencies = [ [[package]] name = "libp2p-ping" -version = "0.29.0" +version = "0.31.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4bfaffac63bf3c7ec11ed9d8879d455966ddea7e78ee14737f0b6dce0d1cd1" +checksum = "9bff0999bc990d3f176e812b7d25e593cafb36b70a77db1cb3abde2fda542ca5" dependencies = [ "futures", "libp2p-core", @@ -3847,11 +3955,87 @@ dependencies = [ "wasm-timer", ] +[[package]] +name = "libp2p-plaintext" +version = "0.30.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "364eb2b647652682f5e629fabf5d401f870e0fcee7a63c7333f4c185829bb491" +dependencies = [ + "asynchronous-codec", + "bytes 1.0.1", + "futures", + "libp2p-core", + "log", + "prost 0.9.0", + "prost-build 0.9.0", + "unsigned-varint 0.7.0", + "void", +] + +[[package]] +name = "libp2p-pnet" +version = "0.22.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "015a7bff2a2e5622efd75cec30dd61205c1f29590d9faedb921b355afc0e94df" +dependencies = [ + "futures", + "log", + "pin-project 1.0.7", + "rand 0.7.3", + "salsa20", + "sha3", +] + +[[package]] +name = "libp2p-relay" +version = "0.4.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3150ebdb83d65e2663e5378d012ceac2393ea6a92c9fa34ed786f92a1917a65b" +dependencies = [ + "asynchronous-codec", + "bytes 1.0.1", + "futures", + "futures-timer", + "libp2p-core", + "libp2p-swarm", + "log", + "pin-project 1.0.7", + "prost 0.9.0", + "prost-build 0.9.0", + "rand 0.7.3", + "smallvec", + "unsigned-varint 0.7.0", + "void", + "wasm-timer", +] + +[[package]] +name = "libp2p-rendezvous" +version = "0.1.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c050a515b297f82d3699522787eb0d69595d186a9b1b88d4059ad433e4c0496" +dependencies = [ + "asynchronous-codec", + "bimap", + "futures", + "libp2p-core", + "libp2p-swarm", + "log", + "prost 0.9.0", + "prost-build 0.9.0", + "rand 0.8.4", + "sha2 0.9.5", + "thiserror", + "unsigned-varint 0.7.0", + "void", + "wasm-timer", +] + [[package]] name = "libp2p-request-response" -version = "0.11.0" +version = "0.13.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cdbe172f08e6d0f95fa8634e273d4c4268c4063de2e33e7435194b0130c62e3" +checksum = "10e0e9c3519e8fdc23f146ac9ba1b346ba7c175c93ef09945a7ebd309653fa05" dependencies = [ "async-trait", "bytes 1.0.1", @@ -3859,8 +4043,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "lru", - "minicbor", + "lru 0.7.0", "rand 0.7.3", "smallvec", "unsigned-varint 0.7.0", @@ -3869,9 +4052,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.29.0" +version = "0.31.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e04d8e1eef675029ec728ba14e8d0da7975d84b6679b699b4ae91a1de9c3a92" +checksum = "5ebaa726a322c375a745bf2b1043edd56ccf8f4b0ca512f7b10f80a7a8de7120" dependencies = [ "either", "futures", @@ -3885,9 +4068,9 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.23.0" +version = "0.25.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "365b0a699fea5168676840567582a012ea297b1ca02eee467e58301b9c9c5eed" +checksum = "0a4d34b88c742b903813bb1fc5b87cc42f9da29314c9eba35abb2eb5d31a0588" dependencies = [ "quote 1.0.9", "syn 1.0.73", @@ -3895,9 +4078,9 @@ dependencies = [ [[package]] name = "libp2p-tcp" -version = "0.28.0" +version = "0.30.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b1a27d21c477951799e99d5c105d78868258502ce092988040a808d5a19bbd9" +checksum = "0431b74198d05004a706b78fd5f7d217d15fbacd2b8e4d116ade24d5510992b3" dependencies = [ "async-io", "futures", @@ -3910,11 +4093,37 @@ dependencies = [ "socket2 0.4.0", ] +[[package]] +name = "libp2p-uds" +version = "0.30.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad64777bf52a1e325de44b74e7a3e4278b52c8ef40c8d8aff9dc80fd1dd351de" +dependencies = [ + "async-std", + "futures", + "libp2p-core", + "log", +] + +[[package]] +name = "libp2p-wasm-ext" +version = "0.30.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87c721571ab627ad4c584543bafb18783bc296f11490cdfd68531da73cf9a69b" +dependencies = [ + "futures", + "js-sys", + "libp2p-core", + "parity-send-wrapper", + "wasm-bindgen", + "wasm-bindgen-futures", +] + [[package]] name = "libp2p-websocket" -version = "0.29.0" +version = "0.31.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cace60995ef6f637e4752cccbb2590f6bc358e8741a0d066307636c69a4b3a74" +checksum = "262e768479476a4b8ac4eb2714a4cdcaf642edf3a515ba10f30751dbd0c4353c" dependencies = [ "either", "futures", @@ -3930,9 +4139,9 @@ dependencies = [ [[package]] name = "libp2p-yamux" -version = "0.32.0" +version = "0.34.0-rc.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f35da42cfc6d5cb0dcf3ad6881bc68d146cdf38f98655e09e33fbba4d13eabc4" +checksum = "f2569b1509317a854e124c4e9266415195def3184c865423e01c39ed0cf07351" dependencies = [ "futures", "libp2p-core", @@ -3962,13 +4171,61 @@ dependencies = [ "arrayref", "crunchy", "digest 0.8.1", - "hmac-drbg", + "hmac-drbg 0.2.0", "rand 0.7.3", "sha2 0.8.2", "subtle 2.4.1", "typenum", ] +[[package]] +name = "libsecp256k1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9d220bc1feda2ac231cb78c3d26f27676b8cf82c96971f7aeef3d0cf2797c73" +dependencies = [ + "arrayref", + "base64 0.12.3", + "digest 0.9.0", + "hmac-drbg 0.3.0", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.7.3", + "serde", + "sha2 0.9.5", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0f6ab710cec28cef759c5f18671a27dae2a5f952cdaaee1d8e2908cb2478a80" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle 2.4.1", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccab96b584d38fac86a83f07e659f0deafd0253dc096dab5a36d53efe653c5c3" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67abfe149395e3aa1c48a2beb32b068e2334402df8181f818d3aee2b304c4f5d" +dependencies = [ + "libsecp256k1-core", +] + [[package]] name = "libsodium-sys" version = "0.2.7" @@ -4036,6 +4293,15 @@ dependencies = [ "hashbrown 0.9.1", ] +[[package]] +name = "lru" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c748cfe47cb8da225c37595b3108bea1c198c84aaae8ea0ba76d01dda9fc803" +dependencies = [ + "hashbrown 0.11.2", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -4143,9 +4409,9 @@ dependencies = [ "interpreter", "ipld_blockstore", "key_management", - "libsecp256k1", + "libsecp256k1 0.3.5", "log", - "lru", + "lru 0.6.5", "networks", "num-rational", "num-traits", @@ -4187,26 +4453,6 @@ dependencies = [ "unicase", ] -[[package]] -name = "minicbor" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51aa5bb0ca22415daca596a227b507f880ad1b2318a87fa9325312a5d285ca0d" -dependencies = [ - "minicbor-derive", -] - -[[package]] -name = "minicbor-derive" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2b9e8883d58e34b18facd16c4564a77ea50fce028ad3d0ee6753440e37acc8" -dependencies = [ - "proc-macro2 1.0.27", - "quote 1.0.9", - "syn 1.0.73", -] - [[package]] name = "miniz_oxide" version = "0.4.4" @@ -4217,6 +4463,24 @@ dependencies = [ "autocfg", ] +[[package]] +name = "multiaddr" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ee4ea82141951ac6379f964f71b20876d43712bea8faf6dd1a375e08a46499" +dependencies = [ + "arrayref", + "bs58", + "byteorder 1.4.3", + "data-encoding", + "multihash 0.14.0", + "percent-encoding", + "serde", + "static_assertions", + "unsigned-varint 0.7.0", + "url", +] + [[package]] name = "multibase" version = "0.8.0" @@ -4254,6 +4518,19 @@ dependencies = [ "unsigned-varint 0.5.1", ] +[[package]] +name = "multihash" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "752a61cd890ff691b4411423d23816d5866dd5621e4d1c5687a53b94b5a979d8" +dependencies = [ + "digest 0.9.0", + "generic-array 0.14.4", + "multihash-derive", + "sha2 0.9.5", + "unsigned-varint 0.7.0", +] + [[package]] name = "multihash-derive" version = "0.7.2" @@ -4276,9 +4553,9 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.10.2" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d91ec0a2440aaff5f78ec35631a7027d50386c6163aa975f7caa0d5da4b6ff8" +checksum = "56a336acba8bc87c8876f6425407dbbe6c417bf478b22015f8fb0994ef3bc0ab" dependencies = [ "bytes 1.0.1", "futures", @@ -4493,6 +4770,29 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "open-metrics-client" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7337d80c23c2d8b1349563981bc4fb531220733743ba8115454a67b181173f0d" +dependencies = [ + "dtoa", + "itoa", + "open-metrics-client-derive-text-encode", + "owning_ref", +] + +[[package]] +name = "open-metrics-client-derive-text-encode" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a15c83b586f00268c619c1cb3340ec1a6f59dd9ba1d9833a273a68e6d5cd8ffc" +dependencies = [ + "proc-macro2 1.0.27", + "quote 1.0.9", + "syn 1.0.73", +] + [[package]] name = "openssl-probe" version = "0.1.4" @@ -4527,6 +4827,15 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "30fceb411f9a12ff9222c5f824026be368ff15dc2f13468d850c7d3f502205d6" +[[package]] +name = "owning_ref" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ff55baddef9e4ad00f88b6c743a2a8062d4c6ade126c2a528644b8e444d52ce" +dependencies = [ + "stable_deref_trait", +] + [[package]] name = "paired" version = "0.21.0" @@ -4562,22 +4871,10 @@ dependencies = [ ] [[package]] -name = "parity-multiaddr" -version = "0.11.2" +name = "parity-send-wrapper" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58341485071825827b7f03cf7efd1cb21e6a709bea778fb50227fd45d2f361b4" -dependencies = [ - "arrayref", - "bs58", - "byteorder 1.4.3", - "data-encoding", - "multihash", - "percent-encoding", - "serde", - "static_assertions", - "unsigned-varint 0.7.0", - "url", -] +checksum = "aa9777aa91b8ad9dd5aaa04a9b6bcb02c7f1deb952fca5a66034d5e63afc5c6f" [[package]] name = "parking" @@ -4666,7 +4963,17 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" dependencies = [ - "fixedbitset", + "fixedbitset 0.2.0", + "indexmap", +] + +[[package]] +name = "petgraph" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" +dependencies = [ + "fixedbitset 0.4.0", "indexmap", ] @@ -4955,68 +5262,70 @@ dependencies = [ [[package]] name = "prost" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6984d2f1a23009bd270b8bb56d0926810a3d483f59c987d77969e9d8e840b2" +checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" dependencies = [ "bytes 1.0.1", - "prost-derive 0.7.0", + "prost-derive 0.8.0", ] [[package]] name = "prost" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" +checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" dependencies = [ "bytes 1.0.1", - "prost-derive 0.8.0", + "prost-derive 0.9.0", ] [[package]] name = "prost-build" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d3ebd75ac2679c2af3a92246639f9fcc8a442ee420719cc4fe195b98dd5fa3" +checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" dependencies = [ "bytes 1.0.1", "heck", - "itertools 0.9.0", + "itertools 0.10.1", "log", "multimap", - "petgraph", - "prost 0.7.0", - "prost-types 0.7.0", + "petgraph 0.5.1", + "prost 0.8.0", + "prost-types 0.8.0", "tempfile", "which", ] [[package]] name = "prost-build" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" +checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" dependencies = [ "bytes 1.0.1", "heck", "itertools 0.10.1", + "lazy_static", "log", "multimap", - "petgraph", - "prost 0.8.0", - "prost-types 0.8.0", + "petgraph 0.6.0", + "prost 0.9.0", + "prost-types 0.9.0", + "regex", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "169a15f3008ecb5160cba7d37bcd690a7601b6d30cfb87a117d45e59d52af5d4" +checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" dependencies = [ "anyhow", - "itertools 0.9.0", + "itertools 0.10.1", "proc-macro2 1.0.27", "quote 1.0.9", "syn 1.0.73", @@ -5024,9 +5333,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" +checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" dependencies = [ "anyhow", "itertools 0.10.1", @@ -5037,22 +5346,22 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b518d7cdd93dab1d1122cf07fa9a60771836c668dde9d9e2a139f957f0d9f1bb" +checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" dependencies = [ "bytes 1.0.1", - "prost 0.7.0", + "prost 0.8.0", ] [[package]] name = "prost-types" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" +checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" dependencies = [ "bytes 1.0.1", - "prost 0.8.0", + "prost 0.9.0", ] [[package]] @@ -5555,6 +5864,15 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +[[package]] +name = "salsa20" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c0fbb5f676da676c260ba276a8f43a8dc67cf02d1438423aeb1c677a7212686" +dependencies = [ + "cipher 0.3.0", +] + [[package]] name = "same-file" version = "1.0.6" @@ -5992,17 +6310,17 @@ dependencies = [ [[package]] name = "soketto" -version = "0.4.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c71ed3d54db0a699f4948e1bb3e45b450fa31fe602621dee6680361d569c88" +checksum = "083624472e8817d44d02c0e55df043737ff11f279af924abdf93845717c2b75c" dependencies = [ - "base64 0.12.3", - "bytes 0.5.6", + "base64 0.13.0", + "bytes 1.0.1", "flate2", "futures", "httparse", "log", - "rand 0.7.3", + "rand 0.8.4", "sha-1", ] diff --git a/blockchain/chain_sync/Cargo.toml b/blockchain/chain_sync/Cargo.toml index 4b90f7fbf519..64ccd7038e86 100644 --- a/blockchain/chain_sync/Cargo.toml +++ b/blockchain/chain_sync/Cargo.toml @@ -13,7 +13,7 @@ blocks = { package = "forest_blocks", path = "../blocks", features = ["json"] } beacon = { path = "../beacon" } db = { package = "forest_db", version = "0.1" } encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.38", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } cid = { package = "forest_cid", version = "0.3" } ipld_blockstore = "0.1" chain = { path = "../chain" } diff --git a/forest/Cargo.toml b/forest/Cargo.toml index 73cfa4b7d13f..9b2e336498dc 100644 --- a/forest/Cargo.toml +++ b/forest/Cargo.toml @@ -12,7 +12,7 @@ base64 = "0.13" forest_libp2p = { path = "../node/forest_libp2p" } utils = { path = "../node/utils" } db = { package = "forest_db", version = "0.1" } -libp2p = { version = "0.38", default-features = false, features = ["identify"] } +libp2p = { version = "0.40.0-rc.1", default-features = false, features = ["identify"] } futures = "0.3.5" log = "0.4.8" async-log = "2.0.0" diff --git a/ipld/graphsync/Cargo.toml b/ipld/graphsync/Cargo.toml index e2fd5e207766..7439aca1d1bb 100644 --- a/ipld/graphsync/Cargo.toml +++ b/ipld/graphsync/Cargo.toml @@ -10,7 +10,7 @@ cid = { package = "forest_cid", version = "0.3" } forest_ipld = "0.1.1" fnv = "1.0.6" encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.38", default-features = false } +libp2p = { git = "https://github.com/mxinden/rust-libp2p", rev = "04c694faa5dae5abbde3a6b23e03d8a14859e9e8", default-features = false } futures = "0.3.5" futures-util = "0.3.5" futures_codec = "0.4.0" diff --git a/node/forest_libp2p/Cargo.toml b/node/forest_libp2p/Cargo.toml index 87994ba86680..584fe189d593 100644 --- a/node/forest_libp2p/Cargo.toml +++ b/node/forest_libp2p/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] utils = { path = "../utils" } networks = { path = "../../types/networks" } -libp2p = { version = "0.38", default-features = false, features = [ +libp2p = { version = "0.40.0-rc.1" , default-features = false, features = [ "gossipsub", "kad", "identify", @@ -40,8 +40,7 @@ clock = { package = "fil_clock", path = "../clock" } db = { package = "forest_db", version = "0.1" } forest_car = { path = "../../ipld/car" } num-bigint = { path = "../../utils/bigint", package = "forest_bigint" } -# libp2p-bitswap = { git = "https://github.com/ChainSafe/libp2p-bitswap", rev = "1ee048077cfdfc0a3bb16b236c0c308b1c4b52fa" } -libp2p-bitswap = { path = "../../../../libp2p-bitswap" } +libp2p-bitswap = { git = "https://github.com/ChainSafe/libp2p-bitswap", rev = "8d3913ea7fc1e693776c83eecc7a9675c3426446" } tiny-cid = "0.2.0" ipld_blockstore = "0.1" async-trait = "0.1" diff --git a/node/forest_libp2p/src/behaviour.rs b/node/forest_libp2p/src/behaviour.rs index 9046c2236bef..5dd37c1824d9 100644 --- a/node/forest_libp2p/src/behaviour.rs +++ b/node/forest_libp2p/src/behaviour.rs @@ -19,16 +19,15 @@ use forest_encoding::blake2b_256; use futures::channel::oneshot::{self, Sender as OneShotSender}; use futures::{prelude::*, stream::FuturesUnordered}; use git_version::git_version; -use libp2p::identify::{Identify, IdentifyConfig, IdentifyEvent}; +use libp2p::{identify::{Identify, IdentifyConfig, IdentifyEvent}, ping::{PingFailure, PingSuccess}, swarm::{IntoProtocolsHandler, ProtocolsHandler}}; use libp2p::ping::{ - handler::{PingFailure, PingSuccess}, - Ping, PingEvent, + Ping, PingEvent, }; use libp2p::request_response::{ ProtocolSupport, RequestId, RequestResponse, RequestResponseConfig, RequestResponseEvent, RequestResponseMessage, ResponseChannel, }; -use libp2p::swarm::{NetworkBehaviourAction, NetworkBehaviourEventProcess, PollParameters}; +use libp2p::swarm::{NetworkBehaviourAction, NetworkBehaviourEventProcess, PollParameters, NetworkBehaviour}; use libp2p::NetworkBehaviour; use libp2p::{core::identity::Keypair, kad::QueryId}; use libp2p::{core::PeerId, gossipsub::GossipsubMessage}; @@ -59,7 +58,7 @@ lazy_static! { /// Libp2p behaviour for the Forest node. This handles all sub protocols needed for a Filecoin node. #[derive(NetworkBehaviour)] -#[behaviour(out_event = "ForestBehaviourEvent", poll_method = "poll")] +#[behaviour(out_event = "ForestBehaviourEvent", poll_method = "poll", event_process=true)] pub(crate) struct ForestBehaviour { gossipsub: Gossipsub, discovery: DiscoveryBehaviour, @@ -118,6 +117,46 @@ pub(crate) enum ForestBehaviourEvent { }, } +// impl From for ForestBehaviourEvent { +// fn from(a: DiscoveryOut) -> Self { +// todo!() +// } +// } + +// impl From for ForestBehaviourEvent { +// fn from(_: BitswapEvent) -> Self { +// todo!() +// } +// } +// impl From> for ForestBehaviourEvent{ +// fn from(_: RequestResponseEvent) -> Self { +// todo!() +// } +// } + +// impl From> for ForestBehaviourEvent{ +// fn from(_: RequestResponseEvent) -> Self { +// todo!() +// } +// } + +// impl From for ForestBehaviourEvent{ +// fn from(_: PingEvent) -> Self { +// todo!() +// } +// } + +// impl From for ForestBehaviourEvent{ +// fn from(_: IdentifyEvent) -> Self { +// todo!() +// } +// } +// impl From for ForestBehaviourEvent{ +// fn from(_: GossipsubEvent) -> Self { +// todo!() +// } +// } + impl NetworkBehaviourEventProcess for ForestBehaviour { fn inject_event(&mut self, event: DiscoveryOut) { match event { @@ -188,22 +227,25 @@ impl NetworkBehaviourEventProcess for ForestBehaviour { impl NetworkBehaviourEventProcess for ForestBehaviour { fn inject_event(&mut self, event: PingEvent) { match event.result { - Result::Ok(PingSuccess::Ping { rtt }) => { + Ok(PingSuccess::Ping { rtt }) => { trace!( "PingSuccess::Ping rtt to {} is {} ms", event.peer.to_base58(), rtt.as_millis() ); } - Result::Ok(PingSuccess::Pong) => { + Ok(PingSuccess::Pong) => { trace!("PingSuccess::Pong from {}", event.peer.to_base58()); } - Result::Err(PingFailure::Timeout) => { + Err(PingFailure::Timeout) => { debug!("PingFailure::Timeout {}", event.peer.to_base58()); } - Result::Err(PingFailure::Other { error }) => { + Err(PingFailure::Other { error }) => { debug!("PingFailure::Other {}: {}", event.peer.to_base58(), error); } + Err(PingFailure::Unsupported) => { + debug!("PingFailure::Unsupported {}", event.peer.to_base58()); + } } } } @@ -394,11 +436,11 @@ impl NetworkBehaviourEventProcess( + fn poll( &mut self, cx: &mut Context, _: &mut impl PollParameters, - ) -> Poll> { + ) -> Poll::OutEvent, ::ProtocolsHandler>> { // Poll to see if any response is ready to be sent back. while let Poll::Ready(Some(outcome)) = self.cx_pending_responses.poll_next_unpin(cx) { let RequestProcessingOutcome { @@ -410,7 +452,7 @@ impl ForestBehaviour { // later on reported as a `InboundFailure::Omission`. None => break, }; - + // Poll::Handler as ProtocolsHandler>::InEvent, Self::OutEvent>> if self .chain_exchange .send_response(inner_channel, response) diff --git a/node/forest_libp2p/src/discovery.rs b/node/forest_libp2p/src/discovery.rs index 6560f1ec29e6..ecbc06f025ec 100644 --- a/node/forest_libp2p/src/discovery.rs +++ b/node/forest_libp2p/src/discovery.rs @@ -4,6 +4,8 @@ use async_std::stream::{self, Interval}; use async_std::task; use futures::prelude::*; +use libp2p::swarm::DialError; +use libp2p::swarm::protocols_handler::DummyProtocolsHandler; use libp2p::{ core::{ connection::{ConnectionId, ListenerId}, @@ -15,7 +17,7 @@ use libp2p::{ swarm::{ toggle::{Toggle, ToggleIntoProtoHandler}, IntoProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction, PollParameters, - ProtocolsHandler, + ProtocolsHandler, ProtocolsHandlerSelect, }, }; use libp2p::{kad::record::store::MemoryStore, mdns::Mdns}; @@ -56,7 +58,7 @@ impl<'a> DiscoveryConfig<'a> { /// Create a default configuration with the given public key. pub fn new(local_public_key: PublicKey, network_name: &'a str) -> Self { DiscoveryConfig { - local_peer_id: local_public_key.into_peer_id(), + local_peer_id: local_public_key.to_peer_id(), user_defined: Vec::new(), discovery_max: std::u64::MAX, enable_mdns: false, @@ -212,6 +214,10 @@ impl DiscoveryBehaviour { impl NetworkBehaviour for DiscoveryBehaviour { type ProtocolsHandler = ToggleIntoProtoHandler>; + // type ProtocolsHandler = ProtocolsHandlerSelect< + // KademliaHandlerProto, + // ToggleIntoProtoHandler, + // >; type OutEvent = DiscoveryOut; fn new_handler(&mut self) -> Self::ProtocolsHandler { @@ -246,11 +252,12 @@ impl NetworkBehaviour for DiscoveryBehaviour { peer_id: &PeerId, conn: &ConnectionId, endpoint: &ConnectedPoint, + failed_addresses: Option<&Vec>, ) { self.num_connections += 1; self.kademlia - .inject_connection_established(peer_id, conn, endpoint) + .inject_connection_established(peer_id, conn, endpoint, failed_addresses) } fn inject_connected(&mut self, peer_id: &PeerId) { @@ -268,11 +275,12 @@ impl NetworkBehaviour for DiscoveryBehaviour { peer_id: &PeerId, conn: &ConnectionId, endpoint: &ConnectedPoint, + handler: ::Handler, ) { self.num_connections -= 1; self.kademlia - .inject_connection_closed(peer_id, conn, endpoint) + .inject_connection_closed(peer_id, conn, endpoint, handler) } fn inject_disconnected(&mut self, peer_id: &PeerId) { @@ -283,16 +291,6 @@ impl NetworkBehaviour for DiscoveryBehaviour { self.kademlia.inject_disconnected(peer_id) } - fn inject_addr_reach_failure( - &mut self, - peer_id: Option<&PeerId>, - addr: &Multiaddr, - error: &dyn std::error::Error, - ) { - self.kademlia - .inject_addr_reach_failure(peer_id, addr, error) - } - fn inject_event( &mut self, peer_id: PeerId, @@ -313,8 +311,8 @@ impl NetworkBehaviour for DiscoveryBehaviour { self.kademlia.inject_expired_listen_addr(id, addr); } - fn inject_dial_failure(&mut self, peer_id: &PeerId) { - self.kademlia.inject_dial_failure(peer_id) + fn inject_dial_failure(&mut self, peer_id: Option, handler: Self::ProtocolsHandler, err: &DialError) { + self.kademlia.inject_dial_failure(peer_id, handler, err) } fn inject_new_listen_addr(&mut self, id: ListenerId, addr: &Multiaddr) { @@ -336,8 +334,8 @@ impl NetworkBehaviour for DiscoveryBehaviour { params: &mut impl PollParameters, ) -> Poll< NetworkBehaviourAction< - <::Handler as ProtocolsHandler>::InEvent, - Self::OutEvent, + Self::OutEvent, + Self::ProtocolsHandler, >, >{ // Immediately process the content of `discovered`. @@ -367,8 +365,7 @@ impl NetworkBehaviour for DiscoveryBehaviour { } // Poll Kademlia. - if let Some(kademlia) = self.kademlia.as_mut() { - while let Poll::Ready(ev) = kademlia.poll(cx, params) { + while let Poll::Ready(ev) = self.kademlia.poll(cx, params) { match ev { NetworkBehaviourAction::GenerateEvent(ev) => match ev { // Adding to Kademlia buckets is automatic with our config, @@ -382,11 +379,11 @@ impl NetworkBehaviour for DiscoveryBehaviour { debug!("Libp2p => Unhandled Kademlia event: {:?}", other) } }, - NetworkBehaviourAction::DialAddress { address } => { - return Poll::Ready(NetworkBehaviourAction::DialAddress { address }) + NetworkBehaviourAction::DialAddress { address, handler } => { + return Poll::Ready(NetworkBehaviourAction::DialAddress { address, handler }) } - NetworkBehaviourAction::DialPeer { peer_id, condition } => { - return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id, condition }) + NetworkBehaviourAction::DialPeer { peer_id, condition, handler } => { + return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id, condition, handler }) } NetworkBehaviourAction::NotifyHandler { peer_id, @@ -405,9 +402,15 @@ impl NetworkBehaviour for DiscoveryBehaviour { score, }) } + NetworkBehaviourAction::CloseConnection { peer_id, connection } => { + return Poll::Ready(NetworkBehaviourAction::CloseConnection { + peer_id, + connection, + }) + }, } } - } + // Poll mdns. while let Poll::Ready(ev) = self.mdns.poll(cx, params) { @@ -430,11 +433,11 @@ impl NetworkBehaviour for DiscoveryBehaviour { } MdnsEvent::Expired(_) => {} }, - NetworkBehaviourAction::DialAddress { address } => { - return Poll::Ready(NetworkBehaviourAction::DialAddress { address }) + NetworkBehaviourAction::DialAddress { .. } => { + // return Poll::Ready(NetworkBehaviourAction::DialAddress { address, handler }) } - NetworkBehaviourAction::DialPeer { peer_id, condition } => { - return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id, condition }) + NetworkBehaviourAction::DialPeer { .. } => { + // return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id, condition, handler }) } // Nothing to notify handler NetworkBehaviourAction::NotifyHandler { event, .. } => match event {}, @@ -444,6 +447,9 @@ impl NetworkBehaviour for DiscoveryBehaviour { score, }) } + NetworkBehaviourAction::CloseConnection { peer_id, connection } => { + return Poll::Ready(NetworkBehaviourAction::CloseConnection{ peer_id, connection }) + }, } } diff --git a/node/forest_libp2p/src/service.rs b/node/forest_libp2p/src/service.rs index fe904828bbde..f8c104b84b43 100644 --- a/node/forest_libp2p/src/service.rs +++ b/node/forest_libp2p/src/service.rs @@ -23,7 +23,9 @@ use ipld_blockstore::BlockStore; pub use libp2p::gossipsub::IdentTopic; pub use libp2p::gossipsub::Topic; use libp2p::multiaddr::Protocol; +use libp2p::multihash::Multihash; use libp2p::request_response::ResponseChannel; +use libp2p::swarm::SwarmEvent; use libp2p::{ core, core::connection::ConnectionLimits, @@ -34,7 +36,6 @@ use libp2p::{ }; use libp2p::{core::Multiaddr, swarm::SwarmBuilder}; use log::{debug, error, info, trace, warn}; -use multihash::Multihash; use std::collections::HashMap; use std::path::Path; use std::sync::Arc; @@ -199,19 +200,19 @@ where swarm_event = swarm_stream.next() => match swarm_event { // outbound events Some(event) => match event { - ForestBehaviourEvent::PeerConnected(peer_id) => { + SwarmEvent::Behaviour(ForestBehaviourEvent::PeerConnected(peer_id)) => { debug!("Peer connected, {:?}", peer_id); emit_event(&self.network_sender_out, NetworkEvent::PeerConnected(peer_id)).await; } - ForestBehaviourEvent::PeerDisconnected(peer_id) => { + SwarmEvent::Behaviour(ForestBehaviourEvent::PeerDisconnected(peer_id)) => { emit_event(&self.network_sender_out, NetworkEvent::PeerDisconnected(peer_id)).await; } - ForestBehaviourEvent::GossipMessage { + SwarmEvent::Behaviour(ForestBehaviourEvent::GossipMessage { source, topic, message, - } => { + }) => { trace!("Got a Gossip Message from {:?}", source); let topic = topic.as_str(); if topic == pubsub_block_str { @@ -242,14 +243,14 @@ where warn!("Getting gossip messages from unknown topic: {}", topic); } } - ForestBehaviourEvent::HelloRequest { request, peer } => { + SwarmEvent::Behaviour(ForestBehaviourEvent::HelloRequest { request, peer } )=> { debug!("Received hello request (peer_id: {:?})", peer); emit_event(&self.network_sender_out, NetworkEvent::HelloRequest { request, source: peer, }).await; } - ForestBehaviourEvent::ChainExchangeRequest { channel, peer, request } => { + SwarmEvent::Behaviour(ForestBehaviourEvent::ChainExchangeRequest { channel, peer, request }) => { debug!("Received chain_exchange request (peer_id: {:?})", peer); let db = self.cs.clone(); @@ -257,7 +258,7 @@ where channel.send(make_chain_exchange_response(db.as_ref(), &request).await) }); } - ForestBehaviourEvent::BitswapReceivedBlock(_peer_id, cid, block) => { + SwarmEvent::Behaviour(ForestBehaviourEvent::BitswapReceivedBlock(_peer_id, cid, block)) => { let res: Result<_, String> = self.cs.blockstore().put_raw(block.into(), Blake2b256).map_err(|e| e.to_string()); match res { Ok(actual_cid) => { @@ -280,7 +281,7 @@ where } } }, - ForestBehaviourEvent::BitswapReceivedWant(peer_id, cid,) => match self.cs.blockstore().get(&cid) { + SwarmEvent::Behaviour(ForestBehaviourEvent::BitswapReceivedWant(peer_id, cid,)) => match self.cs.blockstore().get(&cid) { Ok(Some(data)) => { match swarm_stream.get_mut().behaviour_mut().send_block(&peer_id, cid, data) { Ok(_) => { @@ -298,6 +299,9 @@ where trace!("Failed to get data: {}", e.to_string()); } }, + _ => { + continue; + } } None => { break; } }, diff --git a/node/rpc-api/Cargo.toml b/node/rpc-api/Cargo.toml index def65597a7fa..b06edacd8940 100644 --- a/node/rpc-api/Cargo.toml +++ b/node/rpc-api/Cargo.toml @@ -31,7 +31,7 @@ async-std = { version = "1.9", features = ["attributes"] } once_cell = "1.7.2" serde = { version = "1.0.101", default-features = false, features = ["derive"] } serde_json = "1.0" -libp2p = { version = "0.38", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } [dependencies.jsonrpc-v2] version = "0.10.1" diff --git a/vm/actor/Cargo.toml b/vm/actor/Cargo.toml index e69969d4239e..d3464256cf31 100644 --- a/vm/actor/Cargo.toml +++ b/vm/actor/Cargo.toml @@ -39,7 +39,7 @@ indexmap = { version = "1.7.0", features = ["serde-1"] } derive_builder = "0.9" db = { package = "forest_db", version = "0.1" } hex = "0.4.2" -libp2p = { version = "0.38", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } [features] devnet = [] diff --git a/vm/actor_interface/Cargo.toml b/vm/actor_interface/Cargo.toml index 35c1856ea112..9409e227817c 100644 --- a/vm/actor_interface/Cargo.toml +++ b/vm/actor_interface/Cargo.toml @@ -19,7 +19,7 @@ serde = { version = "1.0", features = ["derive"] } cid = { package = "forest_cid", version = "0.3", features = ["json"] } clock = { package = "fil_clock", version = "0.1" } encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.38", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } forest_bitfield = "0.1" num-bigint = { version = "0.1.1", package = "forest_bigint", features = ["json"] } forest_hash_utils = "0.1" diff --git a/vm/state_migration/Cargo.toml b/vm/state_migration/Cargo.toml index f11aeb4b3377..b8cd90bd403d 100644 --- a/vm/state_migration/Cargo.toml +++ b/vm/state_migration/Cargo.toml @@ -13,7 +13,7 @@ serde = { version = "1.0", features = ["derive"] } cid = { package = "forest_cid", version = "0.3", features = ["json"] } clock = { package = "fil_clock", version = "0.1" } encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.38", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } forest_bitfield = "0.1" num-bigint = { version = "0.1.1", package = "forest_bigint", features = ["json"] } forest_hash_utils = "0.1" From 60eda2cf15820849dbd16f7ba62d4ad51fd3697d Mon Sep 17 00:00:00 2001 From: eric tu Date: Fri, 15 Oct 2021 13:51:36 +0200 Subject: [PATCH 03/10] fmt --- node/forest_libp2p/src/behaviour.rs | 38 +++++---- node/forest_libp2p/src/discovery.rs | 128 ++++++++++++++++------------ 2 files changed, 96 insertions(+), 70 deletions(-) diff --git a/node/forest_libp2p/src/behaviour.rs b/node/forest_libp2p/src/behaviour.rs index 5dd37c1824d9..07b0df52b9bb 100644 --- a/node/forest_libp2p/src/behaviour.rs +++ b/node/forest_libp2p/src/behaviour.rs @@ -19,15 +19,14 @@ use forest_encoding::blake2b_256; use futures::channel::oneshot::{self, Sender as OneShotSender}; use futures::{prelude::*, stream::FuturesUnordered}; use git_version::git_version; -use libp2p::{identify::{Identify, IdentifyConfig, IdentifyEvent}, ping::{PingFailure, PingSuccess}, swarm::{IntoProtocolsHandler, ProtocolsHandler}}; -use libp2p::ping::{ - Ping, PingEvent, -}; +use libp2p::ping::{Ping, PingEvent}; use libp2p::request_response::{ ProtocolSupport, RequestId, RequestResponse, RequestResponseConfig, RequestResponseEvent, RequestResponseMessage, ResponseChannel, }; -use libp2p::swarm::{NetworkBehaviourAction, NetworkBehaviourEventProcess, PollParameters, NetworkBehaviour}; +use libp2p::swarm::{ + NetworkBehaviour, NetworkBehaviourAction, NetworkBehaviourEventProcess, PollParameters, +}; use libp2p::NetworkBehaviour; use libp2p::{core::identity::Keypair, kad::QueryId}; use libp2p::{core::PeerId, gossipsub::GossipsubMessage}; @@ -39,6 +38,11 @@ use libp2p::{ }, Multiaddr, }; +use libp2p::{ + identify::{Identify, IdentifyConfig, IdentifyEvent}, + ping::{PingFailure, PingSuccess}, + swarm::{IntoProtocolsHandler, ProtocolsHandler}, +}; use libp2p_bitswap::{Bitswap, BitswapEvent, Priority}; use log::{debug, trace, warn}; use std::collections::HashSet; @@ -58,7 +62,11 @@ lazy_static! { /// Libp2p behaviour for the Forest node. This handles all sub protocols needed for a Filecoin node. #[derive(NetworkBehaviour)] -#[behaviour(out_event = "ForestBehaviourEvent", poll_method = "poll", event_process=true)] +#[behaviour( + out_event = "ForestBehaviourEvent", + poll_method = "poll", + event_process = true +)] pub(crate) struct ForestBehaviour { gossipsub: Gossipsub, discovery: DiscoveryBehaviour, @@ -253,10 +261,7 @@ impl NetworkBehaviourEventProcess for ForestBehaviour { impl NetworkBehaviourEventProcess for ForestBehaviour { fn inject_event(&mut self, event: IdentifyEvent) { match event { - IdentifyEvent::Received { - peer_id, - info, - } => { + IdentifyEvent::Received { peer_id, info } => { trace!("Identified Peer {}", peer_id); trace!("protocol_version {}", info.protocol_version); trace!("agent_version {}", info.agent_version); @@ -265,7 +270,7 @@ impl NetworkBehaviourEventProcess for ForestBehaviour { trace!("protocols {:?}", info.protocols); } IdentifyEvent::Sent { .. } => (), - IdentifyEvent::Pushed{ .. } => (), + IdentifyEvent::Pushed { .. } => (), IdentifyEvent::Error { .. } => (), } } @@ -440,7 +445,12 @@ impl ForestBehaviour { &mut self, cx: &mut Context, _: &mut impl PollParameters, - ) -> Poll::OutEvent, ::ProtocolsHandler>> { + ) -> Poll< + NetworkBehaviourAction< + ::OutEvent, + ::ProtocolsHandler, + >, + > { // Poll to see if any response is ready to be sent back. while let Poll::Ready(Some(outcome)) = self.cx_pending_responses.poll_next_unpin(cx) { let RequestProcessingOutcome { @@ -512,9 +522,7 @@ impl ForestBehaviour { gossipsub, discovery: discovery_config.finish(), ping: Ping::default(), - identify: Identify::new( - IdentifyConfig::new("ipfs/0.1.0".into(), local_key.public()) - ), + identify: Identify::new(IdentifyConfig::new("ipfs/0.1.0".into(), local_key.public())), bitswap, hello: RequestResponse::new(HelloCodec::default(), hp, req_res_config.clone()), chain_exchange: RequestResponse::new(ChainExchangeCodec::default(), cp, req_res_config), diff --git a/node/forest_libp2p/src/discovery.rs b/node/forest_libp2p/src/discovery.rs index ecbc06f025ec..658a3e6cf981 100644 --- a/node/forest_libp2p/src/discovery.rs +++ b/node/forest_libp2p/src/discovery.rs @@ -4,8 +4,8 @@ use async_std::stream::{self, Interval}; use async_std::task; use futures::prelude::*; -use libp2p::swarm::DialError; use libp2p::swarm::protocols_handler::DummyProtocolsHandler; +use libp2p::swarm::DialError; use libp2p::{ core::{ connection::{ConnectionId, ListenerId}, @@ -145,7 +145,9 @@ impl<'a> DiscoveryConfig<'a> { let mdns_opt = if enable_mdns { Some(task::block_on(async { - Mdns::new(Default::default()).await.expect("Could not start mDNS") + Mdns::new(Default::default()) + .await + .expect("Could not start mDNS") })) } else { None @@ -311,7 +313,12 @@ impl NetworkBehaviour for DiscoveryBehaviour { self.kademlia.inject_expired_listen_addr(id, addr); } - fn inject_dial_failure(&mut self, peer_id: Option, handler: Self::ProtocolsHandler, err: &DialError) { + fn inject_dial_failure( + &mut self, + peer_id: Option, + handler: Self::ProtocolsHandler, + err: &DialError, + ) { self.kademlia.inject_dial_failure(peer_id, handler, err) } @@ -328,16 +335,11 @@ impl NetworkBehaviour for DiscoveryBehaviour { } #[allow(clippy::type_complexity)] - fn poll( - &mut self, - cx: &mut Context, - params: &mut impl PollParameters, - ) -> Poll< - NetworkBehaviourAction< - Self::OutEvent, - Self::ProtocolsHandler, - >, - >{ + fn poll( + &mut self, + cx: &mut Context, + params: &mut impl PollParameters, + ) -> Poll> { // Immediately process the content of `discovered`. if let Some(ev) = self.pending_events.pop_front() { return Poll::Ready(NetworkBehaviourAction::GenerateEvent(ev)); @@ -365,52 +367,62 @@ impl NetworkBehaviour for DiscoveryBehaviour { } // Poll Kademlia. - while let Poll::Ready(ev) = self.kademlia.poll(cx, params) { - match ev { - NetworkBehaviourAction::GenerateEvent(ev) => match ev { - // Adding to Kademlia buckets is automatic with our config, - // no need to do manually. - KademliaEvent::RoutingUpdated { .. } => {} - KademliaEvent::RoutablePeer { .. } => {} - KademliaEvent::PendingRoutablePeer { .. } => { - // Intentionally ignore - } - other => { - debug!("Libp2p => Unhandled Kademlia event: {:?}", other) - } - }, - NetworkBehaviourAction::DialAddress { address, handler } => { - return Poll::Ready(NetworkBehaviourAction::DialAddress { address, handler }) + while let Poll::Ready(ev) = self.kademlia.poll(cx, params) { + match ev { + NetworkBehaviourAction::GenerateEvent(ev) => match ev { + // Adding to Kademlia buckets is automatic with our config, + // no need to do manually. + KademliaEvent::RoutingUpdated { .. } => {} + KademliaEvent::RoutablePeer { .. } => {} + KademliaEvent::PendingRoutablePeer { .. } => { + // Intentionally ignore } - NetworkBehaviourAction::DialPeer { peer_id, condition, handler } => { - return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id, condition, handler }) + other => { + debug!("Libp2p => Unhandled Kademlia event: {:?}", other) } - NetworkBehaviourAction::NotifyHandler { + }, + NetworkBehaviourAction::DialAddress { address, handler } => { + return Poll::Ready(NetworkBehaviourAction::DialAddress { address, handler }) + } + NetworkBehaviourAction::DialPeer { + peer_id, + condition, + handler, + } => { + return Poll::Ready(NetworkBehaviourAction::DialPeer { + peer_id, + condition, + handler, + }) + } + NetworkBehaviourAction::NotifyHandler { + peer_id, + handler, + event, + } => { + return Poll::Ready(NetworkBehaviourAction::NotifyHandler { peer_id, handler, event, - } => { - return Poll::Ready(NetworkBehaviourAction::NotifyHandler { - peer_id, - handler, - event, - }) - } - NetworkBehaviourAction::ReportObservedAddr { address, score } => { - return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { - address, - score, - }) - } - NetworkBehaviourAction::CloseConnection { peer_id, connection } => { - return Poll::Ready(NetworkBehaviourAction::CloseConnection { - peer_id, - connection, - }) - }, + }) + } + NetworkBehaviourAction::ReportObservedAddr { address, score } => { + return Poll::Ready(NetworkBehaviourAction::ReportObservedAddr { + address, + score, + }) + } + NetworkBehaviourAction::CloseConnection { + peer_id, + connection, + } => { + return Poll::Ready(NetworkBehaviourAction::CloseConnection { + peer_id, + connection, + }) } } - + } // Poll mdns. while let Poll::Ready(ev) = self.mdns.poll(cx, params) { @@ -447,9 +459,15 @@ impl NetworkBehaviour for DiscoveryBehaviour { score, }) } - NetworkBehaviourAction::CloseConnection { peer_id, connection } => { - return Poll::Ready(NetworkBehaviourAction::CloseConnection{ peer_id, connection }) - }, + NetworkBehaviourAction::CloseConnection { + peer_id, + connection, + } => { + return Poll::Ready(NetworkBehaviourAction::CloseConnection { + peer_id, + connection, + }) + } } } From fc7b6db777c972a2b1a1fff7c57105a83f67c876 Mon Sep 17 00:00:00 2001 From: eric tu Date: Fri, 15 Oct 2021 14:11:19 +0200 Subject: [PATCH 04/10] lint --- node/forest_libp2p/src/behaviour.rs | 1 - node/forest_libp2p/src/discovery.rs | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/node/forest_libp2p/src/behaviour.rs b/node/forest_libp2p/src/behaviour.rs index 07b0df52b9bb..4fcc2de31147 100644 --- a/node/forest_libp2p/src/behaviour.rs +++ b/node/forest_libp2p/src/behaviour.rs @@ -41,7 +41,6 @@ use libp2p::{ use libp2p::{ identify::{Identify, IdentifyConfig, IdentifyEvent}, ping::{PingFailure, PingSuccess}, - swarm::{IntoProtocolsHandler, ProtocolsHandler}, }; use libp2p_bitswap::{Bitswap, BitswapEvent, Priority}; use log::{debug, trace, warn}; diff --git a/node/forest_libp2p/src/discovery.rs b/node/forest_libp2p/src/discovery.rs index 658a3e6cf981..3f4ec953b566 100644 --- a/node/forest_libp2p/src/discovery.rs +++ b/node/forest_libp2p/src/discovery.rs @@ -4,7 +4,6 @@ use async_std::stream::{self, Interval}; use async_std::task; use futures::prelude::*; -use libp2p::swarm::protocols_handler::DummyProtocolsHandler; use libp2p::swarm::DialError; use libp2p::{ core::{ @@ -17,7 +16,7 @@ use libp2p::{ swarm::{ toggle::{Toggle, ToggleIntoProtoHandler}, IntoProtocolsHandler, NetworkBehaviour, NetworkBehaviourAction, PollParameters, - ProtocolsHandler, ProtocolsHandlerSelect, + ProtocolsHandler, }, }; use libp2p::{kad::record::store::MemoryStore, mdns::Mdns}; From 0bf2c1b65a0f524812f1c2b136f6a1b0db2b38a2 Mon Sep 17 00:00:00 2001 From: eric tu Date: Fri, 15 Oct 2021 14:46:37 +0200 Subject: [PATCH 05/10] update some security offending libraries --- Cargo.lock | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d01d9fe517f..6d45926531a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4653,14 +4653,15 @@ dependencies = [ [[package]] name = "nix" -version = "0.20.0" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9b4819da1bc61c0ea48b63b7bc8604064dd43013e7cc325df098d49cd7c18a" +checksum = "f5e06129fb611568ef4e868c14b326274959aa70ff7776e9d55323531c374945" dependencies = [ "bitflags", "cc", "cfg-if 1.0.0", "libc", + "memoffset", ] [[package]] @@ -7677,9 +7678,9 @@ dependencies = [ [[package]] name = "zeroize_derive" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2c1e130bebaeab2f23886bf9acbaca14b092408c452543c857f66399cd6dab1" +checksum = "bdff2024a851a322b08f179173ae2ba620445aef1e838f0c196820eade4ae0c7" dependencies = [ "proc-macro2 1.0.27", "quote 1.0.9", From eb2962346d1acebdc9a152cf03ee5b17b6fe1bb8 Mon Sep 17 00:00:00 2001 From: eric tu Date: Fri, 15 Oct 2021 14:47:57 +0200 Subject: [PATCH 06/10] fix graphsync dep --- ipld/graphsync/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipld/graphsync/Cargo.toml b/ipld/graphsync/Cargo.toml index 7439aca1d1bb..f908f4d473ac 100644 --- a/ipld/graphsync/Cargo.toml +++ b/ipld/graphsync/Cargo.toml @@ -10,7 +10,7 @@ cid = { package = "forest_cid", version = "0.3" } forest_ipld = "0.1.1" fnv = "1.0.6" encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { git = "https://github.com/mxinden/rust-libp2p", rev = "04c694faa5dae5abbde3a6b23e03d8a14859e9e8", default-features = false } +libp2p = { version = "0.40.0-rc.1", rev = "04c694faa5dae5abbde3a6b23e03d8a14859e9e8", default-features = false } futures = "0.3.5" futures-util = "0.3.5" futures_codec = "0.4.0" From 673ab43a076697adac2544d426933cfbbb88a331 Mon Sep 17 00:00:00 2001 From: eric tu Date: Fri, 15 Oct 2021 14:48:19 +0200 Subject: [PATCH 07/10] remove rev tag from libp2p --- ipld/graphsync/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipld/graphsync/Cargo.toml b/ipld/graphsync/Cargo.toml index f908f4d473ac..32b875da2dc2 100644 --- a/ipld/graphsync/Cargo.toml +++ b/ipld/graphsync/Cargo.toml @@ -10,7 +10,7 @@ cid = { package = "forest_cid", version = "0.3" } forest_ipld = "0.1.1" fnv = "1.0.6" encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.40.0-rc.1", rev = "04c694faa5dae5abbde3a6b23e03d8a14859e9e8", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } futures = "0.3.5" futures-util = "0.3.5" futures_codec = "0.4.0" From a952b7d6b1132152c96798e70722f8d9f54d8bc3 Mon Sep 17 00:00:00 2001 From: eric tu Date: Fri, 15 Oct 2021 14:52:53 +0200 Subject: [PATCH 08/10] clean up comments --- node/forest_libp2p/src/behaviour.rs | 41 ----------------------------- node/forest_libp2p/src/discovery.rs | 12 ++------- 2 files changed, 2 insertions(+), 51 deletions(-) diff --git a/node/forest_libp2p/src/behaviour.rs b/node/forest_libp2p/src/behaviour.rs index 4fcc2de31147..1c8b84d75477 100644 --- a/node/forest_libp2p/src/behaviour.rs +++ b/node/forest_libp2p/src/behaviour.rs @@ -124,46 +124,6 @@ pub(crate) enum ForestBehaviourEvent { }, } -// impl From for ForestBehaviourEvent { -// fn from(a: DiscoveryOut) -> Self { -// todo!() -// } -// } - -// impl From for ForestBehaviourEvent { -// fn from(_: BitswapEvent) -> Self { -// todo!() -// } -// } -// impl From> for ForestBehaviourEvent{ -// fn from(_: RequestResponseEvent) -> Self { -// todo!() -// } -// } - -// impl From> for ForestBehaviourEvent{ -// fn from(_: RequestResponseEvent) -> Self { -// todo!() -// } -// } - -// impl From for ForestBehaviourEvent{ -// fn from(_: PingEvent) -> Self { -// todo!() -// } -// } - -// impl From for ForestBehaviourEvent{ -// fn from(_: IdentifyEvent) -> Self { -// todo!() -// } -// } -// impl From for ForestBehaviourEvent{ -// fn from(_: GossipsubEvent) -> Self { -// todo!() -// } -// } - impl NetworkBehaviourEventProcess for ForestBehaviour { fn inject_event(&mut self, event: DiscoveryOut) { match event { @@ -461,7 +421,6 @@ impl ForestBehaviour { // later on reported as a `InboundFailure::Omission`. None => break, }; - // Poll::Handler as ProtocolsHandler>::InEvent, Self::OutEvent>> if self .chain_exchange .send_response(inner_channel, response) diff --git a/node/forest_libp2p/src/discovery.rs b/node/forest_libp2p/src/discovery.rs index 3f4ec953b566..61b05525f2c5 100644 --- a/node/forest_libp2p/src/discovery.rs +++ b/node/forest_libp2p/src/discovery.rs @@ -215,10 +215,6 @@ impl DiscoveryBehaviour { impl NetworkBehaviour for DiscoveryBehaviour { type ProtocolsHandler = ToggleIntoProtoHandler>; - // type ProtocolsHandler = ProtocolsHandlerSelect< - // KademliaHandlerProto, - // ToggleIntoProtoHandler, - // >; type OutEvent = DiscoveryOut; fn new_handler(&mut self) -> Self::ProtocolsHandler { @@ -444,12 +440,8 @@ impl NetworkBehaviour for DiscoveryBehaviour { } MdnsEvent::Expired(_) => {} }, - NetworkBehaviourAction::DialAddress { .. } => { - // return Poll::Ready(NetworkBehaviourAction::DialAddress { address, handler }) - } - NetworkBehaviourAction::DialPeer { .. } => { - // return Poll::Ready(NetworkBehaviourAction::DialPeer { peer_id, condition, handler }) - } + NetworkBehaviourAction::DialAddress { .. } => {} + NetworkBehaviourAction::DialPeer { .. } => {} // Nothing to notify handler NetworkBehaviourAction::NotifyHandler { event, .. } => match event {}, NetworkBehaviourAction::ReportObservedAddr { address, score } => { From 8940c444940006d2b5816705817dddf09cad8d12 Mon Sep 17 00:00:00 2001 From: eric tu Date: Fri, 15 Oct 2021 15:08:38 +0200 Subject: [PATCH 09/10] bump msrv to 1.55 --- .circleci/config.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3e31293a4aa0..edff4b8a2081 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2.1 parameters: msrv-version: type: string - default: "1.52.1" + default: "1.55.0" executors: linux-executor: diff --git a/README.md b/README.md index 97fbd33e1aa7..042e0ab46dd9 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Our crates: | `vm` | State transition and actors, message and address definitions | ## Dependencies -rustc >= 1.46.0 +rustc >= 1.55.0 ## Usage ```bash From 37d9a91ab7ca011a386612d9d9911a231136c3ad Mon Sep 17 00:00:00 2001 From: eric tu Date: Mon, 18 Oct 2021 18:33:33 +0100 Subject: [PATCH 10/10] fix suggestions from q9f --- forest/Cargo.toml | 2 +- node/forest_libp2p/Cargo.toml | 2 +- node/rpc-api/Cargo.toml | 2 +- vm/actor/Cargo.toml | 2 +- vm/actor_interface/Cargo.toml | 2 +- vm/state_migration/Cargo.toml | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/forest/Cargo.toml b/forest/Cargo.toml index 9cea5fb1bc70..6711f76bbf1b 100644 --- a/forest/Cargo.toml +++ b/forest/Cargo.toml @@ -12,7 +12,7 @@ base64 = "0.13" forest_libp2p = { path = "../node/forest_libp2p" } utils = { path = "../node/utils" } db = { package = "forest_db", version = "0.1" } -libp2p = { version = "0.40.0-rc.1", default-features = false, features = ["identify"] } +libp2p = { version = "0.40.0-rc.1", default-features = false, features = ["identify"] } futures = "0.3.5" log = "0.4.8" async-log = "2.0.0" diff --git a/node/forest_libp2p/Cargo.toml b/node/forest_libp2p/Cargo.toml index 584fe189d593..6bbba5da13e0 100644 --- a/node/forest_libp2p/Cargo.toml +++ b/node/forest_libp2p/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" [dependencies] utils = { path = "../utils" } networks = { path = "../../types/networks" } -libp2p = { version = "0.40.0-rc.1" , default-features = false, features = [ +libp2p = { version = "0.40.0-rc.1" , default-features = false, features = [ "gossipsub", "kad", "identify", diff --git a/node/rpc-api/Cargo.toml b/node/rpc-api/Cargo.toml index b06edacd8940..eccafe69517f 100644 --- a/node/rpc-api/Cargo.toml +++ b/node/rpc-api/Cargo.toml @@ -31,7 +31,7 @@ async-std = { version = "1.9", features = ["attributes"] } once_cell = "1.7.2" serde = { version = "1.0.101", default-features = false, features = ["derive"] } serde_json = "1.0" -libp2p = { version = "0.40.0-rc.1", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } [dependencies.jsonrpc-v2] version = "0.10.1" diff --git a/vm/actor/Cargo.toml b/vm/actor/Cargo.toml index d3464256cf31..47ada59ed0c6 100644 --- a/vm/actor/Cargo.toml +++ b/vm/actor/Cargo.toml @@ -39,7 +39,7 @@ indexmap = { version = "1.7.0", features = ["serde-1"] } derive_builder = "0.9" db = { package = "forest_db", version = "0.1" } hex = "0.4.2" -libp2p = { version = "0.40.0-rc.1", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } [features] devnet = [] diff --git a/vm/actor_interface/Cargo.toml b/vm/actor_interface/Cargo.toml index 9409e227817c..d1cc5b0e93b2 100644 --- a/vm/actor_interface/Cargo.toml +++ b/vm/actor_interface/Cargo.toml @@ -19,7 +19,7 @@ serde = { version = "1.0", features = ["derive"] } cid = { package = "forest_cid", version = "0.3", features = ["json"] } clock = { package = "fil_clock", version = "0.1" } encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.40.0-rc.1", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } forest_bitfield = "0.1" num-bigint = { version = "0.1.1", package = "forest_bigint", features = ["json"] } forest_hash_utils = "0.1" diff --git a/vm/state_migration/Cargo.toml b/vm/state_migration/Cargo.toml index b8cd90bd403d..a933a605d12d 100644 --- a/vm/state_migration/Cargo.toml +++ b/vm/state_migration/Cargo.toml @@ -13,7 +13,7 @@ serde = { version = "1.0", features = ["derive"] } cid = { package = "forest_cid", version = "0.3", features = ["json"] } clock = { package = "fil_clock", version = "0.1" } encoding = { package = "forest_encoding", version = "0.2.1" } -libp2p = { version = "0.40.0-rc.1", default-features = false } +libp2p = { version = "0.40.0-rc.1", default-features = false } forest_bitfield = "0.1" num-bigint = { version = "0.1.1", package = "forest_bigint", features = ["json"] } forest_hash_utils = "0.1"