Skip to content

Commit

Permalink
Cleanup Forest to make CI green (#1538)
Browse files Browse the repository at this point in the history
Co-authored-by: tyshkor <[email protected]>
Co-authored-by: David Himmelstrup <[email protected]>
  • Loading branch information
3 people authored Jun 21, 2022
1 parent c209286 commit d846152
Show file tree
Hide file tree
Showing 83 changed files with 96 additions and 5,797 deletions.
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,3 @@
[submodule "ipld/tests/ipld-traversal-vectors"]
path = ipld/tests/ipld-traversal-vectors
url = https://github.com:ChainSafe/ipld-traversal-vectors.git
[submodule "tests/conformance_tests/test-vectors"]
path = tests/conformance_tests/test-vectors
url = https://github.com/filecoin-project/test-vectors.git
[submodule "tests/conformance_tests/fvm-test-vectors"]
path = tests/conformance_tests/fvm-test-vectors
url = https://github.com/filecoin-project/fvm-test-vectors
5 changes: 0 additions & 5 deletions .tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
[mainnet]
workspace = true
exclude = ["conformance_tests"]

[conformance]
features = "submodule_tests"
packages = ["conformance_tests"]

[report]
out = ["Xml"]
43 changes: 0 additions & 43 deletions Cargo.lock

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

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ members = [
"ipld/hamt",
"ipld/blockstore",
"key_management",
"tests/conformance_tests",
"tests/serialization_tests",
"types",
"types/networks",
Expand Down
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
SER_TESTS = "tests/serialization_tests"
CONF_TESTS = "tests/conformance_tests"

ifndef RUST_TEST_THREADS
RUST_TEST_THREADS := 1
Expand Down Expand Up @@ -83,16 +82,13 @@ pull-serialization-tests:
run-serialization-vectors:
cargo test --release --manifest-path=$(SER_TESTS)/Cargo.toml --features "submodule_tests" -- --test-threads=$(RUST_TEST_THREADS)

run-conformance-vectors:
cargo test --release --manifest-path=$(CONF_TESTS)/Cargo.toml --features "submodule_tests" -- --nocapture --test-threads=$(RUST_TEST_THREADS)

run-vectors: run-serialization-vectors run-conformance-vectors

test-vectors: pull-serialization-tests run-vectors

# Test all without the submodule test vectors with release configuration
test:
cargo test --all --exclude serialization_tests --exclude conformance_tests --exclude forest_message --exclude forest_crypto -- --test-threads=$(RUST_TEST_THREADS)
cargo test --all --exclude serialization_tests --exclude forest_message --exclude forest_crypto -- --test-threads=$(RUST_TEST_THREADS)
cargo test -p forest_crypto --features blst --no-default-features -- --test-threads=$(RUST_TEST_THREADS)
# FIXME: https://github.com/ChainSafe/forest/issues/1444
#cargo test -p forest_crypto --features pairing --no-default-features -- --test-threads=$(RUST_TEST_THREADS)
Expand All @@ -101,7 +97,7 @@ test:
#cargo test -p forest_message --features pairing --no-default-features -- --test-threads=$(RUST_TEST_THREADS)

test-release:
cargo test --release --all --exclude serialization_tests --exclude conformance_tests --exclude forest_message --exclude forest_crypto -- --test-threads=$(RUST_TEST_THREADS)
cargo test --release --all --exclude serialization_tests --exclude forest_message --exclude forest_crypto -- --test-threads=$(RUST_TEST_THREADS)
cargo test --release -p forest_crypto --features blst --no-default-features -- --test-threads=$(RUST_TEST_THREADS)
# FIXME: https://github.com/ChainSafe/forest/issues/1444
#cargo test --release -p forest_crypto --features pairing --no-default-features -- --test-threads=$(RUST_TEST_THREADS)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Will show all debug logs by default, but the `forest_libp2p::service` logs will
# To run base tests
cargo test # use `make test-release` for longer compilation but faster execution

# To pull serialization vectors submodule and run serialization and conformance tests
# To pull serialization vectors submodule and run serialization tests
make test-vectors

# To run all tests and all features enabled
Expand Down
14 changes: 12 additions & 2 deletions blockchain/beacon/src/drand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,23 @@ impl DrandPublic {
}
}

/// Type of the Drand network. In general only Mainnet and its chain information
/// should be considered stable.
#[derive(PartialEq, Eq, Clone)]
pub enum DrandNetwork {
Mainnet,
Incentinet,
}

#[derive(Clone)]
/// Config used when initializing a Drand beacon.
pub struct DrandConfig<'a> {
/// Url endpoint to send JSON http requests to.
pub server: &'static str,
/// Info about the beacon chain, used to verify correctness of endpoint.
pub chain_info: ChainInfo<'a>,
/// Network type
pub network_type: DrandNetwork,
}

