From 3cadb6f7e482c1fa4e584ea205e6f1b7cb9b05ad Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Thu, 6 Oct 2022 14:30:56 +0200 Subject: [PATCH 1/7] update to libp2p 0.48 --- Cargo.lock | 224 +++++++---------------------------------------------- Cargo.toml | 4 +- 2 files changed, 30 insertions(+), 198 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7f9113b..b613cd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,15 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "aho-corasick" -version = "0.7.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" -dependencies = [ - "memchr", -] - [[package]] name = "anyhow" version = "1.0.56" @@ -29,15 +20,6 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e22d1f4b888c298a027c99dc9048015fac177587de20fc30232a057dfbe24a21" -[[package]] -name = "atomic" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b88d82667eca772c4aa12f0f1348b3ae643424c8876448f3f7bd5787032e234c" -dependencies = [ - "autocfg", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -74,12 +56,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" -[[package]] -name = "bumpalo" -version = "3.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899" - [[package]] name = "byteorder" version = "1.4.3" @@ -92,12 +68,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" -[[package]] -name = "cc" -version = "1.0.73" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" - [[package]] name = "cfg-if" version = "1.0.0" @@ -366,12 +336,9 @@ checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" [[package]] name = "heck" -version = "0.3.3" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] +checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" [[package]] name = "hermit-abi" @@ -421,15 +388,6 @@ dependencies = [ "either", ] -[[package]] -name = "js-sys" -version = "0.3.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a38fc24e30fd564ce974c02bf1d337caddff65be6cc4735a1f7eab22a7440f04" -dependencies = [ - "wasm-bindgen", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -444,11 +402,10 @@ checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" [[package]] name = "libp2p" -version = "0.43.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e8570e25fa03d4385405dbeaf540ba00e3ee50942f03d84e1a8928a029f35f9" +checksum = "94c996fe5bfdba47f5a5af71d48ecbe8cec900b7b97391cc1d3ba1afb0e2d3b6" dependencies = [ - "atomic", "bytes", "futures", "futures-timer", @@ -460,14 +417,14 @@ dependencies = [ "libp2p-swarm-derive", "multiaddr", "parking_lot", - "pin-project 1.0.10", + "pin-project", "rand 0.7.3", "smallvec", ] [[package]] name = "libp2p-broadcast" -version = "0.9.1" +version = "0.10.0" dependencies = [ "fnv", "futures", @@ -476,9 +433,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.32.0" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9164ec41455856e8187addc870bb4fe1ea2ee28e1a9244831d449a2429b32c1a" +checksum = "b1fff5bd889c82a0aec668f2045edd066f559d4e5c40354e5a4c77ac00caac38" dependencies = [ "asn1_der", "bs58", @@ -494,11 +451,10 @@ dependencies = [ "multihash", "multistream-select", "parking_lot", - "pin-project 1.0.10", + "pin-project", "prost", "prost-build", "rand 0.8.5", - "ring", "rw-stream-sink", "sha2 0.10.2", "smallvec", @@ -510,9 +466,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.34.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53ab2d4eb8ef2966b10fdf859245cdd231026df76d3c6ed2cf9e418a8f688ec9" +checksum = "70ad2db60c06603606b54b58e4247e32efec87a93cb4387be24bf32926c600f2" dependencies = [ "either", "fnv", @@ -521,7 +477,7 @@ dependencies = [ "instant", "libp2p-core", "log", - "pin-project 1.0.10", + "pin-project", "rand 0.7.3", "smallvec", "thiserror", @@ -530,10 +486,11 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.27.1" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "daf2fe8c80b43561355f4d51875273b5b6dfbac37952e8f64b1270769305c9d7" +checksum = "1f02622b9dd150011b4eeec387f8bd013189a2f27da08ba363e7c6e606d77a48" dependencies = [ + "heck", "quote", "syn", ] @@ -628,7 +585,7 @@ dependencies = [ "bytes", "futures", "log", - "pin-project 1.0.10", + "pin-project", "smallvec", "unsigned-varint", ] @@ -643,12 +600,6 @@ dependencies = [ "libc", ] -[[package]] -name = "once_cell" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -694,33 +645,13 @@ dependencies = [ "indexmap", ] -[[package]] -name = "pin-project" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9615c18d31137579e9ff063499264ddc1278e7b1982757ebc111028c4d1dc909" -dependencies = [ - "pin-project-internal 0.4.29", -] - [[package]] name = "pin-project" version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58ad3879ad3baf4e44784bc6a718a8698867bb991f8ce24d1bcbe2cfb4c3a75e" dependencies = [ - "pin-project-internal 1.0.10", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "044964427019eed9d49d9d5bbce6047ef18f37100ea400912a9fa4a3523ab12a" -dependencies = [ - "proc-macro2", - "quote", - "syn", + "pin-project-internal", ] [[package]] @@ -797,9 +728,9 @@ dependencies = [ [[package]] name = "prost" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +checksum = "399c3c31cdec40583bb68f0b18403400d01ec4289c383aa047560439952c4dd7" dependencies = [ "bytes", "prost-derive", @@ -807,9 +738,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.9.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" +checksum = "7f835c582e6bd972ba8347313300219fed5bfa52caf175298d860b61ff6069bb" dependencies = [ "bytes", "heck", @@ -827,9 +758,9 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +checksum = "7345d5f0e08c0536d7ac7229952590239e77abf0a0100a1b1d890add6ea96364" dependencies = [ "anyhow", "itertools", @@ -840,9 +771,9 @@ dependencies = [ [[package]] name = "prost-types" -version = "0.9.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534b7a0e836e3c482d2693070f982e39e7611da9695d4d1f5a4b186b51faef0a" +checksum = "4dfaa718ad76a44b3415e6c4d53b17c8f99160dcb3a99b10470fce8ad43f6e3e" dependencies = [ "bytes", "prost", @@ -943,8 +874,6 @@ version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" dependencies = [ - "aho-corasick", - "memchr", "regex-syntax", ] @@ -963,29 +892,14 @@ dependencies = [ "winapi", ] -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - [[package]] name = "rw-stream-sink" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4da5fcb054c46f5a5dff833b129285a93d3f0179531735e6c866e8cc307d2020" +checksum = "26338f5e09bb721b85b135ea05af7767c90b52f6de4f087d4f4a3a9d64e7dc04" dependencies = [ "futures", - "pin-project 0.4.29", + "pin-project", "static_assertions", ] @@ -1043,12 +957,6 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "static_assertions" version = "1.1.0" @@ -1163,12 +1071,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-segmentation" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8820f5d777f6224dc4be3632222971ac30164d4a258d595640799554ebfd99" - [[package]] name = "unicode-xid" version = "0.2.2" @@ -1181,12 +1083,6 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "url" version = "2.2.2" @@ -1223,70 +1119,6 @@ version = "0.10.2+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" -[[package]] -name = "wasm-bindgen" -version = "0.2.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f1af7423d8588a3d840681122e72e6a24ddbcb3f0ec385cac0d12d24256c06" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b21c0df030f5a177f3cba22e9bc4322695ec43e7257d865302900290bcdedca" -dependencies = [ - "bumpalo", - "lazy_static", - "log", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4203d69e40a52ee523b2529a773d5ffc1dc0071801c87b3d270b471b80ed01" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa8a30d46208db204854cadbb5d4baf5fcf8071ba5bf48190c3e59937962ebc" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d958d035c4438e28c70e4321a2911302f10135ce78a9c7834c0cab4123d06a2" - -[[package]] -name = "web-sys" -version = "0.3.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c060b319f29dd25724f09a2ba1418f142f539b2be99fbf4d2d5a8f7330afb8eb" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - [[package]] name = "which" version = "4.2.5" diff --git a/Cargo.toml b/Cargo.toml index bae4028..9d4fcc4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-broadcast" -version = "0.9.1" +version = "0.10.0" authors = ["David Craven ", "Actyx AG"] edition = "2018" license = "MIT OR Apache-2.0" @@ -10,4 +10,4 @@ repository = "https://github.com/ipfs-rust/libp2p-broadcast" [dependencies] fnv = "1.0.7" futures = "0.3.21" -libp2p = { version = "0.43.0", default-features = false } +libp2p = { version = "0.48.0", default-features = false } From f278ed078f10d897f1a57cdfe0dae4690fbe4897 Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Tue, 18 Oct 2022 13:15:10 +0200 Subject: [PATCH 2/7] update to libp2p-0.49 and release 0.11.0 --- Cargo.lock | 25 ++++++++++++------------- Cargo.toml | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b613cd0..5e8e9fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -402,9 +402,9 @@ checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" [[package]] name = "libp2p" -version = "0.48.0" +version = "0.49.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94c996fe5bfdba47f5a5af71d48ecbe8cec900b7b97391cc1d3ba1afb0e2d3b6" +checksum = "ec878fda12ebec479186b3914ebc48ff180fa4c51847e11a1a68bf65249e02c1" dependencies = [ "bytes", "futures", @@ -418,13 +418,12 @@ dependencies = [ "multiaddr", "parking_lot", "pin-project", - "rand 0.7.3", "smallvec", ] [[package]] name = "libp2p-broadcast" -version = "0.10.0" +version = "0.11.0" dependencies = [ "fnv", "futures", @@ -433,9 +432,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.36.0" +version = "0.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1fff5bd889c82a0aec668f2045edd066f559d4e5c40354e5a4c77ac00caac38" +checksum = "799676bb0807c788065e57551c6527d461ad572162b0519d1958946ff9e0539d" dependencies = [ "asn1_der", "bs58", @@ -466,9 +465,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.39.0" +version = "0.40.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ad2db60c06603606b54b58e4247e32efec87a93cb4387be24bf32926c600f2" +checksum = "46d13df7c37807965d82930c0e4b04a659efcb6cca237373b206043db5398ecf" dependencies = [ "either", "fnv", @@ -478,7 +477,7 @@ dependencies = [ "libp2p-core", "log", "pin-project", - "rand 0.7.3", + "rand 0.8.5", "smallvec", "thiserror", "void", @@ -486,9 +485,9 @@ dependencies = [ [[package]] name = "libp2p-swarm-derive" -version = "0.30.0" +version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f02622b9dd150011b4eeec387f8bd013189a2f27da08ba363e7c6e606d77a48" +checksum = "a0eddc4497a8b5a506013c40e8189864f9c3a00db2b25671f428ae9007f3ba32" dependencies = [ "heck", "quote", @@ -578,9 +577,9 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "363a84be6453a70e63513660f4894ef815daf88e3356bffcda9ca27d810ce83b" +checksum = "9bc41247ec209813e2fd414d6e16b9d94297dacf3cd613fa6ef09cd4d9755c10" dependencies = [ "bytes", "futures", diff --git a/Cargo.toml b/Cargo.toml index 9d4fcc4..752963b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-broadcast" -version = "0.10.0" +version = "0.11.0" authors = ["David Craven ", "Actyx AG"] edition = "2018" license = "MIT OR Apache-2.0" @@ -10,4 +10,4 @@ repository = "https://github.com/ipfs-rust/libp2p-broadcast" [dependencies] fnv = "1.0.7" futures = "0.3.21" -libp2p = { version = "0.48.0", default-features = false } +libp2p = { version = "0.49.0" } From 1ad0e5464dfd27758022200148ccf6966d166a35 Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Wed, 30 Nov 2022 08:14:05 +0100 Subject: [PATCH 3/7] update libp2p 0.50 and release 0.12 --- Cargo.lock | 152 ++++++++++++++++++++++++++++++++++++++---------- Cargo.toml | 4 +- src/lib.rs | 41 +++++-------- src/protocol.rs | 2 +- 4 files changed, 141 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5e8e9fa..1cd8373 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -26,6 +26,24 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "base-x" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" + +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + +[[package]] +name = "base64ct" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" + [[package]] name = "bitflags" version = "1.3.2" @@ -74,6 +92,12 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "const-oid" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" + [[package]] name = "core2" version = "0.4.0" @@ -104,9 +128,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "3.2.1" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90f9d052967f590a76e62eb387bd0bbb1b000182c3cefe5364db6b7211651bc0" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" dependencies = [ "byteorder", "digest 0.9.0", @@ -121,6 +145,36 @@ version = "2.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" +[[package]] +name = "data-encoding-macro" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86927b7cd2fe88fa698b87404b287ab98d1a0063a34071d92e575b72d3029aca" +dependencies = [ + "data-encoding", + "data-encoding-macro-internal", +] + +[[package]] +name = "data-encoding-macro-internal" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5bbed42daaa95e780b60a50546aa345b8413a1e46f9a40a12907d3598f038db" +dependencies = [ + "data-encoding", + "syn", +] + +[[package]] +name = "der" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dd2ae565c0a381dde7fade45fce95984c568bdcb4700a4fdbe3175e0380b2f" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "digest" version = "0.9.0" @@ -402,19 +456,17 @@ checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" [[package]] name = "libp2p" -version = "0.49.0" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec878fda12ebec479186b3914ebc48ff180fa4c51847e11a1a68bf65249e02c1" +checksum = "2e0a0d2f693675f49ded13c5d510c48b78069e23cbd9108d7ccd59f6dc568819" dependencies = [ "bytes", "futures", "futures-timer", "getrandom 0.2.5", "instant", - "lazy_static", "libp2p-core", "libp2p-swarm", - "libp2p-swarm-derive", "multiaddr", "parking_lot", "pin-project", @@ -423,7 +475,7 @@ dependencies = [ [[package]] name = "libp2p-broadcast" -version = "0.11.0" +version = "0.12.0" dependencies = [ "fnv", "futures", @@ -432,9 +484,9 @@ dependencies = [ [[package]] name = "libp2p-core" -version = "0.37.0" +version = "0.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "799676bb0807c788065e57551c6527d461ad572162b0519d1958946ff9e0539d" +checksum = "b6a8fcd392ff67af6cc3f03b1426c41f7f26b6b9aff2dc632c1c56dd649e571f" dependencies = [ "asn1_der", "bs58", @@ -444,17 +496,18 @@ dependencies = [ "futures", "futures-timer", "instant", - "lazy_static", "log", "multiaddr", "multihash", "multistream-select", + "once_cell", "parking_lot", "pin-project", "prost", "prost-build", "rand 0.8.5", "rw-stream-sink", + "sec1", "sha2 0.10.2", "smallvec", "thiserror", @@ -465,9 +518,9 @@ dependencies = [ [[package]] name = "libp2p-swarm" -version = "0.40.1" +version = "0.41.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46d13df7c37807965d82930c0e4b04a659efcb6cca237373b206043db5398ecf" +checksum = "b2a35472fe3276b3855c00f1c032ea8413615e030256429ad5349cdf67c6e1a0" dependencies = [ "either", "fnv", @@ -483,17 +536,6 @@ dependencies = [ "void", ] -[[package]] -name = "libp2p-swarm-derive" -version = "0.30.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0eddc4497a8b5a506013c40e8189864f9c3a00db2b25671f428ae9007f3ba32" -dependencies = [ - "heck", - "quote", - "syn", -] - [[package]] name = "lock_api" version = "0.4.6" @@ -526,14 +568,14 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "multiaddr" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c580bfdd8803cce319b047d239559a22f809094aaea4ac13902a1fdcfcd4261" +checksum = "a4aebdb21e90f81d13ed01dc84123320838e53963c2ca94b60b305d3fa64f31e" dependencies = [ "arrayref", - "bs58", "byteorder", "data-encoding", + "multibase", "multihash", "percent-encoding", "serde", @@ -542,6 +584,17 @@ dependencies = [ "url", ] +[[package]] +name = "multibase" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b3539ec3c1f04ac9748a260728e855f261b4977f5c3406612c884564f329404" +dependencies = [ + "base-x", + "data-encoding", + "data-encoding-macro", +] + [[package]] name = "multihash" version = "0.16.1" @@ -577,9 +630,9 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "multistream-select" -version = "0.12.0" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bc41247ec209813e2fd414d6e16b9d94297dacf3cd613fa6ef09cd4d9755c10" +checksum = "c8552ab875c1313b97b8d20cb857b9fd63e2d1d6a0a1b53ce9821e575405f27a" dependencies = [ "bytes", "futures", @@ -599,6 +652,12 @@ dependencies = [ "libc", ] +[[package]] +name = "once_cell" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860" + [[package]] name = "opaque-debug" version = "0.3.0" @@ -676,6 +735,16 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + [[package]] name = "ppv-lite86" version = "0.2.16" @@ -908,6 +977,19 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "zeroize", +] + [[package]] name = "serde" version = "1.0.136" @@ -956,6 +1038,16 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2dd574626839106c320a323308629dcb1acfc96e32a8cba364ddc61ac23ee83" +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -1196,9 +1288,9 @@ checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" [[package]] name = "zeroize" -version = "1.3.0" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4756f7db3f7b5574938c3eb1c117038b8e07f95ee6718c0efad4ac21508f1efd" +checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" dependencies = [ "zeroize_derive", ] diff --git a/Cargo.toml b/Cargo.toml index 752963b..d51cc77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "libp2p-broadcast" -version = "0.11.0" +version = "0.12.0" authors = ["David Craven ", "Actyx AG"] edition = "2018" license = "MIT OR Apache-2.0" @@ -10,4 +10,4 @@ repository = "https://github.com/ipfs-rust/libp2p-broadcast" [dependencies] fnv = "1.0.7" futures = "0.3.21" -libp2p = { version = "0.49.0" } +libp2p = { version = "0.50.0" } diff --git a/src/lib.rs b/src/lib.rs index 9276d99..9680cb5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,7 @@ use std::task::{Context, Poll}; mod protocol; +use libp2p::swarm::derive_prelude::FromSwarm; pub use protocol::{BroadcastConfig, Topic}; #[derive(Clone, Debug, Eq, PartialEq)] @@ -139,33 +140,23 @@ impl NetworkBehaviour for Broadcast { Vec::new() } - fn inject_connection_established( - &mut self, - peer: &PeerId, - _connection_id: &ConnectionId, - _endpoint: &libp2p::core::ConnectedPoint, - _failed_addresses: Option<&Vec>, - other_established: usize, - ) { - if other_established == 0 { - self.inject_connected(peer) - } - } - - fn inject_connection_closed( - &mut self, - peer: &PeerId, - _: &ConnectionId, - _: &libp2p::core::ConnectedPoint, - _: ::Handler, - remaining_established: usize, - ) { - if remaining_established == 0 { - self.inject_disconnected(peer) + fn on_swarm_event(&mut self, event: FromSwarm) { + match event { + FromSwarm::ConnectionEstablished(c) => { + if c.other_established == 0 { + self.inject_connected(&c.peer_id); + } + } + FromSwarm::ConnectionClosed(c) => { + if c.remaining_established == 0 { + self.inject_disconnected(&c.peer_id); + } + } + _ => {} } } - fn inject_event(&mut self, peer: PeerId, _: ConnectionId, msg: HandlerEvent) { + fn on_connection_handler_event(&mut self, peer: PeerId, _: ConnectionId, msg: HandlerEvent) { use HandlerEvent::*; use Message::*; let ev = match msg { @@ -278,7 +269,7 @@ mod tests { }) => { if let Some(other) = self.connections.get(&peer_id) { let mut other = other.lock().unwrap(); - other.inject_event( + other.on_connection_handler_event( *self.peer_id(), ConnectionId::new(0), HandlerEvent::Rx(event), diff --git a/src/protocol.rs b/src/protocol.rs index 45b4cd0..e6dcee0 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -39,7 +39,7 @@ impl AsRef<[u8]> for Topic { } } -#[derive(Clone, Debug, PartialEq)] +#[derive(Clone, Debug, PartialEq, Eq)] pub enum Message { Subscribe(Topic), Broadcast(Topic, Arc<[u8]>), From c02291acbacd04cb642c727a39d32832d1729524 Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Wed, 30 Nov 2022 08:41:56 +0100 Subject: [PATCH 4/7] add protoc to CI --- .github/workflows/ci.yml | 163 ++++++++++++++++++++------------------- 1 file changed, 83 insertions(+), 80 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2e90b4..1606d88 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,35 +8,35 @@ jobs: fail-fast: false matrix: toolchain: - - rust: stable + - rust: stable #- rust: nightly platform: - - target: x86_64-unknown-linux-gnu - host: ubuntu-latest - cross: false - - - target: x86_64-apple-darwin - host: macos-latest - cross: false - - - target: x86_64-pc-windows-msvc - host: windows-latest - cross: false - - - target: armv7-linux-androideabi - host: ubuntu-latest - cross: true - - target: aarch64-linux-android - host: ubuntu-latest - cross: true - - - target: aarch64-apple-ios - host: macos-latest - cross: true - - # - target: wasm32-unknown-unknown - # host: ubuntu-latest - # cross: true + - target: x86_64-unknown-linux-gnu + host: ubuntu-latest + cross: false + + - target: x86_64-apple-darwin + host: macos-latest + cross: false + + - target: x86_64-pc-windows-msvc + host: windows-latest + cross: false + + - target: armv7-linux-androideabi + host: ubuntu-latest + cross: true + - target: aarch64-linux-android + host: ubuntu-latest + cross: true + + - target: aarch64-apple-ios + host: macos-latest + cross: true + + # - target: wasm32-unknown-unknown + # host: ubuntu-latest + # cross: true env: RUST_BACKTRACE: 1 CARGO_INCREMENTAL: 0 @@ -45,69 +45,72 @@ jobs: runs-on: ${{ matrix.platform.host }} steps: - - name: Checkout sources - uses: actions/checkout@v2 + - name: Checkout sources + uses: actions/checkout@v2 - - name: Cache cargo folder - uses: actions/cache@v1 - with: - path: ~/.cargo - key: ${{ matrix.platform.target }}-cargo-${{ matrix.toolchain.rust }} + - name: Cache cargo folder + uses: actions/cache@v1 + with: + path: ~/.cargo + key: ${{ matrix.platform.target }}-cargo-${{ matrix.toolchain.rust }} - - name: Install dependencies ubuntu - if: matrix.platform.host == 'ubuntu-latest' - run: sudo apt-get install llvm-dev + - name: Install Protoc + uses: arduino/setup-protoc@v1 - - name: Install dependencies macos - if: matrix.platform.host == 'macos-latest' - run: brew install llvm + - name: Install dependencies ubuntu + if: matrix.platform.host == 'ubuntu-latest' + run: sudo apt-get install llvm-dev - - name: Install dependencies windows - if: matrix.platform.host == 'windows-latest' - run: choco install llvm + - name: Install dependencies macos + if: matrix.platform.host == 'macos-latest' + run: brew install llvm - - name: Install rust toolchain - uses: hecrj/setup-rust-action@v1 - with: - rust-version: ${{ matrix.toolchain.rust }} - targets: ${{ matrix.platform.target }} + - name: Install dependencies windows + if: matrix.platform.host == 'windows-latest' + run: choco install llvm - - name: Install cargo-apk - if: contains(matrix.platform.target, 'android') - run: cargo install cargo-apk + - name: Install rust toolchain + uses: hecrj/setup-rust-action@v1 + with: + rust-version: ${{ matrix.toolchain.rust }} + targets: ${{ matrix.platform.target }} - - name: Build - if: contains(matrix.platform.target, 'android') == false - run: cargo build --all --target ${{ matrix.platform.target }} + - name: Install cargo-apk + if: contains(matrix.platform.target, 'android') + run: cargo install cargo-apk - - name: Build android - if: contains(matrix.platform.target, 'android') - run: cargo apk --target ${{ matrix.platform.target }} build --all + - name: Build + if: contains(matrix.platform.target, 'android') == false + run: cargo build --all --target ${{ matrix.platform.target }} - - name: Rust tests - if: matrix.platform.cross == false - run: cargo test --all + - name: Build android + if: contains(matrix.platform.target, 'android') + run: cargo apk --target ${{ matrix.platform.target }} build --all + + - name: Rust tests + if: matrix.platform.cross == false + run: cargo test --all lint-rust: runs-on: ubuntu-latest steps: - - name: Checkout sources - uses: actions/checkout@v2 - - - name: Cache cargo folder - uses: actions/cache@v1 - with: - path: ~/.cargo - key: lint-cargo - - - name: Install rust toolchain - uses: hecrj/setup-rust-action@v1 - with: - rust-version: stable - components: clippy, rustfmt - - - name: cargo fmt - run: cargo fmt --all -- --check - - - name: cargo clippy - run: cargo clippy --workspace --examples --tests -- -D warnings + - name: Checkout sources + uses: actions/checkout@v2 + + - name: Cache cargo folder + uses: actions/cache@v1 + with: + path: ~/.cargo + key: lint-cargo + + - name: Install rust toolchain + uses: hecrj/setup-rust-action@v1 + with: + rust-version: stable + components: clippy, rustfmt + + - name: cargo fmt + run: cargo fmt --all -- --check + + - name: cargo clippy + run: cargo clippy --workspace --examples --tests -- -D warnings From ecfb99606117b5e955717be5d96709fec8441085 Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Wed, 30 Nov 2022 09:36:51 +0100 Subject: [PATCH 5/7] use actions-rs jobs --- .github/workflows/ci.yml | 66 +++++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1606d88..361d8cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,13 +46,18 @@ jobs: runs-on: ${{ matrix.platform.host }} steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache cargo folder - uses: actions/cache@v1 + uses: actions/cache@v3 with: - path: ~/.cargo - key: ${{ matrix.platform.target }}-cargo-${{ matrix.toolchain.rust }} + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ matrix.platform.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install Protoc uses: arduino/setup-protoc@v1 @@ -70,14 +75,17 @@ jobs: run: choco install llvm - name: Install rust toolchain - uses: hecrj/setup-rust-action@v1 + uses: actions-rs/toolchain@v1 with: - rust-version: ${{ matrix.toolchain.rust }} - targets: ${{ matrix.platform.target }} + profile: minimal + toolchain: ${{ matrix.toolchain.rust }} + target: ${{ matrix.platform.target }} - name: Install cargo-apk if: contains(matrix.platform.target, 'android') - run: cargo install cargo-apk + uses: baptiste0928/cargo-install@bf6758885262d0e6f61089a9d8c8790d3ac3368f # v1.3.0 + with: + crate: cargo-apk - name: Build if: contains(matrix.platform.target, 'android') == false @@ -85,32 +93,54 @@ jobs: - name: Build android if: contains(matrix.platform.target, 'android') - run: cargo apk --target ${{ matrix.platform.target }} build --all + uses: actions-rs/cargo@v1 + with: + command: apk + args: -- build --target ${{ matrix.platform.target }} - name: Rust tests if: matrix.platform.cross == false - run: cargo test --all + uses: actions-rs/cargo@v1 + with: + command: test + args: --all lint-rust: runs-on: ubuntu-latest steps: - name: Checkout sources - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Cache cargo folder - uses: actions/cache@v1 + uses: actions/cache@v3 with: - path: ~/.cargo - key: lint-cargo + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ matrix.platform.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install rust toolchain - uses: hecrj/setup-rust-action@v1 + uses: actions-rs/toolchain@v1 with: - rust-version: stable + toolchain: ${{ matrix.toolchain.rust }} + target: ${{ matrix.platform.target }} + profile: minimal components: clippy, rustfmt + - name: Install Protoc + uses: arduino/setup-protoc@v1 + - name: cargo fmt - run: cargo fmt --all -- --check + uses: actions-rs/cargo@v1 + with: + command: fmt + args: --all -- --check - name: cargo clippy - run: cargo clippy --workspace --examples --tests -- -D warnings + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --workspace --examples --tests -- -D warnings From b3222d0a70a4bf22bdbcc19a8225b015c8e1cacb Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Wed, 30 Nov 2022 09:45:46 +0100 Subject: [PATCH 6/7] some fixes to CI setup --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 361d8cd..71b5ce5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -61,6 +61,8 @@ jobs: - name: Install Protoc uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies ubuntu if: matrix.platform.host == 'ubuntu-latest' @@ -120,18 +122,19 @@ jobs: ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ - key: ${{ matrix.platform.target }}-cargo-${{ hashFiles('**/Cargo.lock') }} + key: cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install rust toolchain uses: actions-rs/toolchain@v1 with: - toolchain: ${{ matrix.toolchain.rust }} - target: ${{ matrix.platform.target }} + toolchain: stable profile: minimal components: clippy, rustfmt - name: Install Protoc uses: arduino/setup-protoc@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: cargo fmt uses: actions-rs/cargo@v1 From 24c8132cf0c63e55c19f3acfb71b81cd6239edc9 Mon Sep 17 00:00:00 2001 From: Roland Kuhn Date: Wed, 30 Nov 2022 09:54:25 +0100 Subject: [PATCH 7/7] use actions-rs also for build --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 71b5ce5..ec07764 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,7 +91,10 @@ jobs: - name: Build if: contains(matrix.platform.target, 'android') == false - run: cargo build --all --target ${{ matrix.platform.target }} + uses: actions-rs/cargo@v1 + with: + command: build + args: --all --target ${{ matrix.platform.target }} - name: Build android if: contains(matrix.platform.target, 'android')