Skip to content

Commit 1848cbc

Browse files
committed
rpc: take over tendermint::abci
The existing contents of the `tendermint::abci` module note that they're only for the purpose of implementing the RPC endpoints, not a general ABCI implementation. Moving that code from the `tendermint` crate to the `tendermint-rpc` crate decouples the RPC interface from improvements to the ABCI domain modeling. Eventually, it would be good to eliminate this code and align it with the new ABCI domain types.
1 parent bd17153 commit 1848cbc

32 files changed

+88
-81
lines changed

light-client/src/evidence.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use crate::{components::io::IoError, types::PeerId};
44

5-
use tendermint::abci::transaction::Hash;
5+
use tendermint_rpc::abci::transaction::Hash;
66

77
use contracts::contract_trait;
88

light-client/src/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
use crate::types::{Height, LightBlock, PeerId, SignedHeader, Time, TrustThreshold, ValidatorSet};
44

55
use serde::{Deserialize, Serialize};
6-
use tendermint::abci::transaction::Hash;
76
use tendermint_rpc as rpc;
7+
use tendermint_rpc::abci::transaction::Hash;
88

99
use crate::components::clock::Clock;
1010
use crate::components::io::{AtHeight, Io, IoError};

rpc/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ subtle-encoding = { version = "0.5", default-features = false, features = ["bech
7878
url = { version = "2.2", default-features = false }
7979
walkdir = { version = "2.3", default-features = false }
8080
flex-error = { version = "0.4.4", default-features = false }
81+
subtle = { version = "2", default-features = false }
8182

8283
# Optional dependencies
8384
async-trait = { version = "0.1", optional = true, default-features = false }

rpc/src/abci.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
//! Old ABCI structures, formerly defined in `tendermint::abci`.
2+
//!
3+
//! The original contents of `tendermint::abci` were created only to model RPC
4+
//! responses, not to model ABCI itself:
5+
//!
6+
//! > NOTE: This module contains types for ABCI responses as consumed from RPC
7+
//! endpoints. It does not contain an ABCI protocol implementation.
8+
//!
9+
//! The old types should be eliminated and
10+
//! merged with the new ABCI domain types. Moving them here in the meantime
11+
//! disentangles improving the ABCI domain modeling from changes to the RPC
12+
//! interface.
13+
14+
mod code;
15+
mod data;
16+
mod gas;
17+
mod info;
18+
mod log;
19+
mod path;
20+
21+
pub mod responses;
22+
pub mod tag;
23+
pub mod transaction;
24+
25+
pub use self::{
26+
code::Code,
27+
data::Data,
28+
gas::Gas,
29+
info::Info,
30+
log::Log,
31+
path::Path,
32+
responses::{DeliverTx, Event, Responses},
33+
transaction::Transaction,
34+
};
File renamed without changes.

tendermint/src/abci/data.rs renamed to rpc/src/abci/data.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
77
/// application-specific rules.
88
#[derive(Clone, Debug, Eq, PartialEq, Default, Serialize, Deserialize)]
99
#[serde(transparent)]
10-
pub struct Data(#[serde(with = "crate::serializers::bytes::base64string")] Vec<u8>);
10+
pub struct Data(#[serde(with = "tendermint::serializers::bytes::base64string")] Vec<u8>);
1111

1212
impl From<Vec<u8>> for Data {
1313
fn from(value: Vec<u8>) -> Self {

tendermint/src/abci/gas.rs renamed to rpc/src/abci/gas.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
//!
66
//! <https://tendermint.com/docs/spec/abci/apps.html#gas>
77
8-
use crate::error::Error;
98
use crate::prelude::*;
109
use core::{
1110
fmt::{self, Display},
1211
str::FromStr,
1312
};
1413
use serde::{de::Error as _, Deserialize, Deserializer, Serialize, Serializer};
14+
use tendermint::error::Error;
1515

1616
/// Gas: representation of transaction processing resource costs
1717
#[derive(Copy, Clone, Debug, Default, Eq, PartialEq, PartialOrd, Ord)]
File renamed without changes.
File renamed without changes.

tendermint/src/abci/path.rs renamed to rpc/src/abci/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
//! Paths to ABCI data
22
3-
use crate::error::Error;
43
use crate::prelude::*;
54
use core::{
65
fmt::{self, Display},
76
str::FromStr,
87
};
98
use serde::{Deserialize, Serialize};
9+
use tendermint::error::Error;
1010

1111
/// Path to ABCI data
1212
#[derive(Clone, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)]

0 commit comments

Comments
 (0)