Merge pull request #550 from sigp/protobuf-2.8

Fix the build for Rust 1.38, protobuf releases
This commit is contained in:
Paul Hauner 2019-09-30 13:57:01 +10:00 committed by GitHub
commit 682b11f248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 22 additions and 64 deletions

View File

@ -146,15 +146,9 @@ impl<T: BeaconChainTypes + 'static> MessageHandler<T> {
) { ) {
// an error could have occurred. // an error could have occurred.
match error_response { match error_response {
RPCErrorResponse::InvalidRequest(error) => { RPCErrorResponse::InvalidRequest(error) => warn!(self.log, "Peer indicated invalid request";"peer_id" => format!("{:?}", peer_id), "error" => error.as_string()),
warn!(self.log, "Peer indicated invalid request";"peer_id" => format!("{:?}", peer_id), "error" => error.as_string()) RPCErrorResponse::ServerError(error) => warn!(self.log, "Peer internal server error";"peer_id" => format!("{:?}", peer_id), "error" => error.as_string()),
} RPCErrorResponse::Unknown(error) => warn!(self.log, "Unknown peer error";"peer" => format!("{:?}", peer_id), "error" => error.as_string()),
RPCErrorResponse::ServerError(error) => {
warn!(self.log, "Peer internal server error";"peer_id" => format!("{:?}", peer_id), "error" => error.as_string())
}
RPCErrorResponse::Unknown(error) => {
warn!(self.log, "Unknown peer error";"peer" => format!("{:?}", peer_id), "error" => error.as_string())
}
RPCErrorResponse::Success(response) => { RPCErrorResponse::Success(response) => {
match response { match response {
RPCResponse::Hello(hello_message) => { RPCResponse::Hello(hello_message) => {

View File

@ -13,7 +13,7 @@ criterion = "0.2"
env_logger = "0.6.0" env_logger = "0.6.0"
serde = "1.0" serde = "1.0"
serde_derive = "1.0" serde_derive = "1.0"
lazy_static = "0.1" lazy_static = "1.4"
serde_yaml = "0.8" serde_yaml = "0.8"
eth2_ssz = { path = "../utils/ssz" } eth2_ssz = { path = "../utils/ssz" }
beacon_chain = { path = "../../beacon_node/beacon_chain" } beacon_chain = { path = "../../beacon_node/beacon_chain" }

View File

@ -58,5 +58,4 @@ mod tests {
use crate::*; use crate::*;
ssz_tests!(Attestation<MainnetEthSpec>); ssz_tests!(Attestation<MainnetEthSpec>);
} }

View File

@ -19,5 +19,4 @@ mod test {
use super::*; use super::*;
ssz_tests!(AttestationDataAndCustodyBit); ssz_tests!(AttestationDataAndCustodyBit);
} }

View File

@ -21,5 +21,4 @@ mod tests {
use crate::*; use crate::*;
ssz_tests!(AttesterSlashing<MainnetEthSpec>); ssz_tests!(AttesterSlashing<MainnetEthSpec>);
} }

View File

@ -32,5 +32,4 @@ mod tests {
use super::*; use super::*;
ssz_tests!(Checkpoint); ssz_tests!(Checkpoint);
} }

View File

@ -37,5 +37,4 @@ mod tests {
use super::*; use super::*;
ssz_tests!(Crosslink); ssz_tests!(Crosslink);
} }

View File

@ -21,5 +21,4 @@ mod tests {
use super::*; use super::*;
ssz_tests!(Deposit); ssz_tests!(Deposit);
} }

View File

@ -55,5 +55,4 @@ mod tests {
use super::*; use super::*;
ssz_tests!(DepositData); ssz_tests!(DepositData);
} }

View File

@ -23,5 +23,4 @@ mod tests {
use super::*; use super::*;
ssz_tests!(Eth1Data); ssz_tests!(Eth1Data);
} }

View File

@ -23,5 +23,4 @@ mod tests {
pub type FoundationHistoricalBatch = HistoricalBatch<MainnetEthSpec>; pub type FoundationHistoricalBatch = HistoricalBatch<MainnetEthSpec>;
ssz_tests!(FoundationHistoricalBatch); ssz_tests!(FoundationHistoricalBatch);
} }

