-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat(hardfork): l2 hardfork #1212
base: main
Are you sure you want to change the base?
Conversation
block/modes.go
Outdated
|
||
func (m *Manager) subscribeFullNodeEvents(ctx context.Context) { | ||
// 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
block/modes.go
Outdated
func (m *Manager) subscribeFullNodeEvents(ctx context.Context) { | ||
// 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
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, p2pGossipLoop, p2p.EventQueryNewGossipedBlock, m.OnReceivedBlock, m.logger) |
Check notice
Code scanning / CodeQL
Spawning a Go routine
|
||
// Subscribe to P2P received blocks events (used for P2P syncing). | ||
go uevent.MustSubscribe(ctx, m.Pubsub, p2pGossipLoop, p2p.EventQueryNewGossipedBlock, m.OnReceivedBlock, m.logger) | ||
go uevent.MustSubscribe(ctx, m.Pubsub, p2pBlocksyncLoop, p2p.EventQueryNewBlockSyncBlock, m.OnReceivedBlock, m.logger) |
Check notice
Code scanning / CodeQL
Spawning a Go routine
68644a8
to
217ba07
Compare
635d160
to
f815898
Compare
…ymint into srene/hardfork-fix
i think we addressed everything but there are things i dont think need to be changed now. ill add issues for what is ncessary:
|
block/fork.go
Outdated
if err := m.checkForkUpdate(ctx); err != nil { | ||
continue |
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.
dont you want error here?
block/fork.go
Outdated
if !types.InstructionExists(m.RootDir) { | ||
err := m.checkForkUpdate(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
} | ||
|
||
ticker := time.NewTicker(LoopInterval) // TODO make this configurable | ||
defer ticker.Stop() | ||
|
||
for { | ||
select { | ||
case <-ctx.Done(): | ||
return nil | ||
case <-ticker.C: | ||
if err := m.checkForkUpdate(ctx); err != nil { | ||
continue | ||
} | ||
} |
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.
can dry out and put checkForUpdate at top of for loop?
block/fork.go
Outdated
// Block Creation Rules: | ||
// - Two blocks are considered in this process: | ||
// - First block: Contains consensus messages for the fork | ||
// - Second block: Should be empty (no messages or transactions) | ||
// - Total height increase should be 2 blocks from RevisionStartHeight | ||
func (m *Manager) handleCreationOfForkBlocks(instruction types.Instruction, consensusMsgs []proto.Message) 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.
just call it create fork blocks?
block/fork.go
Outdated
if err := m.validateExistingBlocks(instruction, 1); err != nil { | ||
return err | ||
} | ||
return m.createNewBlocks(consensusMsgs, 1) // Create only the second block |
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.
why does second block have cons message?
block/fork.go
Outdated
// Create first block with consensus messages if blocksToCreate == 2 | ||
if blocksToCreate == 2 { | ||
if _, _, err := m.ProduceApplyGossipBlock(context.Background(), true); err != nil { | ||
return fmt.Errorf("producing first block: %v", err) | ||
} | ||
} | ||
|
||
// Create second empty block for both cases (blocksToCreate == 1 or 2) | ||
if _, _, err := m.ProduceApplyGossipBlock(context.Background(), true); err != nil { | ||
return fmt.Errorf("producing second block: %v", err) | ||
} |
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.
it's allow empty, it should be forced empty
047c201
to
5f0f8d1
Compare
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: