Skip to content

Commit

Permalink
Remove struct logs from Native
Browse files Browse the repository at this point in the history
  • Loading branch information
LindaGuiga committed Oct 4, 2024
1 parent 538e8cd commit 5b676c3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 49 deletions.
1 change: 0 additions & 1 deletion trace_decoder/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ fn middle<StateTrieT: StateTrie + Clone>(
byte_code,
new_receipt_trie_node_byte,
gas_used: txn_gas_used,
struct_log: _,
},
} = txn.unwrap_or_default();

Expand Down
9 changes: 1 addition & 8 deletions trace_decoder/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
use std::collections::{BTreeMap, BTreeSet, HashMap};

use ethereum_types::{Address, U256};
use evm_arithmetization::proof::{BlockHashes, BlockMetadata};
use evm_arithmetization::ConsolidatedHash;
use evm_arithmetization::{
proof::{BlockHashes, BlockMetadata},
structlog::zerostructlog::ZeroStructLog,
};
use keccak_hash::H256;
use mpt_trie::partial_trie::HashedPartialTrie;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -114,10 +111,6 @@ pub struct TxnMeta {

/// Gas used by this txn (Note: not cumulative gas used).
pub gas_used: u64,

/// Optional logs for a transaction's user code. Used for debugging purposes
/// only.
pub struct_log: Option<Vec<ZeroStructLog>>,
}

/// A "trace" specific to an account for a txn.
Expand Down
11 changes: 4 additions & 7 deletions zero/src/rpc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,10 @@ where
.await
}
RpcType::Native => {
native::block_prover_input(
cached_provider,
block_id,
checkpoint_block_number,
get_struct_logs,
)
.await
if get_struct_logs {
warn!("struct logs are not supported in native. They will not be gathered in this run.")
}
native::block_prover_input(cached_provider, block_id, checkpoint_block_number).await
}
}
}
Expand Down
14 changes: 1 addition & 13 deletions zero/src/rpc/native/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pub async fn block_prover_input<ProviderT, TransportT>(
provider: Arc<CachedProvider<ProviderT, TransportT>>,
block_number: BlockId,
checkpoint_block_number: u64,
get_struct_logs: bool,
) -> anyhow::Result<BlockProverInput>
where
ProviderT: Provider<TransportT>,
Expand All @@ -34,21 +33,10 @@ where
crate::rpc::fetch_other_block_data(provider.clone(), block_number, checkpoint_block_number)
)?;

let struct_logs = if get_struct_logs {
Some(
block_trace
.txn_info
.iter()
.map(|t_i| t_i.meta.struct_log.clone())
.collect::<Vec<_>>(),
)
} else {
None
};
Ok(BlockProverInput {
block_trace,
other_data,
struct_logs,
struct_logs: None,
})
}

Expand Down
24 changes: 4 additions & 20 deletions zero/src/rpc/native/txn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use alloy::{
};
use anyhow::Context as _;
use compat::Compat;
use evm_arithmetization::structlog::{get_structlog_for_debug, zerostructlog::ZeroStructLog};
use futures::stream::{FuturesOrdered, TryStreamExt};
use trace_decoder::{ContractCodeUsage, TxnInfo, TxnMeta, TxnTrace};

Expand Down Expand Up @@ -64,7 +63,7 @@ where
ProviderT: Provider<TransportT>,
TransportT: Transport + Clone,
{
let (tx_receipt, pre_trace, diff_trace, struct_log) = fetch_tx_data(provider, &tx.hash).await?;
let (tx_receipt, pre_trace, diff_trace) = fetch_tx_data(provider, &tx.hash).await?;
let tx_status = tx_receipt.status();
let tx_receipt = tx_receipt.map_inner(rlp::map_receipt_envelope);
let access_list = parse_access_list(tx.access_list.as_ref());
Expand All @@ -73,7 +72,6 @@ where
byte_code: <Ethereum as Network>::TxEnvelope::try_from(tx.clone())?.encoded_2718(),
new_receipt_trie_node_byte: alloy::rlp::encode(tx_receipt.inner),
gas_used: tx_receipt.gas_used as u64,
struct_log,
};

let (code_db, mut tx_traces) = match (pre_trace, diff_trace) {
Expand Down Expand Up @@ -105,36 +103,22 @@ where
async fn fetch_tx_data<ProviderT, TransportT>(
provider: &ProviderT,
tx_hash: &B256,
) -> anyhow::Result<
(
<Ethereum as Network>::ReceiptResponse,
GethTrace,
GethTrace,
Option<Vec<ZeroStructLog>>,
),
anyhow::Error,
>
) -> anyhow::Result<(<Ethereum as Network>::ReceiptResponse, GethTrace, GethTrace), anyhow::Error>
where
ProviderT: Provider<TransportT>,
TransportT: Transport + Clone,
{
let tx_receipt_fut = provider.get_transaction_receipt(*tx_hash);
let pre_trace_fut = provider.debug_trace_transaction(*tx_hash, prestate_tracing_options(false));
let diff_trace_fut = provider.debug_trace_transaction(*tx_hash, prestate_tracing_options(true));
let struct_logs_fut = get_structlog_for_debug(provider, tx_hash);

let (tx_receipt, pre_trace, diff_trace, struct_logs) = futures::try_join!(
tx_receipt_fut,
pre_trace_fut,
diff_trace_fut,
struct_logs_fut
)?;
let (tx_receipt, pre_trace, diff_trace) =
futures::try_join!(tx_receipt_fut, pre_trace_fut, diff_trace_fut)?;

Ok((
tx_receipt.context("Transaction receipt not found.")?,
pre_trace,
diff_trace,
struct_logs,
))
}

Expand Down

0 comments on commit 5b676c3

Please sign in to comment.