Skip to content

Conversation

@noot
Copy link
Contributor

@noot noot commented Sep 25, 2023

Summary

remove byzantine validators in begin_block

Background

needed to decide how to handle byzantine validators; for now, since we only have a PoA implementation, we can just remove them

Changes

  • updated ValidatorSet HashMap key to be account::Id
  • update AuthorityComponent::begin_block to remove byzantine validators from the validator set

Testing

unit tests

Related Issues

closes #360

@github-actions github-actions bot added the sequencer pertaining to the astria-sequencer crate label Sep 25, 2023
@noot noot marked this pull request as ready for review September 25, 2023 12:26
Base automatically changed from noot/validator-changes to main September 26, 2023 15:42
@github-actions github-actions bot added the proto pertaining to the Astria Protobuf spec label Sep 26, 2023
@github-actions github-actions bot removed the proto pertaining to the Astria Protobuf spec label Sep 26, 2023
Copy link
Contributor

@SuperFluffy SuperFluffy left a comment

Choose a reason for hiding this comment

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

Looks good. So this just makes use of cometbft telling us which validators are Byzantine?

Also, is there a chance of this removing all validators? If so, what would be the implications?

_begin_block: &BeginBlock,
) {
#[instrument(name = "AuthorityComponent::begin_block", skip(state))]
async fn begin_block<S: StateWriteExt + 'static>(state: &mut Arc<S>, begin_block: &BeginBlock) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should probably return an error and let tower-abci take down the app gracefully

0 => self.0.remove(&pub_key),
_ => self.0.insert(pub_key, update),
0 => self.0.remove(&address),
_ => self.0.insert(address, update),
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to use the remove and push_update methods you defined above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is okay since push_update recalculates the address which isn't needed

@noot
Copy link
Contributor Author

noot commented Sep 28, 2023

@SuperFluffy I suppose if all validators were byzantine then they could all be removed, which seems like a bigger problem :p I guess if there are no validators, the chain will stop. I'm not sure if it will panic or just stall, if it stalls we can add new validators with the sudo key.

@noot noot merged commit f4758f1 into main Sep 28, 2023
@noot noot deleted the noot/byzantine-validators branch September 28, 2023 13:29
steezeburger added a commit that referenced this pull request Sep 28, 2023
…egration

* main:
  feat(sequencer): remove byzantine validators in begin_block (#429)
  docs: add documentation on e2e rollup data flow and verification (#406)
  ci: run docker builds less frequently + minors (#437)
  release: conductor, sequencer-relayer, sequencer (#427)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sequencer pertaining to the astria-sequencer crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sequencer: handle byzantine validators

4 participants