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(manager): allow starting node when sequencer is sentinel #1275

Merged
merged 6 commits into from
Feb 3, 2025

Conversation

srene
Copy link
Contributor

@srene srene commented Dec 10, 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 #1273,#1274

<-- 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 December 10, 2024 16:17
@srene srene linked an issue Dec 10, 2024 that may be closed by this pull request
block/manager.go Outdated
@@ -232,7 +232,9 @@ func (m *Manager) Start(ctx context.Context) error {
if m.State.GetProposer() == nil {
m.logger.Info("No proposer on the rollapp, fallback to the hub proposer, if available")
err := m.UpdateProposerFromSL()
if err != nil {
if errors.Is(err, settlement.ErrProposerIsSentinel) {
m.freezeNode(fmt.Errorf("unable to start without new proposer at height %d", m.State.NextHeight()))
Copy link
Contributor

Choose a reason for hiding this comment

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

why u need it here? if u allow starting as full node anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this was added to freeze node instead of panicing when sentinel. however, i replaced it by a waiting function, so in case no active proposer is found it will wait til there is an active proposer, without requirng to restart.

block/manager.go Outdated
@@ -246,7 +248,9 @@ func (m *Manager) Start(ctx context.Context) error {
// for this case, 2 nodes will get `true` for `AmIProposer` so the l2 proposer can produce blocks and the hub proposer can submit his last batch.
// The hub proposer, after sending the last state update, will panic and restart as full node.
amIProposerOnSL, err := m.AmIProposerOnSL()
Copy link
Contributor

Choose a reason for hiding this comment

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

u can add

if errors.Is(err, settlement.ErrProposerIsSentinel) {
		return false, nil

into m.AmIProposerOnSL()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved

@srene srene marked this pull request as draft December 11, 2024 11:26
@srene srene self-assigned this Jan 24, 2025
@srene srene marked this pull request as ready for review January 24, 2025 15:20
@@ -347,8 +347,8 @@ func (c *Client) GetProposerAtHeight(height int64) (*types.Sequencer, error) {
}
}

if proposerAddr == SENTINEL_PROPOSER {
return nil, fmt.Errorf("proposer is sentinel")
if proposerAddr == "" || proposerAddr == SENTINEL_PROPOSER {
Copy link
Contributor

Choose a reason for hiding this comment

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

when does == "" happens?

@omritoptix omritoptix merged commit ecae6ed into main Feb 3, 2025
4 checks passed
@omritoptix omritoptix deleted the srene/1273-new-sentinel-query branch February 3, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants