mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-27 01:33:33 +00:00
builder gas limit & some refactoring (#6583)
* Cache gas_limit * Payload Parameters Refactor * Enforce Proposer Gas Limit * Fixed and Added New Tests * Fix Beacon Chain Tests
This commit is contained in:
@@ -127,6 +127,11 @@ pub struct ChainSpec {
|
||||
pub deposit_network_id: u64,
|
||||
pub deposit_contract_address: Address,
|
||||
|
||||
/*
|
||||
* Execution Specs
|
||||
*/
|
||||
pub gas_limit_adjustment_factor: u64,
|
||||
|
||||
/*
|
||||
* Altair hard fork params
|
||||
*/
|
||||
@@ -715,6 +720,11 @@ impl ChainSpec {
|
||||
.parse()
|
||||
.expect("chain spec deposit contract address"),
|
||||
|
||||
/*
|
||||
* Execution Specs
|
||||
*/
|
||||
gas_limit_adjustment_factor: 1024,
|
||||
|
||||
/*
|
||||
* Altair hard fork params
|
||||
*/
|
||||
@@ -1029,6 +1039,11 @@ impl ChainSpec {
|
||||
.parse()
|
||||
.expect("chain spec deposit contract address"),
|
||||
|
||||
/*
|
||||
* Execution Specs
|
||||
*/
|
||||
gas_limit_adjustment_factor: 1024,
|
||||
|
||||
/*
|
||||
* Altair hard fork params
|
||||
*/
|
||||
@@ -1285,6 +1300,10 @@ pub struct Config {
|
||||
#[serde(with = "serde_utils::address_hex")]
|
||||
deposit_contract_address: Address,
|
||||
|
||||
#[serde(default = "default_gas_limit_adjustment_factor")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
gas_limit_adjustment_factor: u64,
|
||||
|
||||
#[serde(default = "default_gossip_max_size")]
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
gossip_max_size: u64,
|
||||
@@ -1407,6 +1426,10 @@ const fn default_max_per_epoch_activation_churn_limit() -> u64 {
|
||||
8
|
||||
}
|
||||
|
||||
const fn default_gas_limit_adjustment_factor() -> u64 {
|
||||
1024
|
||||
}
|
||||
|
||||
const fn default_gossip_max_size() -> u64 {
|
||||
10485760
|
||||
}
|
||||
@@ -1659,6 +1682,8 @@ impl Config {
|
||||
deposit_network_id: spec.deposit_network_id,
|
||||
deposit_contract_address: spec.deposit_contract_address,
|
||||
|
||||
gas_limit_adjustment_factor: spec.gas_limit_adjustment_factor,
|
||||
|
||||
gossip_max_size: spec.gossip_max_size,
|
||||
max_request_blocks: spec.max_request_blocks,
|
||||
min_epochs_for_block_requests: spec.min_epochs_for_block_requests,
|
||||
@@ -1733,6 +1758,7 @@ impl Config {
|
||||
deposit_chain_id,
|
||||
deposit_network_id,
|
||||
deposit_contract_address,
|
||||
gas_limit_adjustment_factor,
|
||||
gossip_max_size,
|
||||
min_epochs_for_block_requests,
|
||||
max_chunk_size,
|
||||
@@ -1794,6 +1820,7 @@ impl Config {
|
||||
deposit_chain_id,
|
||||
deposit_network_id,
|
||||
deposit_contract_address,
|
||||
gas_limit_adjustment_factor,
|
||||
terminal_total_difficulty,
|
||||
terminal_block_hash,
|
||||
terminal_block_hash_activation_epoch,
|
||||
|
||||
@@ -32,6 +32,7 @@ pub trait ExecPayload<E: EthSpec>: Debug + Clone + PartialEq + Hash + TreeHash +
|
||||
fn prev_randao(&self) -> Hash256;
|
||||
fn block_number(&self) -> u64;
|
||||
fn timestamp(&self) -> u64;
|
||||
fn extra_data(&self) -> VariableList<u8, E::MaxExtraDataBytes>;
|
||||
fn block_hash(&self) -> ExecutionBlockHash;
|
||||
fn fee_recipient(&self) -> Address;
|
||||
fn gas_limit(&self) -> u64;
|
||||
@@ -225,6 +226,13 @@ impl<E: EthSpec> ExecPayload<E> for FullPayload<E> {
|
||||
})
|
||||
}
|
||||
|
||||
fn extra_data<'a>(&'a self) -> VariableList<u8, E::MaxExtraDataBytes> {
|
||||
map_full_payload_ref!(&'a _, self.to_ref(), move |payload, cons| {
|
||||
cons(payload);
|
||||
payload.execution_payload.extra_data.clone()
|
||||
})
|
||||
}
|
||||
|
||||
fn block_hash<'a>(&'a self) -> ExecutionBlockHash {
|
||||
map_full_payload_ref!(&'a _, self.to_ref(), move |payload, cons| {
|
||||
cons(payload);
|
||||
@@ -357,6 +365,13 @@ impl<E: EthSpec> ExecPayload<E> for FullPayloadRef<'_, E> {
|
||||
})
|
||||
}
|
||||
|
||||
fn extra_data<'a>(&'a self) -> VariableList<u8, E::MaxExtraDataBytes> {
|
||||
map_full_payload_ref!(&'a _, self, move |payload, cons| {
|
||||
cons(payload);
|
||||
payload.execution_payload.extra_data.clone()
|
||||
})
|
||||
}
|
||||
|
||||
fn block_hash<'a>(&'a self) -> ExecutionBlockHash {
|
||||
map_full_payload_ref!(&'a _, self, move |payload, cons| {
|
||||
cons(payload);
|
||||
@@ -542,6 +557,13 @@ impl<E: EthSpec> ExecPayload<E> for BlindedPayload<E> {
|
||||
})
|
||||
}
|
||||
|
||||
fn extra_data<'a>(&'a self) -> VariableList<u8, <E as EthSpec>::MaxExtraDataBytes> {
|
||||
map_blinded_payload_ref!(&'a _, self.to_ref(), move |payload, cons| {
|
||||
cons(payload);
|
||||
payload.execution_payload_header.extra_data.clone()
|
||||
})
|
||||
}
|
||||
|
||||
fn block_hash<'a>(&'a self) -> ExecutionBlockHash {
|
||||
map_blinded_payload_ref!(&'a _, self.to_ref(), move |payload, cons| {
|
||||
cons(payload);
|
||||
@@ -643,6 +665,13 @@ impl<'b, E: EthSpec> ExecPayload<E> for BlindedPayloadRef<'b, E> {
|
||||
})
|
||||
}
|
||||
|
||||
fn extra_data<'a>(&'a self) -> VariableList<u8, <E as EthSpec>::MaxExtraDataBytes> {
|
||||
map_blinded_payload_ref!(&'a _, self, move |payload, cons| {
|
||||
cons(payload);
|
||||
payload.execution_payload_header.extra_data.clone()
|
||||
})
|
||||
}
|
||||
|
||||
fn block_hash<'a>(&'a self) -> ExecutionBlockHash {
|
||||
map_blinded_payload_ref!(&'a _, self, move |payload, cons| {
|
||||
cons(payload);
|
||||
@@ -745,6 +774,10 @@ macro_rules! impl_exec_payload_common {
|
||||
self.$wrapped_field.timestamp
|
||||
}
|
||||
|
||||
fn extra_data(&self) -> VariableList<u8, E::MaxExtraDataBytes> {
|
||||
self.$wrapped_field.extra_data.clone()
|
||||
}
|
||||
|
||||
fn block_hash(&self) -> ExecutionBlockHash {
|
||||
self.$wrapped_field.block_hash
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user