chore(deps): update rust crate multihash to 0.19.1 (#748)

* chore(deps): update rust crate multihash to 0.19.1
* Coordinated update of `cid` and `multihash` crates

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Ivan Boldyrev <ivan@fluence.one>
This commit is contained in:
renovate[bot] 2023-12-08 00:32:16 +07:00 committed by GitHub
parent 2c78fd5f7a
commit f1b6c48987
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 166 additions and 39 deletions

184
Cargo.lock generated
View File

@ -99,7 +99,8 @@ dependencies = [
"blake3", "blake3",
"cid", "cid",
"digest 0.10.7", "digest 0.10.7",
"multihash 0.18.1", "multihash 0.19.1",
"multihash-codetable",
"serde", "serde",
"serde_json", "serde_json",
"sha2 0.10.7", "sha2 0.10.7",
@ -1127,15 +1128,14 @@ dependencies = [
[[package]] [[package]]
name = "cid" name = "cid"
version = "0.10.1" version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd94671561e36e4e7de75f753f577edafb0e7c05d6e4547229fdf7938fbcd2c3" checksum = "472ac98592f38dfd48f188d5713a328422ed22fa39eb52b8bca495370134762a"
dependencies = [ dependencies = [
"core2", "core2",
"multibase", "multibase",
"multihash 0.18.1", "multihash 0.19.1",
"serde", "unsigned-varint 0.8.0",
"unsigned-varint",
] ]
[[package]] [[package]]
@ -1166,7 +1166,7 @@ checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123"
dependencies = [ dependencies = [
"bitflags 1.3.2", "bitflags 1.3.2",
"clap_lex 0.2.4", "clap_lex 0.2.4",
"indexmap", "indexmap 1.9.3",
"textwrap 0.16.0", "textwrap 0.16.0",
] ]
@ -1937,6 +1937,12 @@ dependencies = [
"termcolor", "termcolor",
] ]
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]] [[package]]
name = "errno" name = "errno"
version = "0.3.2" version = "0.3.2"
@ -2308,7 +2314,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d"
dependencies = [ dependencies = [
"fallible-iterator", "fallible-iterator",
"indexmap", "indexmap 1.9.3",
"stable_deref_trait", "stable_deref_trait",
] ]
@ -2330,7 +2336,7 @@ dependencies = [
"futures-sink", "futures-sink",
"futures-util", "futures-util",
"http", "http",
"indexmap", "indexmap 1.9.3",
"slab", "slab",
"tokio", "tokio",
"tokio-util", "tokio-util",
@ -2361,6 +2367,12 @@ dependencies = [
"ahash", "ahash",
] ]
[[package]]
name = "hashbrown"
version = "0.14.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
[[package]] [[package]]
name = "heck" name = "heck"
version = "0.3.3" version = "0.3.3"
@ -2601,6 +2613,16 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "indexmap"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
dependencies = [
"equivalent",
"hashbrown 0.14.3",
]
[[package]] [[package]]
name = "instant" name = "instant"
version = "0.1.12" version = "0.1.12"
@ -2830,7 +2852,7 @@ dependencies = [
"ed25519-dalek", "ed25519-dalek",
"libsecp256k1", "libsecp256k1",
"log", "log",
"multihash 0.19.0", "multihash 0.19.1",
"quick-protobuf", "quick-protobuf",
"rand 0.8.5", "rand 0.8.5",
"ring", "ring",
@ -3322,29 +3344,73 @@ dependencies = [
"blake3", "blake3",
"core2", "core2",
"digest 0.10.7", "digest 0.10.7",
"multihash-derive", "multihash-derive 0.8.0",
"sha2 0.10.7", "sha2 0.10.7",
"sha3", "sha3",
"unsigned-varint", "unsigned-varint 0.7.1",
] ]
[[package]] [[package]]
name = "multihash" name = "multihash"
version = "0.19.0" version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2fd59dcc2bbe70baabeac52cd22ae52c55eefe6c38ff11a9439f16a350a939f2" checksum = "076d548d76a0e2a0d4ab471d0b1c36c577786dfc4471242035d97a12a735c492"
dependencies = [ dependencies = [
"core2", "core2",
"unsigned-varint", "unsigned-varint 0.7.1",
]
[[package]]
name = "multihash-codetable"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6d815ecb3c8238d00647f8630ede7060a642c9f704761cd6082cb4028af6935"
dependencies = [
"blake2b_simd 1.0.1",
"blake2s_simd",
"blake3",
"core2",
"digest 0.10.7",
"multihash-derive 0.9.0",
"ripemd",
"sha1",
"sha2 0.10.7",
"sha3",
"strobe-rs",
] ]
[[package]] [[package]]
name = "multihash-derive" name = "multihash-derive"
version = "0.8.1" version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1d6d4752e6230d8ef7adf7bd5d8c4b1f6561c1014c5ba9a37445ccefe18aa1db" checksum = "fc076939022111618a5026d3be019fd8b366e76314538ff9a1b59ffbcbf98bcd"
dependencies = [ dependencies = [
"proc-macro-crate 1.1.3", "proc-macro-crate 1.3.1",
"proc-macro-error",
"proc-macro2",
"quote",
"syn 1.0.109",
"synstructure",
]
[[package]]
name = "multihash-derive"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "890e72cb7396cb99ed98c1246a97b243cc16394470d94e0bc8b0c2c11d84290e"
dependencies = [
"core2",
"multihash 0.19.1",
"multihash-derive-impl",
]
[[package]]
name = "multihash-derive-impl"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d38685e08adb338659871ecfc6ee47ba9b22dcc8abcf6975d379cc49145c3040"
dependencies = [
"proc-macro-crate 1.3.1",
"proc-macro-error", "proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
@ -3872,7 +3938,7 @@ checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"hashbrown 0.12.3", "hashbrown 0.12.3",
"indexmap", "indexmap 1.9.3",
"memchr", "memchr",
] ]
@ -3991,7 +4057,7 @@ version = "2.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27" checksum = "1557010476e0595c9b568d16dcfb81b93cdeb157612726f5170d31aa707bed27"
dependencies = [ dependencies = [
"proc-macro-crate 1.1.3", "proc-macro-crate 1.3.1",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 1.0.109", "syn 1.0.109",
@ -4082,7 +4148,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4"
dependencies = [ dependencies = [
"fixedbitset", "fixedbitset",
"indexmap", "indexmap 1.9.3",
] ]
[[package]] [[package]]
@ -4255,12 +4321,12 @@ dependencies = [
[[package]] [[package]]
name = "proc-macro-crate" name = "proc-macro-crate"
version = "1.1.3" version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e17d47ce914bf4de440332250b0edd23ce48c005f59fab39d3335866b114f11a" checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919"
dependencies = [ dependencies = [
"thiserror", "once_cell",
"toml", "toml_edit",
] ]
[[package]] [[package]]
@ -4907,7 +4973,7 @@ dependencies = [
"base64 0.13.1", "base64 0.13.1",
"chrono", "chrono",
"hex 0.4.3", "hex 0.4.3",
"indexmap", "indexmap 1.9.3",
"serde", "serde",
"serde_json", "serde_json",
"serde_with_macros", "serde_with_macros",
@ -4926,6 +4992,17 @@ dependencies = [
"syn 2.0.29", "syn 2.0.29",
] ]
[[package]]
name = "sha1"
version = "0.10.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba"
dependencies = [
"cfg-if 1.0.0",
"cpufeatures",
"digest 0.10.7",
]
[[package]] [[package]]
name = "sha2" name = "sha2"
version = "0.9.9" version = "0.9.9"
@ -5098,6 +5175,19 @@ dependencies = [
"precomputed-hash", "precomputed-hash",
] ]
[[package]]
name = "strobe-rs"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fabb238a1cccccfa4c4fb703670c0d157e1256c1ba695abf1b93bd2bb14bab2d"
dependencies = [
"bitflags 1.3.2",
"byteorder",
"keccak",
"subtle",
"zeroize",
]
[[package]] [[package]]
name = "strsim" name = "strsim"
version = "0.10.0" version = "0.10.0"
@ -5430,6 +5520,23 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "toml_datetime"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
[[package]]
name = "toml_edit"
version = "0.19.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421"
dependencies = [
"indexmap 2.1.0",
"toml_datetime",
"winnow",
]
[[package]] [[package]]
name = "tower-service" name = "tower-service"
version = "0.3.2" version = "0.3.2"
@ -5574,6 +5681,12 @@ version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836" checksum = "d86a8dc7f45e4c1b0d30e43038c38f274e77af056aa5f74b93c2cf9eb3c1c836"
[[package]]
name = "unsigned-varint"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb066959b24b5196ae73cb057f45598450d2c5f71460e98c49b738086eff9c06"
[[package]] [[package]]
name = "untrusted" name = "untrusted"
version = "0.7.1" version = "0.7.1"
@ -5888,7 +6001,7 @@ version = "0.100.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4"
dependencies = [ dependencies = [
"indexmap", "indexmap 1.9.3",
"url", "url",
] ]
@ -5898,7 +6011,7 @@ version = "0.101.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf2f22ef84ac5666544afa52f326f13e16f3d019d2e61e704fd8091c9358b130" checksum = "bf2f22ef84ac5666544afa52f326f13e16f3d019d2e61e704fd8091c9358b130"
dependencies = [ dependencies = [
"indexmap", "indexmap 1.9.3",
"url", "url",
] ]
@ -5911,7 +6024,7 @@ dependencies = [
"anyhow", "anyhow",
"bincode", "bincode",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"indexmap", "indexmap 1.9.3",
"libc", "libc",
"log", "log",
"object 0.29.0", "object 0.29.0",
@ -5990,7 +6103,7 @@ dependencies = [
"anyhow", "anyhow",
"cranelift-entity", "cranelift-entity",
"gimli 0.26.2", "gimli 0.26.2",
"indexmap", "indexmap 1.9.3",
"log", "log",
"object 0.29.0", "object 0.29.0",
"serde", "serde",
@ -6056,7 +6169,7 @@ dependencies = [
"anyhow", "anyhow",
"cc", "cc",
"cfg-if 1.0.0", "cfg-if 1.0.0",
"indexmap", "indexmap 1.9.3",
"libc", "libc",
"log", "log",
"mach", "mach",
@ -6386,6 +6499,15 @@ version = "0.48.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d419259aba16b663966e29e6d7c6ecfa0bb8425818bb96f6f1f3c3eb71a6e7b9" checksum = "d419259aba16b663966e29e6d7c6ecfa0bb8425818bb96f6f1f3c3eb71a6e7b9"
[[package]]
name = "winnow"
version = "0.5.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e87b8dfbe3baffbe687eef2e164e32286eff31a5ee16463ce03d991643ec94"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "winreg" name = "winreg"
version = "0.10.1" version = "0.10.1"

View File

@ -11,8 +11,8 @@ keywords = ["fluence", "air", "programming-language", "cid", "ipld"]
categories = ["wasm"] categories = ["wasm"]
[dependencies] [dependencies]
cid = { version = "0.10.1", default-features = false, features = ["std"] } cid = { version = "0.11.0", default-features = false, features = ["std"] }
multihash = { version = "0.18.1", default-features = false, features = ["multihash-impl", "std", "sha2", "blake3"] } multihash = { version = "0.19.1" }
serde = { version = "1.0.190", features = ["derive", "rc"] } serde = { version = "1.0.190", features = ["derive", "rc"] }
serde_json = "1.0.95" serde_json = "1.0.95"
thiserror = "1.0.49" thiserror = "1.0.49"
@ -21,3 +21,7 @@ thiserror = "1.0.49"
digest = "0.10.7" digest = "0.10.7"
sha2 = "0.10.7" sha2 = "0.10.7"
blake3 = { version = "1.5.0", features = ["traits-preview"] } blake3 = { version = "1.5.0", features = ["traits-preview"] }
multihash-codetable = { version = "0.1.1", features = ["blake3", "sha2", "digest"] }
[dev-dependencies]
multihash-codetable = { version = "0.1.1", features = ["ripemd"] }

View File

@ -125,7 +125,7 @@ pub fn value_to_json_cid<Val: Serialize + ?Sized>(
value: &Val, value: &Val,
) -> Result<CID<Val>, CidCalculationError> { ) -> Result<CID<Val>, CidCalculationError> {
use cid::Cid; use cid::Cid;
use multihash::{Code, MultihashDigest}; use multihash_codetable::{Code, MultihashDigest};
let hash = value_json_hash::<blake3::Hasher, Val>(value)?; let hash = value_json_hash::<blake3::Hasher, Val>(value)?;

View File

@ -55,11 +55,11 @@ pub fn verify_value<Val: Serialize>(
} }
fn verify_json_value<Val: Serialize>( fn verify_json_value<Val: Serialize>(
mhash: &multihash::Multihash, mhash: &multihash_codetable::Multihash,
value: &Val, value: &Val,
cid: &CID<Val>, cid: &CID<Val>,
) -> Result<(), CidVerificationError> { ) -> Result<(), CidVerificationError> {
use multihash::Code; use multihash_codetable::Code;
let raw_code = mhash.code(); let raw_code = mhash.code();
let code: Code = raw_code let code: Code = raw_code
@ -200,17 +200,18 @@ mod tests {
#[test] #[test]
fn test_verify_unsupported_hasher() { fn test_verify_unsupported_hasher() {
use multihash_codetable::Code;
use std::str::FromStr; use std::str::FromStr;
// we have no plan to support it, but it may change, and the test should be corrected // we have no plan to support it, but it may change, and the test should be corrected
let identity_code: u64 = multihash::Code::Identity.into(); let ripemd160_code: u64 = Code::Ripemd160.into();
let cid_1 = let cid_1 =
cid::Cid::from_str("bagaaieranodle477gt6odhllqbhp6wr7k5d23jhkuixr2soadzjn3n4hlnfq") cid::Cid::from_str("bagaaieranodle477gt6odhllqbhp6wr7k5d23jhkuixr2soadzjn3n4hlnfq")
.unwrap(); .unwrap();
let unknown_hasher_multihash = let unknown_hasher_multihash =
Multihash::wrap(identity_code, cid_1.hash().digest()).unwrap(); Multihash::wrap(ripemd160_code, cid_1.hash().digest()).unwrap();
let unknown_hasher_cid = let unknown_hasher_cid =
cid::Cid::new(cid::Version::V1, JSON_CODEC, unknown_hasher_multihash).unwrap(); cid::Cid::new(cid::Version::V1, JSON_CODEC, unknown_hasher_multihash).unwrap();
@ -219,7 +220,7 @@ mod tests {
let err = verify_value(&unknown_hasher_cid, &json!(1)); let err = verify_value(&unknown_hasher_cid, &json!(1));
match err { match err {
Err(CidVerificationError::UnsupportedHashCode(code)) => { Err(CidVerificationError::UnsupportedHashCode(code)) => {
assert_eq!(code, identity_code); assert_eq!(code, ripemd160_code);
} }
_ => panic!("wrong result: {:?}", err), _ => panic!("wrong result: {:?}", err),
} }