Skip to content

Commit 65e4396

Browse files
committed
add more traces
1 parent 07fae4d commit 65e4396

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

crates/ingress-rpc/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rdkafka::producer::FutureProducer;
77
use std::fs;
88
use std::net::IpAddr;
99
use tips_common::init_tracing;
10-
use tracing::{info, warn};
10+
use tracing::{info, trace, warn};
1111
use url::Url;
1212

1313
mod queue;
@@ -98,7 +98,7 @@ async fn main() -> anyhow::Result<()> {
9898
log_level.to_string(),
9999
)?;
100100
}
101-
info!(
101+
trace!(
102102
message = "Starting ingress service",
103103
address = %config.address,
104104
port = config.port,

crates/ingress-rpc/src/queue.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use async_trait::async_trait;
55
use backon::{ExponentialBuilder, Retryable};
66
use rdkafka::producer::{FutureProducer, FutureRecord};
77
use tokio::time::Duration;
8-
use tracing::{error, info};
8+
use tracing::{error, info, trace};
99

1010
/// A queue to buffer transactions
1111
#[async_trait]
@@ -32,6 +32,7 @@ impl KafkaQueuePublisher {
3232
let key = sender.to_string();
3333
let payload = serde_json::to_vec(bundle)?;
3434

35+
trace!(message = "Enqueuing bundle", sender = %sender, topic = %self.topic);
3536
let enqueue = || async {
3637
let record = FutureRecord::to(&self.topic).key(&key).payload(&payload);
3738

crates/ingress-rpc/src/service.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use op_alloy_consensus::OpTxEnvelope;
1111
use op_alloy_network::Optimism;
1212
use reth_rpc_eth_types::EthApiError;
1313
use std::time::{SystemTime, UNIX_EPOCH};
14-
use tracing::{info, warn};
14+
use tracing::{info, trace, warn};
1515

1616
use crate::queue::QueuePublisher;
1717

@@ -75,6 +75,7 @@ where
7575
}
7676

7777
async fn send_raw_transaction(&self, data: Bytes) -> RpcResult<B256> {
78+
trace!(message = "Sending raw transaction", data = %data);
7879
if data.is_empty() {
7980
return Err(EthApiError::EmptyRawTransactionData.into_rpc_err());
8081
}
@@ -92,6 +93,8 @@ where
9293
.provider
9394
.fetch_account_info(transaction.signer())
9495
.await?;
96+
97+
trace!(message = "Validating transaction", account = %transaction.signer(), transaction = %transaction.tx_hash());
9598
validate_tx(account, &transaction, &data, &mut l1_block_info).await?;
9699

97100
let expiry_timestamp = SystemTime::now()
@@ -110,6 +113,7 @@ where
110113
};
111114

112115
// queue the bundle
116+
trace!(message = "Queueing bundle", bundle = ?bundle);
113117
let sender = transaction.signer();
114118
if let Err(e) = self.queue.publish(&bundle, sender).await {
115119
warn!(message = "Failed to publish Queue::enqueue_bundle", sender = %sender, error = %e);

crates/ingress-rpc/src/validation.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use op_alloy_network::Optimism;
99
use op_revm::{OpSpecId, l1block::L1BlockInfo};
1010
use reth_optimism_evm::extract_l1_info_from_tx;
1111
use reth_rpc_eth_types::{EthApiError, RpcInvalidTransactionError, SignError};
12-
use tracing::warn;
12+
use tracing::{trace, warn};
1313

1414
/// Account info for a given address
1515
pub struct AccountInfo {
@@ -89,6 +89,8 @@ pub async fn validate_tx<T: Transaction>(
8989
data: &[u8],
9090
l1_block_info: &mut L1BlockInfo,
9191
) -> RpcResult<()> {
92+
trace!(message = "Validating with no state", account = %txn.signer(), transaction = ?txn);
93+
9294
// skip eip4844 transactions
9395
if txn.is_eip4844() {
9496
warn!(message = "EIP-4844 transactions are not supported");
@@ -108,6 +110,7 @@ pub async fn validate_tx<T: Transaction>(
108110
}
109111
}
110112

113+
trace!(message = "Validating with inner state", account = %txn.signer(), transaction = ?txn);
111114
// error if account is 7702 but tx is not 7702
112115
if account.code_hash != KECCAK_EMPTY && !txn.is_eip7702() {
113116
return Err(EthApiError::InvalidTransaction(
@@ -144,6 +147,7 @@ pub async fn validate_tx<T: Transaction>(
144147
.into_rpc_err());
145148
}
146149

150+
trace!(message = "Validating op checks", account = %txn.signer(), transaction = ?txn);
147151
// op-checks to see if sender can cover L1 gas cost
148152
// from: https://github.com/paradigmxyz/reth/blob/6aa73f14808491aae77fc7c6eb4f0aa63bef7e6e/crates/optimism/txpool/src/validator.rs#L219
149153
let l1_cost_addition = l1_block_info.calculate_tx_l1_cost(data, OpSpecId::ISTHMUS);

0 commit comments

Comments
 (0)