Skip to content

Commit d07c97f

Browse files
authored
fix: Fetch parent block even when past reexecution deadline (#17872)
Attempts fetching the parent block when computing an attestation even if past the reexecution deadline. This may fix flakes in tests where reexecution is not needed, in particular inactivity slash.
2 parents 5c00bd1 + ff59d47 commit d07c97f

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

yarn-project/validator-client/src/block_proposal_handler.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,21 +135,18 @@ export class BlockProposalHandler {
135135
const currentTime = this.dateProvider.now();
136136
const timeoutDurationMs = deadline.getTime() - currentTime;
137137
const parentBlock =
138-
timeoutDurationMs <= 0
138+
(await this.blockSource.getBlock(blockNumber - 1)) ??
139+
(timeoutDurationMs <= 0
139140
? undefined
140141
: await retryUntil(
141142
async () => {
142-
const block = await this.blockSource.getBlock(blockNumber - 1);
143-
if (block) {
144-
return block;
145-
}
146143
await this.blockSource.syncImmediate();
147144
return await this.blockSource.getBlock(blockNumber - 1);
148145
},
149146
'Force Archiver Sync',
150147
timeoutDurationMs / 1000,
151148
0.5,
152-
);
149+
));
153150

154151
if (parentBlock === undefined) {
155152
this.log.warn(`Parent block for ${blockNumber} not found, skipping processing`, proposalInfo);

0 commit comments

Comments
 (0)