View File

@ -23,5 +23,4 @@ mod tests {
use crate::*; use crate::*;
ssz_tests!(PendingAttestation<MainnetEthSpec>); ssz_tests!(PendingAttestation<MainnetEthSpec>);
} }

View File

@ -21,5 +21,4 @@ mod tests {
use super::*; use super::*;
ssz_tests!(ProposerSlashing); ssz_tests!(ProposerSlashing);
} }

View File

@ -42,5 +42,4 @@ mod tests {
use super::*; use super::*;
ssz_tests!(Transfer); ssz_tests!(Transfer);
} }

View File

@ -117,5 +117,4 @@ mod tests {
} }
ssz_tests!(Validator); ssz_tests!(Validator);
} }

View File

@ -35,5 +35,4 @@ mod tests {
use super::*; use super::*;
ssz_tests!(VoluntaryExit); ssz_tests!(VoluntaryExit);
} }

View File

@ -19,4 +19,4 @@ types = { path = "../../types" }
[dependencies] [dependencies]
ethereum-types = "0.6" ethereum-types = "0.6"
eth2_hashing = "0.1" eth2_hashing = "0.1"
lazy_static = "0.1" lazy_static = "1.4"

View File

@ -2,7 +2,7 @@
extern crate proc_macro; extern crate proc_macro;
use proc_macro::TokenStream; use proc_macro::TokenStream;
use quote::{quote, ToTokens}; use quote::quote;
use syn::{parse_macro_input, DeriveInput}; use syn::{parse_macro_input, DeriveInput};
/// Returns a Vec of `syn::Ident` for each named field in the struct, whilst filtering out fields /// Returns a Vec of `syn::Ident` for each named field in the struct, whilst filtering out fields
@ -130,8 +130,8 @@ fn get_signed_root_named_field_idents(struct_data: &syn::DataStruct) -> Vec<&syn
} }
fn should_skip_signed_root(field: &syn::Field) -> bool { fn should_skip_signed_root(field: &syn::Field) -> bool {
field field.attrs.iter().any(|attr| {
.attrs attr.path.is_ident("signed_root")
.iter() && attr.tts.to_string().replace(" ", "") == "(skip_hashing)"
.any(|attr| attr.into_token_stream().to_string() == "# [ signed_root ( skip_hashing ) ]") })
} }

View File

@ -8,7 +8,7 @@ description = "Google protobuf message and service definitions used in Lighthous
[dependencies] [dependencies]
futures = "0.1" futures = "0.1"
grpcio = { version = "0.4", default-features = false, features = ["protobuf-codec"] } grpcio = { version = "0.4", default-features = false, features = ["protobuf-codec"] }
protobuf = "2.0" protobuf = "~2.8.1"
[build-dependencies] [build-dependencies]
protoc-grpcio = "0.3.1" protoc-grpcio = "0.3.1"

View File

@ -57,21 +57,11 @@ impl<'a, B: BeaconNodeAttestation, S: Signer, E: EthSpec> AttestationProducer<'a
"slot" => slot, "slot" => slot,
), ),
Err(e) => error!(log, "Attestation production error"; "Error" => format!("{:?}", e)), Err(e) => error!(log, "Attestation production error"; "Error" => format!("{:?}", e)),
Ok(ValidatorEvent::SignerRejection(_slot)) => { Ok(ValidatorEvent::SignerRejection(_slot)) => error!(log, "Attestation production error"; "Error" => "Signer could not sign the attestation".to_string()),
error!(log, "Attestation production error"; "Error" => "Signer could not sign the attestation".to_string()) Ok(ValidatorEvent::IndexedAttestationNotProduced(_slot)) => error!(log, "Attestation production error"; "Error" => "Rejected the attestation as it could have been slashed".to_string()),
} Ok(ValidatorEvent::PublishAttestationFailed) => error!(log, "Attestation production error"; "Error" => "Beacon node was unable to publish an attestation".to_string()),
Ok(ValidatorEvent::IndexedAttestationNotProduced(_slot)) => { Ok(ValidatorEvent::InvalidAttestation) => error!(log, "Attestation production error"; "Error" => "The signed attestation was invalid".to_string()),
error!(log, "Attestation production error"; "Error" => "Rejected the attestation as it could have been slashed".to_string()) Ok(v) => warn!(log, "Unknown result for attestation production"; "Error" => format!("{:?}",v)),
}
Ok(ValidatorEvent::PublishAttestationFailed) => {
error!(log, "Attestation production error"; "Error" => "Beacon node was unable to publish an attestation".to_string())
}
Ok(ValidatorEvent::InvalidAttestation) => {
error!(log, "Attestation production error"; "Error" => "The signed attestation was invalid".to_string())
}
Ok(v) => {
warn!(log, "Unknown result for attestation production"; "Error" => format!("{:?}",v))
}
} }
} }

