diff --git a/Cargo.lock b/Cargo.lock index 520b49194b78..1e3073256c0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -278,6 +278,7 @@ dependencies = [ "bitfield", "byteorder 1.3.4", "clock", + "commcid", "db", "derive_builder", "fil_types", diff --git a/crypto/src/vrf.rs b/crypto/src/vrf.rs index 8939053711f6..dce35dab77c4 100644 --- a/crypto/src/vrf.rs +++ b/crypto/src/vrf.rs @@ -1,7 +1,6 @@ // Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT -use crate::signature::BLS_SIG_LEN; use encoding::{blake2b_256, serde_bytes}; use serde::{Deserialize, Serialize}; @@ -25,12 +24,6 @@ impl VRFProof { pub fn digest(&self) -> [u8; 32] { blake2b_256(&self.0) } - - /// Returns max value based on [BLS_SIG_LEN](constant.BLS_SIG_LEN.html) - pub fn max_value() -> Self { - // TODO revisit if this is necessary - Self::new([std::u8::MAX; BLS_SIG_LEN].to_vec()) - } } #[cfg(feature = "json")] diff --git a/forest/src/daemon.rs b/forest/src/daemon.rs index 046b1b5d5c07..efc4953c361e 100644 --- a/forest/src/daemon.rs +++ b/forest/src/daemon.rs @@ -72,7 +72,6 @@ pub(super) async fn start(config: Config) { // Get Drand Coefficients let coeff = config.drand_public; - // TODO: Interval is supposed to be consistent with fils epoch interval length, but not yet defined let beacon = DrandBeacon::new( DEFAULT_DRAND_URL, coeff, diff --git a/ipld/car/src/util.rs b/ipld/car/src/util.rs index 3eb344a1f194..00f7e9f6e957 100644 --- a/ipld/car/src/util.rs +++ b/ipld/car/src/util.rs @@ -37,7 +37,6 @@ pub(crate) fn read_node(buf_reader: &mut R) -> Result Result<(Cid, u64), Error> { - // TODO: Add some checks for cid v0 // TODO: Upgrade the Cid crate to read_cid using a BufReader let (version, buf) = unsigned_varint::decode::u64(buf).map_err(|e| Error::ParsingError(e.to_string()))?; diff --git a/ipld/cid/src/lib.rs b/ipld/cid/src/lib.rs index 854a42e31bbd..e37c627217ab 100644 --- a/ipld/cid/src/lib.rs +++ b/ipld/cid/src/lib.rs @@ -44,7 +44,7 @@ pub struct Cid { impl Default for Cid { fn default() -> Self { - Self::new(Codec::Raw, Version::V1, Identity.digest(&[])) + Self::new(Codec::Raw, Version::V0, Identity.digest(&[])) } } diff --git a/node/forest_libp2p/src/behaviour.rs b/node/forest_libp2p/src/behaviour.rs index 7967eea2f4ae..745f377445b1 100644 --- a/node/forest_libp2p/src/behaviour.rs +++ b/node/forest_libp2p/src/behaviour.rs @@ -43,7 +43,6 @@ use tiny_cid::Cid as Cid2; #[behaviour(out_event = "ForestBehaviourEvent", poll_method = "poll")] pub struct ForestBehaviour { gossipsub: Gossipsub, - // TODO configure to allow turning mdns off mdns: Toggle, ping: Ping, identify: Identify, diff --git a/types/src/sector/post.rs b/types/src/sector/post.rs index 1290b682e631..2c39f51a0b00 100644 --- a/types/src/sector/post.rs +++ b/types/src/sector/post.rs @@ -21,7 +21,6 @@ pub struct SectorInfo { #[derive(Debug, PartialEq, Clone, Eq, Serialize_tuple, Deserialize_tuple)] pub struct PoStProof { pub post_proof: RegisteredPoStProof, - // TODO revisit if can be array in future #[serde(with = "serde_bytes")] pub proof_bytes: Vec, } diff --git a/vm/actor/Cargo.toml b/vm/actor/Cargo.toml index 7be77749b690..334ebdb17a36 100644 --- a/vm/actor/Cargo.toml +++ b/vm/actor/Cargo.toml @@ -31,6 +31,7 @@ byteorder = "1.3.4" ahash = "0.4" base64 = "0.12.1" log = "0.4.8" +commcid = { path = "../../utils/commcid" } indexmap = { version = "1.3.2", features = ["serde-1"] } [dev-dependencies] diff --git a/vm/actor/src/builtin/market/deal.rs b/vm/actor/src/builtin/market/deal.rs index 172ccad4e2d1..1c67c590bd71 100644 --- a/vm/actor/src/builtin/market/deal.rs +++ b/vm/actor/src/builtin/market/deal.rs @@ -3,8 +3,9 @@ use crate::DealWeight; use address::Address; -use cid::{multihash::Code, Cid, Codec, Prefix, Version}; +use cid::{Cid, Codec, Prefix, Version}; use clock::ChainEpoch; +use commcid::SHA2_256_TRUNC254_PADDED; use crypto::Signature; use encoding::tuple::*; use encoding::Cbor; @@ -12,14 +13,11 @@ use fil_types::PaddedPieceSize; use num_bigint::bigint_ser; use vm::TokenAmount; -// TODO this hash code should probably be in common place -const SHA2_256_TRUNC254_PADDED: u64 = 0x1012; - /// Cid prefix for piece Cids pub const PIECE_CID_PREFIX: Prefix = Prefix { version: Version::V1, codec: Codec::FilCommitmentUnsealed, - mh_type: Code::Custom(SHA2_256_TRUNC254_PADDED), + mh_type: SHA2_256_TRUNC254_PADDED, mh_len: 32, }; diff --git a/vm/actor/src/builtin/reward/mod.rs b/vm/actor/src/builtin/reward/mod.rs index e75dbf01c995..4867d4b71c14 100644 --- a/vm/actor/src/builtin/reward/mod.rs +++ b/vm/actor/src/builtin/reward/mod.rs @@ -103,8 +103,6 @@ impl Actor { let mut block_reward = (&st.this_epoch_reward * params.win_count) / EXPECTED_LEADERS_PER_EPOCH; let mut total_reward = params.gas_reward.clone() + &block_reward; - // TODO revisit this, I removed duplicate calls to current balance, but should be - // matched once fully iteroping (if not fixed) let curr_balance = rt.current_balance()?; if total_reward > curr_balance { log::warn!( diff --git a/vm/actor/src/util/balance_table.rs b/vm/actor/src/util/balance_table.rs index 7c04d74e1af7..990c1104ef7d 100644 --- a/vm/actor/src/util/balance_table.rs +++ b/vm/actor/src/util/balance_table.rs @@ -38,8 +38,7 @@ where Ok(self .0 .get(&key.to_bytes())? - // TODO investigate whether it's worth it to cache root to give better error details - .ok_or("no key {} in map root")? + .ok_or(format!("no key {} in map root", key))? .0) } diff --git a/vm/address/src/lib.rs b/vm/address/src/lib.rs index 51659eba5345..cad26fc28df1 100644 --- a/vm/address/src/lib.rs +++ b/vm/address/src/lib.rs @@ -45,7 +45,6 @@ const NETWORK_DEFAULT: Network = Network::Testnet; /// Address is the struct that defines the protocol and data payload conversion from either /// a public key or value -/// TODO add Address JSON implementation #[derive(PartialEq, Eq, Clone, Debug, Hash, Copy)] pub struct Address { network: Network, diff --git a/vm/interpreter/src/default_runtime.rs b/vm/interpreter/src/default_runtime.rs index 655d31b217f2..78f41132658a 100644 --- a/vm/interpreter/src/default_runtime.rs +++ b/vm/interpreter/src/default_runtime.rs @@ -30,7 +30,7 @@ use vm::{ EMPTY_ARR_CID, METHOD_SEND, }; -// TODO this param isn't finalized +// This is just used for gas tracing, intentionally 0 and could be removed. const ACTOR_EXEC_GAS: GasCharge = GasCharge { name: "on_actor_exec", compute_gas: 0, @@ -461,7 +461,6 @@ where "actor state for transaction doesn't exist"))?; // get state for actor based on generic C - // TODO Lotus is not handling the not exist case, revisit let mut state: C = self .get(&act.state)? .ok_or_else(|| actor_error!(fatal("Actor state does not exist: {}", act.state)))?; diff --git a/vm/interpreter/src/gas_syscalls.rs b/vm/interpreter/src/gas_syscalls.rs index cdfe5e34f840..cb4fbdd379a9 100644 --- a/vm/interpreter/src/gas_syscalls.rs +++ b/vm/interpreter/src/gas_syscalls.rs @@ -79,7 +79,7 @@ where &self, vis: &[(Address, &Vec)], ) -> Result>, Box> { - // TODO revisit if gas ends up being charged (only used by cron actor) + // Gas charged for batch verify in actor self.syscalls.batch_verify_seals(vis) } }