-
Notifications
You must be signed in to change notification settings - Fork 70
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
refactor(manager): cleanup proposer, full node and rotation flows #1183
refactor(manager): cleanup proposer, full node and rotation flows #1183
Conversation
}) | ||
|
||
// Subscribe to new (or finalized) state updates events. | ||
go uevent.MustSubscribe(ctx, m.Pubsub, "syncLoop", settlement.EventQueryNewSettlementBatchAccepted, m.onNewStateUpdate, m.logger) |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
|
||
// Subscribe to new (or finalized) state updates events. | ||
go uevent.MustSubscribe(ctx, m.Pubsub, "syncLoop", settlement.EventQueryNewSettlementBatchAccepted, m.onNewStateUpdate, m.logger) | ||
go uevent.MustSubscribe(ctx, m.Pubsub, "validateLoop", settlement.EventQueryNewSettlementBatchFinalized, m.onNewStateUpdateFinalized, m.logger) |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
go uevent.MustSubscribe(ctx, m.Pubsub, "validateLoop", settlement.EventQueryNewSettlementBatchFinalized, m.onNewStateUpdateFinalized, m.logger) | ||
|
||
// Subscribe to P2P received blocks events (used for P2P syncing). | ||
go uevent.MustSubscribe(ctx, m.Pubsub, "applyGossipedBlocksLoop", p2p.EventQueryNewGossipedBlock, m.OnReceivedBlock, m.logger) |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
|
||
// Subscribe to P2P received blocks events (used for P2P syncing). | ||
go uevent.MustSubscribe(ctx, m.Pubsub, "applyGossipedBlocksLoop", p2p.EventQueryNewGossipedBlock, m.OnReceivedBlock, m.logger) | ||
go uevent.MustSubscribe(ctx, m.Pubsub, "applyBlockSyncBlocksLoop", p2p.EventQueryNewBlockSyncBlock, m.OnReceivedBlock, m.logger) |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
|
||
func (m *Manager) runAsProposer(ctx context.Context, eg *errgroup.Group) error { | ||
// Subscribe to batch events, to update last submitted height in case batch confirmation was lost. This could happen if the sequencer crash/restarted just after submitting a batch to the settlement and by the time we query the last batch, this batch wasn't accepted yet. | ||
go uevent.MustSubscribe(ctx, m.Pubsub, "updateSubmittedHeightLoop", settlement.EventQueryNewSettlementBatchAccepted, m.UpdateLastSubmittedHeight, m.logger) |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
}) | ||
|
||
// Monitor and handling of the rotation | ||
go m.MonitorProposerRotation(ctx) |
Check notice
Code scanning / CodeQL
Spawning a Go routine Note
// In case there is a current proposer but no next proposer, it returns nil. | ||
// in case there isnt current or next proposer, it returns an empty sequencer struct. | ||
// in case there is a next proposer, it returns the next proposer. | ||
func (c *Client) GetNextProposer() (*types.Sequencer, error) { |
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.
regarding the godoc, im not sure i follow why there are two different cases when there is no next proposer set and whether this could be set simpler. i guess its because some specifics of the rotation.. but i would be more explicit about this (maybe renaming the function or having two separate functions).
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.
right. so this is indeed confusing. there is a difference between:
- the current proposer is the next proposer
- the next proposer is empty - i.e the proposer unbonded and no one came.
I'll improve the godoc.
// rotate rotates current proposer by doing the following: | ||
// 1. Creating last block with the new proposer, which will stop him from producing blocks. | ||
// 2. Submitting the last batch | ||
// 3. Panicing so the node restarts as full node |
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.
typo
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.
where exactly?
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.
panicing?
PR Standards
Opening a pull request should be able to meet the following requirements
--
PR naming convention: https://hackmd.io/@nZpxHZ0CT7O5ngTp0TP9mg/HJP_jrm7A
Close #XXX
<-- Briefly describe the content of this pull request -->
For Author:
godoc
commentsFor Reviewer:
After reviewer approval: