-
Notifications
You must be signed in to change notification settings - Fork 607
chore(node): fix p2p services start-stop #22776
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -157,6 +157,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb | |
| protected readonly slasherClient: SlasherClientInterface | undefined, | ||
| protected readonly validatorsSentinel: Sentinel | undefined, | ||
| protected readonly epochPruneWatcher: EpochPruneWatcher | undefined, | ||
| protected readonly attestationsBlockWatcher: AttestationsBlockWatcher | undefined, | ||
| protected readonly l1ChainId: number, | ||
| protected readonly version: number, | ||
| protected readonly globalVariableBuilder: GlobalVariableBuilderInterface, | ||
|
|
@@ -403,7 +404,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb | |
|
|
||
| let validatorClient: ValidatorClient | undefined; | ||
|
|
||
| if (!proverOnly) { | ||
| if (!config.disableValidator) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure about this one. It's more declarative/readable, but not semantically the same. LMK. |
||
| // Create validator client if required | ||
| validatorClient = await createValidatorClient(config, { | ||
| checkpointsBuilder: validatorCheckpointsBuilder, | ||
|
|
@@ -494,9 +495,18 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb | |
| void archiver | ||
| .waitForInitialSync() | ||
| .then(async () => { | ||
| await validatorsSentinel?.start(); | ||
| await epochPruneWatcher?.start(); | ||
| await attestationsBlockWatcher?.start(); | ||
| if (validatorsSentinel) { | ||
| await validatorsSentinel.start(); | ||
| started.push(validatorsSentinel); | ||
| } | ||
| if (epochPruneWatcher) { | ||
| await epochPruneWatcher.start(); | ||
| started.push(epochPruneWatcher); | ||
| } | ||
| if (attestationsBlockWatcher) { | ||
| await attestationsBlockWatcher.start(); | ||
| started.push(attestationsBlockWatcher); | ||
| } | ||
| log.info(`All p2p services started`); | ||
| }) | ||
| .catch(err => log.error('Failed to start p2p services after archiver sync', err)); | ||
|
|
@@ -627,6 +637,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb | |
| slasherClient, | ||
| validatorsSentinel, | ||
| epochPruneWatcher, | ||
| attestationsBlockWatcher, | ||
| ethereumChain.chainInfo.id, | ||
| config.rollupVersion, | ||
| globalVariableBuilder, | ||
|
|
@@ -966,10 +977,15 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb | |
| // If the tx is in the pool but not in the archiver, it's pending. | ||
| // This handles race conditions between archiver and p2p, where the archiver | ||
| // has pruned the block in which a tx was mined, but p2p has not caught up yet. | ||
| receipt = new TxReceipt(txHash, TxStatus.PENDING, undefined, undefined); | ||
| receipt = new TxReceipt(txHash, TxStatus.PENDING, /*executionResult=*/ undefined, /*error=*/ undefined); | ||
| } else { | ||
| // Otherwise, if we don't know the tx, we consider it dropped. | ||
| receipt = new TxReceipt(txHash, TxStatus.DROPPED, undefined, 'Tx dropped by P2P node'); | ||
| receipt = new TxReceipt( | ||
| txHash, | ||
| TxStatus.DROPPED, | ||
| /*executionResult=*/ undefined, | ||
| /*error=*/ 'Tx dropped by P2P node', | ||
| ); | ||
| } | ||
|
|
||
| this.debugLogStore.decorateReceiptWithLogs(txHash.toString(), receipt); | ||
|
|
@@ -986,6 +1002,7 @@ export class AztecNodeService implements AztecNode, AztecNodeAdmin, AztecNodeDeb | |
| */ | ||
| public async stop() { | ||
| this.log.info(`Stopping Aztec Node`); | ||
| await tryStop(this.attestationsBlockWatcher); | ||
| await tryStop(this.validatorsSentinel); | ||
| await tryStop(this.epochPruneWatcher); | ||
| await tryStop(this.slasherClient); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to keep track of it to be able to stop it.