Skip to content
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

Merged
merged 110 commits into from
Nov 19, 2024
Merged

feat(hardfork): l2 hardfork #1212

merged 110 commits into from
Nov 19, 2024

Conversation

srene
Copy link
Contributor

@srene srene commented Nov 9, 2024

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:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

@srene srene requested a review from a team as a code owner November 9, 2024 15:11
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

Spawning a Go routine may be a possible source of non-determinism
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

Spawning a Go routine may be a possible source of non-determinism
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

Spawning a Go routine may be a possible source of non-determinism

// 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

Spawning a Go routine may be a possible source of non-determinism
@srene srene marked this pull request as draft November 9, 2024 15:52
@srene srene marked this pull request as ready for review November 9, 2024 17:28
@srene srene force-pushed the srene/hardfork-fix branch from 68644a8 to 217ba07 Compare November 10, 2024 12:00
@srene srene force-pushed the srene/hardfork-fix branch from 635d160 to f815898 Compare November 11, 2024 09:46
@srene srene force-pushed the srene/hardfork-fix branch from 047c201 to 5f0f8d1 Compare November 16, 2024 10:11
if err != nil {
return err
}
if m.shouldStopNode(rollapp, m.State.GetRevision()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why we check it inside the loop.
a batch has single revision
this can be checked at the start

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because revision is not serialized in the batch, therefore it needs to be obtained from the block in retrieval

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so it should be added in convertStateInfoToResultRetrieveBatch

Comment on lines 42 to 53
rollapp, err := m.SLClient.GetRollapp()
if err != nil {
return err
}
if m.shouldStopNode(rollapp, m.State.GetRevision()) {
err = m.createInstruction(rollapp)
if err != nil {
return err
}
m.freezeNode(context.Background(), fmt.Errorf("syncing to fork height. please restart the node. local_block_height: %d rollapp_revision_start_height: %d local_revision: %d rollapp_revision: %d", m.State.Height(), rollapp.RevisionStartHeight, m.State.GetRevision(), rollapp.Revision))
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same snippet as m.checkForkUpdate()

Suggested change
rollapp, err := m.SLClient.GetRollapp()
if err != nil {
return err
}
if m.shouldStopNode(rollapp, m.State.GetRevision()) {
err = m.createInstruction(rollapp)
if err != nil {
return err
}
m.freezeNode(context.Background(), fmt.Errorf("syncing to fork height. please restart the node. local_block_height: %d rollapp_revision_start_height: %d local_revision: %d rollapp_revision: %d", m.State.Height(), rollapp.RevisionStartHeight, m.State.GetRevision(), rollapp.Revision))
return nil
}
m.checkForkUpdate()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced by checkForkUpdate, adding stop message in the func.

@mtsitrin mtsitrin merged commit 2bb17cc into main Nov 19, 2024
4 checks passed
@mtsitrin mtsitrin deleted the srene/hardfork-fix branch November 19, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants