Skip to content
This repository has been archived by the owner on Jun 3, 2020. It is now read-only.

Initial chain registry (fixes #60, #178) #205

Merged
merged 5 commits into from
Mar 10, 2019
Merged

Initial chain registry (fixes #60, #178) #205

merged 5 commits into from
Mar 10, 2019

Conversation

tarcieri
Copy link
Contributor

@tarcieri tarcieri commented Mar 8, 2019

Adds a chain::REGISTRY (as a lazy_static) to tmkms, populated from the configuration file.

Uses this registry when serializing keys to select the appropriate serialization format.

Also lays the ground work for fixing #111 by associating one or more chain IDs with each key (previously done in an ad hoc manner)

@tarcieri tarcieri requested review from liamsi and zmanian March 9, 2019 22:38
@tarcieri tarcieri changed the title [WIP] Chain registry Initial chain registry Mar 9, 2019
@tarcieri tarcieri changed the title Initial chain registry Initial chain registry (fixes #178) Mar 9, 2019
@tarcieri tarcieri marked this pull request as ready for review March 9, 2019 23:59
@tarcieri
Copy link
Contributor Author

tarcieri commented Mar 9, 2019

Note this does not yet integrate tracking for the last signed state into the chain registry. I plan on doing that in a follow-up PR.

Never mind, added in 4ee1a4a 31eaad1!

Adds a `chain::REGISTRY` (as a `lazy_static`) to tmkms, populated from
the configuration file.

Uses this registry when serializing keys to select the appropriate
serialization format.
@tarcieri
Copy link
Contributor Author

tarcieri commented Mar 10, 2019

This commit makes breaking changes to the configuration format (namely adding a mandatory chain_ids field to each provider). That breaks remote_val_harness:

error: tmkms fatal error: config error: error loading config from '/remote_val_harness/tmkms.toml': parse error: missing field `chain_ids` for key `providers.softsign`

Not sure what the proper order is as far as merging this commit versus updating that...

@tarcieri tarcieri changed the title Initial chain registry (fixes #178) Initial chain registry (fixes #60, #178) Mar 10, 2019
This commit moves the last sign state tracking for chains into the
global chain registry.

It also allows configurable locations for the chain state tracking
files, which should probably make it easier to ensure they don't clobber
each other in tests.

This doesn't fully implement the double signing plan in #60 but at this
point I think we're close enough. The remaining item is (optionally)
running a user-specified command on startup to query the current block
height.
Preparatory work for adding support for initializing the `last_sign`
state from a user-specified hook.
Adds a new option to tmkms.toml `[chain]` entries:

    [chain.state_hook]
    cmd = ["/path/to/block/height_script", "--example-arg", "cosmoshub"]

This command is expected to return a JSON document like:

    {"latest_block_height": "347290"}

If present, and larger than the latest known block height, this value
will be used instead (up to a pre-configured sanity limit).
The KMS configs need to be updated in Tendermint
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants