-
Notifications
You must be signed in to change notification settings - Fork 359
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
Implemented 'keys add' and 'keys list' commmands #408
Conversation
…in local branch after merging (#363)
- Added a new test keyring backend to support adding keys to file system (under home folder) - Refactored logic to add key to be part of the keystore and not the command - Switched the keybase on a chain to use the test keyring - Key seed file is saved in the test keystore default folder (/home/andy/.rrly)
…ed name parameter from keys add cmd (#363)
- Clean up remaining key_seed flag for tx cmds - Refactored keybase to include chain config - Refactoring keyring methods to use chain config - Logic to use configured key to sign tx
…was having before merge. (#363)
Codecov Report
@@ Coverage Diff @@
## master #408 +/- ##
=========================================
+ Coverage 13.6% 36.7% +23.0%
=========================================
Files 69 154 +85
Lines 3752 11089 +7337
Branches 1374 4124 +2750
=========================================
+ Hits 513 4072 +3559
- Misses 2618 6360 +3742
- Partials 621 657 +36
Continue to review full report at Codecov.
|
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.
Looks good, aside from some minor remarks. Thanks :)
@@ -121,7 +121,7 @@ mod tests { | |||
#[test] | |||
fn parse_channel_query_end_parameters() { | |||
let default_params = QueryChannelEndCmd { | |||
chain_id: Some("ibc0".to_string().parse().unwrap()), |
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.
Why is this needed?
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 didn't implement this as part of my issue, maybe something merged from master? Maybe @ancazamfir knows ?
@@ -3,12 +3,13 @@ timeout = '10s' | |||
strategy = 'naive' | |||
|
|||
[[chains]] | |||
id = 'ibc0' | |||
id = 'ibc-0' |
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.
Is this change needed because the identifiers of the chains spawned by the Go relayer setup scripts have changed?
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.
Yes, they changed
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.
Hmm, i don't understand why this needs change. We are still on stargate-4. This change is coming in stargate-5.
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.
do you want me to change this back to ibc0
?
MemoryKeyStore { store: BTreeMap<Address, KeyEntry> }, | ||
MemoryKeyStore { | ||
store: BTreeMap<String, String>, | ||
chain_config: ChainConfig, |
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.
Do we really need to full chain config here? Can we instead just store the data that's actually needed from it (eg. the key 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.
Actually I had it before with key name and chain id but it made calling the functions more complex and thought that this way was cleaner and also if we need more params in the config here in the future this would make it simpler to implement
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.
But I couldn't find a good pattern here. Ideally this is used as a property of the chain (keybase
) so if the config could be "passed down" into the keybase then this chain_config
property would not be needed.
I noticed that with other PRs merged to master this PR got broken again, I will fix this one again so it can be merged |
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.
Found some issues while testing. I can only submit transactions on one chain (ibc0
of stargate-4/ gaia setup with Go relayer). For the other one the account is not recognized. Not sure why, will try to debug.
Also not sure why the protos had changed compared with master.
@@ -3,12 +3,13 @@ timeout = '10s' | |||
strategy = 'naive' | |||
|
|||
[[chains]] | |||
id = 'ibc0' | |||
id = 'ibc-0' |
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.
Hmm, i don't understand why this needs change. We are still on stargate-4. This change is coming in stargate-5.
I've changed to Concerning the transactions, please make sure you add the right key for each chain. So you should have a key_seed.json for each chain, after you add them you should see something like this under your
But each testkey.json should have different contents. You can verify by doing:
which should display different addresses. Then the transactions should be signed with the key for the chain (right now there's no way to use more than one key per chain). If you have the right setup and still not working then might be a bug in the logic. Concerning the proto changes, as far as I remember I didn't change them, might be changes once I've merged the latest master into this branch. |
yes, I did that. All accounts and keys seem fine and I doubled checked they are the same as the ones from the Go relayer seed files. Does this work for you? Having both chains accepting transactions? |
Yes but for the latest (stargate-5) we need a number of changes in ibc-rs and tendermint-rs (I made changes for this on |
I figured what went wrong. From previous testing I had some sections |
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.
Looks great! All commands work without the key seed file option, which is great! Thanks a lot Andy, let's merge this today.
* Added logic to generate GRPC client from cosmos.auth proto (#337) * Adding logic to use GRPC client (#337) * Grpc client connection retrieves account sequence (#337) * Removed the account sequence flag from the tx raw commands (#337) * Removed instructions to query and specify account sequence from tx raw command (#337) * Logic to fetch GRPC endpoint address from config (#337) * Fixing tests (#361) * Logic to use the address from the key seed (#337) * Added boilerplate code for a keys add command to the relayer (#363) * Removing key flag from tx cmds * Adding logic to get key specified in the config * Logic to get the key specified in the config (#363) * Removed the -k flag from the tx raw commands (#363) * More logic to add key command (#363) * key add command for memory store working (#363) * Added logic to persist key seed in 'home' folder (#363) * Changes implemented (#363): - Added a new test keyring backend to support adding keys to file system (under home folder) - Refactored logic to add key to be part of the keystore and not the command - Switched the keybase on a chain to use the test keyring - Key seed file is saved in the test keystore default folder (/home/andy/.rrly) * Logic to use the key_name parameter from the config to add key. Removed name parameter from keys add cmd (#363) * Changed the logic to get the key from the test keyring file store (#363) * Implemented changes: (#363) - Clean up remaining key_seed flag for tx cmds - Refactored keybase to include chain config - Refactoring keyring methods to use chain config - Logic to use configured key to sign tx * Updated the README instructions (#363) * Disable the 'keys restore' command for now (#363) * Added 'keys list' command to show key added on a chain (#363) * Added entry for issue #363 (PR #408) * Refactored the bound variables to use the full name per comment suggestion (#408) * Move key retrieval, memo and timeout height inside send_tx * Add the client creation, connection and channel handshake * remove sleeps * More error handling, cleanup * Macro for channel CLIs * Macro for connection CLIs * Where src/dst make no sense rename to a/b, also fix a few bugs after last commits * cleanup * cargo fmt * Use Romain's skip-verif until backwards verification is done * fix CLI bugs Co-authored-by: Andy Nogueira <me@andynogueira.dev>
* Added logic to generate GRPC client from cosmos.auth proto (#337) * Adding logic to use GRPC client (#337) * Grpc client connection retrieves account sequence (#337) * Removed the account sequence flag from the tx raw commands (#337) * Removed instructions to query and specify account sequence from tx raw command (#337) * Logic to fetch GRPC endpoint address from config (#337) * Fixing tests (informalsystems#361) * Logic to use the address from the key seed (#337) * Added boilerplate code for a keys add command to the relayer (informalsystems#363) * Removing key flag from tx cmds * Adding logic to get key specified in the config * Logic to get the key specified in the config (informalsystems#363) * Removed the -k flag from the tx raw commands (informalsystems#363) * More logic to add key command (informalsystems#363) * key add command for memory store working (informalsystems#363) * Added logic to persist key seed in 'home' folder (informalsystems#363) * Changes implemented (informalsystems#363): - Added a new test keyring backend to support adding keys to file system (under home folder) - Refactored logic to add key to be part of the keystore and not the command - Switched the keybase on a chain to use the test keyring - Key seed file is saved in the test keystore default folder (/home/andy/.rrly) * Logic to use the key_name parameter from the config to add key. Removed name parameter from keys add cmd (informalsystems#363) * Changed the logic to get the key from the test keyring file store (informalsystems#363) * Implemented changes: (informalsystems#363) - Clean up remaining key_seed flag for tx cmds - Refactored keybase to include chain config - Refactoring keyring methods to use chain config - Logic to use configured key to sign tx * Updated the README instructions (informalsystems#363) * Disable the 'keys restore' command for now (informalsystems#363) * Added 'keys list' command to show key added on a chain (informalsystems#363) * Added entry for issue informalsystems#363 (PR informalsystems#408) * Refactored the bound variables to use the full name per comment suggestion (informalsystems#408) * Move key retrieval, memo and timeout height inside send_tx Co-authored-by: Anca Zamfir <zamfiranca@gmail.com>
* Added logic to generate GRPC client from cosmos.auth proto (#337) * Adding logic to use GRPC client (#337) * Grpc client connection retrieves account sequence (#337) * Removed the account sequence flag from the tx raw commands (#337) * Removed instructions to query and specify account sequence from tx raw command (#337) * Logic to fetch GRPC endpoint address from config (#337) * Fixing tests (informalsystems#361) * Logic to use the address from the key seed (#337) * Added boilerplate code for a keys add command to the relayer (informalsystems#363) * Removing key flag from tx cmds * Adding logic to get key specified in the config * Logic to get the key specified in the config (informalsystems#363) * Removed the -k flag from the tx raw commands (informalsystems#363) * More logic to add key command (informalsystems#363) * key add command for memory store working (informalsystems#363) * Added logic to persist key seed in 'home' folder (informalsystems#363) * Changes implemented (informalsystems#363): - Added a new test keyring backend to support adding keys to file system (under home folder) - Refactored logic to add key to be part of the keystore and not the command - Switched the keybase on a chain to use the test keyring - Key seed file is saved in the test keystore default folder (/home/andy/.rrly) * Logic to use the key_name parameter from the config to add key. Removed name parameter from keys add cmd (informalsystems#363) * Changed the logic to get the key from the test keyring file store (informalsystems#363) * Implemented changes: (informalsystems#363) - Clean up remaining key_seed flag for tx cmds - Refactored keybase to include chain config - Refactoring keyring methods to use chain config - Logic to use configured key to sign tx * Updated the README instructions (informalsystems#363) * Disable the 'keys restore' command for now (informalsystems#363) * Added 'keys list' command to show key added on a chain (informalsystems#363) * Added entry for issue informalsystems#363 (PR informalsystems#408) * Refactored the bound variables to use the full name per comment suggestion (informalsystems#408) * Move key retrieval, memo and timeout height inside send_tx * Add the client creation, connection and channel handshake * remove sleeps * More error handling, cleanup * Macro for channel CLIs * Macro for connection CLIs * Where src/dst make no sense rename to a/b, also fix a few bugs after last commits * cleanup * cargo fmt * Use Romain's skip-verif until backwards verification is done * fix CLI bugs Co-authored-by: Andy Nogueira <me@andynogueira.dev>
Closes: #363
Description
This PR includes the implementation of the
keys add
andkeys list
commands on the relayer. Changes:tx
commands. So notkey_seed.json
file needs to be specified for atx raw
commandkeys add
command. Basically this adds thekey_seed.json
file on a folder$HOME/.rrly
. The file will be saved with thekey_name
parameter specified in the config (e.g. testkey.json).tx raw
commands.README.md
filekeys list
command that can be used to list the key configured for a chainFor contributor use:
docs/
) and code comments.Files changed
in the Github PR explorer.