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: Gate-keeping validator set from validators without required public keys #431

Merged
merged 7 commits into from
Dec 9, 2024

Conversation

hacheigriega
Copy link
Member

@hacheigriega hacheigriega commented Dec 4, 2024

Motivation

Once a proving scheme is enabled, we want to gate-keep the validator store to ensure that all validators in the store have the required public key. Also, since an account cannot register a public key before registering itself as a validator, the CreateValidator has to handle registration of the required public keys.

Explanation of Changes

We wrap the staking module's message server to replace the original CreateValidator handler with the new CreateSEDAValidator handler. A few things to note about the new handler:

  • It checks if the secp256k1 proving scheme has been activated and, if it has, requires the secp256k1 public key to be present in the transaction message.
  • The transaction command tx staking create-validator remains the same.
  • A flag --without-seda-keys can be added to skip generating and uploading the SEDA keys.

The gentx has also been updated to generate and upload the SEDA keys.

Testing

We first set up a local network with a single genesis validator and, before the proving scheme activation period is over, create a few new validators with the --without-seda-keys flag to make the public key registration rate fall below the threshold. This cancels the activation process. Subsequently, the new validators send the tx pubkey add-seda-keys to generate and upload the required public keys. This again starts the activation process and eventually activates the proving scheme with the guarantee that all validators have registered their public keys.

Related PRs and Issues

Related: #422 (to close the issue, we still need to update the unjail logic - addressed in #434)

@hacheigriega hacheigriega force-pushed the hy/gatekeep branch 2 times, most recently from 99e71b5 to f8f57da Compare December 4, 2024 19:47
@hacheigriega hacheigriega marked this pull request as ready for review December 5, 2024 22:22
@hacheigriega hacheigriega marked this pull request as draft December 6, 2024 03:39
@hacheigriega hacheigriega marked this pull request as ready for review December 6, 2024 16:23
@hacheigriega hacheigriega force-pushed the hy/gatekeep branch 3 times, most recently from e7db8c8 to b400fdd Compare December 6, 2024 19:37
@hacheigriega
Copy link
Member Author

hacheigriega commented Dec 6, 2024

With the commit 2b64145 the original SDK handlers should work as before. The SDK's CreateValidator, however, is discarded in favor of SEDA Chain's CreateSEDAValidator. Cc @Thomasvdam

@hacheigriega hacheigriega force-pushed the hy/gatekeep branch 2 times, most recently from 2b3cb78 to 2b64145 Compare December 6, 2024 20:24
@hacheigriega hacheigriega requested a review from a team December 6, 2024 20:33
cmd/sedad/gentx/gentx.go Outdated Show resolved Hide resolved
cmd/sedad/gentx/gentx.go Outdated Show resolved Hide resolved
x/staking/keeper/invariants.go Show resolved Hide resolved
@gluax gluax mentioned this pull request Dec 7, 2024
Copy link
Member

@Thomasvdam Thomasvdam left a comment

Choose a reason for hiding this comment

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

We should also remember to update the docs for creating a validator once we go to testnet and mainnet. :D

@hacheigriega hacheigriega merged commit d781ff3 into main Dec 9, 2024
8 of 10 checks passed
@hacheigriega hacheigriega deleted the hy/gatekeep branch December 9, 2024 23:09
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