From e5028720833d18dfa161559854b4f8812e410ca2 Mon Sep 17 00:00:00 2001 From: Stan Drozd Date: Wed, 19 Dec 2018 16:07:01 +0100 Subject: [PATCH 1/2] cargo-fix the whole workspace into Rust 2018 --- .../attestation_validation/src/lib.rs | 12 ++++---- beacon_chain/chain/src/lib.rs | 6 ++-- beacon_chain/types/src/lib.rs | 28 +++++++++---------- beacon_chain/utils/ssz/src/lib.rs | 4 +-- beacon_chain/validator_induction/src/lib.rs | 2 +- beacon_chain/validator_shuffling/src/lib.rs | 2 +- lighthouse/main.rs | 2 +- 7 files changed, 28 insertions(+), 28 deletions(-) diff --git a/beacon_chain/attestation_validation/src/lib.rs b/beacon_chain/attestation_validation/src/lib.rs index 8544be862..36fca9740 100644 --- a/beacon_chain/attestation_validation/src/lib.rs +++ b/beacon_chain/attestation_validation/src/lib.rs @@ -15,9 +15,9 @@ mod justified_slot; mod shard_block; mod signature; -pub use enums::{Invalid, Outcome, Error}; -pub use block_inclusion::validate_attestation_for_block; -pub use justified_slot::validate_attestation_justified_slot; -pub use justified_block::validate_attestation_justified_block_hash; -pub use signature::validate_attestation_signature; -pub use shard_block::validate_attestation_data_shard_block_hash; +pub use crate::enums::{Invalid, Outcome, Error}; +pub use crate::block_inclusion::validate_attestation_for_block; +pub use crate::justified_slot::validate_attestation_justified_slot; +pub use crate::justified_block::validate_attestation_justified_block_hash; +pub use crate::signature::validate_attestation_signature; +pub use crate::shard_block::validate_attestation_data_shard_block_hash; diff --git a/beacon_chain/chain/src/lib.rs b/beacon_chain/chain/src/lib.rs index 0837f3baf..7976b34a1 100644 --- a/beacon_chain/chain/src/lib.rs +++ b/beacon_chain/chain/src/lib.rs @@ -14,11 +14,11 @@ mod stores; mod transition; use db::ClientDB; -use genesis::{genesis_states, Error as GenesisError}; -use maps::{generate_attester_and_proposer_maps, AttesterAndProposerMapError}; +use crate::genesis::{genesis_states, Error as GenesisError}; +use crate::maps::{generate_attester_and_proposer_maps, AttesterAndProposerMapError}; use std::collections::HashMap; use std::sync::Arc; -use stores::BeaconChainStore; +use crate::stores::BeaconChainStore; use types::{ActiveState, AttesterMap, ChainConfig, CrystallizedState, Hash256, ProposerMap}; #[derive(Debug, PartialEq)] diff --git a/beacon_chain/types/src/lib.rs b/beacon_chain/types/src/lib.rs index f86d5f024..273318a85 100644 --- a/beacon_chain/types/src/lib.rs +++ b/beacon_chain/types/src/lib.rs @@ -23,20 +23,20 @@ pub mod validator_registration; use self::ethereum_types::{H160, H256, U256}; use std::collections::HashMap; -pub use active_state::ActiveState; -pub use attestation_data::AttestationData; -pub use attestation::Attestation; -pub use beacon_block::BeaconBlock; -pub use beacon_state::BeaconState; -pub use chain_config::ChainConfig; -pub use crosslink_record::CrosslinkRecord; -pub use crystallized_state::CrystallizedState; -pub use fork_data::ForkData; -pub use pending_attestation_record::PendingAttestationRecord; -pub use shard_and_committee::ShardAndCommittee; -pub use special_record::{SpecialRecord, SpecialRecordKind}; -pub use validator_record::{ValidatorRecord, ValidatorStatus}; -pub use validator_registration::ValidatorRegistration; +pub use crate::active_state::ActiveState; +pub use crate::attestation_data::AttestationData; +pub use crate::attestation::Attestation; +pub use crate::beacon_block::BeaconBlock; +pub use crate::beacon_state::BeaconState; +pub use crate::chain_config::ChainConfig; +pub use crate::crosslink_record::CrosslinkRecord; +pub use crate::crystallized_state::CrystallizedState; +pub use crate::fork_data::ForkData; +pub use crate::pending_attestation_record::PendingAttestationRecord; +pub use crate::shard_and_committee::ShardAndCommittee; +pub use crate::special_record::{SpecialRecord, SpecialRecordKind}; +pub use crate::validator_record::{ValidatorRecord, ValidatorStatus}; +pub use crate::validator_registration::ValidatorRegistration; pub type Hash256 = H256; pub type Address = H160; diff --git a/beacon_chain/utils/ssz/src/lib.rs b/beacon_chain/utils/ssz/src/lib.rs index f3a195e42..ccfcb7f5b 100644 --- a/beacon_chain/utils/ssz/src/lib.rs +++ b/beacon_chain/utils/ssz/src/lib.rs @@ -16,8 +16,8 @@ pub mod encode; mod impl_decode; mod impl_encode; -pub use decode::{decode_ssz, decode_ssz_list, Decodable, DecodeError}; -pub use encode::{Encodable, SszStream}; +pub use crate::decode::{decode_ssz, decode_ssz_list, Decodable, DecodeError}; +pub use crate::encode::{Encodable, SszStream}; pub const LENGTH_BYTES: usize = 4; pub const MAX_LIST_SIZE: usize = 1 << (4 * 8); diff --git a/beacon_chain/validator_induction/src/lib.rs b/beacon_chain/validator_induction/src/lib.rs index 6ea6265ba..ded9785da 100644 --- a/beacon_chain/validator_induction/src/lib.rs +++ b/beacon_chain/validator_induction/src/lib.rs @@ -4,4 +4,4 @@ extern crate types; mod inductor; -pub use inductor::{ValidatorInductionError, ValidatorInductor}; +pub use crate::inductor::{ValidatorInductionError, ValidatorInductor}; diff --git a/beacon_chain/validator_shuffling/src/lib.rs b/beacon_chain/validator_shuffling/src/lib.rs index 90077279f..b4d320437 100644 --- a/beacon_chain/validator_shuffling/src/lib.rs +++ b/beacon_chain/validator_shuffling/src/lib.rs @@ -4,4 +4,4 @@ extern crate vec_shuffle; mod shuffle; -pub use shuffle::{shard_and_committees_for_cycle, ValidatorAssignmentError}; +pub use crate::shuffle::{shard_and_committees_for_cycle, ValidatorAssignmentError}; diff --git a/lighthouse/main.rs b/lighthouse/main.rs index 67c9954f0..b2c199db9 100644 --- a/lighthouse/main.rs +++ b/lighthouse/main.rs @@ -13,7 +13,7 @@ mod config; use std::path::PathBuf; use clap::{App, Arg}; -use config::LighthouseConfig; +use crate::config::LighthouseConfig; use slog::Drain; fn main() { From dcf9f2244a5ac7d635f648430759b3dba43edbb8 Mon Sep 17 00:00:00 2001 From: Stan Drozd Date: Wed, 19 Dec 2018 16:38:59 +0100 Subject: [PATCH 2/2] Add 'edition = "2018"' to every Cargo.toml --- Cargo.toml | 1 + beacon_chain/attestation_validation/Cargo.toml | 1 + beacon_chain/chain/Cargo.toml | 1 + beacon_chain/naive_fork_choice/Cargo.toml | 1 + beacon_chain/spec/Cargo.toml | 1 + beacon_chain/state-transition/Cargo.toml | 1 + beacon_chain/types/Cargo.toml | 1 + beacon_chain/utils/bls/Cargo.toml | 1 + beacon_chain/utils/boolean-bitfield/Cargo.toml | 3 ++- beacon_chain/utils/hashing/Cargo.toml | 3 ++- beacon_chain/utils/honey-badger-split/Cargo.toml | 1 + beacon_chain/utils/slot-clock/Cargo.toml | 1 + beacon_chain/utils/ssz/Cargo.toml | 1 + beacon_chain/utils/ssz_helpers/Cargo.toml | 1 + beacon_chain/utils/vec_shuffle/Cargo.toml | 1 + beacon_chain/validator_change/Cargo.toml | 1 + beacon_chain/validator_induction/Cargo.toml | 1 + beacon_chain/validator_shuffling/Cargo.toml | 1 + lighthouse/db/Cargo.toml | 1 + 19 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 069e697a4..7490c3d00 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "lighthouse" version = "0.0.1" authors = ["Paul Hauner "] +edition = "2018" [dependencies] blake2-rfc = "0.2.18" diff --git a/beacon_chain/attestation_validation/Cargo.toml b/beacon_chain/attestation_validation/Cargo.toml index 4606d03ec..b2f84fd1d 100644 --- a/beacon_chain/attestation_validation/Cargo.toml +++ b/beacon_chain/attestation_validation/Cargo.toml @@ -2,6 +2,7 @@ name = "attestation_validation" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] bls = { path = "../utils/bls" } diff --git a/beacon_chain/chain/Cargo.toml b/beacon_chain/chain/Cargo.toml index 479804f45..77555d9a9 100644 --- a/beacon_chain/chain/Cargo.toml +++ b/beacon_chain/chain/Cargo.toml @@ -2,6 +2,7 @@ name = "chain" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] bls = { path = "../utils/bls" } diff --git a/beacon_chain/naive_fork_choice/Cargo.toml b/beacon_chain/naive_fork_choice/Cargo.toml index 679575556..9508ed02e 100644 --- a/beacon_chain/naive_fork_choice/Cargo.toml +++ b/beacon_chain/naive_fork_choice/Cargo.toml @@ -2,6 +2,7 @@ name = "naive_fork_choice" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] db = { path = "../../lighthouse/db" } diff --git a/beacon_chain/spec/Cargo.toml b/beacon_chain/spec/Cargo.toml index a2eac0692..2da687fa3 100644 --- a/beacon_chain/spec/Cargo.toml +++ b/beacon_chain/spec/Cargo.toml @@ -2,6 +2,7 @@ name = "spec" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] types = { path = "../types" } diff --git a/beacon_chain/state-transition/Cargo.toml b/beacon_chain/state-transition/Cargo.toml index 7beb8f613..12618a6ce 100644 --- a/beacon_chain/state-transition/Cargo.toml +++ b/beacon_chain/state-transition/Cargo.toml @@ -2,6 +2,7 @@ name = "state-transition" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] types = { path = "../types" } diff --git a/beacon_chain/types/Cargo.toml b/beacon_chain/types/Cargo.toml index cf20f69c0..7b1f0d440 100644 --- a/beacon_chain/types/Cargo.toml +++ b/beacon_chain/types/Cargo.toml @@ -2,6 +2,7 @@ name = "types" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] bls = { path = "../utils/bls" } diff --git a/beacon_chain/utils/bls/Cargo.toml b/beacon_chain/utils/bls/Cargo.toml index 1199efc15..d38b5c604 100644 --- a/beacon_chain/utils/bls/Cargo.toml +++ b/beacon_chain/utils/bls/Cargo.toml @@ -2,6 +2,7 @@ name = "bls" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] bls-aggregates = { git = "https://github.com/sigp/signature-schemes" } diff --git a/beacon_chain/utils/boolean-bitfield/Cargo.toml b/beacon_chain/utils/boolean-bitfield/Cargo.toml index 1633401e2..b3d05f979 100644 --- a/beacon_chain/utils/boolean-bitfield/Cargo.toml +++ b/beacon_chain/utils/boolean-bitfield/Cargo.toml @@ -2,7 +2,8 @@ name = "boolean-bitfield" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] ssz = { path = "../ssz" } -bit-vec = "0.5.0" \ No newline at end of file +bit-vec = "0.5.0" diff --git a/beacon_chain/utils/hashing/Cargo.toml b/beacon_chain/utils/hashing/Cargo.toml index 8bed7adaf..1527bceba 100644 --- a/beacon_chain/utils/hashing/Cargo.toml +++ b/beacon_chain/utils/hashing/Cargo.toml @@ -2,6 +2,7 @@ name = "hashing" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] -tiny-keccak = "1.4.2" \ No newline at end of file +tiny-keccak = "1.4.2" diff --git a/beacon_chain/utils/honey-badger-split/Cargo.toml b/beacon_chain/utils/honey-badger-split/Cargo.toml index e9721efd4..87246eafd 100644 --- a/beacon_chain/utils/honey-badger-split/Cargo.toml +++ b/beacon_chain/utils/honey-badger-split/Cargo.toml @@ -2,5 +2,6 @@ name = "honey-badger-split" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] diff --git a/beacon_chain/utils/slot-clock/Cargo.toml b/beacon_chain/utils/slot-clock/Cargo.toml index c10fb6bd9..ccb2e4ed4 100644 --- a/beacon_chain/utils/slot-clock/Cargo.toml +++ b/beacon_chain/utils/slot-clock/Cargo.toml @@ -2,5 +2,6 @@ name = "slot-clock" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] diff --git a/beacon_chain/utils/ssz/Cargo.toml b/beacon_chain/utils/ssz/Cargo.toml index aa4dc5d72..e28e92c23 100644 --- a/beacon_chain/utils/ssz/Cargo.toml +++ b/beacon_chain/utils/ssz/Cargo.toml @@ -2,6 +2,7 @@ name = "ssz" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] bytes = "0.4.9" diff --git a/beacon_chain/utils/ssz_helpers/Cargo.toml b/beacon_chain/utils/ssz_helpers/Cargo.toml index a8189ce60..3634ea39c 100644 --- a/beacon_chain/utils/ssz_helpers/Cargo.toml +++ b/beacon_chain/utils/ssz_helpers/Cargo.toml @@ -2,6 +2,7 @@ name = "ssz_helpers" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] bls = { path = "../bls" } diff --git a/beacon_chain/utils/vec_shuffle/Cargo.toml b/beacon_chain/utils/vec_shuffle/Cargo.toml index 3e7ece8ea..aaeb50074 100644 --- a/beacon_chain/utils/vec_shuffle/Cargo.toml +++ b/beacon_chain/utils/vec_shuffle/Cargo.toml @@ -2,6 +2,7 @@ name = "vec_shuffle" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] hashing = { path = "../hashing" } diff --git a/beacon_chain/validator_change/Cargo.toml b/beacon_chain/validator_change/Cargo.toml index 0705033dc..4574a115f 100644 --- a/beacon_chain/validator_change/Cargo.toml +++ b/beacon_chain/validator_change/Cargo.toml @@ -2,6 +2,7 @@ name = "validator_change" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] bytes = "0.4.10" diff --git a/beacon_chain/validator_induction/Cargo.toml b/beacon_chain/validator_induction/Cargo.toml index 9a443133e..5907014df 100644 --- a/beacon_chain/validator_induction/Cargo.toml +++ b/beacon_chain/validator_induction/Cargo.toml @@ -2,6 +2,7 @@ name = "validator_induction" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] bls = { path = "../utils/bls" } diff --git a/beacon_chain/validator_shuffling/Cargo.toml b/beacon_chain/validator_shuffling/Cargo.toml index ba99841b8..ae2babf1a 100644 --- a/beacon_chain/validator_shuffling/Cargo.toml +++ b/beacon_chain/validator_shuffling/Cargo.toml @@ -2,6 +2,7 @@ name = "validator_shuffling" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] honey-badger-split = { path = "../utils/honey-badger-split" } diff --git a/lighthouse/db/Cargo.toml b/lighthouse/db/Cargo.toml index a2718889c..a8cfb88d4 100644 --- a/lighthouse/db/Cargo.toml +++ b/lighthouse/db/Cargo.toml @@ -2,6 +2,7 @@ name = "db" version = "0.1.0" authors = ["Paul Hauner "] +edition = "2018" [dependencies] blake2-rfc = "0.2.18"