-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
cmd/geth: add developer account password support #17155
Conversation
I'm not sure this is the correct use case though. The What would be the use case for trying to open an existing account in developer mode? I'd consider that a dangerous move. |
@karalabe My personal use case is re-using same keystore on test environment with ephemeral private chain. While chain itself is being reset every iteration, the pre-generated keystore can be used again. Using empty passphrase is not an option, because of the software requirements. I agree that it's kind of a special situation, but I don't see any danger here. This flag is part of |
Would it be possible for you to just copy a predefined keystore file into the dev datadir? |
@fjl That's exactly what I'm doing, but I want |
cmd/utils/flags.go
Outdated
@@ -1137,7 +1141,8 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *eth.Config) { | |||
Fatalf("Failed to create developer account: %v", err) | |||
} | |||
} | |||
if err := ks.Unlock(developer, ""); err != nil { | |||
password := ctx.GlobalString(DeveloperPasswordFlag.Name) |
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.
You'd need to use this flag a bit higher too, when creating the developer account to remain consistent on all code paths.
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.
@karalabe Thanks, updated my pull request
@karalabe Any tip on how-to pass these tests? |
We've been discussing this, but we think there's a mostly simple workaround that allows you to use your own accounts already without having to jump into the rabbit hole of adding configuration flags for dev mode:
This will result in moving all the funds from the test account to your one and you can do whatever workflow you have. Would this solve your issue without having to make modifications to dev mode? |
During environment provisioning for integration testing, using same pre-defined deterministic values come in handy. Everyone becomes aware of team's specific conventions, e.g. "test server has X value for gas price", "Y for chain ID" etc.
Everytime
geth
starts in developer mode, it either generates new non-deterministic account or tries to unlock a specified keystore (by either--datadir
or--keystore
flags) with an empty string password. I need something in the middle - ability to unlock a custom keystore with specified password.This feature is inspired by Truffle's
--deterministic
option (which might be non-trivial to implement here, considering the size of codebase): trufflesuite/ganache#24 (comment)