Skip to content

Conversation

kamsz
Copy link

@kamsz kamsz commented May 8, 2024

This pull request adds support for specifying a different passwords for each key. It is useful if you plan to use a different password for BLS, ECDSA and aliased ECDSA keys.


func RunDeregister(c *cli.Context) error {
passphrase := c.String(flag.PassphraseFlag.Name)
ecdsaPassphrase := c.String(flag.EcdsaPassphraseFlag.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

this should only override the general passphrase if the dedicated one is not provided, like the encrypt command works no?

Copy link
Author

Choose a reason for hiding this comment

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

since deregister doesn't require more than one password i've left it as it is, but made it explicit with ecdsa passphrase flag that it is ecdsa key password

Copy link
Collaborator

Choose a reason for hiding this comment

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

we should be backward compatibility, so we should pass the two passphrase flags use the backward compatibility flag if the correct flag is empty


func RunPrintStatus(c *cli.Context) error {
passphrase := c.String(flag.PassphraseFlag.Name)
ecdsaPassphrase := c.String(flag.EcdsaPassphraseFlag.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

same issue as decrypt

Copy link
Author

Choose a reason for hiding this comment

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

same as above

Copy link
Collaborator

Choose a reason for hiding this comment

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

same feedback to the deregister

@kamsz kamsz force-pushed the support-for-per-key-password branch from ce047e6 to 022ef4c Compare May 8, 2024 10:04
Action: runDeclareAlias,
Flags: []cli.Flag{
flag.PassphraseFlag,
flag.EcdsaPassphraseFlag,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Declare alias requires the ecdsa private key to sign and submit the transaction. The alias ecdsa is used to get the address of the alias

flag.EthRPCFlag,
flag.RegistryCoordinatorFlag,
flag.PassphraseFlag,
flag.EcdsaPassphraseFlag,
Copy link
Collaborator

Choose a reason for hiding this comment

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

need to support the old PassphraseFlag (for backward compatibility)

flag.EthRPCFlag,
flag.RegistryCoordinatorFlag,
flag.PassphraseFlag,
flag.EcdsaPassphraseFlag,
Copy link
Collaborator

Choose a reason for hiding this comment

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

need to support the old PassphraseFlag (for backward compatibility)

Comment on lines 54 to 61
if passphrase == "" {
return cli.Exit("passphrase is required", 1)
if blsPassphrase == "" || ecdsaPassphrase == "" {
return cli.Exit("either passphrase or bls/ecdsa passphrase is required", 1)
}
} else {
blsPassphrase = passphrase
ecdsaPassphrase = passphrase
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

need to change the order of checking the flags.
first checks the new flags (the configuration we want to have)
second check the backward compatbility

Comment on lines 99 to 107
if passphrase == "" {
return cli.Exit("passphrase is required", 1)
if blsPassphrase == "" || ecdsaPassphrase == "" || aliasedEcdsaPassphrase == "" {
return cli.Exit("either passphrase or bls/ecdsa/aliased ecdsa passphrase is required", 1)
}
} else {
blsPassphrase = passphrase
ecdsaPassphrase = passphrase
aliasedEcdsaPassphrase = passphrase
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment on checking first the new flags and later the backward compatibility

Comment on lines +154 to +157
if passphrase != "" {
blsPassphrase = passphrase
ecdsaPassphrase = passphrase
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

since there is default value to passphrase this will be true.
Need to reverse the order (or check if the new flags are empty)

ecdsaPassphrase = passphrase
}

if blsPassphrase == "" || ecdsaPassphrase == "" || keyStorePath == "" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

with the new approach of having a passphrase per key, need to spilt this if into smaller and unrelated it statements


func RunDeregister(c *cli.Context) error {
passphrase := c.String(flag.PassphraseFlag.Name)
ecdsaPassphrase := c.String(flag.EcdsaPassphraseFlag.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

we should be backward compatibility, so we should pass the two passphrase flags use the backward compatibility flag if the correct flag is empty


func RunPrintStatus(c *cli.Context) error {
passphrase := c.String(flag.PassphraseFlag.Name)
ecdsaPassphrase := c.String(flag.EcdsaPassphraseFlag.Name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

same feedback to the deregister

Comment on lines 565 to +571
if passphrase == "" {
return cli.Exit("passphrase is required", 1)
if ecdsaPassphrase == "" || aliasedEcdsaPassphrase == "" {
return cli.Exit("either passphrase or ecdsa/aliased ecdsa passphrase is required", 1)
}
} else {
ecdsaPassphrase = passphrase
aliasedEcdsaPassphrase = passphrase
Copy link
Collaborator

Choose a reason for hiding this comment

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

same comment on the order of the checks, first use the new flags

@RonTuretzky
Copy link
Contributor

@kamsz Hey, is this still a pressing PR for your team?

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.

3 participants