View File

@ -69,18 +69,10 @@ impl<'a, B: BeaconNodeBlock, S: Signer, E: EthSpec> BlockProducer<'a, B, S, E> {
"slot" => slot, "slot" => slot,
), ),
Err(e) => error!(self.log, "Block production error"; "Error" => format!("{:?}", e)), Err(e) => error!(self.log, "Block production error"; "Error" => format!("{:?}", e)),
Ok(ValidatorEvent::SignerRejection(_slot)) => { Ok(ValidatorEvent::SignerRejection(_slot)) => error!(self.log, "Block production error"; "Error" => "Signer Could not sign the block".to_string()),
error!(self.log, "Block production error"; "Error" => "Signer Could not sign the block".to_string()) Ok(ValidatorEvent::SlashableBlockNotProduced(_slot)) => error!(self.log, "Block production error"; "Error" => "Rejected the block as it could have been slashed".to_string()),
} Ok(ValidatorEvent::BeaconNodeUnableToProduceBlock(_slot)) => error!(self.log, "Block production error"; "Error" => "Beacon node was unable to produce a block".to_string()),
Ok(ValidatorEvent::SlashableBlockNotProduced(_slot)) => { Ok(v) => warn!(self.log, "Unknown result for block production"; "Error" => format!("{:?}",v)),
error!(self.log, "Block production error"; "Error" => "Rejected the block as it could have been slashed".to_string())
}
Ok(ValidatorEvent::BeaconNodeUnableToProduceBlock(_slot)) => {
error!(self.log, "Block production error"; "Error" => "Beacon node was unable to produce a block".to_string())
}
Ok(v) => {
warn!(self.log, "Unknown result for block production"; "Error" => format!("{:?}",v))
}
} }
} }

View File

@ -77,12 +77,8 @@ impl<U: BeaconNodeDuties, S: Signer + Display> DutiesManager<U, S> {
pub fn run_update(&self, epoch: Epoch, log: slog::Logger) -> Result<Async<()>, ()> { pub fn run_update(&self, epoch: Epoch, log: slog::Logger) -> Result<Async<()>, ()> {
match self.update(epoch) { match self.update(epoch) {
Err(error) => error!(log, "Epoch duties poll error"; "error" => format!("{:?}", error)), Err(error) => error!(log, "Epoch duties poll error"; "error" => format!("{:?}", error)),
Ok(UpdateOutcome::NoChange(epoch)) => { Ok(UpdateOutcome::NoChange(epoch)) => debug!(log, "No change in duties"; "epoch" => epoch),
debug!(log, "No change in duties"; "epoch" => epoch) Ok(UpdateOutcome::DutiesChanged(epoch, duties)) => info!(log, "Duties changed (potential re-org)"; "epoch" => epoch, "duties" => format!("{:?}", duties)),
}
Ok(UpdateOutcome::DutiesChanged(epoch, duties)) => {
info!(log, "Duties changed (potential re-org)"; "epoch" => epoch, "duties" => format!("{:?}", duties))
}
Ok(UpdateOutcome::NewDuties(epoch, duties)) => { Ok(UpdateOutcome::NewDuties(epoch, duties)) => {
info!(log, "New duties obtained"; "epoch" => epoch); info!(log, "New duties obtained"; "epoch" => epoch);
print_duties(&log, duties); print_duties(&log, duties);