Skip to content

Commit

Permalink
Merge pull request #496 from chainbound/lore/fix/logs
Browse files Browse the repository at this point in the history
fix(sidecar): review trace logs
  • Loading branch information
thedevbirb authored Nov 29, 2024
2 parents d253b5d + cbdb6a4 commit f1374fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
9 changes: 1 addition & 8 deletions bolt-sidecar/src/builder/payload_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,27 +118,22 @@ impl FallbackPayloadBuilder {
// For the timestamp, we must use the one expected by the beacon chain instead, to
// prevent edge cases where the proposer before us has missed their slot.
let latest_block = self.execution_rpc_client.get_block(None, true).await?;
trace!(num = ?latest_block.header.number, "got latest block");

let withdrawals = self.get_expected_withdrawals_at_head().await?;
trace!(amount = ?withdrawals.len(), "got expected withdrawals");

let prev_randao = self.get_prev_randao().await?;
trace!(randao = ?prev_randao, "got prev_randao");

let parent_beacon_block_root = B256::from_slice(
// TODO: compat: as_slice() from_slice() is necessary until we bump ethereum-consensus
// version to match alloy's.
self.beacon_api_client.get_beacon_block_root(BlockId::Head).await?.as_slice(),
);
trace!(parent = ?parent_beacon_block_root, "got parent_beacon_block_root");

let versioned_hashes = transactions
.iter()
.flat_map(|tx| tx.blob_versioned_hashes())
.flatten()
.collect::<Vec<_>>();
trace!(amount = ?versioned_hashes.len(), "got versioned_hashes");

let base_fee = calc_next_block_base_fee(
latest_block.header.gas_used,
Expand Down Expand Up @@ -198,8 +193,6 @@ impl FallbackPayloadBuilder {
.fetch_next_payload_hint(&exec_payload, &versioned_hashes, parent_beacon_block_root)
.await?;

trace!("engine_hint: {:?}", engine_hint);

match engine_hint {
EngineApiHint::BlockHash(hash) => {
trace!("Should not receive block hash hint {:?}", hash);
Expand Down Expand Up @@ -333,7 +326,7 @@ impl EngineHinter {
return Err(BuilderError::InvalidEngineHint(raw_hint));
};

trace!("raw hint: {:?}", raw_hint);
trace!("engine hint: {:?}", raw_hint);

// Match the hint value to the corresponding header field and return it
if raw_hint.contains("blockhash mismatch") {
Expand Down
6 changes: 4 additions & 2 deletions bolt-sidecar/src/state/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,10 @@ impl<C: StateFetcher> ExecutionState<C> {
.map(|(nonce, balance)| (nonce, balance, *slot))
.unwrap_or((0, U256::ZERO, 0));

// This might be noisy but it is a critical part in validation logic and
// hard to debug.
trace!(?nonce_diff, ?balance_diff, ?slot, ?sender, "found diffs");

(
nonce_diff_acc + nonce_diff,
balance_diff_acc.saturating_add(balance_diff),
Expand All @@ -358,8 +362,6 @@ impl<C: StateFetcher> ExecutionState<C> {
return Err(ValidationError::SlotTooLow(highest_slot_for_account));
}

trace!(nonce_diff, %balance_diff, "Applying diffs to account state");

let account_state = match self.account_states.get(sender).copied() {
Some(account) => account,
None => {
Expand Down

0 comments on commit f1374fb

Please sign in to comment.