Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into alexey/sparse-trie-ca…
Browse files Browse the repository at this point in the history
…che-prefix-set-lookup
  • Loading branch information
shekhirin committed Oct 28, 2024
2 parents 0cbab07 + 8f5fd1d commit a679e75
Show file tree
Hide file tree
Showing 93 changed files with 1,473 additions and 756 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/compact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ jobs:
ref: ${{ github.base_ref || 'main' }}
# On `main` branch, generates test vectors and serializes them to disk using `Compact`.
- name: Generate compact vectors
run: ${{ matrix.bin }} -- test-vectors compact --write
run: |
${{ matrix.bin }} -- test-vectors compact --write &&
for f in ./testdata/micro/compact/*; do mv "$f" "$(dirname "$f")/$(basename "$f" | awk -F '__' '{print $NF}')"; done
- name: Checkout PR
uses: actions/checkout@v4
with:
Expand Down
12 changes: 5 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions book/cli/reth/node.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ RPC:
--http.api <HTTP_API>
Rpc Modules to be configured for the HTTP server
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots]
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, flashbots]
--http.corsdomain <HTTP_CORSDOMAIN>
Http Corsdomain to allow request from
Expand All @@ -269,7 +269,7 @@ RPC:
--ws.api <WS_API>
Rpc Modules to be configured for the WS server
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots]
[possible values: admin, debug, eth, net, trace, txpool, web3, rpc, reth, ots, flashbots]
--ipcdisable
Disable the IPC-RPC server
Expand Down
2 changes: 1 addition & 1 deletion crates/chain-state/src/in_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ pub struct ExecutedBlock {
pub senders: Arc<Vec<Address>>,
/// Block's execution outcome.
pub execution_output: Arc<ExecutionOutcome>,
/// Block's hashedst state.
/// Block's hashed state.
pub hashed_state: Arc<HashedPostState>,
/// Trie updates that result of applying the block.
pub trie: Arc<TrieUpdates>,
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/commands/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl<C: ChainSpecParser<ChainSpec: EthChainSpec + EthereumHardforks>> Environmen
.static_file_provider()
.check_consistency(&factory.provider()?, has_receipt_pruning)?
{
if factory.db_ref().is_read_only() {
if factory.db_ref().is_read_only()? {
warn!(target: "reth::cli", ?unwind_target, "Inconsistent storage. Restart node to heal.");
return Ok(factory)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/commands/src/test_vectors/compact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,5 +267,5 @@ where
}

pub fn type_name<T>() -> String {
std::any::type_name::<T>().replace("::", "__")
std::any::type_name::<T>().split("::").last().unwrap_or(std::any::type_name::<T>()).to_string()
}
6 changes: 2 additions & 4 deletions crates/consensus/common/src/validation.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
//! Collection of methods for block validation.

use alloy_consensus::constants::MAXIMUM_EXTRA_DATA_SIZE;
use alloy_eips::eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK};
use reth_chainspec::{EthChainSpec, EthereumHardforks};
use reth_consensus::ConsensusError;
use reth_primitives::{
constants::eip4844::{DATA_GAS_PER_BLOB, MAX_DATA_GAS_PER_BLOCK},
EthereumHardfork, GotExpected, Header, SealedBlock, SealedHeader,
};
use reth_primitives::{EthereumHardfork, GotExpected, Header, SealedBlock, SealedHeader};
use revm_primitives::calc_excess_blob_gas;

/// Gas used needs to be less than gas limit. Gas used is going to be checked after execution.
Expand Down
2 changes: 1 addition & 1 deletion crates/consensus/debug-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ workspace = true
[dependencies]
# reth
reth-node-api.workspace = true
reth-rpc-api.workspace = true
reth-rpc-api = { workspace = true, features = ["client"] }
reth-rpc-builder.workspace = true
reth-tracing.workspace = true

Expand Down
9 changes: 1 addition & 8 deletions crates/e2e-test-utils/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,7 @@ impl<E: EngineTypes, ChainSpec: EthereumHardforks> EngineApiTestContext<E, Chain
.chain_spec
.is_prague_active_at_timestamp(payload_builder_attributes.timestamp())
{
let requests = payload
.executed_block()
.unwrap()
.execution_outcome()
.requests
.first()
.unwrap()
.clone();
let requests = payload.requests().unwrap();
let envelope: <E as EngineTypes>::ExecutionPayloadEnvelopeV4 = payload.into();
EngineApiClient::<E>::new_payload_v4(
&self.engine_api_client,
Expand Down
7 changes: 2 additions & 5 deletions crates/e2e-test-utils/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ use reth::{
network::PeersHandleProvider,
providers::{BlockReader, BlockReaderIdExt, CanonStateSubscriptions, StageCheckpointReader},
rpc::{
api::eth::{
helpers::{EthApiSpec, EthTransactions, TraceExt},
FullEthApiTypes,
},
api::eth::helpers::{EthApiSpec, EthTransactions, TraceExt},
types::engine::PayloadStatusEnum,
},
};
Expand Down Expand Up @@ -97,7 +94,7 @@ where
where
Engine::ExecutionPayloadEnvelopeV3: From<Engine::BuiltPayload> + PayloadEnvelopeExt,
Engine::ExecutionPayloadEnvelopeV4: From<Engine::BuiltPayload> + PayloadEnvelopeExt,
AddOns::EthApi: EthApiSpec + EthTransactions + TraceExt + FullEthApiTypes,
AddOns::EthApi: EthApiSpec + EthTransactions + TraceExt,
{
let mut chain = Vec::with_capacity(length as usize);
for i in 0..length {
Expand Down
7 changes: 5 additions & 2 deletions crates/e2e-test-utils/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ use alloy_primitives::{Bytes, B256};
use reth::{
builder::{rpc::RpcRegistry, FullNodeComponents},
rpc::api::{
eth::helpers::{EthApiSpec, EthTransactions, TraceExt},
eth::{
helpers::{EthApiSpec, EthTransactions, TraceExt},
EthApiTypes,
},
DebugApiServer,
},
};
use reth_chainspec::EthereumHardforks;
use reth_node_builder::{EthApiTypes, NodeTypes};
use reth_node_builder::NodeTypes;

#[allow(missing_debug_implementations)]
pub struct RpcTestContext<Node: FullNodeComponents, EthApi: EthApiTypes> {
Expand Down
26 changes: 15 additions & 11 deletions crates/ethereum/engine-primitives/src/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ pub struct EthBuiltPayload {
/// The blobs, proofs, and commitments in the block. If the block is pre-cancun, this will be
/// empty.
pub(crate) sidecars: Vec<BlobTransactionSidecar>,
/// The requests of the payload
pub(crate) requests: Option<Requests>,
}

// === impl BuiltPayload ===
Expand All @@ -46,8 +48,9 @@ impl EthBuiltPayload {
block: SealedBlock,
fees: U256,
executed_block: Option<ExecutedBlock>,
requests: Option<Requests>,
) -> Self {
Self { id, block, executed_block, fees, sidecars: Vec::new() }
Self { id, block, executed_block, fees, sidecars: Vec::new(), requests }
}

/// Returns the identifier of the payload.
Expand Down Expand Up @@ -97,6 +100,10 @@ impl BuiltPayload for EthBuiltPayload {
fn executed_block(&self) -> Option<ExecutedBlock> {
self.executed_block.clone()
}

fn requests(&self) -> Option<Requests> {
self.requests.clone()
}
}

impl BuiltPayload for &EthBuiltPayload {
Expand All @@ -111,6 +118,10 @@ impl BuiltPayload for &EthBuiltPayload {
fn executed_block(&self) -> Option<ExecutedBlock> {
self.executed_block.clone()
}

fn requests(&self) -> Option<Requests> {
self.requests.clone()
}
}

// V1 engine_getPayloadV1 response
Expand Down Expand Up @@ -152,15 +163,8 @@ impl From<EthBuiltPayload> for ExecutionPayloadEnvelopeV3 {

impl From<EthBuiltPayload> for ExecutionPayloadEnvelopeV4 {
fn from(value: EthBuiltPayload) -> Self {
let EthBuiltPayload { block, fees, sidecars, executed_block, .. } = value;

// if we have an executed block, we pop off the first set of requests from the execution
// outcome. the assumption here is that there will always only be one block in the execution
// outcome.
let execution_requests = executed_block
.and_then(|block| block.execution_outcome().requests.first().cloned())
.map(Requests::take)
.unwrap_or_default();
let EthBuiltPayload { block, fees, sidecars, requests, .. } = value;

Self {
execution_payload: block_to_payload_v3(block),
block_value: fees,
Expand All @@ -174,7 +178,7 @@ impl From<EthBuiltPayload> for ExecutionPayloadEnvelopeV4 {
// <https://github.com/ethereum/execution-apis/blob/fe8e13c288c592ec154ce25c534e26cb7ce0530d/src/engine/cancun.md#specification-2>
should_override_builder: false,
blobs_bundle: sidecars.into_iter().map(Into::into).collect::<Vec<_>>().into(),
execution_requests,
execution_requests: requests.unwrap_or_default().take(),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/node/tests/e2e/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::utils::eth_payload_attributes;
use alloy_genesis::Genesis;
use alloy_primitives::{b256, hex};
use futures::StreamExt;
use reth::{args::DevArgs, core::rpc::eth::helpers::EthTransactions};
use reth::{args::DevArgs, rpc::api::eth::helpers::EthTransactions};
use reth_chainspec::ChainSpec;
use reth_e2e_test_utils::setup;
use reth_node_api::FullNodeComponents;
Expand Down
8 changes: 4 additions & 4 deletions crates/ethereum/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#![allow(clippy::useless_let_if_seq)]

use alloy_consensus::EMPTY_OMMER_ROOT_HASH;
use alloy_eips::{eip7685::Requests, merge::BEACON_NONCE};
use alloy_eips::{eip4844::MAX_DATA_GAS_PER_BLOCK, eip7685::Requests, merge::BEACON_NONCE};
use alloy_primitives::U256;
use reth_basic_payload_builder::{
commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder,
Expand All @@ -25,7 +25,6 @@ use reth_execution_types::ExecutionOutcome;
use reth_payload_builder::{EthBuiltPayload, EthPayloadBuilderAttributes};
use reth_payload_primitives::{PayloadBuilderAttributes, PayloadBuilderError};
use reth_primitives::{
constants::eip4844::MAX_DATA_GAS_PER_BLOCK,
proofs::{self},
revm_primitives::{BlockEnv, CfgEnvWithHandlerCfg},
Block, BlockBody, EthereumHardforks, Header, Receipt,
Expand Down Expand Up @@ -360,7 +359,7 @@ where
db.take_bundle(),
vec![receipts].into(),
block_number,
vec![requests.unwrap_or_default()],
vec![requests.clone().unwrap_or_default()],
);
let receipts_root =
execution_outcome.receipts_root_slow(block_number).expect("Number is in range");
Expand Down Expand Up @@ -449,7 +448,8 @@ where
trie: Arc::new(trie_output),
};

let mut payload = EthBuiltPayload::new(attributes.id, sealed_block, total_fees, Some(executed));
let mut payload =
EthBuiltPayload::new(attributes.id, sealed_block, total_fees, Some(executed), requests);

// extend the payload with the blob sidecars from the executed txs
payload.extend_sidecars(blob_sidecars);
Expand Down
Loading

0 comments on commit a679e75

Please sign in to comment.