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

Commit

Permalink
Revert "tendermint-rs: Move to a separate repository"
Browse files Browse the repository at this point in the history
This reverts commit 07c31d4.

Reverting to restore the original Secret Connection code
  • Loading branch information
tony-iqlusion committed Oct 17, 2019
1 parent 94ff3d1 commit 104bb82
Show file tree
Hide file tree
Showing 121 changed files with 31,705 additions and 6 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
cargo build --features=yubihsm-server
cargo build --features=ledgertm
cargo build --features=yubihsm-server,ledgertm,softsign
cd tendermint-rs && cargo build --no-default-features && cargo build --features=config && cargo build --features=rpc
- run:
name: build --release
command: |
Expand Down
107 changes: 104 additions & 3 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ categories = ["cryptography"]
keywords = ["cosmos", "ed25519", "kms", "key-management", "yubihsm"]
edition = "2018"

[workspace]
members = [".", "tendermint-rs"]

[badges]
circle-ci = { repository = "tendermint/kms" }

Expand Down Expand Up @@ -46,6 +49,7 @@ zeroize = "1"

[dependencies.tendermint]
version = "0.10"
path = "tendermint-rs"
features = ["amino-types", "config", "secret-connection"]

[dev-dependencies]
Expand Down
130 changes: 130 additions & 0 deletions tendermint-rs/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
## [0.10.0] (2019-07-30)

