-
Notifications
You must be signed in to change notification settings - Fork 1
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: remove delegator address in WrappedFilePV, change init cmd and add migration cmd. #8
base: feat/bls-keystore-improvement
Are you sure you want to change the base?
Conversation
Commit Summary
|
@@ -115,3 +115,7 @@ func (k Keeper) CheckMsgCreateValidator(ctx context.Context, msg *stakingtypes.M | |||
func (k Keeper) GetPubKeyByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (cmtprotocrypto.PublicKey, error) { | |||
return k.stk.GetPubKeyByConsAddr(ctx, consAddr) | |||
} | |||
|
|||
func (k Keeper) GetValidatorByConsAddr(ctx context.Context, consAddr sdk.ConsAddress) (stakingtypes.Validator, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider Removing GetValidatorPubkey
and FilePVKey
- If the
BLS ValidatorPubkey
exists, we can retrieve the associatedValidatorAddr
through its pairing (viablsKeysToAddr
). - This would eliminate the need for
GetValidatorPubkey
. - Consequently, the FilePVKey from Comet in
WrappedFilePV
would also become unnecessary and could be removed. - Removing
FilePVKey
would reduce overall complexity.
Observations
- Reading
FilePVKey
at the app level seems unnatural. - In cases where CometBFT uses a
PrivValidator
that does not rely onFilePV
(e.g., Horcrux, tmkms or other SignerClient),FilePV
will not exist. - Without
FilePV
, it may not be possible to perform vote extensions.
Benefits of Removing FilePV
- Simplifies the architecture by removing dependency on
FilePVKey
. - Aligns better with modern
PrivValidator
implementations that utilize external signing solutions likeHorcrux
.
@wnjoon The base branch of this PR currently overlaps with the branch for #396. To prevent branches from different PRs from mixing, please fetch https://github.com/babylonlabs-io/babylon/tree/feat/bls-keystore-improvement into the b-harvest repository and update the base branch of this PR |
@wnjoon Could you add plan on description for migration cmd?
|
dbfe05a
to
d914469
Compare
Commit Summary
|
Commit Summary
|
Commit Summary
|
d055b84
to
d296e09
Compare
…add migration cmd This PR includes the following changes: **1. Remove delegator address in WrappedFilePV:** - Removed Delegator Address field from WrappedFilePV. Delegator Address can be obtained from kvStore of x/checkpointing module via bls public key. - Simplify the structure of WrappedFilePV. **2. Addition of InitCmd**: - InitCmd has been updated to generate both Comet and BLS keys through babylond init. - The --bls-password flag allows you to specify a BLS password. If the flag is not provided, the password will be requested interactively via a prompt. **3. BLS Key File Migration**: - The babylond migrate-bls-key command allows the priv_validator_key.json file from previous versions to be converted into the separated key file structure used in the current version. - If the priv_validator_key.json file does not exist or already contains only Comet key information (indicating it is in the latest format), no migration will occur. **4. Fix for `e2e-run-upgrade-v1` Error**: - Resolved an issue in e2e-run-upgrade-v1 during e2e testing caused by differences in the key file structures between the current version and the images pulled from Docker Hub for pre-upgrade containers. - Introduced a new build tag, e2e_upgrade, applied when building the e2e Docker image. This ensures that `babylond start` checks the priv_validator_key.json file, and if it is in an older format, it is automatically migrated. And we suggest a new discussion about lightweight BlsSigner interface with remove FilePVKey from comet in WrappedFilePV. - When BLS public key is known, the validator address required for Vote extensions can be obtained using the kvStore of the `x/checkpointing` module. - Therefore, the BlsSigner interface can be fully implemented in BlsPVKey, and the FilePV from comet is not needed. - In cases where CometBFT uses a PrivValidator that does not rely on FilePV (e.g., Horcrux or other SignerClient), the FilePV will not be present. Note that remote signers are currently not supported. - [comment for reference](b-harvest#8 (comment)) - Please consider whether this proposal is necessary and give us your opinion.
Description
This PR changes the logic including the delegator address while removing the WrappedFilePV structure.
LastSignState
in the WrappedFilePV structure and reduced the hierarchy by one level.babylond create-bls-key
, only the bls key is generated based on the password entered as a prompt, and the delegator address is passed as an argument at the time ofbabylond gen-helper create-bls
.priv_validator_key.json
and bls key files simultaneously duringbabylond init
.ExtendVote()
.init
orcreate-bls-key
commands if the key file does not exist at babylond start time. This prevents the node from starting if the key file does not exist, and restricts key files to only be created via specific cli.priv_validator_key.json
file is automatically migrated to the updated structure, where the comet and BLS keys are separated. This ensures compatibility with the new key file format.How to test for migration
Before starting, two different versions of
babylond
are required. One is the previous version and the other is the changed version.The previous version should generate
priv_validator_key.json
, which contains comet and bls keys. and the changed version generates separate files saving each key.1. Start the node using the
babylond
version before changing.2. Stop the running node.
3. Execute migration from the changed version of
babylond
.Before calling migration, check if the
priv_validator_key.json
file storing the two types of keys exists inside<home>/.babylond/config
.4. Enter the password you will use to encrypt the bls key into the erc2335 structure.
5. Verify that the
bls_key.json
andbls_password.txt
files are correctly created in<home>/.babylond/config
.6. Verify that
priv_validator_key.json
contains only keys for comet.7. Restart the node using changed version of
babylond
.Error cases
priv_validator_key.json
does not exist when calling migrationpriv_validator_key.json
does not satisfy the previous version of a structure containing comet and bls keys.