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

[WIP] ECDSA (secp256k1) key support #388

Closed
wants to merge 835 commits into from
Closed

[WIP] ECDSA (secp256k1) key support #388

wants to merge 835 commits into from

Conversation

tarcieri
Copy link
Contributor

Support for ECDSA (secp256k1) account keys, with the goal of using them to support KMS-backed Cosmos transaction signing (#386)

tony-iqlusion and others added 30 commits April 15, 2019 10:20
Support for serializing and deserializing hash values from hex strings
Adds serde serializers/deserializers for PublicKey types which support
the JSON serialization used by the JSONRPC interface.
Adds a type for representing IDs of Tendermint accounts, which are
computed as a truncated hash of a secp256k1 public key.
…anups

tendermint-rs: Fixes, cleanups, and updates
Moves from a single global keyring to chain-specific keyrings, where
keys/signers can be potentially shared across chains if desired.

This enables true multitenancy for supporting multiple chains with a
single KMS instance, and reloves lingering questions around the access
control model, namely that each connection has an associated chain ID,
and signing operations are isolated to that chain's keyring.
Tendermint itself says: "Height must be greater than 0" (code -32603)
Implement chain-specific keyrings (closes #231, #111)
…rsing

tendermint-rs: Disallow a block height of 0
Make the configuration of type block::Height.

Make the height method on SignableMessage idiomatic
Adds a set of JSONRPC request and response types, designed to construct
JSON requests to the Tendermint RPC (HTTP) API, and parse the returned
JSON responses.
Adds initial support for parsing JSON responses from the `/status`
JSONRPC endpoint.
Initial support for querying blocks through the RPC API.

Blocks comprise a number of different types which are generally useful
(e.g. transactions), so many of them have been peppered throughout the
`tendermint` crate where applicable.

This commit also includes some debug output improvements, and factors
algorithm types under the relevant modules.
Adds support for parsing genesis files from RPC responses.

Genesis files are generic over the underlying application, and by
default use `serde_json::Value` to model arbitrary JSON data.
This commit also includes a bunch of new documentation, and renames the
`Timestamp` type to `Time` to better match upstream Tendermint.
Parses JSONRPC responses into `tendermint::rpc::Error` with a
corresponding `tendermint::rpc::error::Code` covering all presently
known RPC errors.
tendermint-rs: Initial "rpc" feature
@tarcieri
Copy link
Contributor Author

This has a bit more copypasta than I'd like between ECDSA and Ed25519.

It should be possible, with some refactoring, to eliminate some of it with the use of return types generic over signatory::signature::Signature which can select the algorithm that way. However, to get the ball rolling, this splits the keyring into ECDSA vs Ed25519 keys, with duplicate methods for both.

zmanian and others added 22 commits January 18, 2020 22:17
Update to tendermint-rs 0.12.0-rc0; prost-amino v0.5
It's no longer explicitly used
The `rand_os` crate is deprecated and uses an out-of-date `rand_core`
dependency, which was previously blocking the `x25519-dalek` upgrade.

This replaces it with `rand` v0.7 and `rand::thread_rng()`, a
`CryptoRng` (ensured by dalek's trait bounds) seeded by the OS RNG.

For producing the YubiHSM master secret used during setup, the
`getrandom` crate is used directly, since this is guaranteed to be a
direct interface to the OS RNG (it also pulls randomness from the
YubiHSM itself).
…rand_os

Upgrade `x25519-dalek` to v0.6; remove `rand_os`
Update `rpassword` requirement from 3.0 to 4.0
The `once_cell` crate provides a macro-free alternative to `lazy_static`
and is already used by Abscissa.

There's also an open RFC to incorporate `once_cell` into the Rust
standard library:

rust-lang/rfcs#2788

This PR does a straightforward replacement of `lazy_static` with
`once_cell::sync::Lazy`.

However some of this code (particularly the YubiHSM initialization code)
is dirtier than it needs to be because of the `lazy_static` API, and
would benefit from refatcoring to use `once_cell::sync::OnceCell`
instead, which allows a one-time initialization.

Notably this would be useful for replacing the the `init_connector()`
and `init_client()` methods (as well as the `CLI_COMMAND` static),
which are all workarounds for a lazy initialization-based API.
…_cell

Replace `lazy_static` with `once_cell`
The `tiny-bip39` crate is an unmaintained fork of the unmaintained
`bip39` crate.

As such, it duplicates functionality in the `hkd32` crate, which can be
used to straightforwardly replace it.

The existing test vectors cover the derivation paths to ensure that they
are still compatible.
Replace `tiny-bip39` with the equivalent `hkd32` functionality
The equivalent endianness conversion code is now available in the Rust
standard library.
We now use `tracing` behind the scenes
Remove explicit dependency on the `log` crate
...renaming them all to `prost_amino`.

This should allow us to use `prost` proper with the KMS to do proper
Protobuf encoding/decoding.
…eferences

Remove remaining non-namespaced references to `prost`
Support for ECDSA (secp256k1) account keys, with the goal of using them
to support KMS-backed Cosmos transaction signing (#386)
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.

8 participants