From 1bdce182a94fa45efafd8ad365924613823fc372 Mon Sep 17 00:00:00 2001 From: Feng94 <8751189+Feng94@users.noreply.github.com> Date: Tue, 19 Feb 2019 00:03:35 +1100 Subject: [PATCH 1/2] Rename block_producer crate to block_proposer and change references inside it to block_proposer --- eth2/{block_producer => block_proposer}/Cargo.toml | 2 +- eth2/{block_producer => block_proposer}/src/lib.rs | 12 ++++++------ .../src/test_utils/epoch_map.rs | 0 .../src/test_utils/local_signer.rs | 0 .../src/test_utils/mod.rs | 0 .../src/test_utils/simulated_beacon_node.rs | 0 .../{block_producer => block_proposer}/src/traits.rs | 0 7 files changed, 7 insertions(+), 7 deletions(-) rename eth2/{block_producer => block_proposer}/Cargo.toml (91%) rename eth2/{block_producer => block_proposer}/src/lib.rs (97%) rename eth2/{block_producer => block_proposer}/src/test_utils/epoch_map.rs (100%) rename eth2/{block_producer => block_proposer}/src/test_utils/local_signer.rs (100%) rename eth2/{block_producer => block_proposer}/src/test_utils/mod.rs (100%) rename eth2/{block_producer => block_proposer}/src/test_utils/simulated_beacon_node.rs (100%) rename eth2/{block_producer => block_proposer}/src/traits.rs (100%) diff --git a/eth2/block_producer/Cargo.toml b/eth2/block_proposer/Cargo.toml similarity index 91% rename from eth2/block_producer/Cargo.toml rename to eth2/block_proposer/Cargo.toml index 15d1343cc..81f1ccc28 100644 --- a/eth2/block_producer/Cargo.toml +++ b/eth2/block_proposer/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "block_producer" +name = "block_proposer" version = "0.1.0" authors = ["Paul Hauner "] edition = "2018" diff --git a/eth2/block_producer/src/lib.rs b/eth2/block_proposer/src/lib.rs similarity index 97% rename from eth2/block_producer/src/lib.rs rename to eth2/block_proposer/src/lib.rs index 7b15eb4e9..cf71edd99 100644 --- a/eth2/block_producer/src/lib.rs +++ b/eth2/block_proposer/src/lib.rs @@ -236,7 +236,7 @@ mod tests { epoch_map.map.insert(produce_epoch, produce_slot); let epoch_map = Arc::new(epoch_map); - let mut block_producer = BlockProducer::new( + let mut block_proposer = BlockProducer::new( spec.clone(), epoch_map.clone(), slot_clock.clone(), @@ -251,28 +251,28 @@ mod tests { // One slot before production slot... slot_clock.set_slot(produce_slot.as_u64() - 1); assert_eq!( - block_producer.poll(), + block_proposer.poll(), Ok(PollOutcome::BlockProductionNotRequired(produce_slot - 1)) ); // On the produce slot... slot_clock.set_slot(produce_slot.as_u64()); assert_eq!( - block_producer.poll(), + block_proposer.poll(), Ok(PollOutcome::BlockProduced(produce_slot.into())) ); // Trying the same produce slot again... slot_clock.set_slot(produce_slot.as_u64()); assert_eq!( - block_producer.poll(), + block_proposer.poll(), Ok(PollOutcome::SlotAlreadyProcessed(produce_slot)) ); // One slot after the produce slot... slot_clock.set_slot(produce_slot.as_u64() + 1); assert_eq!( - block_producer.poll(), + block_proposer.poll(), Ok(PollOutcome::BlockProductionNotRequired(produce_slot + 1)) ); @@ -280,7 +280,7 @@ mod tests { let slot = (produce_epoch.as_u64() + 1) * spec.epoch_length; slot_clock.set_slot(slot); assert_eq!( - block_producer.poll(), + block_proposer.poll(), Ok(PollOutcome::ProducerDutiesUnknown(Slot::new(slot))) ); } diff --git a/eth2/block_producer/src/test_utils/epoch_map.rs b/eth2/block_proposer/src/test_utils/epoch_map.rs similarity index 100% rename from eth2/block_producer/src/test_utils/epoch_map.rs rename to eth2/block_proposer/src/test_utils/epoch_map.rs diff --git a/eth2/block_producer/src/test_utils/local_signer.rs b/eth2/block_proposer/src/test_utils/local_signer.rs similarity index 100% rename from eth2/block_producer/src/test_utils/local_signer.rs rename to eth2/block_proposer/src/test_utils/local_signer.rs diff --git a/eth2/block_producer/src/test_utils/mod.rs b/eth2/block_proposer/src/test_utils/mod.rs similarity index 100% rename from eth2/block_producer/src/test_utils/mod.rs rename to eth2/block_proposer/src/test_utils/mod.rs diff --git a/eth2/block_producer/src/test_utils/simulated_beacon_node.rs b/eth2/block_proposer/src/test_utils/simulated_beacon_node.rs similarity index 100% rename from eth2/block_producer/src/test_utils/simulated_beacon_node.rs rename to eth2/block_proposer/src/test_utils/simulated_beacon_node.rs diff --git a/eth2/block_producer/src/traits.rs b/eth2/block_proposer/src/traits.rs similarity index 100% rename from eth2/block_producer/src/traits.rs rename to eth2/block_proposer/src/traits.rs From 7ed606eca126567845eea0c333f1254a8be5a3e0 Mon Sep 17 00:00:00 2001 From: Feng94 <8751189+Feng94@users.noreply.github.com> Date: Tue, 19 Feb 2019 00:21:23 +1100 Subject: [PATCH 2/2] Modify block_producer references in other crates where needed for compilation --- Cargo.toml | 2 +- beacon_node/beacon_chain/Cargo.toml | 2 +- beacon_node/beacon_chain/test_harness/Cargo.toml | 2 +- .../test_harness/src/validator_harness/direct_beacon_node.rs | 2 +- .../test_harness/src/validator_harness/direct_duties.rs | 2 +- .../test_harness/src/validator_harness/local_signer.rs | 2 +- .../beacon_chain/test_harness/src/validator_harness/mod.rs | 4 ++-- validator_client/Cargo.toml | 2 +- .../src/block_producer_service/beacon_block_grpc_client.rs | 2 +- validator_client/src/block_producer_service/mod.rs | 2 +- validator_client/src/duties/epoch_duties.rs | 2 +- validator_client/src/main.rs | 2 +- 12 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5ab0ba847..302c04154 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [workspace] members = [ "eth2/attester", - "eth2/block_producer", + "eth2/block_proposer", "eth2/fork_choice", "eth2/state_processing", "eth2/types", diff --git a/beacon_node/beacon_chain/Cargo.toml b/beacon_node/beacon_chain/Cargo.toml index 36d7b3721..4ce894477 100644 --- a/beacon_node/beacon_chain/Cargo.toml +++ b/beacon_node/beacon_chain/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Paul Hauner "] edition = "2018" [dependencies] -block_producer = { path = "../../eth2/block_producer" } +block_proposer = { path = "../../eth2/block_proposer" } bls = { path = "../../eth2/utils/bls" } boolean-bitfield = { path = "../../eth2/utils/boolean-bitfield" } db = { path = "../db" } diff --git a/beacon_node/beacon_chain/test_harness/Cargo.toml b/beacon_node/beacon_chain/test_harness/Cargo.toml index bb335c152..77b52ccf6 100644 --- a/beacon_node/beacon_chain/test_harness/Cargo.toml +++ b/beacon_node/beacon_chain/test_harness/Cargo.toml @@ -14,7 +14,7 @@ criterion = "0.2" [dependencies] attester = { path = "../../../eth2/attester" } beacon_chain = { path = "../../beacon_chain" } -block_producer = { path = "../../../eth2/block_producer" } +block_proposer = { path = "../../../eth2/block_proposer" } bls = { path = "../../../eth2/utils/bls" } boolean-bitfield = { path = "../../../eth2/utils/boolean-bitfield" } db = { path = "../../db" } diff --git a/beacon_node/beacon_chain/test_harness/src/validator_harness/direct_beacon_node.rs b/beacon_node/beacon_chain/test_harness/src/validator_harness/direct_beacon_node.rs index be71b9abd..06d3e7c72 100644 --- a/beacon_node/beacon_chain/test_harness/src/validator_harness/direct_beacon_node.rs +++ b/beacon_node/beacon_chain/test_harness/src/validator_harness/direct_beacon_node.rs @@ -3,7 +3,7 @@ use attester::{ PublishOutcome as AttestationPublishOutcome, }; use beacon_chain::BeaconChain; -use block_producer::{ +use block_proposer::{ BeaconNode as BeaconBlockNode, BeaconNodeError as BeaconBlockNodeError, PublishOutcome as BlockPublishOutcome, }; diff --git a/beacon_node/beacon_chain/test_harness/src/validator_harness/direct_duties.rs b/beacon_node/beacon_chain/test_harness/src/validator_harness/direct_duties.rs index 66b9d650c..5bed59531 100644 --- a/beacon_node/beacon_chain/test_harness/src/validator_harness/direct_duties.rs +++ b/beacon_node/beacon_chain/test_harness/src/validator_harness/direct_duties.rs @@ -2,7 +2,7 @@ use attester::{ DutiesReader as AttesterDutiesReader, DutiesReaderError as AttesterDutiesReaderError, }; use beacon_chain::BeaconChain; -use block_producer::{ +use block_proposer::{ DutiesReader as ProducerDutiesReader, DutiesReaderError as ProducerDutiesReaderError, }; use db::ClientDB; diff --git a/beacon_node/beacon_chain/test_harness/src/validator_harness/local_signer.rs b/beacon_node/beacon_chain/test_harness/src/validator_harness/local_signer.rs index 8e901b057..aa46a1c9a 100644 --- a/beacon_node/beacon_chain/test_harness/src/validator_harness/local_signer.rs +++ b/beacon_node/beacon_chain/test_harness/src/validator_harness/local_signer.rs @@ -1,5 +1,5 @@ use attester::Signer as AttesterSigner; -use block_producer::Signer as BlockProposerSigner; +use block_proposer::Signer as BlockProposerSigner; use std::sync::RwLock; use types::{Keypair, Signature}; diff --git a/beacon_node/beacon_chain/test_harness/src/validator_harness/mod.rs b/beacon_node/beacon_chain/test_harness/src/validator_harness/mod.rs index 3df32fa64..f48309541 100644 --- a/beacon_node/beacon_chain/test_harness/src/validator_harness/mod.rs +++ b/beacon_node/beacon_chain/test_harness/src/validator_harness/mod.rs @@ -5,8 +5,8 @@ mod local_signer; use attester::PollOutcome as AttestationPollOutcome; use attester::{Attester, Error as AttestationPollError}; use beacon_chain::BeaconChain; -use block_producer::PollOutcome as BlockPollOutcome; -use block_producer::{BlockProducer, Error as BlockPollError}; +use block_proposer::PollOutcome as BlockPollOutcome; +use block_proposer::{BlockProducer, Error as BlockPollError}; use db::MemoryDB; use direct_beacon_node::DirectBeaconNode; use direct_duties::DirectDuties; diff --git a/validator_client/Cargo.toml b/validator_client/Cargo.toml index 8ab515e15..f76772f28 100644 --- a/validator_client/Cargo.toml +++ b/validator_client/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Paul Hauner "] edition = "2018" [dependencies] -block_producer = { path = "../eth2/block_producer" } +block_proposer = { path = "../eth2/block_proposer" } bls = { path = "../eth2/utils/bls" } clap = "2.32.0" dirs = "1.0.3" diff --git a/validator_client/src/block_producer_service/beacon_block_grpc_client.rs b/validator_client/src/block_producer_service/beacon_block_grpc_client.rs index 39ef7fcdc..6bf3005d4 100644 --- a/validator_client/src/block_producer_service/beacon_block_grpc_client.rs +++ b/validator_client/src/block_producer_service/beacon_block_grpc_client.rs @@ -1,4 +1,4 @@ -use block_producer::{BeaconNode, BeaconNodeError, PublishOutcome}; +use block_proposer::{BeaconNode, BeaconNodeError, PublishOutcome}; use protos::services::{ BeaconBlock as GrpcBeaconBlock, ProduceBeaconBlockRequest, PublishBeaconBlockRequest, }; diff --git a/validator_client/src/block_producer_service/mod.rs b/validator_client/src/block_producer_service/mod.rs index 82c3f2537..bd1e691cb 100644 --- a/validator_client/src/block_producer_service/mod.rs +++ b/validator_client/src/block_producer_service/mod.rs @@ -1,7 +1,7 @@ mod beacon_block_grpc_client; // mod block_producer_service; -use block_producer::{ +use block_proposer::{ BeaconNode, BlockProducer, DutiesReader, PollOutcome as BlockProducerPollOutcome, Signer, }; use slog::{error, info, warn, Logger}; diff --git a/validator_client/src/duties/epoch_duties.rs b/validator_client/src/duties/epoch_duties.rs index b555eee28..54a882f8d 100644 --- a/validator_client/src/duties/epoch_duties.rs +++ b/validator_client/src/duties/epoch_duties.rs @@ -1,4 +1,4 @@ -use block_producer::{DutiesReader, DutiesReaderError}; +use block_proposer::{DutiesReader, DutiesReaderError}; use std::collections::HashMap; use std::sync::RwLock; use types::{Epoch, Slot}; diff --git a/validator_client/src/main.rs b/validator_client/src/main.rs index 98be9159a..c835300b5 100644 --- a/validator_client/src/main.rs +++ b/validator_client/src/main.rs @@ -1,7 +1,7 @@ use self::block_producer_service::{BeaconBlockGrpcClient, BlockProducerService}; use self::duties::{DutiesManager, DutiesManagerService, EpochDutiesMap}; use crate::config::ClientConfig; -use block_producer::{test_utils::LocalSigner, BlockProducer}; +use block_proposer::{test_utils::LocalSigner, BlockProducer}; use bls::Keypair; use clap::{App, Arg}; use grpcio::{ChannelBuilder, EnvBuilder};