diff --git a/Cargo.lock b/Cargo.lock index fe4b0a28b5b9..104ab7257feb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -495,13 +495,13 @@ dependencies = [ [[package]] name = "axum" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08b108ad2665fa3f6e6a517c3d80ec3e77d224c47d605167aefaa5d7ef97fa48" +checksum = "1304eab461cf02bd70b083ed8273388f9724c549b316ba3d1e213ce0e9e7fb7e" dependencies = [ "async-trait", "axum-core", - "base64", + "base64 0.20.0", "bitflags", "bytes 1.3.0", "futures-util", @@ -519,7 +519,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sha-1 0.10.1", + "sha1", "sync_wrapper", "tokio", "tokio-tungstenite", @@ -531,9 +531,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79b8558f5a0581152dc94dcd289132a1d377494bdeafcd41869b3258e3e2ad92" +checksum = "f487e40dc9daee24d8a1779df88522f159a54a980f99cfbe43db0be0bd3444a8" dependencies = [ "async-trait", "bytes 1.3.0", @@ -593,6 +593,12 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +[[package]] +name = "base64" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ea22880d78093b0cbe17c89f64a7d457941e65759157ec6cb31a31d652b05e5" + [[package]] name = "base64ct" version = "1.5.3" @@ -1039,12 +1045,25 @@ checksum = "f6ed9c8b2d17acb8110c46f1da5bf4a696d745e1474a16db0cd2b49cd0249bf2" dependencies = [ "core2", "multibase", - "multihash", + "multihash 0.16.3", "serde", "serde_bytes", "unsigned-varint", ] +[[package]] +name = "cid" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9b68e3193982cd54187d71afdb2a271ad4cf8af157858e9cb911b91321de143" +dependencies = [ + "core2", + "multibase", + "multihash 0.17.0", + "serde", + "unsigned-varint", +] + [[package]] name = "cipher" version = "0.2.5" @@ -2306,7 +2325,7 @@ version = "8.0.0" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fil_actors_runtime_v8", "fvm_ipld_blockstore", "fvm_ipld_encoding 0.2.3", @@ -2324,7 +2343,7 @@ version = "9.0.3" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fil_actors_runtime_v9", "fvm_ipld_blockstore", "fvm_ipld_encoding 0.2.3", @@ -2342,7 +2361,7 @@ version = "8.0.0" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fil_actors_runtime_v8", "fvm_ipld_bitfield", "fvm_ipld_blockstore", @@ -2362,7 +2381,7 @@ version = "9.0.3" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fil_actors_runtime_v9", "fvm_ipld_bitfield", "fvm_ipld_blockstore", @@ -2384,7 +2403,7 @@ source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f240005970 dependencies = [ "anyhow", "byteorder", - "cid", + "cid 0.8.6", "fil_actors_runtime_v8", "fvm_ipld_amt", "fvm_ipld_bitfield", @@ -2408,7 +2427,7 @@ source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f240005970 dependencies = [ "anyhow", "byteorder", - "cid", + "cid 0.8.6", "fil_actors_runtime_v9", "fvm_ipld_amt", "fvm_ipld_bitfield", @@ -2420,7 +2439,7 @@ dependencies = [ "lazy_static", "libipld-core 0.14.0", "log", - "multihash", + "multihash 0.16.3", "num-derive", "num-traits", "rand 0.8.5", @@ -2433,7 +2452,7 @@ version = "9.0.3" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fil_actors_runtime_v9", "frc42_dispatch", "fvm_ipld_blockstore", @@ -2454,7 +2473,7 @@ version = "8.0.0" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fil_actors_runtime_v8", "fvm_ipld_blockstore", "fvm_ipld_encoding 0.2.3", @@ -2474,7 +2493,7 @@ version = "9.0.3" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fil_actors_runtime_v9", "fvm_ipld_blockstore", "fvm_ipld_encoding 0.2.3", @@ -2528,7 +2547,7 @@ version = "9.0.3" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fvm_ipld_blockstore", "fvm_ipld_encoding 0.2.3", "fvm_shared", @@ -2543,10 +2562,10 @@ version = "8.0.0" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "base64", + "base64 0.13.1", "blake2b_simd", "byteorder", - "cid", + "cid 0.8.6", "fil_actors_runtime_v9", "fvm_ipld_amt", "fvm_ipld_blockstore", @@ -2557,7 +2576,7 @@ dependencies = [ "itertools 0.10.5", "lazy_static", "log", - "multihash", + "multihash 0.16.3", "num-derive", "num-traits", "paste", @@ -2576,10 +2595,10 @@ version = "9.0.3" source = "git+https://github.com/ChainSafe/fil-actor-states#942818b811f2400059707c77754ca02e8443b514" dependencies = [ "anyhow", - "base64", + "base64 0.13.1", "blake2b_simd", "byteorder", - "cid", + "cid 0.8.6", "fvm_ipld_amt", "fvm_ipld_blockstore", "fvm_ipld_encoding 0.2.3", @@ -2588,7 +2607,7 @@ dependencies = [ "getrandom 0.2.8", "itertools 0.10.5", "log", - "multihash", + "multihash 0.16.3", "num", "num-derive", "num-traits", @@ -2715,8 +2734,8 @@ dependencies = [ "anyhow", "assert_cmd", "atty", - "base64", - "cid", + "base64 0.13.1", + "cid 0.8.6", "dialoguer", "directories", "fil_actor_miner_v8", @@ -2787,9 +2806,9 @@ dependencies = [ "anes", "anyhow", "atty", - "base64", + "base64 0.13.1", "chrono", - "cid", + "cid 0.8.6", "ctrlc", "daemonize-me", "dialoguer", @@ -2860,7 +2879,7 @@ name = "forest_actor_interface" version = "0.2.0" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fil_actor_account_v8", "fil_actor_account_v9", "fil_actor_cron_v8", @@ -2910,7 +2929,7 @@ dependencies = [ "ahash 0.8.2", "anyhow", "async-trait", - "base64", + "base64 0.13.1", "bls-signatures", "byteorder", "forest_encoding", @@ -2929,9 +2948,9 @@ dependencies = [ name = "forest_blocks" version = "0.2.0" dependencies = [ - "base64", + "base64 0.13.1", "byteorder", - "cid", + "cid 0.8.6", "derive_builder", "forest_beacon", "forest_crypto", @@ -2965,7 +2984,7 @@ dependencies = [ "blake2b_simd", "bls-signatures", "byteorder", - "cid", + "cid 0.8.6", "digest 0.10.6", "flume", "forest_actor_interface", @@ -2988,8 +3007,8 @@ dependencies = [ "fvm_ipld_encoding 0.2.3", "fvm_shared", "log", - "lru", - "multihash", + "lru 0.9.0", + "multihash 0.16.3", "num-traits", "once_cell", "prometheus", @@ -3005,8 +3024,8 @@ version = "0.2.1" dependencies = [ "anyhow", "async-trait", - "base64", - "cid", + "base64 0.13.1", + "cid 0.8.6", "flume", "forest_actor_interface", "forest_beacon", @@ -3036,7 +3055,7 @@ dependencies = [ "hex", "lazy_static", "log", - "lru", + "lru 0.9.0", "nonempty", "num-bigint", "num-traits", @@ -3058,10 +3077,10 @@ dependencies = [ "anyhow", "atty", "axum", - "base64", + "base64 0.13.1", "byte-unit", "chrono", - "cid", + "cid 0.8.6", "console-subscriber", "directories", "fil_actor_miner_v8", @@ -3132,7 +3151,7 @@ name = "forest_crypto" version = "0.6.0" dependencies = [ "anyhow", - "base64", + "base64 0.13.1", "bls-signatures", "forest_encoding", "fvm_ipld_encoding 0.2.3", @@ -3151,15 +3170,17 @@ name = "forest_db" version = "0.2.0" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fvm_ipld_blockstore", "lazy_static", - "libipld", + "libipld 0.14.0", "libp2p-bitswap", + "multihash 0.16.3", "num_cpus", "parity-db", "parking_lot 0.12.1", "prometheus", + "rand 0.8.5", "rocksdb", "serde", "tempfile", @@ -3172,7 +3193,7 @@ version = "0.2.0" dependencies = [ "anyhow", "async-trait", - "cid", + "cid 0.8.6", "forest_actor_interface", "forest_blocks", "forest_chain", @@ -3215,7 +3236,7 @@ version = "0.2.0" dependencies = [ "anyhow", "async-trait", - "cid", + "cid 0.8.6", "fil_actors_runtime_v9", "forest_actor_interface", "forest_beacon", @@ -3249,8 +3270,8 @@ name = "forest_fil_types" version = "0.4.0" dependencies = [ "anyhow", - "base64", - "cid", + "base64 0.13.1", + "cid 0.8.6", "filecoin-proofs-api", "fvm_ipld_encoding 0.2.3", "fvm_shared", @@ -3266,7 +3287,7 @@ name = "forest_genesis" version = "0.2.0" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "forest_blocks", "forest_chain", "forest_db", @@ -3301,7 +3322,7 @@ dependencies = [ "ahash 0.8.2", "anyhow", "byteorder", - "cid", + "cid 0.8.6", "fil_actors_runtime_v9", "forest_actor_interface", "forest_blocks", @@ -3331,18 +3352,18 @@ dependencies = [ "anyhow", "async-recursion", "async-trait", - "cid", + "cid 0.8.6", "forest_db", "forest_json", "forest_utils", "fvm_ipld_encoding 0.2.3", "fvm_shared", "indexmap", - "libipld", + "libipld 0.14.0", "libipld-core 0.14.0", - "libipld-macro", + "libipld-macro 0.14.0", "multibase", - "multihash", + "multihash 0.16.3", "quickcheck", "quickcheck_macros", "serde", @@ -3357,8 +3378,8 @@ version = "0.2.0" dependencies = [ "anyhow", "arbitrary", - "base64", - "cid", + "base64 0.13.1", + "cid 0.8.6", "cs_serde_bytes", "data-encoding", "data-encoding-macro", @@ -3369,7 +3390,7 @@ dependencies = [ "fvm", "fvm_ipld_encoding 0.2.3", "fvm_shared", - "multihash", + "multihash 0.16.3", "num-bigint", "quickcheck", "quickcheck_macros", @@ -3383,7 +3404,7 @@ version = "0.2.0" dependencies = [ "anyhow", "argon2", - "base64", + "base64 0.13.1", "bls-signatures", "forest_encoding", "forest_json", @@ -3408,7 +3429,7 @@ version = "0.2.0" dependencies = [ "ahash 0.8.2", "anyhow", - "cid", + "cid 0.8.6", "forest_db", "forest_encoding", "forest_utils", @@ -3427,7 +3448,7 @@ dependencies = [ "anyhow", "async-trait", "bytes 1.3.0", - "cid", + "cid 0.8.6", "flume", "fnv", "forest_blocks", @@ -3447,11 +3468,11 @@ dependencies = [ "fvm_ipld_encoding 0.2.3", "fvm_shared", "lazy_static", - "libipld", + "libipld 0.14.0", "libp2p", "libp2p-bitswap", "log", - "multihash", + "multihash 0.16.3", "pin-project-lite", "prometheus", "quickcheck", @@ -3471,8 +3492,8 @@ name = "forest_message" version = "0.8.0" dependencies = [ "anyhow", - "base64", - "cid", + "base64 0.13.1", + "cid 0.8.6", "forest_encoding", "fvm", "fvm_ipld_encoding 0.2.3", @@ -3491,7 +3512,7 @@ dependencies = [ "anyhow", "async-trait", "blake2b_simd", - "cid", + "cid 0.8.6", "flume", "forest_blocks", "forest_chain", @@ -3513,7 +3534,7 @@ dependencies = [ "fvm_shared", "libsecp256k1", "log", - "lru", + "lru 0.9.0", "num-rational", "num-traits", "rand 0.8.5", @@ -3577,9 +3598,9 @@ version = "0.2.0" dependencies = [ "anyhow", "axum", - "base64", + "base64 0.13.1", "bls-signatures", - "cid", + "cid 0.8.6", "crossbeam", "fil_actor_miner_v8", "flume", @@ -3634,7 +3655,7 @@ version = "0.2.0" dependencies = [ "anyhow", "chrono", - "cid", + "cid 0.8.6", "flume", "forest_actor_interface", "forest_beacon", @@ -3692,7 +3713,7 @@ dependencies = [ "anyhow", "blake2b_simd", "byteorder", - "cid", + "cid 0.8.6", "fil_actors_runtime_v9", "filecoin-proofs-api", "forest_actor_interface", @@ -3717,7 +3738,7 @@ dependencies = [ "fvm_ipld_encoding 0.2.3", "fvm_shared", "lazy_static", - "lru", + "lru 0.9.0", "num-traits", "once_cell", "prometheus", @@ -3731,7 +3752,7 @@ dependencies = [ name = "forest_state_migration" version = "0.2.0" dependencies = [ - "cid", + "cid 0.8.6", "crossbeam-channel", "fvm", "fvm_ipld_blockstore", @@ -3748,7 +3769,7 @@ name = "forest_statediff" version = "0.2.0" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "colored", "directories", "fil_actor_account_v9", @@ -3782,8 +3803,8 @@ name = "forest_test_utils" version = "0.2.0" dependencies = [ "anyhow", - "base64", - "cid", + "base64 0.13.1", + "cid 0.8.6", "forest_blocks", "forest_chain", "forest_crypto", @@ -3801,7 +3822,7 @@ dependencies = [ "anyhow", "async-trait", "atty", - "cid", + "cid 0.8.6", "const_format", "digest 0.10.6", "forest_encoding", @@ -4041,7 +4062,7 @@ dependencies = [ "anyhow", "blake2b_simd", "byteorder", - "cid", + "cid 0.8.6", "derive-getters", "derive_builder", "derive_more", @@ -4054,7 +4075,7 @@ dependencies = [ "fvm_shared", "lazy_static", "log", - "multihash", + "multihash 0.16.3", "num-derive", "num-traits", "num_cpus", @@ -4086,7 +4107,7 @@ checksum = "48d09e5aa7de45452676d18fcb70b750acd65faae7a4fe18fe784b4c85f869fb" dependencies = [ "ahash 0.7.6", "anyhow", - "cid", + "cid 0.8.6", "fvm_ipld_blockstore", "fvm_ipld_encoding 0.2.3", "itertools 0.10.5", @@ -4114,8 +4135,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "688239a96199577f6705a3f9689abfd795f867f91f5847bc7e236017cc672df7" dependencies = [ "anyhow", - "cid", - "multihash", + "cid 0.8.6", + "multihash 0.16.3", ] [[package]] @@ -4124,7 +4145,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0af5e410b349533e8b1a2b46a7ca3d66cd68c53a477e2cf3d005845c1a346428" dependencies = [ - "cid", + "cid 0.8.6", "futures", "fvm_ipld_blockstore", "fvm_ipld_encoding 0.2.3", @@ -4140,10 +4161,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fa1ff5ba581625ab38cf2829fbd04ac232c6277466fdbe0270b42dcb976902d5" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "cs_serde_bytes", "fvm_ipld_blockstore", - "multihash", + "multihash 0.16.3", "serde", "serde_ipld_dagcbor", "serde_repr", @@ -4158,9 +4179,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "189214585b1dc3c2a92682aa175cce1991c1a09542e5338c400d00c15b706142" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "fvm_ipld_blockstore", - "multihash", + "multihash 0.16.3", "serde", "serde_ipld_dagcbor", "serde_repr", @@ -4176,13 +4197,13 @@ checksum = "65b5c939897aa1bfd63e7cb9c458ba10689371af3278ff20d66c6f8ca152c6c0" dependencies = [ "anyhow", "byteorder", - "cid", + "cid 0.8.6", "cs_serde_bytes", "forest_hash_utils", "fvm_ipld_blockstore", "fvm_ipld_encoding 0.2.3", "libipld-core 0.13.1", - "multihash", + "multihash 0.16.3", "once_cell", "serde", "sha2 0.10.6", @@ -4195,7 +4216,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19d6b29114b9cbdee7ccf7540bdda6657af7fa91666e2489c4d415a7f0706748" dependencies = [ - "cid", + "cid 0.8.6", "fvm_ipld_encoding 0.2.3", "fvm_shared", "lazy_static", @@ -4215,7 +4236,7 @@ dependencies = [ "blake2b_simd", "bls-signatures", "byteorder", - "cid", + "cid 0.8.6", "cs_serde_bytes", "data-encoding", "data-encoding-macro", @@ -4225,7 +4246,7 @@ dependencies = [ "lazy_static", "libsecp256k1", "log", - "multihash", + "multihash 0.16.3", "num-bigint", "num-derive", "num-integer", @@ -4411,13 +4432,22 @@ dependencies = [ "ahash 0.7.6", ] +[[package]] +name = "hashbrown" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" +dependencies = [ + "ahash 0.8.2", +] + [[package]] name = "hdrhistogram" version = "7.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f19b9f54f7c7f55e31401bb647626ce0cf0f67b0004982ce815b3ee72a02aa8" dependencies = [ - "base64", + "base64 0.13.1", "byteorder", "flate2", "nom", @@ -4890,7 +4920,7 @@ version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09f4f04699947111ec1733e71778d763555737579e44b85844cae8e1940a1828" dependencies = [ - "base64", + "base64 0.13.1", "pem", "ring", "serde", @@ -4938,13 +4968,27 @@ dependencies = [ "libipld-cbor-derive", "libipld-core 0.14.0", "libipld-json", - "libipld-macro", + "libipld-macro 0.14.0", "log", - "multihash", + "multihash 0.16.3", "parking_lot 0.12.1", "thiserror", ] +[[package]] +name = "libipld" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a20e38e0ad9a2fd600476691fa0780421931a198279985e398a3a0851903e1b2" +dependencies = [ + "fnv", + "libipld-core 0.15.0", + "libipld-macro 0.15.0", + "log", + "multihash 0.17.0", + "thiserror", +] + [[package]] name = "libipld-cbor" version = "0.14.0" @@ -4976,10 +5020,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbdd758764f9680a818af33c31db733eb7c45224715d8816b9dcf0548c75f7c5" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "core2", "multibase", - "multihash", + "multihash 0.16.3", "serde", "thiserror", ] @@ -4991,14 +5035,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d44790246ec6b7314cba745992c23d479d018073e66d49ae40ae1b64e5dd8eb5" dependencies = [ "anyhow", - "cid", + "cid 0.8.6", "core2", "multibase", - "multihash", + "multihash 0.16.3", "serde", "thiserror", ] +[[package]] +name = "libipld-core" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7a704ba3b25dee9e7a2361fae2c7c19defae2a92e69ae96ffb203996705cd7c" +dependencies = [ + "anyhow", + "cid 0.9.0", + "core2", + "multibase", + "multihash 0.17.0", + "thiserror", +] + [[package]] name = "libipld-json" version = "0.14.0" @@ -5006,7 +5064,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "18aa481a87f084d98473dd9ece253a9569c762b75f6bbba8217d54e48c9d63b3" dependencies = [ "libipld-core 0.14.0", - "multihash", + "multihash 0.16.3", "serde", "serde_json", ] @@ -5020,6 +5078,15 @@ dependencies = [ "libipld-core 0.14.0", ] +[[package]] +name = "libipld-macro" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c7ccd89e54f2796cf3f99aabeea7a7751d418df504926544f28348d3c890c7" +dependencies = [ + "libipld-core 0.15.0", +] + [[package]] name = "libloading" version = "0.7.4" @@ -5077,14 +5144,14 @@ dependencies = [ [[package]] name = "libp2p-bitswap" -version = "0.24.0" -source = "git+https://github.com/hanabi1224/libp2p-bitswap?branch=forest-libp2p@0.50#6f14bc98846abb4a7e1ee8739d199a55bcfcb441" +version = "0.25.0" +source = "git+https://github.com/ipfs-rust/libp2p-bitswap?rev=refs/pull/42/head#55ea687df0223acd97f81acc8992c9a97cf440eb" dependencies = [ "async-trait", "fnv", "futures", "lazy_static", - "libipld", + "libipld 0.15.0", "libp2p", "prometheus", "prost 0.11.5", @@ -5110,7 +5177,7 @@ dependencies = [ "instant", "log", "multiaddr", - "multihash", + "multihash 0.16.3", "multistream-select", "once_cell", "parking_lot 0.12.1", @@ -5149,7 +5216,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a173171c71c29bb156f98886c7c4824596de3903dadf01e2e79d2ccdcf38cd9f" dependencies = [ "asynchronous-codec", - "base64", + "base64 0.13.1", "byteorder", "bytes 1.3.0", "fnv", @@ -5184,7 +5251,7 @@ dependencies = [ "libp2p-core", "libp2p-swarm", "log", - "lru", + "lru 0.8.1", "prost 0.11.5", "prost-build", "prost-codec", @@ -5435,7 +5502,7 @@ dependencies = [ "libp2p-core", "libp2p-noise", "log", - "multihash", + "multihash 0.16.3", "prost 0.11.5", "prost-build", "prost-codec", @@ -5485,7 +5552,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" dependencies = [ "arrayref", - "base64", + "base64 0.13.1", "digest 0.9.0", "hmac-drbg", "libsecp256k1-core", @@ -5603,6 +5670,15 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "lru" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71e7d46de488603ffdd5f30afbc64fbba2378214a2c3a2fb83abf3d33126df17" +dependencies = [ + "hashbrown 0.13.1", +] + [[package]] name = "lru-cache" version = "0.1.2" @@ -5835,7 +5911,7 @@ dependencies = [ "byteorder", "data-encoding", "multibase", - "multihash", + "multihash 0.16.3", "percent-encoding", "serde", "static_assertions", @@ -5874,6 +5950,17 @@ dependencies = [ "unsigned-varint", ] +[[package]] +name = "multihash" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835d6ff01d610179fbce3de1694d007e500bf33a7f29689838941d6bf783ae40" +dependencies = [ + "core2", + "multihash-derive", + "unsigned-varint", +] + [[package]] name = "multihash-derive" version = "0.8.1" @@ -6497,7 +6584,7 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "03c64931a1a212348ec4f3b4362585eca7159d0d09cbdf4a7f74f02173596fd4" dependencies = [ - "base64", + "base64 0.13.1", ] [[package]] @@ -7173,9 +7260,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" dependencies = [ "aho-corasick", "memchr", @@ -7218,7 +7305,7 @@ version = "0.11.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "68cc60575865c7831548863cc02356512e3f1dc2f3f82cb837d7fc4cc8f3c97c" dependencies = [ - "base64", + "base64 0.13.1", "bytes 1.3.0", "encoding_rs", "futures-core", @@ -7419,7 +7506,7 @@ dependencies = [ "attohttpc", "aws-creds", "aws-region", - "base64", + "base64 0.13.1", "cfg-if 1.0.0", "hex", "hmac 0.12.1", @@ -7502,7 +7589,7 @@ version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" dependencies = [ - "base64", + "base64 0.13.1", "log", "ring", "sct 0.6.1", @@ -7539,7 +7626,7 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0864aeff53f8c05aa08d86e5ef839d3dfcf07aeba2db32f12db0ef716e87bd55" dependencies = [ - "base64", + "base64 0.13.1", ] [[package]] @@ -7604,12 +7691,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "lazy_static", - "windows-sys 0.36.1", + "windows-sys 0.42.0", ] [[package]] @@ -7756,7 +7842,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1e23de7a4a18dff77ab9531f279a882500b8cf3549fde044d4e10481b411f1e" dependencies = [ "cbor4ii", - "cid", + "cid 0.8.6", "scopeguard", "serde", ] @@ -7831,7 +7917,7 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25bf4a5a814902cd1014dbccfa4d4560fb8432c779471e96e035602519f82eef" dependencies = [ - "base64", + "base64 0.13.1", "chrono", "hex", "indexmap", @@ -7857,9 +7943,9 @@ dependencies = [ name = "serialization_tests" version = "0.1.0" dependencies = [ - "base64", + "base64 0.13.1", "bls-signatures", - "cid", + "cid 0.8.6", "forest_blocks", "forest_encoding", "forest_json", @@ -7885,10 +7971,10 @@ dependencies = [ ] [[package]] -name = "sha-1" -version = "0.10.1" +name = "sha1" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5058ada175748e33390e40e872bd0fe59a19f265d0158daa551c5a88a76009c" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" dependencies = [ "cfg-if 1.0.0", "cpufeatures", @@ -8340,7 +8426,7 @@ version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" dependencies = [ - "base64", + "base64 0.13.1", "crc", "lazy_static", "md-5", @@ -8639,9 +8725,9 @@ dependencies = [ [[package]] name = "tokio-tungstenite" -version = "0.17.2" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f714dd15bead90401d77e04243611caec13726c2408afd5b31901dfcdcb3b181" +checksum = "54319c93411147bced34cb5609a80e0a8e44c5999c93903a81cd866630ec0bfd" dependencies = [ "futures-util", "log", @@ -8682,7 +8768,7 @@ dependencies = [ "async-stream", "async-trait", "axum", - "base64", + "base64 0.13.1", "bytes 1.3.0", "futures-core", "futures-util", @@ -8932,18 +9018,18 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "tungstenite" -version = "0.17.3" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e27992fd6a8c29ee7eef28fc78349aa244134e10ad447ce3b9f0ac0ed0fa4ce0" +checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788" dependencies = [ - "base64", + "base64 0.13.1", "byteorder", "bytes 1.3.0", "http", "httparse", "log", "rand 0.8.5", - "sha-1 0.10.1", + "sha1", "thiserror", "url", "utf-8", @@ -8956,7 +9042,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" dependencies = [ "async-trait", - "base64", + "base64 0.13.1", "futures", "log", "md-5", @@ -9540,7 +9626,7 @@ dependencies = [ "rustls 0.19.1", "sec1", "serde", - "sha-1 0.9.8", + "sha-1", "sha2 0.9.9", "signature", "subtle", @@ -9639,7 +9725,7 @@ dependencies = [ "log", "rtcp", "rtp", - "sha-1 0.9.8", + "sha-1", "subtle", "thiserror", "tokio", @@ -9954,7 +10040,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" dependencies = [ "asn1-rs 0.3.1", - "base64", + "base64 0.13.1", "data-encoding", "der-parser 7.0.0", "lazy_static", @@ -9973,7 +10059,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" dependencies = [ "asn1-rs 0.5.1", - "base64", + "base64 0.13.1", "data-encoding", "der-parser 8.1.0", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 6435418bff58..9e1dda0bfb16 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,12 +101,13 @@ libipld = { version = "0.14", default-features = false, features = ["dag-cbor", libipld-core = "0.14" libipld-macro = "0.14" libp2p = { version = "0.50", default-features = false } -libp2p-bitswap.branch = "forest-libp2p@0.50" -libp2p-bitswap.features = ["compat"] -libp2p-bitswap.git = "https://github.com/hanabi1224/libp2p-bitswap" +# FIXME: use `crate.io` version once changes are merged and released +libp2p-bitswap = { git = "https://github.com/ipfs-rust/libp2p-bitswap", rev = "refs/pull/42/head", features = [ + "compat", +] } libsecp256k1 = "0.7" log = "0.4" -lru = "0.8" +lru = "0.9" multibase = "0.9" multihash = "0.16" nonempty = "0.8.0" diff --git a/node/db/Cargo.toml b/node/db/Cargo.toml index aab778b3d968..3649d030c219 100644 --- a/node/db/Cargo.toml +++ b/node/db/Cargo.toml @@ -37,4 +37,6 @@ serde = { workspace = true, features = ["derive"] } thiserror.workspace = true [dev-dependencies] +multihash.workspace = true +rand.workspace = true tempfile.workspace = true diff --git a/node/db/src/lib.rs b/node/db/src/lib.rs index 94ffca0f0e31..49274758f279 100644 --- a/node/db/src/lib.rs +++ b/node/db/src/lib.rs @@ -133,3 +133,45 @@ pub trait DBStatistics { None } } + +// FIXME: We should propose `cid@0.9` upgrade to `fvm_ipld_blockstore` to match `libp2p_bitswap` +/// Temporary workaround for `cid` version mismatch in upstream `libp2p_bitswap` and `fvm_ipld_blockstore` crates +pub(crate) trait CidCompat { + fn compat(&self) -> libipld::Cid; +} + +impl CidCompat for libp2p_bitswap::libipld::Cid { + fn compat(&self) -> libipld::Cid { + libipld::Cid::read_bytes(self.to_bytes().as_slice()).expect("Infallible") + } +} + +/// Temporary workaround for `cid` version mismatch in upstream `libp2p_bitswap` and `fvm_ipld_blockstore` crates +pub trait CidCompatBitswap { + fn compat(&self) -> libp2p_bitswap::libipld::Cid; +} + +impl CidCompatBitswap for libipld::Cid { + fn compat(&self) -> libp2p_bitswap::libipld::Cid { + libp2p_bitswap::libipld::Cid::read_bytes(self.to_bytes().as_slice()).expect("Infallible") + } +} + +#[cfg(test)] +mod tests { + use super::*; + use multihash::MultihashDigest; + use rand::{rngs::OsRng, RngCore}; + + #[test] + fn test_cid_compat_roundtrip() { + const DAG_CBOR: u64 = 0x71; + + let mut bytes = [0; 1024]; + OsRng.fill_bytes(&mut bytes); + let cid = libipld::Cid::new_v1(DAG_CBOR, multihash::Code::Blake2b256.digest(&bytes)); + + assert_eq!(cid.to_string(), cid.compat().to_string()); + assert_eq!(cid.compat().to_string(), cid.compat().compat().to_string()); + } +} diff --git a/node/db/src/memory.rs b/node/db/src/memory.rs index d4056b417bee..d95204e9f7a4 100644 --- a/node/db/src/memory.rs +++ b/node/db/src/memory.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0, MIT use crate::utils::bitswap_missing_blocks; +use crate::CidCompat; use super::{Error, Store}; use anyhow::Result; @@ -76,21 +77,24 @@ impl Blockstore for MemoryDB { } impl BitswapStore for MemoryDB { - type Params = libipld::DefaultParams; + type Params = libp2p_bitswap::libipld::DefaultParams; - fn contains(&mut self, cid: &Cid) -> Result { + fn contains(&mut self, cid: &libp2p_bitswap::libipld::Cid) -> Result { Ok(self.exists(cid.to_bytes())?) } - fn get(&mut self, cid: &Cid) -> Result>> { - Blockstore::get(self, cid) + fn get(&mut self, cid: &libp2p_bitswap::libipld::Cid) -> Result>> { + Blockstore::get(self, &cid.compat()) } - fn insert(&mut self, block: &libipld::Block) -> Result<()> { - self.put_keyed(block.cid(), block.data()) + fn insert(&mut self, block: &libp2p_bitswap::libipld::Block) -> Result<()> { + self.put_keyed(&block.cid().compat(), block.data()) } - fn missing_blocks(&mut self, cid: &Cid) -> Result> { + fn missing_blocks( + &mut self, + cid: &libp2p_bitswap::libipld::Cid, + ) -> Result> { bitswap_missing_blocks::<_, Self::Params>(self, cid) } } diff --git a/node/db/src/parity_db.rs b/node/db/src/parity_db.rs index 3b96893fd1f1..a26144f8be54 100644 --- a/node/db/src/parity_db.rs +++ b/node/db/src/parity_db.rs @@ -4,7 +4,7 @@ use super::errors::Error; use crate::parity_db_config::ParityDbConfig; use crate::utils::bitswap_missing_blocks; -use crate::{DBStatistics, Store}; +use crate::{CidCompat, DBStatistics, Store}; use anyhow::anyhow; use cid::Cid; use fvm_ipld_blockstore::Blockstore; @@ -132,21 +132,27 @@ impl Blockstore for ParityDb { impl BitswapStore for ParityDb { /// `fvm_ipld_encoding::DAG_CBOR(0x71)` is covered by [`libipld::DefaultParams`] /// under feature `dag-cbor` - type Params = libipld::DefaultParams; + type Params = libp2p_bitswap::libipld::DefaultParams; - fn contains(&mut self, cid: &Cid) -> anyhow::Result { + fn contains(&mut self, cid: &libp2p_bitswap::libipld::Cid) -> anyhow::Result { Ok(self.exists(cid.to_bytes())?) } - fn get(&mut self, cid: &Cid) -> anyhow::Result>> { - Blockstore::get(self, cid) + fn get(&mut self, cid: &libp2p_bitswap::libipld::Cid) -> anyhow::Result>> { + Blockstore::get(self, &cid.compat()) } - fn insert(&mut self, block: &libipld::Block) -> anyhow::Result<()> { - self.put_keyed(block.cid(), block.data()) + fn insert( + &mut self, + block: &libp2p_bitswap::libipld::Block, + ) -> anyhow::Result<()> { + self.put_keyed(&block.cid().compat(), block.data()) } - fn missing_blocks(&mut self, cid: &Cid) -> anyhow::Result> { + fn missing_blocks( + &mut self, + cid: &libp2p_bitswap::libipld::Cid, + ) -> anyhow::Result> { bitswap_missing_blocks::<_, Self::Params>(self, cid) } } diff --git a/node/db/src/rocks.rs b/node/db/src/rocks.rs index c81bc01ca1e8..f964c7ad9070 100644 --- a/node/db/src/rocks.rs +++ b/node/db/src/rocks.rs @@ -4,6 +4,7 @@ use super::errors::Error; use super::Store; use crate::rocks_config::RocksDbConfig; +use crate::CidCompat; use crate::{metrics, utils::bitswap_missing_blocks, DBStatistics}; use anyhow::anyhow; use cid::Cid; @@ -300,21 +301,27 @@ impl Blockstore for RocksDb { impl BitswapStore for RocksDb { /// `fvm_ipld_encoding::DAG_CBOR(0x71)` is covered by [`libipld::DefaultParams`] /// under feature `dag-cbor` - type Params = libipld::DefaultParams; + type Params = libp2p_bitswap::libipld::DefaultParams; - fn contains(&mut self, cid: &Cid) -> anyhow::Result { + fn contains(&mut self, cid: &libp2p_bitswap::libipld::Cid) -> anyhow::Result { Ok(self.exists(cid.to_bytes())?) } - fn get(&mut self, cid: &Cid) -> anyhow::Result>> { - Blockstore::get(self, cid) + fn get(&mut self, cid: &libp2p_bitswap::libipld::Cid) -> anyhow::Result>> { + Blockstore::get(self, &cid.compat()) } - fn insert(&mut self, block: &libipld::Block) -> anyhow::Result<()> { - self.put_keyed(block.cid(), block.data()) + fn insert( + &mut self, + block: &libp2p_bitswap::libipld::Block, + ) -> anyhow::Result<()> { + self.put_keyed(&block.cid().compat(), block.data()) } - fn missing_blocks(&mut self, cid: &Cid) -> anyhow::Result> { + fn missing_blocks( + &mut self, + cid: &libp2p_bitswap::libipld::Cid, + ) -> anyhow::Result> { bitswap_missing_blocks::<_, Self::Params>(self, cid) } } diff --git a/node/db/src/utils.rs b/node/db/src/utils.rs index ab9307885fe0..a630ddb0d5e9 100644 --- a/node/db/src/utils.rs +++ b/node/db/src/utils.rs @@ -1,9 +1,9 @@ // Copyright 2019-2022 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT -use cid::Cid; +use crate::*; use fvm_ipld_blockstore::Blockstore; -use libipld::{prelude::*, store::StoreParams, Ipld}; +use libp2p_bitswap::libipld::{prelude::*, store::StoreParams, Block, Cid, Ipld}; pub(super) fn bitswap_missing_blocks( bs: &mut BS, @@ -15,8 +15,8 @@ where let mut stack = vec![*cid]; let mut missing = vec![]; while let Some(cid) = stack.pop() { - if let Some(data) = bs.get(&cid)? { - let block = libipld::Block::

::new_unchecked(cid, data); + if let Some(data) = bs.get(&cid.compat())? { + let block = Block::

::new_unchecked(cid, data); block.references(&mut stack)?; } else { missing.push(cid); diff --git a/node/forest_libp2p/src/behaviour.rs b/node/forest_libp2p/src/behaviour.rs index 03393fd98bf3..fc80848a8ace 100644 --- a/node/forest_libp2p/src/behaviour.rs +++ b/node/forest_libp2p/src/behaviour.rs @@ -11,8 +11,8 @@ use crate::{ hello::{HelloCodec, HelloProtocolName}, }; use cid::Cid; +use forest_db::CidCompatBitswap; use forest_encoding::blake2b_256; -use libipld::store::StoreParams; use libp2p::swarm::NetworkBehaviour; use libp2p::{core::identity::Keypair, kad::QueryId}; use libp2p::{core::PeerId, gossipsub::GossipsubMessage}; @@ -28,6 +28,7 @@ use libp2p::{ metrics::{Metrics, Recorder}, request_response::{ProtocolSupport, RequestResponse, RequestResponseConfig}, }; +use libp2p_bitswap::libipld::store::StoreParams; use libp2p_bitswap::{Bitswap, BitswapConfig, BitswapStore}; use log::{debug, warn}; use std::collections::{HashMap, HashSet}; @@ -88,7 +89,13 @@ impl ForestBehaviour

{ ) .unwrap(); - let bitswap = Bitswap::new(BitswapConfig::new(), db); + let bitswap = Bitswap::new( + BitswapConfig { + compat_protocol_name: b"/chain/ipfs/bitswap/1.2.0", + ..Default::default() + }, + db, + ); if let Err(err) = bitswap.register_metrics(prometheus::default_registry()) { warn!("Fail to register prometheus metrics for libp2p_bitswap: {err}"); } @@ -155,7 +162,9 @@ impl ForestBehaviour

{ pub fn want_block(&mut self, cid: Cid) -> anyhow::Result { debug!("want {}", cid.to_string()); let peers = self.discovery.peers().iter().cloned().collect(); - let query_id = self.bitswap.sync(cid, peers, [cid].into_iter()); + let query_id = self + .bitswap + .sync(cid.compat(), peers, [cid.compat()].into_iter()); Ok(query_id) } } diff --git a/node/forest_libp2p/src/service.rs b/node/forest_libp2p/src/service.rs index 681e2c82c10f..700f6273b0e2 100644 --- a/node/forest_libp2p/src/service.rs +++ b/node/forest_libp2p/src/service.rs @@ -22,7 +22,6 @@ use futures::select; use futures_util::stream::StreamExt; use fvm_ipld_blockstore::Blockstore; use fvm_ipld_encoding::from_slice; -use libipld::store::StoreParams; use libp2p::gossipsub::GossipsubEvent; pub use libp2p::gossipsub::IdentTopic; pub use libp2p::gossipsub::Topic; @@ -43,6 +42,7 @@ use libp2p::{ yamux, PeerId, Swarm, Transport, }; use libp2p::{core::Multiaddr, swarm::SwarmBuilder}; +use libp2p_bitswap::libipld::store::StoreParams; use libp2p_bitswap::{BitswapEvent, BitswapStore}; use log::{debug, error, info, trace, warn}; use std::collections::HashMap;