Skip to content

Commit 4aa66c1

Browse files
committed
fix: catch potential errors enqueuing gov/slashing signals
1 parent db151be commit 4aa66c1

File tree

1 file changed

+11
-14
lines changed

1 file changed

+11
-14
lines changed

yarn-project/sequencer-client/src/sequencer/sequencer.ts

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -412,18 +412,19 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
412412

413413
const enqueueGovernanceSignalPromise =
414414
this.governanceProposerPayload && !this.governanceProposerPayload.isZero()
415-
? publisher.enqueueGovernanceCastSignal(
416-
this.governanceProposerPayload,
417-
slot,
418-
timestamp,
419-
attestorAddress,
420-
signerFn,
421-
)
415+
? publisher
416+
.enqueueGovernanceCastSignal(this.governanceProposerPayload, slot, timestamp, attestorAddress, signerFn)
417+
.catch(err => {
418+
this.log.error(`Error enqueuing governance vote`, err, { blockNumber: newBlockNumber, slot });
419+
})
422420
: Promise.resolve();
423421

424422
const enqueueSlashingActionsPromise = this.slasherClient
425423
?.getProposerActions(slot)
426-
?.then(actions => publisher.enqueueSlashingActions(actions, slot, timestamp, attestorAddress, signerFn));
424+
.then(actions => publisher.enqueueSlashingActions(actions, slot, timestamp, attestorAddress, signerFn))
425+
.catch(err => {
426+
this.log.error(`Error enqueuing slashing actions`, err, { blockNumber: newBlockNumber, slot });
427+
});
427428

428429
if (invalidateBlock && !this.config.skipInvalidateBlockAsProposer) {
429430
publisher.enqueueInvalidateBlock(invalidateBlock);
@@ -482,12 +483,8 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
482483
this.emit('tx-count-check-failed', { minTxs: this.minTxsPerBlock, availableTxs: pendingTxCount });
483484
}
484485

485-
await enqueueGovernanceSignalPromise?.catch(err => {
486-
this.log.error(`Error enqueuing governance vote`, err, { blockNumber: newBlockNumber, slot });
487-
});
488-
await enqueueSlashingActionsPromise?.catch(err => {
489-
this.log.error(`Error enqueuing slashing actions`, err, { blockNumber: newBlockNumber, slot });
490-
});
486+
await enqueueGovernanceSignalPromise;
487+
await enqueueSlashingActionsPromise;
491488

492489
const l1Response = await publisher.sendRequests();
493490
const proposedBlock = l1Response?.successfulActions.find(a => a === 'propose');

0 commit comments

Comments
 (0)