Skip to content
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

xla/multi-tc-versionsupport/fix #1254

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions config/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn read_fixture(name: &str) -> String {
#[test]
fn config_toml_parser() {
let config_toml = read_fixture("config.toml");
let config = TendermintConfig::parse_toml(&config_toml).unwrap();
let config = TendermintConfig::parse_toml(config_toml).unwrap();

// main base config options

Expand Down Expand Up @@ -206,7 +206,7 @@ fn config_toml_parser() {
#[test]
fn node_key_parser() {
let raw_node_key = read_fixture("node_key.json");
let node_key = NodeKey::parse_json(&raw_node_key).unwrap();
let node_key = NodeKey::parse_json(raw_node_key).unwrap();
assert_eq!(
node_key.node_id().to_string(),
"1a7b6bcf3d6fb055ab3aebca415847531b626699"
Expand All @@ -217,7 +217,7 @@ fn node_key_parser() {
#[test]
fn priv_validator_json_parser() {
let raw_priv_validator_key = read_fixture("priv_validator_key.json");
let priv_validator_key = PrivValidatorKey::parse_json(&raw_priv_validator_key).unwrap();
let priv_validator_key = PrivValidatorKey::parse_json(raw_priv_validator_key).unwrap();
assert_eq!(
priv_validator_key.consensus_pubkey().to_hex(),
"F26BF4B2A2E84CEB7A53C3F1AE77408779B20064782FBADBDF0E365959EE4534"
Expand All @@ -229,7 +229,7 @@ fn priv_validator_json_parser() {
#[test]
fn parsing_roundtrip() {
let config_toml = read_fixture("config.toml");
let config = TendermintConfig::parse_toml(&config_toml).unwrap();
let config = TendermintConfig::parse_toml(config_toml).unwrap();

let written_config_toml = toml::to_string(&config).unwrap();
let written_config = TendermintConfig::parse_toml(&written_config_toml).unwrap();
Expand Down
1 change: 1 addition & 0 deletions light-client/src/builder/light_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ impl LightClientBuilder<NoTrustedState> {
options: Options,
timeout: Option<Duration>,
) -> Self {
#[allow(clippy::box_default)]
Self::custom(
peer_id,
options,
Expand Down
2 changes: 1 addition & 1 deletion p2p/src/secret_connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -648,7 +648,7 @@ fn read_and_decrypt<IoHandler: Read>(
if chunk_length as usize > DATA_MAX_SIZE {
return Err(io::Error::new(
io::ErrorKind::Other,
format!("chunk is too big: {}! max: {}", chunk_length, DATA_MAX_SIZE),
format!("chunk is too big: {chunk_length}! max: {DATA_MAX_SIZE}"),
));
}

Expand Down
12 changes: 6 additions & 6 deletions proto/src/serializers/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ pub mod base64string {
D: Deserializer<'de>,
Vec<u8>: Into<T>,
{
let string = Option::<String>::deserialize(deserializer)?.unwrap_or_default();
let v = base64::decode(&string).map_err(serde::de::Error::custom)?;
let s = Option::<String>::deserialize(deserializer)?.unwrap_or_default();
let v = base64::decode(s).map_err(serde::de::Error::custom)?;
Ok(v.into())
}

Expand All @@ -54,7 +54,7 @@ pub mod base64string {
D: Deserializer<'de>,
{
let s = Option::<String>::deserialize(deserializer)?.unwrap_or_default();
String::from_utf8(base64::decode(&s).map_err(serde::de::Error::custom)?)
String::from_utf8(base64::decode(s).map_err(serde::de::Error::custom)?)
.map_err(serde::de::Error::custom)
}

Expand Down Expand Up @@ -85,7 +85,7 @@ pub mod vec_base64string {
Option::<Vec<String>>::deserialize(deserializer)?
.unwrap_or_default()
.into_iter()
.map(|s| base64::decode(&s).map_err(serde::de::Error::custom))
.map(|s| base64::decode(s).map_err(serde::de::Error::custom))
.collect()
}

Expand Down Expand Up @@ -117,8 +117,8 @@ pub mod option_base64string {
where
D: Deserializer<'de>,
{
let string = Option::<String>::deserialize(deserializer)?.unwrap_or_default();
base64::decode(&string).map_err(serde::de::Error::custom)
let s = Option::<String>::deserialize(deserializer)?.unwrap_or_default();
base64::decode(s).map_err(serde::de::Error::custom)
}

/// Serialize from `T` into `Option<base64string>`
Expand Down
2 changes: 1 addition & 1 deletion proto/src/serializers/txs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ where
}
value_vec_base64string
.into_iter()
.map(|s| base64::decode(&s).map_err(serde::de::Error::custom))
.map(|s| base64::decode(s).map_err(serde::de::Error::custom))
.collect()
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/src/client/transport/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ mod test {
}

async fn read_event(name: &str) -> Event {
Event::from_string(&read_json_fixture(name).await).unwrap()
Event::from_string(read_json_fixture(name).await).unwrap()
}

mod v0_34 {
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/client/transport/websocket.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1155,7 +1155,7 @@ mod test {
}

async fn read_event(name: &str) -> Event {
Event::from_string(&read_json_fixture(name).await).unwrap()
Event::from_string(read_json_fixture(name).await).unwrap()
}

#[tokio::test]
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/serializers/tm_hash_base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ where
D: Deserializer<'de>,
{
let s = Option::<String>::deserialize(deserializer)?.unwrap_or_default();
let decoded = base64::decode(&s).map_err(serde::de::Error::custom)?;
let decoded = base64::decode(s).map_err(serde::de::Error::custom)?;
if decoded.len() != SHA256_HASH_SIZE {
return Err(serde::de::Error::custom(
"unexpected transaction length for hash",
Expand Down
2 changes: 1 addition & 1 deletion rpc/src/serializers/tx_hash_base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ where
D: Deserializer<'de>,
{
let s = Option::<String>::deserialize(deserializer)?.unwrap_or_default();
let decoded = base64::decode(&s).map_err(serde::de::Error::custom)?;
let decoded = base64::decode(s).map_err(serde::de::Error::custom)?;
let hash = Hash::from_bytes(Algorithm::Sha256, &decoded).map_err(serde::de::Error::custom)?;
Ok(hash)
}
Expand Down
4 changes: 2 additions & 2 deletions tendermint/src/abci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ pub mod request;
pub mod response;
pub mod types;

// pub use crate::v0_37::abci::request::Request;
// pub use crate::v0_37::abci::response::Response;
pub use crate::v0_37::abci::request::Request;
pub use crate::v0_37::abci::response::Response;

pub use event::{Event, EventAttribute, EventAttributeIndexExt};

Expand Down
4 changes: 2 additions & 2 deletions tendermint/src/abci/doc/request-applysnapshotchunk.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ appropriate. Tendermint will not do this unless instructed by the
application.

The application may want to verify each chunk, e.g., by attaching chunk
hashes in [`Snapshot::metadata`] and/or incrementally verifying contents
hashes in `Snapshot::metadata` and/or incrementally verifying contents
against `app_hash`.

When all chunks have been accepted, Tendermint will make an ABCI [`Info`]
Expand All @@ -18,4 +18,4 @@ because no suitable peers are available), it will reject the snapshot and try
a different one via `OfferSnapshot`. The application should be prepared to
reset and accept it or abort as appropriate.

[ABCI documentation](https://docs.tendermint.com/master/spec/abci/abci.html#applysnapshotchunk)
[ABCI documentation](https://docs.tendermint.com/master/spec/abci/abci.html#applysnapshotchunk)
4 changes: 2 additions & 2 deletions tendermint/src/abci/doc/request-offersnapshot.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ additional verification schemes to avoid denial-of-service attacks. The
verified `app_hash` is automatically checked against the restored application
at the end of snapshot restoration.

See also the [`Snapshot`] data type and the [ABCI state sync documentation][ssd].
See also the `Snapshot` data type and the [ABCI state sync documentation][ssd].

[ABCI documentation](https://docs.tendermint.com/master/spec/abci/abci.html#offersnapshot)

[ssd]: https://docs.tendermint.com/master/spec/abci/apps.html#state-sync
[ssd]: https://docs.tendermint.com/master/spec/abci/apps.html#state-sync
4 changes: 2 additions & 2 deletions tendermint/src/abci/doc/response-offersnapshot.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Returns the application's response to a snapshot offer.

See also the [`Snapshot`] data type and the [ABCI state sync documentation][ssd].
See also the [`OfferSnapshot`] data type and the [ABCI state sync documentation][ssd].

[ABCI documentation](https://docs.tendermint.com/master/spec/abci/abci.html#offersnapshot)

[ssd]: https://docs.tendermint.com/master/spec/abci/apps.html#state-sync
[ssd]: https://docs.tendermint.com/master/spec/abci/apps.html#state-sync
3 changes: 0 additions & 3 deletions tendermint/src/abci/request.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
//! ABCI requests and request data.
//!
//! The [`Request`] enum records all possible ABCI requests. Requests that
//! contain data are modeled as a separate struct, to avoid duplication of field
//! definitions.

// IMPORTANT NOTE ON DOCUMENTATION:
//
Expand Down
4 changes: 0 additions & 4 deletions tendermint/src/abci/response.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
//! ABCI responses and response data.
//!
//! The [`Response`] enum records all possible ABCI responses. Responses that
//! contain data are modeled as a separate struct, to avoid duplication of field
//! definitions.

// IMPORTANT NOTE ON DOCUMENTATION:
//
Expand Down
2 changes: 1 addition & 1 deletion tendermint/src/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl TryFrom<Bytes> for AppHash {
type Error = Error;

fn try_from(value: Bytes) -> Result<Self, Self::Error> {
Ok(AppHash(value.into()))
Ok(AppHash(value.to_vec()))
}
}
impl From<AppHash> for Bytes {
Expand Down
4 changes: 2 additions & 2 deletions tendermint/src/public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ where
{
use de::Error;
let encoded = String::deserialize(deserializer)?;
let bytes = base64::decode(&encoded).map_err(D::Error::custom)?;
let bytes = base64::decode(encoded).map_err(D::Error::custom)?;
Ed25519::from_bytes(&bytes).map_err(D::Error::custom)
}

Expand All @@ -436,7 +436,7 @@ where
{
use de::Error;
let encoded = String::deserialize(deserializer)?;
let bytes = base64::decode(&encoded).map_err(D::Error::custom)?;
let bytes = base64::decode(encoded).map_err(D::Error::custom)?;
Secp256k1::from_sec1_bytes(&bytes).map_err(|_| D::Error::custom("invalid secp256k1 key"))
}

Expand Down
6 changes: 3 additions & 3 deletions testgen/src/tester.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ impl Tester {
}
if let Ok(kind) = entry.file_type() {
let path = format!("{}", entry.path().display());
let rel_path = self.env().unwrap().rel_path(&path).unwrap();
let rel_path = self.env().unwrap().rel_path(path).unwrap();
if kind.is_file() || kind.is_symlink() {
if rel_path.ends_with(".json") {
self.run_for_file(&rel_path);
Expand Down Expand Up @@ -499,7 +499,7 @@ impl Tester {
print(" Successful tests: ");
for path in tests {
print(&format!(" {}", path));
if let Some(logs) = env.read_file(&(path + "/log")) {
if let Some(logs) = env.read_file(path + "/log") {
print(&logs)
}
}
Expand All @@ -510,7 +510,7 @@ impl Tester {
print(" Failed tests: ");
for (path, message, location) in tests {
print(&format!(" {}, '{}', {}", path, message, location));
if let Some(logs) = env.read_file(&(path + "/log")) {
if let Some(logs) = env.read_file(path + "/log") {
print(&logs)
}
}
Expand Down