Skip to content

Commit

Permalink
fix: include reverts in execution outcome when building payload
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Sep 12, 2024
1 parent b85a4e8 commit 1e17675
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 11 deletions.
7 changes: 7 additions & 0 deletions .github/assets/hive/expected_failures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ rpc-compat:
- eth_getTransactionReceipt/get-access-list (reth)
- eth_getTransactionReceipt/get-blob-tx (reth)
- eth_getTransactionReceipt/get-dynamic-fee (reth)
- eth_getBlockByHash/get-block-by-hash (reth)
- eth_getBlockByNumber/get-block-n (reth)
- eth_getBlockByNumber/get-finalized (reth)
- eth_getBlockByNumber/get-genesis (reth)
- eth_getBlockByNumber/get-latest (reth)
- eth_getBlockByNumber/get-safe (reth)
- eth_sendRawTransaction/send-blob-tx (reth)

# https://github.com/paradigmxyz/reth/issues/8732
engine-withdrawals:
Expand Down
21 changes: 12 additions & 9 deletions .github/assets/hive/expected_failures_experimental.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ rpc-compat:
- eth_getTransactionReceipt/get-access-list (reth)
- eth_getTransactionReceipt/get-blob-tx (reth)
- eth_getTransactionReceipt/get-dynamic-fee (reth)
- eth_getBlockByHash/get-block-by-hash (reth)
- eth_getBlockByNumber/get-block-n (reth)
- eth_getBlockByNumber/get-finalized (reth)
- eth_getBlockByNumber/get-genesis (reth)
- eth_getBlockByNumber/get-latest (reth)
- eth_getBlockByNumber/get-safe (reth)
- eth_sendRawTransaction/send-blob-tx (reth)

# https://github.com/paradigmxyz/reth/issues/8732
engine-withdrawals:
Expand All @@ -37,11 +44,7 @@ engine-withdrawals:

# https://github.com/paradigmxyz/reth/issues/8305
# https://github.com/paradigmxyz/reth/issues/6217
engine-api:
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=False, Invalid P9 (Paris) (reth)
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=True, Invalid P9 (Paris) (reth)
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=False, Invalid P10 (Paris) (reth)
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=True, Invalid P10 (Paris) (reth)
engine-api: []

# https://github.com/paradigmxyz/reth/issues/8305
# https://github.com/paradigmxyz/reth/issues/6217
Expand All @@ -51,10 +54,10 @@ engine-cancun:
- Blob Transaction Ordering, Multiple Clients (Cancun) (reth)
- Invalid PayloadAttributes, Missing BeaconRoot, Syncing=True (Cancun) (reth)
- Invalid NewPayload, ExcessBlobGas, Syncing=True, EmptyTxs=False, DynFeeTxs=False (Cancun) (reth)
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=False, Invalid P9 (Cancun) (reth)
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=True, Invalid P9 (Cancun) (reth)
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=False, Invalid P10 (Cancun) (reth)
- Invalid Missing Ancestor ReOrg, StateRoot, EmptyTxs=True, Invalid P10 (Cancun) (reth)
- Invalid NewPayload, VersionedHashes, Syncing=False, EmptyTxs=False, DynFeeTxs=False (Cancun) (reth)
- Invalid NewPayload, VersionedHashes Version, Syncing=False, EmptyTxs=False, DynFeeTxs=False (Cancun) (reth)
- Invalid NewPayload, Incomplete VersionedHashes, Syncing=False, EmptyTxs=False, DynFeeTxs=False (Cancun) (reth)
- Invalid NewPayload, Extra VersionedHashes, Syncing=False, EmptyTxs=False, DynFeeTxs=False (Cancun) (reth)

# https://github.com/paradigmxyz/reth/issues/8579
sync:
Expand Down
8 changes: 7 additions & 1 deletion crates/engine/tree/src/tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2521,6 +2521,7 @@ mod tests {
use reth_evm::test_utils::MockExecutorProvider;
use reth_primitives::Bytes;
use reth_provider::test_utils::MockEthProvider;
use reth_rpc_types::engine::ForkchoiceUpdated;
use reth_rpc_types_compat::engine::{block_to_payload_v1, payload::block_to_payload_v3};
use reth_trie::updates::TrieUpdates;
use std::{
Expand Down Expand Up @@ -2734,7 +2735,11 @@ mod tests {
self.check_fcu(block_hash, fcu_status).await;
}

async fn send_fcu(&mut self, block_hash: B256, fcu_status: impl Into<ForkchoiceStatus>) {
async fn send_fcu(
&mut self,
block_hash: B256,
fcu_status: impl Into<ForkchoiceStatus>,
) -> ForkchoiceUpdated {
let fcu_state = self.fcu_state(block_hash);

let (tx, rx) = oneshot::channel();
Expand All @@ -2755,6 +2760,7 @@ mod tests {
ForkchoiceStatus::Syncing => assert!(response.payload_status.is_syncing()),
ForkchoiceStatus::Invalid => assert!(response.payload_status.is_invalid()),
}
response
}

async fn check_fcu(&mut self, block_hash: B256, fcu_status: impl Into<ForkchoiceStatus>) {
Expand Down
6 changes: 5 additions & 1 deletion crates/ethereum/payload/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ where

// merge all transitions into bundle state, this would apply the withdrawal balance changes
// and 4788 contract call
db.merge_transitions(BundleRetention::PlainState);
db.merge_transitions(BundleRetention::Reverts);

let execution_outcome = ExecutionOutcome::new(
db.take_bundle(),
Expand Down Expand Up @@ -383,6 +383,10 @@ where
blob_gas_used = Some(sum_blob_gas_used);
}

if parent_block.number == 5 || parent_block.number == 4 {
trace!(target: "payload_builder", ?execution_outcome, "execution outcome in default_ethereum_payload");
}

let header = Header {
parent_hash: parent_block.hash(),
ommers_hash: EMPTY_OMMER_ROOT_HASH,
Expand Down

0 comments on commit 1e17675

Please sign in to comment.