This release is tested against [tendermint v0.31] and known to be compatible
with [tendermint v0.32] aside from one known issue impacting RPC ([#286]).

- Fix inclusive range incompatibility affecting Rust nightly ([#326])
- Derive Eq/Ord for (transitive) status types ([#324])
- Add `TendermintConfig::load_node_key` ([#315])
- Add `TendermintConfig::load_genesis_file` ([#312])
- Add `TendermintConfig` and `Error(Kind)` types ([#298])
- Support `/abci_query` RPC endpoint ([#296])
- Implement the Tendermint (RFC6962) Merkle tree ([#292])
- Support `account::Id` generation from ed25519 pubkeys ([#291])

## [0.9.0] (2019-06-24)

This release is compatible with [tendermint v0.31]

- Reject low order points in Secret Connection handshake ([#279])
- Add `RemoteErrorCode` enum ([#272])
- Add `msg_type()` accessor for signature types ([#271])

## [0.8.0] (2019-06-20)

This release is compatible with [tendermint v0.31]

- `/block_results` RPC endpoint and related types ([#267], [#268])
- Upgrade to Signatory v0.12 ([#259])

## [0.7.0] (2019-04-24)

This release is compatible with [tendermint v0.31]

- Initial JSONRPC over HTTP client + `/broadcast_tx_*` endpoints ([#243])
- Initial RPC support ([#235])
- Disallow a block height of 0 ([#234])

## [0.6.0] (2019-04-16)

This release is compatible with [tendermint v0.31]

- Add `tendermint::Address`, `tendermint::account::Id`, `tendermint::Moniker`,
and improve `serde` serializer support ([#228]).

## [0.5.0] (2019-03-13)

This release is compatible with [tendermint v0.30]

- Rename `SecretConnectionKey` to `secret_connection::PublicKey`, add
`secret_connection::PeerId` ([#219])
- Move `ConsensusState` under `chain::state` ([#205])

## 0.4.0 (N/A)

- Skipped to synchronize versions with `tmkms`

## 0.3.0 (2019-03-05)

- Support for secp256k1 keys ([#181])

## 0.2.0 (2019-01-23)

This release is compatible with [tendermint v0.29]

- Update to x25519-dalek v0.4.4 (#158)
- Consistent ordering of `BlockID` and `Timestamps` in vote and proposal messages (#159)
- Remove `PoisonPillMsg` previously used to shut-down the kms (#162)

## 0.1.5 (2019-01-18)

This release is compatible with [tendermint v0.28]

- Split `PubKeyMsg` into `PubKeyRequest` and `PubKeyResponse` (#141)
- Migrate to Rust 2018 edition (#138)

## 0.1.4 (2018-12-02)

- Allow empty BlockIds in validation method (#131)

## 0.1.3 (2018-12-01)

- Prefix bech32 encoding of consensus keys with amino prefix (#128)

## 0.1.2 (2018-11-27)

- Update to subtle-encoding v0.3 (#124)
- Introduce same validation logic as Tendermint (#110)
- Remove heartbeat (#105)

## 0.1.1 (2018-11-20)

- Minor clarifications/fixes (#103)

## 0.1.0 (2018-11-13)

- Initial release

[0.10.0]: https://github.com/tendermint/kms/pull/328
[tendermint v0.32]: https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#v0320
[#326]: https://github.com/tendermint/kms/pull/326
[#324]: https://github.com/tendermint/kms/pull/324
[#315]: https://github.com/tendermint/kms/pull/315
[#312]: https://github.com/tendermint/kms/pull/312
[#298]: https://github.com/tendermint/kms/pull/298
[#296]: https://github.com/tendermint/kms/pull/296
[#292]: https://github.com/tendermint/kms/pull/292
[#291]: https://github.com/tendermint/kms/pull/291
[#286]: https://github.com/tendermint/kms/pull/286
[0.9.0]: https://github.com/tendermint/kms/pull/280
[#279]: https://github.com/tendermint/kms/pull/279
[#272]: https://github.com/tendermint/kms/pull/272
[#271]: https://github.com/tendermint/kms/pull/271
[0.8.0]: https://github.com/tendermint/kms/pull/269
[#268]: https://github.com/tendermint/kms/pull/268
[#267]: https://github.com/tendermint/kms/pull/267
[#259]: https://github.com/tendermint/kms/pull/259
[0.7.0]: https://github.com/tendermint/kms/pull/247
[#243]: https://github.com/tendermint/kms/pull/243
[#235]: https://github.com/tendermint/kms/pull/235
[#234]: https://github.com/tendermint/kms/pull/234
[0.6.0]: https://github.com/tendermint/kms/pull/229
[tendermint v0.31]: https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#v0310
[#228]: https://github.com/tendermint/kms/pull/228
[0.5.0]: https://github.com/tendermint/kms/pull/220
[tendermint v0.30]: https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#v0300
[#219]: https://github.com/tendermint/kms/pull/219
[#205]: https://github.com/tendermint/kms/pull/219
[#181]: https://github.com/tendermint/kms/pull/181
[tendermint v0.29]: https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#v0290
[tendermint v0.28]: https://github.com/tendermint/tendermint/blob/master/CHANGELOG.md#v0280
76 changes: 76 additions & 0 deletions tendermint-rs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
[package]
name = "tendermint"
version = "0.10.0" # Also update `html_root_url` in lib.rs when bumping this
license = "Apache-2.0"
homepage = "https://www.tendermint.com/"
repository = "https://github.com/tendermint/kms/tree/master/crates/tendermint"
readme = "README.md"
categories = ["cryptography", "database"]
keywords = ["blockchain", "bft", "consensus", "cosmos", "tendermint"]
edition = "2018"

description = """
Tendermint is a high-performance blockchain consensus engine that powers
Byzantine fault tolerant applications written in any programming language.
This crate provides core types for representing information about Tendermint
blockchain networks, including chain information types, secret connections,
and remote procedure calls (JSONRPC).
"""

authors = [
"Ismail Khoffi <Ismail.Khoffi@gmail.com>",
"ValarDragon <dojha12@gmail.com>",
"Tony Arcieri <tony@iqlusion.io>",
"Thane Thomson <thane@interchain.io>"
]

[badges]
circle-ci = { repository = "tendermint/kms" }

[dependencies]
byteorder = { version = "1.2", optional = true }
bytes = "0.4"
chrono = { version = "0.4", features = ["serde"] }
digest = "0.8"
failure = "0.1"
hkdf = { version = "0.7", optional = true }
hyper = { version = "0.10", optional = true }
prost-amino = { version = "0.4.0", optional = true }
prost-amino-derive = { version = "0.4.0", optional = true }
rand_os = { version = "0.1", optional = true }
ring = { version = "0.14", optional = true }
serde = { version = "1", optional = true, features = ["derive"] }
serde_json = { version = "1", optional = true }
signatory = { version = "0.12", features = ["ed25519", "ecdsa"] }
signatory-dalek = { version = "0.12", optional = true }
sha2 = { version = "0.8", default-features = false }
subtle = "2"
subtle-encoding = { version = "0.3", features = ["bech32-preview"] }
tai64 = { version = "2", optional = true, features = ["chrono"] }
toml = { version = "0.5", optional = true }
uuid = { version = "0.7", optional = true, default-features = false }
x25519-dalek = { version = "0.5", optional = true, default-features = false, features = ["u64_backend"] }
zeroize = { version = "0.9", optional = true }

[dev-dependencies]
serde_json = "1"

[features]
default = ["serde", "tai64"]
amino-types = ["prost-amino", "prost-amino-derive"]
config = ["serde", "serde_json", "toml", "zeroize"]
keys = ["signatory-dalek"]
rpc = ["hyper", "rand_os", "serde", "serde_json", "uuid"]
secret-connection = [
"amino-types",
"byteorder",
"rand_os",
"hkdf",
"ring",
"signatory-dalek",
"x25519-dalek",
"zeroize"
]

[package.metadata.docs.rs]
all-features = true
50 changes: 47 additions & 3 deletions tendermint-rs/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,49 @@
# MOVED
# tendermint.rs

`tendermint-rs` is now located in its own repository at:
[![Crate][crate-image]][crate-link]
[![Docs][docs-image]][docs-link]
[![Build Status][build-image]][build-link]
[![Apache 2.0 Licensed][license-image]][license-link]
![Rust 1.35+][rustc-image]

https://github.com/interchainio/tendermint-rs
Rust crate for interacting with [Tendermint]: a high-performance blockchain
consensus engine that powers Byzantine fault tolerant applications written
in any programming language.

[Documentation][docs-link]

## Requirements

- Rust 1.35+

## License

Copyright © 2018-2019 Tendermint

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

[//]: # (badges)

[crate-image]: https://img.shields.io/crates/v/tendermint.svg
[crate-link]: https://crates.io/crates/tendermint
[docs-image]: https://docs.rs/tendermint/badge.svg
[docs-link]: https://docs.rs/tendermint/
[build-image]: https://circleci.com/gh/tendermint/kms.svg?style=shield
[build-link]: https://circleci.com/gh/tendermint/kms
[license-image]: https://img.shields.io/badge/license-Apache2.0-blue.svg
[license-link]: https://github.com/tendermint/kms/blob/master/LICENSE
[rustc-image]: https://img.shields.io/badge/rustc-1.35+-blue.svg

[//]: # (general links)

[Tendermint]: https://github.com/tendermint/tendermint
34 changes: 34 additions & 0 deletions tendermint-rs/src/abci.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//! Application BlockChain Interface (ABCI)
//!
//! NOTE: This module contains types for ABCI responses as consumed from RPC
//! endpoints. It does not contain an ABCI protocol implementation.
//!
//! For that, see:
//!
//! <https://github.com/tendermint/rust-abci>
#[cfg(feature = "rpc")]
mod code;
#[cfg(feature = "rpc")]
mod data;
#[cfg(feature = "rpc")]
mod gas;
#[cfg(feature = "rpc")]
mod info;
#[cfg(feature = "rpc")]
mod log;
#[cfg(feature = "rpc")]
mod path;
#[cfg(feature = "rpc")]
mod proof;
#[cfg(feature = "rpc")]
mod responses;
#[cfg(any(feature = "config", feature = "rpc"))]
pub mod tag;
pub mod transaction;

#[cfg(feature = "rpc")]
pub use self::{
code::Code, data::Data, gas::Gas, info::Info, log::Log, path::Path, proof::Proof,
responses::Responses, transaction::Transaction,
};
71 changes: 71 additions & 0 deletions tendermint-rs/src/abci/code.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
use serde::{de::Error as _, Deserialize, Deserializer, Serialize, Serializer};

/// ABCI application response codes.
///
/// These presently use 0 for success and non-zero for errors:
///
/// <https://tendermint.com/docs/spec/abci/abci.html#errors>
///
/// Note that in the future there may potentially be non-zero success codes.
#[derive(Copy, Clone, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
pub enum Code {
/// Success
Ok,

/// Error codes
Err(u32),
}

impl Code {
/// Was the response OK?
pub fn is_ok(self) -> bool {
match self {
Code::Ok => true,
Code::Err(_) => false,
}
}

/// Was the response an error?
pub fn is_err(self) -> bool {
!self.is_ok()
}

/// Get the integer error value for this code
pub fn value(self) -> u32 {
u32::from(self)
}
}

impl From<u32> for Code {
fn from(value: u32) -> Code {
match value {
0 => Code::Ok,
err => Code::Err(err),
}
}
}

impl From<Code> for u32 {
fn from(code: Code) -> u32 {
match code {
Code::Ok => 0,
Code::Err(err) => err,
}
}
}

impl<'de> Deserialize<'de> for Code {
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
Ok(Code::from(
String::deserialize(deserializer)?
.parse::<u32>()
.map_err(|e| D::Error::custom(format!("{}", e)))?,
))
}
}

impl Serialize for Code {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
self.value().serialize(serializer)
}
}
Loading

0 comments on commit 104bb82

Please sign in to comment.