Skip to content

Commit

Permalink
add receipt to bundle state
Browse files Browse the repository at this point in the history
  • Loading branch information
chirag-bgh committed Oct 1, 2023
1 parent b53b65d commit 422221a
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions mev-build-rs/src/reth_builder/payload_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ use ethers::{
use reth_interfaces::RethError;
use reth_primitives::{
constants::{BEACON_NONCE, EMPTY_OMMER_ROOT},
proofs, Block, Bytes, ChainSpec, Header, IntoRecoveredTransaction, TransactionSigned,
proofs, Block, Bytes, ChainSpec, Header, IntoRecoveredTransaction, Receipt, TransactionSigned,
TransactionSignedEcRecovered, Withdrawal, H256, U256,
};
use reth_provider::{BundleStateWithReceipts, StateProvider, StateProviderFactory};
use reth_revm::{
database::StateProviderDatabase, env::tx_env_with_recovered,
database::StateProviderDatabase, env::tx_env_with_recovered, into_reth_log,
state_change::post_block_withdrawals_balance_increments,
};
use revm::{
Expand Down Expand Up @@ -265,21 +265,18 @@ impl<'a> ExecutionContext<'a> {

let ResultAndState { result, state } = evm.transact().unwrap();

let _block_number = self.build.number();
let block_number = self.build.number();
self.db.commit(state);

let gas_used = result.gas_used();
self.cumulative_gas_used += gas_used;

// self.bundle_state.add_receipt(
// block_number,
// Receipt {
// tx_type: tx.tx_type(),
// success: result.is_success(),
// cumulative_gas_used: self.cumulative_gas_used,
// logs: result.logs().into_iter().map(into_reth_log).collect(),
// },
// );
let receipt = Receipt {
tx_type: tx.tx_type(),
success: result.is_success(),
cumulative_gas_used: self.cumulative_gas_used,
logs: result.logs().into_iter().map(into_reth_log).collect(),
};
self.bundle_state.receipts_by_block(block_number).to_vec().push(Some(receipt));

let base_fee = self.build.base_fee();
let fee = tx.effective_tip_per_gas(base_fee).expect("fee is valid; execution succeeded");
Expand Down

0 comments on commit 422221a

Please sign in to comment.