Skip to content

Commit

Permalink
perf: remove bytecode changes when sending to relayer (#1116)
Browse files Browse the repository at this point in the history
  • Loading branch information
carneiro-cw authored Jun 14, 2024
1 parent 0e1d879 commit 687670f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/eth/relayer/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use crate::config::ExternalRelayerClientConfig;
use crate::config::ExternalRelayerServerConfig;
use crate::eth::primitives::Block;
use crate::eth::primitives::BlockNumber;
use crate::eth::primitives::ExecutionValueChange;
use crate::eth::primitives::ExternalReceipt;
use crate::eth::primitives::Hash;
use crate::eth::primitives::TransactionMined;
Expand Down Expand Up @@ -339,12 +340,20 @@ impl ExternalRelayerClient {
/// Insert the block into the relayer_blocks table on pgsql to be processed by the relayer. Returns Err if
/// the insertion fails.
#[tracing::instrument(name = "external_relayer_client::send_to_relayer", skip_all, fields(block_number))]
pub async fn send_to_relayer(&self, block: Block) -> anyhow::Result<()> {
pub async fn send_to_relayer(&self, mut block: Block) -> anyhow::Result<()> {
#[cfg(feature = "metrics")]
let start = metrics::now();

let block_number = block.header.number;
tracing::info!(?block_number, "sending block to relayer");

// strip bytecode
for tx in block.transactions.iter_mut() {
for (_, change) in tx.execution.changes.iter_mut() {
change.bytecode = ExecutionValueChange::default();
}
}

let block_json = serde_json::to_value(block)?;
// fill span
Span::with(|s| s.rec_str("block_number", &block_number));
Expand Down

0 comments on commit 687670f

Please sign in to comment.