Rename Merge to Bellatrix (#5601)

* Rename Merge to Bellatrix

* Remove tree-hash-cache which got readded from the rebase
This commit is contained in:
Mac L
2024-04-26 06:19:41 +10:00
committed by GitHub
parent 320345695d
commit 13f94ef0f3
104 changed files with 808 additions and 714 deletions

View File

@@ -21,9 +21,9 @@ use std::sync::Arc;
use tree_hash::TreeHash;
use tree_hash_derive::TreeHash;
use types::{
Blob, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadCapella,
ExecutionPayloadDeneb, ExecutionPayloadElectra, ExecutionPayloadHeader, ExecutionPayloadMerge,
ForkName, Hash256, Transaction, Transactions, Uint256,
Blob, ChainSpec, EthSpec, ExecutionBlockHash, ExecutionPayload, ExecutionPayloadBellatrix,
ExecutionPayloadCapella, ExecutionPayloadDeneb, ExecutionPayloadElectra,
ExecutionPayloadHeader, ForkName, Hash256, Transaction, Transactions, Uint256,
};
use super::DEFAULT_TERMINAL_BLOCK;
@@ -92,7 +92,7 @@ impl<E: EthSpec> Block<E> {
match self {
Block::PoS(payload) => Some(payload.clone().try_into().unwrap()),
Block::PoW(block) => Some(
ExecutionPayload::Merge(ExecutionPayloadMerge {
ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix {
block_hash: block.block_hash,
..Default::default()
})
@@ -232,7 +232,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
Some(fork_time) if timestamp >= fork_time => ForkName::Deneb,
_ => match self.shanghai_time {
Some(fork_time) if timestamp >= fork_time => ForkName::Capella,
_ => ForkName::Merge,
_ => ForkName::Bellatrix,
},
},
}
@@ -569,7 +569,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
attributes: &PayloadAttributes,
) -> Result<ExecutionPayload<E>, String> {
let mut execution_payload = match attributes {
PayloadAttributes::V1(pa) => ExecutionPayload::Merge(ExecutionPayloadMerge {
PayloadAttributes::V1(pa) => ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix {
parent_hash: head_block_hash,
fee_recipient: pa.suggested_fee_recipient,
receipts_root: Hash256::repeat_byte(42),
@@ -586,7 +586,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
transactions: vec![].into(),
}),
PayloadAttributes::V2(pa) => match self.get_fork_at_timestamp(pa.timestamp) {
ForkName::Merge => ExecutionPayload::Merge(ExecutionPayloadMerge {
ForkName::Bellatrix => ExecutionPayload::Bellatrix(ExecutionPayloadBellatrix {
parent_hash: head_block_hash,
fee_recipient: pa.suggested_fee_recipient,
receipts_root: Hash256::repeat_byte(42),
@@ -665,7 +665,7 @@ impl<E: EthSpec> ExecutionBlockGenerator<E> {
};
match execution_payload.fork_name() {
ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => {}
ForkName::Base | ForkName::Altair | ForkName::Bellatrix | ForkName::Capella => {}
ForkName::Deneb | ForkName::Electra => {
// get random number between 0 and Max Blobs
let mut rng = self.rng.lock();
@@ -782,14 +782,14 @@ pub fn generate_genesis_header<E: EthSpec>(
let empty_transactions_root = Transactions::<E>::empty().tree_hash_root();
match genesis_fork {
ForkName::Base | ForkName::Altair => None,
ForkName::Merge => {
ForkName::Bellatrix => {
if post_transition_merge {
let mut header = ExecutionPayloadHeader::Merge(<_>::default());
let mut header = ExecutionPayloadHeader::Bellatrix(<_>::default());
*header.block_hash_mut() = genesis_block_hash.unwrap_or_default();
*header.transactions_root_mut() = empty_transactions_root;
Some(header)
} else {
Some(ExecutionPayloadHeader::<E>::Merge(<_>::default()))
Some(ExecutionPayloadHeader::<E>::Bellatrix(<_>::default()))
}
}
ForkName::Capella => {

View File

@@ -135,7 +135,7 @@ pub async fn handle_rpc<E: EthSpec>(
.get_fork_at_timestamp(*request.timestamp());
// validate method called correctly according to fork time
match fork {
ForkName::Merge => {
ForkName::Bellatrix => {
if matches!(request, JsonExecutionPayload::V2(_)) {
return Err((
format!(
@@ -395,7 +395,7 @@ pub async fn handle_rpc<E: EthSpec>(
.read()
.get_fork_at_timestamp(*pa.timestamp())
{
ForkName::Merge => {
ForkName::Bellatrix => {
get_param::<Option<JsonPayloadAttributesV1>>(params, 1)
.map(|opt| opt.map(JsonPayloadAttributes::V1))
.transpose()
@@ -427,7 +427,7 @@ pub async fn handle_rpc<E: EthSpec>(
.read()
.get_fork_at_timestamp(*pa.timestamp())
{
ForkName::Merge => {
ForkName::Bellatrix => {
if matches!(pa, JsonPayloadAttributes::V2(_)) {
return Err((
format!(

View File

@@ -15,7 +15,7 @@ use task_executor::TaskExecutor;
use tempfile::NamedTempFile;
use tree_hash::TreeHash;
use types::builder_bid::{
BuilderBid, BuilderBidCapella, BuilderBidDeneb, BuilderBidElectra, BuilderBidMerge,
BuilderBid, BuilderBidBellatrix, BuilderBidCapella, BuilderBidDeneb, BuilderBidElectra,
SignedBuilderBid,
};
use types::{
@@ -77,7 +77,7 @@ pub trait BidStuff<E: EthSpec> {
impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
fn set_fee_recipient(&mut self, fee_recipient: Address) {
match self.to_mut().header_mut() {
ExecutionPayloadHeaderRefMut::Merge(header) => {
ExecutionPayloadHeaderRefMut::Bellatrix(header) => {
header.fee_recipient = fee_recipient;
}
ExecutionPayloadHeaderRefMut::Capella(header) => {
@@ -94,7 +94,7 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
fn set_gas_limit(&mut self, gas_limit: u64) {
match self.to_mut().header_mut() {
ExecutionPayloadHeaderRefMut::Merge(header) => {
ExecutionPayloadHeaderRefMut::Bellatrix(header) => {
header.gas_limit = gas_limit;
}
ExecutionPayloadHeaderRefMut::Capella(header) => {
@@ -115,7 +115,7 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
fn set_parent_hash(&mut self, parent_hash: Hash256) {
match self.to_mut().header_mut() {
ExecutionPayloadHeaderRefMut::Merge(header) => {
ExecutionPayloadHeaderRefMut::Bellatrix(header) => {
header.parent_hash = ExecutionBlockHash::from_root(parent_hash);
}
ExecutionPayloadHeaderRefMut::Capella(header) => {
@@ -132,7 +132,7 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
fn set_prev_randao(&mut self, prev_randao: Hash256) {
match self.to_mut().header_mut() {
ExecutionPayloadHeaderRefMut::Merge(header) => {
ExecutionPayloadHeaderRefMut::Bellatrix(header) => {
header.prev_randao = prev_randao;
}
ExecutionPayloadHeaderRefMut::Capella(header) => {
@@ -149,7 +149,7 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
fn set_block_number(&mut self, block_number: u64) {
match self.to_mut().header_mut() {
ExecutionPayloadHeaderRefMut::Merge(header) => {
ExecutionPayloadHeaderRefMut::Bellatrix(header) => {
header.block_number = block_number;
}
ExecutionPayloadHeaderRefMut::Capella(header) => {
@@ -166,7 +166,7 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
fn set_timestamp(&mut self, timestamp: u64) {
match self.to_mut().header_mut() {
ExecutionPayloadHeaderRefMut::Merge(header) => {
ExecutionPayloadHeaderRefMut::Bellatrix(header) => {
header.timestamp = timestamp;
}
ExecutionPayloadHeaderRefMut::Capella(header) => {
@@ -183,7 +183,7 @@ impl<E: EthSpec> BidStuff<E> for BuilderBid<E> {
fn set_withdrawals_root(&mut self, withdrawals_root: Hash256) {
match self.to_mut().header_mut() {
ExecutionPayloadHeaderRefMut::Merge(_) => {
ExecutionPayloadHeaderRefMut::Bellatrix(_) => {
panic!("no withdrawals before capella")
}
ExecutionPayloadHeaderRefMut::Capella(header) => {
@@ -336,7 +336,7 @@ pub fn serve<E: EthSpec>(
SignedBlindedBeaconBlock::Base(_) | types::SignedBeaconBlock::Altair(_) => {
return Err(reject("invalid fork"));
}
SignedBlindedBeaconBlock::Merge(block) => {
SignedBlindedBeaconBlock::Bellatrix(block) => {
block.message.body.execution_payload.tree_hash_root()
}
SignedBlindedBeaconBlock::Capella(block) => {
@@ -480,7 +480,7 @@ pub fn serve<E: EthSpec>(
.get_randao_mix(head_state.current_epoch())
.map_err(|_| reject("couldn't get prev randao"))?;
let expected_withdrawals = match fork {
ForkName::Base | ForkName::Altair | ForkName::Merge => None,
ForkName::Base | ForkName::Altair | ForkName::Bellatrix => None,
ForkName::Capella | ForkName::Deneb | ForkName::Electra => Some(
builder
.beacon_client
@@ -496,7 +496,7 @@ pub fn serve<E: EthSpec>(
// first to avoid polluting the execution block generator with invalid payload attributes
// NOTE: this was part of an effort to add payload attribute uniqueness checks,
// which was abandoned because it broke too many tests in subtle ways.
ForkName::Merge | ForkName::Capella => PayloadAttributes::new(
ForkName::Bellatrix | ForkName::Capella => PayloadAttributes::new(
timestamp,
*prev_randao,
fee_recipient,
@@ -577,9 +577,9 @@ pub fn serve<E: EthSpec>(
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
pubkey: builder.builder_sk.public_key().compress(),
}),
ForkName::Merge => BuilderBid::Merge(BuilderBidMerge {
ForkName::Bellatrix => BuilderBid::Bellatrix(BuilderBidBellatrix {
header: payload
.as_merge()
.as_bellatrix()
.map_err(|_| reject("incorrect payload variant"))?
.into(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
@@ -627,9 +627,9 @@ pub fn serve<E: EthSpec>(
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),
pubkey: builder.builder_sk.public_key().compress(),
}),
ForkName::Merge => BuilderBid::Merge(BuilderBidMerge {
ForkName::Bellatrix => BuilderBid::Bellatrix(BuilderBidBellatrix {
header: payload
.as_merge()
.as_bellatrix()
.map_err(|_| reject("incorrect payload variant"))?
.into(),
value: Uint256::from(DEFAULT_BUILDER_PAYLOAD_VALUE_WEI),

View File

@@ -138,7 +138,7 @@ impl<E: EthSpec> MockExecutionLayer<E> {
&payload_attributes,
forkchoice_update_params,
builder_params,
ForkName::Merge,
ForkName::Bellatrix,
&self.spec,
None,
BlockProductionVersion::FullV2,
@@ -178,7 +178,7 @@ impl<E: EthSpec> MockExecutionLayer<E> {
&payload_attributes,
forkchoice_update_params,
builder_params,
ForkName::Merge,
ForkName::Bellatrix,
&self.spec,
None,
BlockProductionVersion::BlindedV2,