Skip to content

Commit cd7dfe1

Browse files
committed
test: trace beacon e2e attestation inclusion
1 parent 73c5fc0 commit cd7dfe1

2 files changed

Lines changed: 33 additions & 5 deletions

File tree

crates/common/chain/beacon/src/beacon_chain.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,18 @@ impl BeaconChain {
5959

6060
for attestation in signed_block.message.body.attestations.iter() {
6161
if let Err(err) = on_attestation(&mut store, attestation.clone(), true) {
62-
warn!("Failed to process block attestation through fork choice: {err:?}");
62+
warn!(
63+
block_slot = signed_block.message.slot,
64+
block_root = %signed_block.message.block_root(),
65+
attestation_slot = attestation.data.slot,
66+
beacon_block_root = %attestation.data.beacon_block_root,
67+
source_epoch = attestation.data.source.epoch,
68+
source_root = %attestation.data.source.root,
69+
target_epoch = attestation.data.target.epoch,
70+
target_root = %attestation.data.target.root,
71+
aggregation_bits = attestation.aggregation_bits.num_set_bits(),
72+
"beacon_e2e_trace: failed block attestation fork-choice import: {err:?}"
73+
);
6374
}
6475
}
6576

crates/rpc/beacon/src/handlers/validator.rs

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,10 +1521,27 @@ pub async fn get_blocks_v3(
15211521
.get_all_attester_slashings()
15221522
.try_into()
15231523
.unwrap_or_default();
1524-
let attestations: VariableList<Attestation, U8> = operation_pool
1525-
.get_attestations_for_block(&state)
1526-
.try_into()
1527-
.unwrap_or_default();
1524+
let selected_attestations = operation_pool.get_attestations_for_block(&state);
1525+
tracing::info!(
1526+
slot,
1527+
state_slot = state.slot,
1528+
attestation_count = selected_attestations.len(),
1529+
attestation_slots = ?selected_attestations
1530+
.iter()
1531+
.map(|attestation| attestation.data.slot)
1532+
.collect::<Vec<_>>(),
1533+
target_epochs = ?selected_attestations
1534+
.iter()
1535+
.map(|attestation| attestation.data.target.epoch)
1536+
.collect::<Vec<_>>(),
1537+
aggregation_bits = ?selected_attestations
1538+
.iter()
1539+
.map(|attestation| attestation.aggregation_bits.num_set_bits())
1540+
.collect::<Vec<_>>(),
1541+
"beacon_e2e_trace: selected block attestations"
1542+
);
1543+
let attestations: VariableList<Attestation, U8> =
1544+
selected_attestations.try_into().unwrap_or_default();
15281545
let deposits: VariableList<Deposit, U16> = operation_pool
15291546
.get_all_deposits()
15301547
.try_into()

0 commit comments

Comments
 (0)