Skip to content

Commit

Permalink
Remove TODOs from scoping (#675)
Browse files Browse the repository at this point in the history
* Remove TODOs from scoping

* fmt
  • Loading branch information
austinabell authored Sep 1, 2020
1 parent 2434164 commit e411eee
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 25 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 0 additions & 7 deletions crypto/src/vrf.rs
Original file line number Diff line number Diff line change
@@ -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};

Expand All @@ -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")]
Expand Down
1 change: 0 additions & 1 deletion forest/src/daemon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion ipld/car/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ pub(crate) fn read_node<R: Read>(buf_reader: &mut R) -> Result<Option<(Cid, Vec<
}

pub(crate) fn read_cid(buf: &[u8]) -> 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()))?;
Expand Down
2 changes: 1 addition & 1 deletion ipld/cid/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&[]))
}
}

Expand Down
1 change: 0 additions & 1 deletion node/forest_libp2p/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Mdns>,
ping: Ping,
identify: Identify,
Expand Down
1 change: 0 additions & 1 deletion types/src/sector/post.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u8>,
}
Expand Down
1 change: 1 addition & 0 deletions vm/actor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
8 changes: 3 additions & 5 deletions vm/actor/src/builtin/market/deal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,21 @@

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;
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,
};

Expand Down
2 changes: 0 additions & 2 deletions vm/actor/src/builtin/reward/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand Down
3 changes: 1 addition & 2 deletions vm/actor/src/util/balance_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
1 change: 0 additions & 1 deletion vm/address/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions vm/interpreter/src/default_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)))?;
Expand Down
2 changes: 1 addition & 1 deletion vm/interpreter/src/gas_syscalls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ where
&self,
vis: &[(Address, &Vec<SealVerifyInfo>)],
) -> Result<HashMap<Address, Vec<bool>>, Box<dyn StdError>> {
// 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)
}
}
Expand Down

0 comments on commit e411eee

Please sign in to comment.