/// Contains the vector of BeaconPoints, which are mappings of epoch to the Randomness beacons used.
Expand Down Expand Up @@ -131,7 +141,7 @@ where
fn max_beacon_round_for_epoch(&self, fil_epoch: ChainEpoch) -> u64;
}

#[derive(SerdeDeserialize, SerdeSerialize, Debug, Clone, PartialEq, Default)]
#[derive(SerdeDeserialize, SerdeSerialize, Debug, Clone, PartialEq, Eq, Default)]
/// Contains all the info about a Drand beacon chain.
/// API reference: https://drand.love/developer/http-api/#info
/// note: groupHash does not exist in docs currently, but is returned.
Expand Down Expand Up @@ -183,7 +193,7 @@ impl DrandBeacon {

let chain_info = &config.chain_info;

if cfg!(debug_assertions) {
if cfg!(debug_assertions) && config.network_type == DrandNetwork::Mainnet {
let remote_chain_info: ChainInfo = surf::get(&format!("{}/info", &config.server))
.recv_json()
.await?;
Expand Down
1 change: 1 addition & 0 deletions blockchain/beacon/tests/drand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ async fn new_beacon() -> DrandBeacon {
.into(),
..Default::default()
},
network_type: beacon::DrandNetwork::Incentinet
},
)
.await
Expand Down
2 changes: 1 addition & 1 deletion blockchain/blocks/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::time::SystemTimeError as TimeErr;
use thiserror::Error;

/// Blockchain blocks error
#[derive(Debug, PartialEq, Error)]
#[derive(Debug, PartialEq, Eq, Error)]
pub enum Error {
/// Tipset contains invalid data, as described by the string parameter.
#[error("Invalid tipset: {0}")]
Expand Down
2 changes: 1 addition & 1 deletion blockchain/chain_sync/src/chain_muxer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub enum ChainMuxerError {
}

/// Struct that defines syncing configuration options
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)]
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
pub struct SyncConfig {
/// Request window length for tipsets during chain exchange
pub req_window: i64,
Expand Down
2 changes: 1 addition & 1 deletion blockchain/chain_sync/src/sync_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::sync::Arc;
use time::{Duration, OffsetDateTime};

/// Current state of the ChainSyncer using the ChainExchange protocol.
#[derive(PartialEq, Debug, Clone, Copy)]
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pub enum SyncStage {
/// Idle state.
Idle,
Expand Down
2 changes: 1 addition & 1 deletion blockchain/message_pool/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use encoding::Error as EncodeError;
use thiserror::Error;

/// MessagePool error.
#[derive(Debug, PartialEq, Error)]
#[derive(Debug, PartialEq, Eq, Error)]
pub enum Error {
/// Error indicating message that's too large
#[error("Message is too big")]
Expand Down
2 changes: 1 addition & 1 deletion blockchain/state_manager/src/vm_circ_supply.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ fn get_fil_locked<DB: BlockStore>(
fn get_fil_burnt<DB: BlockStore>(
state_tree: &StateTree<DB>,
) -> Result<TokenAmount, Box<dyn StdError>> {
let burnt_actor = get_actor_state(state_tree, &*BURNT_FUNDS_ACTOR_ADDR)?;
let burnt_actor = get_actor_state(state_tree, BURNT_FUNDS_ACTOR_ADDR)?;

Ok(burnt_actor.balance)
}
Expand Down
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ coverage:
project:
default:
threshold: 1%
informational: true
patch:
default:
informational: true
2 changes: 1 addition & 1 deletion crypto/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::error;
use thiserror::Error;

/// Crypto error
#[derive(Debug, PartialEq, Error)]
#[derive(Debug, PartialEq, Eq, Error)]
pub enum Error {
/// Failed to produce a signature
#[error("Failed to sign data {0}")]
Expand Down
2 changes: 1 addition & 1 deletion forest/src/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use rpc_client::DEFAULT_PORT;
use serde::{Deserialize, Serialize};
use utils::get_home_dir;

#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(default)]
pub struct Config {
pub data_dir: String,
Expand Down
2 changes: 1 addition & 1 deletion ipld/amt/benches/amt_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<'de> Deserialize<'de> for BenchData {
where
D: Deserializer<'de>,
{
let _s: () = Deserialize::deserialize(deserializer)?;
Deserialize::deserialize(deserializer)?;

Ok(Self::default())
}
Expand Down
2 changes: 1 addition & 1 deletion ipld/car/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use serde::{Deserialize, Serialize};
use util::{ld_read, ld_write, read_node};

/// CAR file header
#[derive(Debug, Default, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
pub struct CarHeader {
pub roots: Vec<Cid>,
pub version: u64,
Expand Down
2 changes: 1 addition & 1 deletion ipld/cid/tests/json_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn symmetric_json_serialization() {

#[test]
fn annotating_struct_json() {
#[derive(Serialize, Deserialize, Debug, PartialEq)]
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq)]
struct TestStruct {
#[serde(with = "json")]
cid_one: Cid,
Expand Down
2 changes: 1 addition & 1 deletion ipld/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::fmt;
use thiserror::Error;

/// Ipld error
#[derive(Debug, PartialEq, Error)]
#[derive(Debug, PartialEq, Eq, Error)]
pub enum Error {
#[error("{0}")]
Encoding(String),
Expand Down
2 changes: 1 addition & 1 deletion ipld/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use std::fmt;
/// path.extend(&"other/path".into());
/// assert_eq!(path.to_string(), "some/path/1/2/other/path");
/// ```
#[derive(Debug, PartialEq, Default, Clone)]
#[derive(Debug, PartialEq, Eq, Default, Clone)]
pub struct Path {
segments: Vec<PathSegment>,
}
Expand Down
2 changes: 1 addition & 1 deletion ipld/src/path_segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::convert::TryFrom;
use std::fmt;

/// Represents either a key in a map or an index in a list.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum PathSegment {
/// Key in a map
String(String),
Expand Down
4 changes: 2 additions & 2 deletions ipld/src/selector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub enum Selector {

impl Cbor for Selector {}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Copy)]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Copy)]
pub enum RecursionLimit {
#[serde(rename = "none", with = "empty_map")]
None,
Expand All @@ -176,7 +176,7 @@ impl SubAssign<u64> for RecursionLimit {
/// TODO -- Condition is very skeletal and incomplete.
/// The place where Condition appears in other structs is correct;
/// the rest of the details inside it are not final nor even completely drafted.
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Copy)]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Copy)]
pub enum Condition {
#[serde(rename = "hasField")]
HasField,
Expand Down
4 changes: 2 additions & 2 deletions ipld/src/selector/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Selector {
}

/// Provides reason for callback in traversal for `walk_all`.
#[derive(Debug, Clone, Copy, PartialEq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum VisitReason {
/// Ipld node visited was a specific match.
SelectionMatch,
Expand Down Expand Up @@ -83,7 +83,7 @@ pub struct Progress<L = ()> {
}

/// Contains information about the last block that was traversed in walking of the ipld graph.
#[derive(Debug, PartialEq, Clone)]
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct LastBlockInfo {
pub path: Path,
pub link: Cid,
Expand Down
2 changes: 1 addition & 1 deletion key_management/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::io;
use thiserror::Error;

#[derive(Debug, PartialEq, Error)]
#[derive(Debug, PartialEq, Eq, Error)]
pub enum Error {
/// info that corresponds to key does not exist
#[error("Key info not found")]
Expand Down
2 changes: 1 addition & 1 deletion node/db/src/rocks_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use serde::{Deserialize, Serialize};
/// Only subset of possible options is implemented, add missing ones when needed.
/// For description of different options please refer to the `rocksdb` crate documentation.
/// <https://docs.rs/rocksdb/latest/rocksdb/>
#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(default)]
pub struct RocksDbConfig {
pub create_if_missing: bool,
Expand Down
6 changes: 3 additions & 3 deletions node/forest_libp2p/src/chain_exchange/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub const HEADERS: u64 = 0b01;
pub const MESSAGES: u64 = 0b10;

/// The payload that gets sent to another node to request for blocks and messages.
#[derive(Clone, Debug, PartialEq, Serialize_tuple, Deserialize_tuple)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct ChainExchangeRequest {
/// The tipset [Cid] to start the request from.
pub start: Vec<Cid>,
Expand All @@ -38,7 +38,7 @@ impl ChainExchangeRequest {
}

/// Status codes of a chain_exchange response.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ChainExchangeResponseStatus {
/// All is well.
Success,
Expand Down Expand Up @@ -126,7 +126,7 @@ impl ChainExchangeResponse {
}
}
/// Contains all bls and secp messages and their indexes per block
#[derive(Clone, Debug, PartialEq, Serialize_tuple, Deserialize_tuple)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize_tuple, Deserialize_tuple)]
pub struct CompactedMessages {
/// Unsigned bls messages.
pub bls_msgs: Vec<UnsignedMessage>,
Expand Down
2 changes: 1 addition & 1 deletion node/forest_libp2p/src/chain_exchange/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use libp2p::core::ProtocolName;
pub const CHAIN_XCHG_PROTOCOL_ID: &[u8] = b"/fil/chain/xchg/0.0.1";

/// Type to satisfy `ProtocolName` interface for ChainExchange RPC.
#[derive(Clone, Debug, PartialEq, Default)]
#[derive(Clone, Debug, PartialEq, Eq, Default)]
pub struct ChainExchangeProtocolName;

impl ProtocolName for ChainExchangeProtocolName {
Expand Down
2 changes: 1 addition & 1 deletion node/forest_libp2p/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use networks::DEFAULT_BOOTSTRAP;
use serde::{Deserialize, Serialize};

/// Libp2p config for the Forest node.
#[derive(Debug, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq)]
#[serde(default)]
pub struct Libp2pConfig {
/// Local address.
Expand Down
Loading

0 comments on commit d846152

Please sign in to comment.