-
Notifications
You must be signed in to change notification settings - Fork 746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.1.5 merge spec tests #2781
1.1.5 merge spec tests #2781
Changes from all commits
baee9da
9c44e72
2c6f1ad
b9ee00e
c21db0a
561ff49
d46d5d5
3443ae8
1973082
1762767
c73e2e5
1eaf351
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -278,18 +278,6 @@ pub enum ExecutionPayloadError { | |
/// | ||
/// The block is invalid and the peer is faulty | ||
InvalidPayloadTimestamp { expected: u64, found: u64 }, | ||
/// The gas used in the block exceeds the gas limit | ||
/// | ||
/// ## Peer scoring | ||
/// | ||
/// The block is invalid and the peer is faulty | ||
GasUsedExceedsLimit, | ||
/// The payload block hash equals the parent hash | ||
/// | ||
/// ## Peer scoring | ||
/// | ||
/// The block is invalid and the peer is faulty | ||
BlockHashEqualsParentHash, | ||
/// The execution payload transaction list data exceeds size limits | ||
/// | ||
/// ## Peer scoring | ||
|
@@ -1353,18 +1341,6 @@ fn validate_execution_payload<T: BeaconChainTypes>( | |
}, | ||
)); | ||
} | ||
// Gas used is less than the gas limit | ||
if execution_payload.gas_used > execution_payload.gas_limit { | ||
return Err(BlockError::ExecutionPayloadError( | ||
ExecutionPayloadError::GasUsedExceedsLimit, | ||
)); | ||
} | ||
// The execution payload block hash is not equal to the parent hash | ||
if execution_payload.block_hash == execution_payload.parent_hash { | ||
return Err(BlockError::ExecutionPayloadError( | ||
ExecutionPayloadError::BlockHashEqualsParentHash, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can remove this |
||
)); | ||
} | ||
// The execution payload transaction list data is within expected size limits | ||
if execution_payload.transactions.len() > T::EthSpec::max_transactions_per_payload() { | ||
return Err(BlockError::ExecutionPayloadError( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -420,6 +420,19 @@ pub fn cli_app<'a, 'b>() -> App<'a, 'b> { | |
the broad Ethereum community has elected to override the terminal PoW block. \ | ||
Incorrect use of this flag will cause your node to experience a consensus | ||
failure. Be extremely careful with this flag.") | ||
.requires("terminal-block-hash-epoch-override") | ||
.takes_value(true) | ||
) | ||
.arg( | ||
Arg::with_name("terminal-block-hash-epoch-override") | ||
.long("terminal-block-hash-epoch-override") | ||
.value_name("EPOCH") | ||
.help("Used to coordinate manual overrides to the TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH \ | ||
parameter. This flag should only be used if the user has a clear understanding \ | ||
that the broad Ethereum community has elected to override the terminal PoW block. \ | ||
Incorrect use of this flag will cause your node to experience a consensus | ||
failure. Be extremely careful with this flag.") | ||
.requires("terminal-block-hash-override") | ||
.takes_value(true) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should make a "requires" dependency between both I can't see how they'd be effective without each other and it would be nice to fail early. |
||
) | ||
.arg( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
//! Serialize `VaraibleList<VariableList<u8, M>, N>` as list of 0x-prefixed hex string. | ||
use crate::VariableList; | ||
use serde::{ser::SerializeSeq, Deserialize, Deserializer, Serialize, Serializer}; | ||
use std::marker::PhantomData; | ||
use typenum::Unsigned; | ||
|
||
#[derive(Deserialize)] | ||
#[serde(transparent)] | ||
pub struct WrappedListOwned<N: Unsigned>( | ||
#[serde(with = "crate::serde_utils::hex_var_list")] VariableList<u8, N>, | ||
); | ||
|
||
#[derive(Serialize)] | ||
#[serde(transparent)] | ||
pub struct WrappedListRef<'a, N: Unsigned>( | ||
#[serde(with = "crate::serde_utils::hex_var_list")] &'a VariableList<u8, N>, | ||
); | ||
|
||
pub fn serialize<S, M, N>( | ||
list: &VariableList<VariableList<u8, M>, N>, | ||
serializer: S, | ||
) -> Result<S::Ok, S::Error> | ||
where | ||
S: Serializer, | ||
M: Unsigned, | ||
N: Unsigned, | ||
{ | ||
let mut seq = serializer.serialize_seq(Some(list.len()))?; | ||
for bytes in list { | ||
seq.serialize_element(&WrappedListRef(bytes))?; | ||
} | ||
seq.end() | ||
} | ||
|
||
#[derive(Default)] | ||
pub struct Visitor<M, N> { | ||
_phantom_m: PhantomData<M>, | ||
_phantom_n: PhantomData<N>, | ||
} | ||
|
||
impl<'a, M, N> serde::de::Visitor<'a> for Visitor<M, N> | ||
where | ||
M: Unsigned, | ||
N: Unsigned, | ||
{ | ||
type Value = VariableList<VariableList<u8, M>, N>; | ||
|
||
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { | ||
write!(formatter, "a list of 0x-prefixed hex bytes") | ||
} | ||
|
||
fn visit_seq<A>(self, mut seq: A) -> Result<Self::Value, A::Error> | ||
where | ||
A: serde::de::SeqAccess<'a>, | ||
{ | ||
let mut list: VariableList<VariableList<u8, M>, N> = <_>::default(); | ||
|
||
while let Some(val) = seq.next_element::<WrappedListOwned<M>>()? { | ||
list.push(val.0).map_err(|e| { | ||
serde::de::Error::custom(format!("failed to push value to list: {:?}.", e)) | ||
})?; | ||
} | ||
|
||
Ok(list) | ||
} | ||
} | ||
|
||
pub fn deserialize<'de, D, M, N>( | ||
deserializer: D, | ||
) -> Result<VariableList<VariableList<u8, M>, N>, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
M: Unsigned, | ||
N: Unsigned, | ||
{ | ||
deserializer.deserialize_seq(Visitor::default()) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
pub mod hex_fixed_vec; | ||
pub mod hex_var_list; | ||
pub mod list_of_hex_var_list; | ||
pub mod quoted_u64_fixed_vec; | ||
pub mod quoted_u64_var_list; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can remove this
GasUsedExceedsLimit
error variant.