stub out tx root check, fix block hash calculation
This commit is contained in:
parent
1dd9812f62
commit
dd512cd82a
@ -1037,6 +1037,11 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if execution_payload_header.transactions_root()
|
||||||
|
!= header_from_payload.transactions_root()
|
||||||
|
{
|
||||||
|
//FIXME(sean) we're not decoding blobs txs correctly yet
|
||||||
|
} else {
|
||||||
return Err(Error::InconsistentPayloadReconstructed {
|
return Err(Error::InconsistentPayloadReconstructed {
|
||||||
slot: blinded_block.slot(),
|
slot: blinded_block.slot(),
|
||||||
exec_block_hash,
|
exec_block_hash,
|
||||||
@ -1046,6 +1051,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|
|||||||
reconstructed_transactions_root: header_from_payload.transactions_root(),
|
reconstructed_transactions_root: header_from_payload.transactions_root(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add the payload to the block to form a full block.
|
// Add the payload to the block to form a full block.
|
||||||
blinded_block
|
blinded_block
|
||||||
|
@ -36,12 +36,15 @@ impl<T: EthSpec> ExecutionLayer<T> {
|
|||||||
None
|
None
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let rlp_excess_data_gas = payload.excess_data_gas().ok();
|
||||||
|
|
||||||
// Construct the block header.
|
// Construct the block header.
|
||||||
let exec_block_header = ExecutionBlockHeader::from_payload(
|
let exec_block_header = ExecutionBlockHeader::from_payload(
|
||||||
payload,
|
payload,
|
||||||
KECCAK_EMPTY_LIST_RLP.as_fixed_bytes().into(),
|
KECCAK_EMPTY_LIST_RLP.as_fixed_bytes().into(),
|
||||||
rlp_transactions_root,
|
rlp_transactions_root,
|
||||||
rlp_withdrawals_root,
|
rlp_withdrawals_root,
|
||||||
|
rlp_excess_data_gas,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Hash the RLP encoding of the block header.
|
// Hash the RLP encoding of the block header.
|
||||||
@ -75,12 +78,15 @@ pub fn rlp_encode_withdrawal(withdrawal: &JsonWithdrawal) -> Vec<u8> {
|
|||||||
pub fn rlp_encode_block_header(header: &ExecutionBlockHeader) -> Vec<u8> {
|
pub fn rlp_encode_block_header(header: &ExecutionBlockHeader) -> Vec<u8> {
|
||||||
let mut rlp_header_stream = RlpStream::new();
|
let mut rlp_header_stream = RlpStream::new();
|
||||||
rlp_header_stream.begin_unbounded_list();
|
rlp_header_stream.begin_unbounded_list();
|
||||||
map_execution_block_header_fields_except_withdrawals!(&header, |_, field| {
|
map_execution_block_header_fields_except_withdrawals_excess_data_gas!(&header, |_, field| {
|
||||||
rlp_header_stream.append(field);
|
rlp_header_stream.append(field);
|
||||||
});
|
});
|
||||||
if let Some(withdrawals_root) = &header.withdrawals_root {
|
if let Some(withdrawals_root) = &header.withdrawals_root {
|
||||||
rlp_header_stream.append(withdrawals_root);
|
rlp_header_stream.append(withdrawals_root);
|
||||||
}
|
}
|
||||||
|
if let Some(excess_data_gas) = &header.excess_data_gas {
|
||||||
|
rlp_header_stream.append(excess_data_gas);
|
||||||
|
}
|
||||||
rlp_header_stream.finalize_unbounded_list();
|
rlp_header_stream.finalize_unbounded_list();
|
||||||
rlp_header_stream.out().into()
|
rlp_header_stream.out().into()
|
||||||
}
|
}
|
||||||
|
@ -24,9 +24,13 @@ use metastruct::metastruct;
|
|||||||
///
|
///
|
||||||
/// Credit to Reth for the type definition.
|
/// Credit to Reth for the type definition.
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
#[metastruct(mappings(map_execution_block_header_fields_except_withdrawals(exclude(
|
#[metastruct(mappings(
|
||||||
withdrawals_root
|
map_execution_block_header_fields_except_withdrawals(exclude(withdrawals_root)),
|
||||||
))))]
|
map_execution_block_header_fields_except_withdrawals_excess_data_gas(exclude(
|
||||||
|
withdrawals_root,
|
||||||
|
excess_data_gas
|
||||||
|
))
|
||||||
|
))]
|
||||||
pub struct ExecutionBlockHeader {
|
pub struct ExecutionBlockHeader {
|
||||||
pub parent_hash: Hash256,
|
pub parent_hash: Hash256,
|
||||||
pub ommers_hash: Hash256,
|
pub ommers_hash: Hash256,
|
||||||
@ -45,6 +49,7 @@ pub struct ExecutionBlockHeader {
|
|||||||
pub nonce: Hash64,
|
pub nonce: Hash64,
|
||||||
pub base_fee_per_gas: Uint256,
|
pub base_fee_per_gas: Uint256,
|
||||||
pub withdrawals_root: Option<Hash256>,
|
pub withdrawals_root: Option<Hash256>,
|
||||||
|
pub excess_data_gas: Option<Uint256>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ExecutionBlockHeader {
|
impl ExecutionBlockHeader {
|
||||||
@ -53,6 +58,7 @@ impl ExecutionBlockHeader {
|
|||||||
rlp_empty_list_root: Hash256,
|
rlp_empty_list_root: Hash256,
|
||||||
rlp_transactions_root: Hash256,
|
rlp_transactions_root: Hash256,
|
||||||
rlp_withdrawals_root: Option<Hash256>,
|
rlp_withdrawals_root: Option<Hash256>,
|
||||||
|
rlp_excess_data_gas: Option<Uint256>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// Most of these field mappings are defined in EIP-3675 except for `mixHash`, which is
|
// Most of these field mappings are defined in EIP-3675 except for `mixHash`, which is
|
||||||
// defined in EIP-4399.
|
// defined in EIP-4399.
|
||||||
@ -74,6 +80,7 @@ impl ExecutionBlockHeader {
|
|||||||
nonce: Hash64::zero(),
|
nonce: Hash64::zero(),
|
||||||
base_fee_per_gas: payload.base_fee_per_gas(),
|
base_fee_per_gas: payload.base_fee_per_gas(),
|
||||||
withdrawals_root: rlp_withdrawals_root,
|
withdrawals_root: rlp_withdrawals_root,
|
||||||
|
excess_data_gas: rlp_excess_data_gas,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user