Commit 22e56f1
authored
debug(blockchain): trace-level instrumentation for build_block loop (lambdaclass#381)
## Summary
Adds tracing inside `build_block`'s fixed-point attestation-selection
loop so we can investigate sparse or empty blocks. Each iteration emits:
- a `start` event with candidate count, current justified checkpoint,
and how many `AttestationData` entries are already chosen;
- `skipped` events tagged with a reason — `max_attestation_data_cap`,
`head_root_unknown`, `source_not_justified`, `chain_mismatch`, or
`target_already_justified`;
- `selected` events with available vs selected bits and proof counts;
- a `converged` or `post-block checkpoint` event when the inner loop
ends or the fixed point continues.
## Implementation notes
- Uses `trace_span!("build_block", slot, proposer_index)` +
`trace_span!("iter", iteration)` so those fields ride along on every
event instead of being typed out each time.
- Skip paths go through a single `trace_skipped_attestation` helper.
- `available_bits` / `selected_bits` `HashSet` computation is gated
behind `tracing::enabled!(tracing::Level::TRACE)` so no allocations
happen when trace logging is off.
Enable with `RUST_LOG=ethlambda_blockchain=trace`.
## Test plan
- [x] `cargo build -p ethlambda-blockchain` passes.
- [ ] `make lint` clean.
- [ ] `make test` passes (no behavior changes; logging only).
- [ ] Devnet run with `RUST_LOG=ethlambda_blockchain=trace` shows the
expected `start` / `skipped` / `selected` / `converged` / `post-block
checkpoint` events under the `build_block{…}:iter{…}` span path.1 parent 260d068 commit 22e56f1
1 file changed
Lines changed: 83 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1032 | 1032 | | |
1033 | 1033 | | |
1034 | 1034 | | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
1035 | 1050 | | |
1036 | 1051 | | |
1037 | 1052 | | |
| |||
1072 | 1087 | | |
1073 | 1088 | | |
1074 | 1089 | | |
| 1090 | + | |
| 1091 | + | |
1075 | 1092 | | |
1076 | 1093 | | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
1077 | 1104 | | |
1078 | 1105 | | |
1079 | 1106 | | |
1080 | 1107 | | |
1081 | 1108 | | |
| 1109 | + | |
1082 | 1110 | | |
1083 | 1111 | | |
| 1112 | + | |
| 1113 | + | |
1084 | 1114 | | |
1085 | 1115 | | |
1086 | 1116 | | |
| 1117 | + | |
| 1118 | + | |
1087 | 1119 | | |
1088 | 1120 | | |
1089 | 1121 | | |
1090 | 1122 | | |
1091 | 1123 | | |
1092 | 1124 | | |
1093 | 1125 | | |
| 1126 | + | |
| 1127 | + | |
1094 | 1128 | | |
1095 | 1129 | | |
1096 | 1130 | | |
1097 | 1131 | | |
| 1132 | + | |
| 1133 | + | |
1098 | 1134 | | |
1099 | 1135 | | |
1100 | 1136 | | |
| |||
1110 | 1146 | | |
1111 | 1147 | | |
1112 | 1148 | | |
| 1149 | + | |
| 1150 | + | |
1113 | 1151 | | |
1114 | 1152 | | |
1115 | 1153 | | |
1116 | 1154 | | |
1117 | 1155 | | |
1118 | 1156 | | |
| 1157 | + | |
1119 | 1158 | | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
1120 | 1186 | | |
1121 | 1187 | | |
1122 | 1188 | | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
1123 | 1195 | | |
1124 | 1196 | | |
1125 | 1197 | | |
| |||
1141 | 1213 | | |
1142 | 1214 | | |
1143 | 1215 | | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
| 1226 | + | |
1147 | 1227 | | |
1148 | 1228 | | |
1149 | 1229 | | |
| |||
0 commit comments