Skip to content

Don't restart non-validators that are behind - #475

Open
samliok wants to merge 10 commits into
mainfrom
cleanup-instance
Open

Don't restart non-validators that are behind#475
samliok wants to merge 10 commits into
mainfrom
cleanup-instance

Conversation

@samliok

@samliok samliok commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator
  • Checks if we have validated a higher epoch before transitioning to a validator
  • Also cleans up the instance code and removes the nodeRole struct

Comment thread instance.go
onEpochChange: func(epoch uint64, validators common.Nodes) error {
height := i.Config.PlatformChain.GetCurrentHeight()
vdrs, err := i.Config.PlatformChain.GetValidatorSet(height)
// set the communication to the highest validator set, since this node is a non-validator and may be behind.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this basically a poor man's caching of the highest validator set from the P-chain?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it uses the same mechanism as before, i just extracted it to a helper.

But yea, we should feed the non-validator the highest pchain validators. I think alternatively we could just pass in the platform chain interface into the non-validator. This could help if the non-validator was offline and the validator set diverged.

Comment thread instance.go Outdated
switch epochChange.nodeRole {
case nonValidator:
switch {
case i.e != nil && i.nv != nil:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we removed the role but can we at least put some more meaningful code than i.e != nil and i.nv != nil?

Maybe:

amValidator := i.e != nil
amNonValidator := i.nv != nil

?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants