Skip to content

Commit 7308289

Browse files
authored
chore: update multihash & cid (#1589)
* chore: update multihash & cid * test: use valid CIDs in the state_control test
1 parent ca31c60 commit 7308289

File tree

35 files changed

+1110
-860
lines changed

35 files changed

+1110
-860
lines changed

Cargo.lock

Lines changed: 1014 additions & 754 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -116,30 +116,30 @@ rlp = { version = "0.5.1", default-features = false }
116116
substrate-bn = { version = "0.6.0", default-features = false }
117117

118118
# IPLD/Encoding
119-
cid = { version = "0.10.1", default-features = false, features = [
120-
"serde-codec",
119+
cid = { version = "0.11.1", default-features = false, features = [
120+
"serde",
121121
"std",
122122
] }
123-
multihash = { version = "0.18.1", default-features = false, features = [
124-
"multihash-impl",
125-
] }
126-
libipld-core = { version = "0.13.1", features = ["serde-codec"] }
123+
multihash = { version = "0.19.1", default-features = false }
124+
multihash-codetable = { version = "0.1.4", default-features = false }
125+
multihash-derive = { version = "0.9.1", default-features = false }
126+
ipld-core = { version = "0.4.1", features = ["serde"] }
127127
integer-encoding = { version = "3.0.3", default-features = false }
128128

129-
# helix-onchain
130-
fvm_actor_utils = "11.0.0"
131-
frc42_dispatch = "7.0.0"
132-
frc46_token = "11.0.0"
129+
# actor-utils
130+
fvm_actor_utils = "12.0.0"
131+
frc42_dispatch = "8.0.0"
132+
frc46_token = "12.0.0"
133133

134134
# FVM
135-
fvm_sdk = "4.3.0"
136-
fvm_shared = "4.3.0"
137-
fvm_ipld_encoding = "0.4.0"
138-
fvm_ipld_blockstore = "0.2.0"
139-
fvm_ipld_hamt = "0.9.0"
140-
fvm_ipld_kamt = "0.3.0"
141-
fvm_ipld_amt = { version = "0.6.2" }
142-
fvm_ipld_bitfield = "0.6.0"
135+
fvm_sdk = "4.5.1"
136+
fvm_shared = "4.5.1"
137+
fvm_ipld_encoding = "0.5.0"
138+
fvm_ipld_blockstore = "0.3.0"
139+
fvm_ipld_hamt = "0.10.2"
140+
fvm_ipld_kamt = "0.4.2"
141+
fvm_ipld_amt = { version = "0.7.3" }
142+
fvm_ipld_bitfield = "0.7.0"
143143

144144
# workspace
145145
fil_actor_account = { path = "actors/account" }
@@ -165,17 +165,17 @@ fil_actors_integration_tests = { version = "1.0.0", path = "integration_tests" }
165165
vm_api = { version = "1.0.0", path = "vm_api" }
166166
test_vm = { path = "test_vm" }
167167

168-
[patch.crates-io]
168+
#[patch.crates-io]
169169
#fvm_shared = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
170170
#fvm_sdk = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
171171
#fvm_ipld_hamt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
172172
#fvm_ipld_amt = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
173173
#fvm_ipld_bitfield = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
174174
#fvm_ipld_encoding = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
175175
#fvm_ipld_blockstore = { git = "https://github.com/filecoin-project/ref-fvm", branch = "master" }
176-
#fvm_actor_utils = { git = "https://github.com/helix-onchain/filecoin", branch = "main" }
177-
#frc42_dispatch = { git = "https://github.com/helix-onchain/filecoin", branch = "main" }
178-
#frc46_token = { git = "https://github.com/helix-onchain/filecoin", branch = "main" }
176+
#fvm_actor_utils = { git = "https://github.com/filecoin-project/actors-utils", branch = "main" }
177+
#frc42_dispatch = { git = "https://github.com/filecoin-project/actors-utils", branch = "main" }
178+
#frc46_token = { git = "https://github.com/filecoin-project/actors-utils", branch = "main" }
179179

180180
## Uncomment when working locally on ref-fvm and this repo simultaneously.
181181
## Assumes the ref-fvm checkout is in a sibling directory with the same name.
@@ -192,17 +192,19 @@ test_vm = { path = "test_vm" }
192192
## Uncomment entries below when working locally on ref-fvm and this repo simultaneously.
193193
## Assumes the ref-fvm checkout is in a sibling directory with the same name.
194194
## (Valid once FVM modules are published to crates.io)
195-
# [patch.crates-io]
196-
# fvm_shared = { path = "../ref-fvm/shared" }
197-
# fvm_sdk = { path = "../ref-fvm/sdk" }
198-
# fvm_ipld_hamt = { path = "../ref-fvm/ipld/hamt" }
199-
# fvm_ipld_amt = { path = "../ref-fvm/ipld/amt" }
200-
# fvm_ipld_bitfield = { path = "../ref-fvm/ipld/bitfield"}
201-
# fvm_ipld_encoding = { path = "../ref-fvm/ipld/encoding"}
202-
# fvm_ipld_blockstore = { path = "../ref-fvm/ipld/blockstore"}
203-
#fvm_actor_utils = { path = "../../filecoin/fvm_actor_utils"}
204-
#frc42_dispatch = { path = "../../filecoin/frc42_dispatch"}
205-
#frc46_token = { path = "../../filecoin/frc46_token"}
195+
#[patch.crates-io]
196+
#fvm_shared = { path = "../ref-fvm/shared" }
197+
#fvm_sdk = { path = "../ref-fvm/sdk" }
198+
#fvm_ipld_car = { path = "../ref-fvm/ipld/car" }
199+
#fvm_ipld_hamt = { path = "../ref-fvm/ipld/hamt" }
200+
#fvm_ipld_amt = { path = "../ref-fvm/ipld/amt" }
201+
#fvm_ipld_bitfield = { path = "../ref-fvm/ipld/bitfield"}
202+
#fvm_ipld_encoding = { path = "../ref-fvm/ipld/encoding"}
203+
#fvm_ipld_blockstore = { path = "../ref-fvm/ipld/blockstore"}
204+
#fvm_actor_utils = { path = "../actors-utils/fvm_actor_utils"}
205+
#fil_actor_bundler = { path = "../builtin-actors-bundler"}
206+
#frc42_dispatch = { path = "../actors-utils/frc42_dispatch"}
207+
#frc46_token = { path = "../actors-utils/frc46_token"}
206208

207209
[profile.wasm]
208210
inherits = "release"

actors/evm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ anyhow = { workspace = true }
2626
log = { workspace = true }
2727
fvm_ipld_blockstore = { workspace = true }
2828
fvm_ipld_encoding = { workspace = true }
29-
multihash = { workspace = true }
29+
multihash-codetable = { workspace = true }
3030
frc42_dispatch = { workspace = true }
3131
fil_actors_evm_shared = { workspace = true }
3232
hex = { workspace = true }

actors/evm/src/interpreter/instructions/context.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ pub fn base_fee(
150150
#[cfg(test)]
151151
mod tests {
152152
use crate::evm_unit_test;
153+
use cid::multihash::Multihash;
153154
use cid::Cid;
154155
use fil_actors_evm_shared::uints::U256;
155156
use fil_actors_runtime::EAM_ACTOR_ID;
@@ -160,12 +161,10 @@ mod tests {
160161
fn test_blockhash() {
161162
// truncate to 32 bytes
162163
let counting_byte_hash: Vec<u8> = (0..40u8).collect();
163-
let long_unknown =
164-
Cid::new_v1(IPLD_RAW, multihash::Multihash::wrap(0, &counting_byte_hash).unwrap());
164+
let long_unknown = Cid::new_v1(IPLD_RAW, Multihash::wrap(0, &counting_byte_hash).unwrap());
165165
let long_expect = counting_byte_hash[..32].try_into().unwrap();
166166
// multihash code ignored
167-
let cbor_odd_hash =
168-
Cid::new_v1(DAG_CBOR, multihash::Multihash::wrap(123, &[0xfe; 32]).unwrap());
167+
let cbor_odd_hash = Cid::new_v1(DAG_CBOR, Multihash::wrap(123, &[0xfe; 32]).unwrap());
169168
let cbor_odd_expect = [0xfe; 32];
170169

171170
let nothing = [0; 32];

actors/evm/src/interpreter/system.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use std::borrow::Cow;
22

3-
use cid::multihash::Code;
43
use fil_actors_evm_shared::{address::EthAddress, uints::U256};
54
use fil_actors_runtime::{
65
actor_error, extract_send_result, runtime::EMPTY_ARR_CID, AsActorError, EAM_ACTOR_ID,
@@ -15,6 +14,7 @@ use fvm_shared::econ::TokenAmount;
1514
use fvm_shared::error::{ErrorNumber, ExitCode};
1615
use fvm_shared::sys::SendFlags;
1716
use fvm_shared::{MethodNum, Response, IPLD_RAW, METHOD_SEND};
17+
use multihash_codetable::Code;
1818

1919
use crate::state::{State, Tombstone};
2020
use crate::BytecodeHash;

actors/evm/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ const EVM_WORD_SIZE: usize = 32;
5050
#[test]
5151
fn test_method_selector() {
5252
// We could just _generate_ this method selector with a proc macro, but this is easier.
53-
use cid::multihash::MultihashDigest;
54-
let hash = cid::multihash::Code::Keccak256.digest(NATIVE_METHOD_SIGNATURE.as_bytes());
53+
use multihash_codetable::MultihashDigest;
54+
let hash = multihash_codetable::Code::Keccak256.digest(NATIVE_METHOD_SIGNATURE.as_bytes());
5555
let computed_selector = &hash.digest()[..4];
5656
assert_eq!(computed_selector, NATIVE_METHOD_SELECTOR);
5757
}

actors/market/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,20 @@ fvm_ipld_encoding = { workspace = true }
2626
fvm_ipld_hamt = { workspace = true }
2727
fvm_shared = { workspace = true }
2828
integer-encoding = { workspace = true }
29-
libipld-core = { workspace = true }
29+
ipld-core = { workspace = true }
3030
log = { workspace = true }
3131
num-derive = { workspace = true }
3232
num-traits = { workspace = true }
3333
serde = { workspace = true }
3434
lazy_static = { workspace = true }
35+
multihash-codetable = { workspace = true }
3536

3637
[dev-dependencies]
3738
fil_actors_runtime = { workspace = true, features = ["test_utils", "sector-default"] }
3839
fil_actor_power = { workspace = true }
3940
fil_actor_reward = { workspace = true }
4041
fil_actor_verifreg = { workspace = true }
4142
fvm_ipld_amt = { workspace = true }
42-
multihash = { workspace = true }
4343
regex = { workspace = true }
4444
itertools = { workspace = true }
4545

actors/market/src/deal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use fvm_shared::crypto::signature::Signature;
1111
use fvm_shared::econ::TokenAmount;
1212
use fvm_shared::piece::PaddedPieceSize;
1313
use fvm_shared::sector::SectorNumber;
14-
use libipld_core::ipld::Ipld;
14+
use ipld_core::ipld::Ipld;
1515
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
1616
use std::convert::{TryFrom, TryInto};
1717

actors/market/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use std::cmp::min;
55
use std::collections::{BTreeMap, BTreeSet, HashSet};
66

7-
use cid::multihash::{Code, MultihashGeneric};
7+
use cid::multihash::Multihash;
88
use cid::Cid;
99
use fil_actors_runtime::reward::ThisEpochRewardReturn;
1010
use frc46_token::token::types::{BalanceReturn, TransferFromParams, TransferFromReturn};
@@ -16,6 +16,7 @@ use fvm_ipld_hamt::BytesKey;
1616
use fvm_shared::address::Address;
1717
use fvm_shared::bigint::BigInt;
1818
use fvm_shared::clock::{ChainEpoch, EPOCH_UNDEFINED};
19+
use fvm_shared::crypto::hash::SupportedHashes;
1920
use fvm_shared::deal::DealID;
2021
use fvm_shared::econ::TokenAmount;
2122
use fvm_shared::error::ExitCode;
@@ -1723,7 +1724,7 @@ pub fn deal_cid(rt: &impl Runtime, proposal: &DealProposal) -> Result<Cid, Actor
17231724
/// Compute a deal CID from serialized proposal using the runtime
17241725
pub(crate) fn serialized_deal_cid(rt: &impl Runtime, data: &[u8]) -> Result<Cid, ActorError> {
17251726
const DIGEST_SIZE: u32 = 32;
1726-
let hash = MultihashGeneric::wrap(Code::Blake2b256.into(), &rt.hash_blake2b(data))
1727+
let hash = Multihash::wrap(SupportedHashes::Blake2b256.into(), &rt.hash_blake2b(data))
17271728
.map_err(|e| actor_error!(illegal_argument; "failed to take cid of proposal {}", e))?;
17281729
debug_assert_eq!(u32::from(hash.size()), DIGEST_SIZE, "expected 32byte digest");
17291730
Ok(Cid::new_v1(DAG_CBOR, hash))

actors/market/src/testing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use std::{
44
convert::TryFrom,
55
};
66

7-
use cid::multihash::{Code, MultihashDigest};
87
use cid::Cid;
98
use fvm_ipld_blockstore::Blockstore;
109
use fvm_ipld_encoding::DAG_CBOR;
@@ -18,6 +17,7 @@ use fvm_shared::{
1817
ActorID,
1918
};
2019
use integer_encoding::VarInt;
20+
use multihash_codetable::{Code, MultihashDigest};
2121
use num_traits::Zero;
2222

2323
use fil_actors_runtime::builtin::HAMT_BIT_WIDTH;

0 commit comments

Comments
 (0)