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

FIX: checkpointing/changed PoP by signing BLS public key #97

Merged
merged 3 commits into from
Aug 19, 2022

Conversation

gitferry
Copy link
Contributor

@gitferry gitferry commented Aug 17, 2022

This PR follows the discussions in a PR where we decided to change PoP by signing the BLS public key instead of the account's public key.

This change works because MsgCreateValidator is signed by both the delegator and the validator. Signing BLS public key will not break the binding between the delegator's key and the validator's key while maintaining the binding between the BLS key and the validator's key.

This change is better to be done in a separate PR.

@gitferry gitferry requested a review from aakoshh August 17, 2022 15:44
Copy link
Contributor

@aakoshh aakoshh left a comment

Choose a reason for hiding this comment

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

Thanks for separating this! Much better to see it as a unit of change.

privval/types.go Outdated
// where valPrivKey is Ed25519_sk, accPubkey is Secp256k1_pk, blsPrivkey is BLS_sk
func BuildPop(valPrivKey tmcrypto.PrivKey, blsPrivkey bls12381.PrivateKey, accPubkey cryptotypes.PubKey) (*types.ProofOfPossession, error) {
data, err := valPrivKey.Sign(accPubkey.Bytes())
// BuildPoP builds a proof-of-possession by PoP=encrypt(key = BLS_sk, data = encrypt(key = Ed25519_sk, data = BLS_pk))
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we say sign instead of encrypt?

3. Otherwise, the corresponding BLS key registered before should be removed to ensure atomicity.
4. The validator should register again.
1. The `Checkpointing` module first processes `MsgWrappedCreateValidator` to register the validator's BLS key. If success, then
2. extract `MsgCreateValidator` and deliver `MsgCreateValidator` to the epoching module's message queue, which will be processed until the end of this epoch. If success, the registration is succeeded.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
2. extract `MsgCreateValidator` and deliver `MsgCreateValidator` to the epoching module's message queue, which will be processed until the end of this epoch. If success, the registration is succeeded.
2. extract `MsgCreateValidator` and deliver `MsgCreateValidator` to the epoching module's message queue, which will be processed at the end of this epoch. If success, the registration is succeeded.


Genesis validators are registered via the legacy `genutil` module from the Cosmos-SDK, which processes `MsgCreateValidator` messages contained in genesis transactions.
The BLS keys are registered as `GenesisState` in the checkpointing module.
The checkpointing module's `ValidateGenesis` should ensure that each genesis validator has both an Ed25519 key and BLS key which are bonded by PoP.
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think the ValidateGenesis method can do this because this seems to run on just the module specific part of the genesis.json part, so it won't be able to see both the genutil and the checkpointing parts, and because there's no execution, it also can't look up validator keys. That's why I suggested there to be a dedicated CLI command to do the validation, by accessing both parts. ValidateGenesis can validate the PoP, though.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the comment, I'll revise the doc in the following PR.

@gitferry gitferry merged commit 21c721b into main Aug 19, 2022
@gitferry gitferry deleted the checkpointing/change-pop branch August 19, 2022 06:51
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