-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
R4R: don't lock keybase on lcd startup #3514
R4R: don't lock keybase on lcd startup #3514
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3514 +/- ##
===========================================
+ Coverage 55.51% 59.66% +4.14%
===========================================
Files 141 131 -10
Lines 10445 9681 -764
===========================================
- Hits 5799 5776 -23
+ Misses 4306 3565 -741
Partials 340 340 |
client/context/context.go
Outdated
@@ -162,6 +164,12 @@ func GetAccountDecoder(cdc *codec.Codec) auth.AccountDecoder { | |||
} | |||
} | |||
|
|||
// WithKeybase returns a copy of the context with an updated keybase. | |||
func (ctx CLIContext) WithKeybase(kb cryptokeys.Keybase) CLIContext { |
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.
++
dir string | ||
} | ||
|
||
func NewLazyKeybase(name, dir string) Keybase { |
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.
++
if err != nil { | ||
return | ||
// MakeSignature builds a StdSignature given keybase, key name, passphrase, and a StdSignMsg. | ||
func MakeSignature(keybase crkeys.Keybase, name, passphrase string, |
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.
++ I like this!! 😎
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.
Big fan of this!
//signedTx, err := func() (auth.StdTx, error) { // oldClientHome := viper.Get(cli.HomeFlag) // defer func() { viper.Set(cli.HomeFlag, oldClientHome) }() // viper.Set(cli.HomeFlag, clientDir) // return txBldr.SignStdTx(nodeDirName, app.DefaultKeyPass, tx, false) //}()
It's far more idiomatic to not have such prefix.
eedeffe
to
5da49fb
Compare
btw, I have already rebased my changes on top of this PR! 👍 |
// TODO: this should be set in NewRestServer | ||
// and pass down the CLIContext to achieve | ||
// parallelism. | ||
viper.Set(cli.HomeFlag, dir) |
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.
Maybe this could return a cleanup function to defer.
Something similar is being done here:
cosmos-sdk/server/test_helpers.go
Lines 43 to 53 in e1f0767
func SetupViper(t *testing.T) func() { | |
rootDir, err := ioutil.TempDir("", "mock-sdk-cmd") | |
require.Nil(t, err) | |
viper.Set(cli.HomeFlag, rootDir) | |
viper.Set(client.FlagName, "moniker") | |
return func() { | |
err := os.RemoveAll(rootDir) | |
if err != nil { | |
// TODO: Handle with #870 | |
panic(err) | |
} |
I am adding a temporary directory helper in a future PR.
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.
I don't see this as an urgent change to block the PR
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.
LGTM -- left a few minor remarks
@@ -19,15 +17,12 @@ import ( | |||
// KeyDBName is the directory under root where we store the keys | |||
const KeyDBName = "keys" | |||
|
|||
// keybase is used to make GetKeyBase a singleton | |||
var keybase keys.Keybase |
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.
++
return lazyKeybase{name: name, dir: dir} | ||
} | ||
|
||
func (lkb lazyKeybase) List() ([]Info, 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.
I know this will be a huge PIA, but can we add godocs for all of these please?
NewKeyBaseFromDir and NewKeyBaseFromHomeFlag.
storage only for the time needed to perform the required operation.
docs/
)PENDING.md
with issue #Files changed
in the github PR explorerFor Admin Use: