From f52b30bd427adcf4cfde031fce69b7f3b43b32de Mon Sep 17 00:00:00 2001 From: Mikhail Zabaluev Date: Tue, 25 Oct 2022 17:20:34 +0300 Subject: [PATCH] proto: Remove serialization of Block and Evidence These are now handled on the domain types directly. --- proto/src/prost/v0_34/tendermint.types.rs | 5 ----- proto/src/prost/v0_37/tendermint.types.rs | 5 ----- tools/proto-compiler/src/constants.rs | 5 ----- 3 files changed, 15 deletions(-) diff --git a/proto/src/prost/v0_34/tendermint.types.rs b/proto/src/prost/v0_34/tendermint.types.rs index 5e8de00a8..22e5f2610 100644 --- a/proto/src/prost/v0_34/tendermint.types.rs +++ b/proto/src/prost/v0_34/tendermint.types.rs @@ -390,7 +390,6 @@ pub struct EventDataRoundState { pub step: ::prost::alloc::string::String, } #[derive(::serde::Deserialize, ::serde::Serialize)] -#[serde(from = "crate::serializers::evidence::EvidenceVariant", into = "crate::serializers::evidence::EvidenceVariant")] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Evidence { #[prost(oneof="evidence::Sum", tags="1, 2")] @@ -400,7 +399,6 @@ pub struct Evidence { pub mod evidence { #[derive(::serde::Deserialize, ::serde::Serialize)] #[serde(tag = "type", content = "value")] - #[serde(from = "crate::serializers::evidence::EvidenceVariant", into = "crate::serializers::evidence::EvidenceVariant")] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Sum { #[prost(message, tag="1")] @@ -444,14 +442,11 @@ pub struct LightClientAttackEvidence { #[prost(message, optional, tag="5")] pub timestamp: ::core::option::Option, } -#[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EvidenceList { #[prost(message, repeated, tag="1")] - #[serde(with = "crate::serializers::nullable")] pub evidence: ::prost::alloc::vec::Vec, } -#[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { #[prost(message, optional, tag="1")] diff --git a/proto/src/prost/v0_37/tendermint.types.rs b/proto/src/prost/v0_37/tendermint.types.rs index 7b205cede..ed51ddb7a 100644 --- a/proto/src/prost/v0_37/tendermint.types.rs +++ b/proto/src/prost/v0_37/tendermint.types.rs @@ -384,7 +384,6 @@ pub struct EventDataRoundState { pub step: ::prost::alloc::string::String, } #[derive(::serde::Deserialize, ::serde::Serialize)] -#[serde(from = "crate::serializers::evidence::EvidenceVariant", into = "crate::serializers::evidence::EvidenceVariant")] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Evidence { #[prost(oneof="evidence::Sum", tags="1, 2")] @@ -394,7 +393,6 @@ pub struct Evidence { pub mod evidence { #[derive(::serde::Deserialize, ::serde::Serialize)] #[serde(tag = "type", content = "value")] - #[serde(from = "crate::serializers::evidence::EvidenceVariant", into = "crate::serializers::evidence::EvidenceVariant")] #[derive(Clone, PartialEq, ::prost::Oneof)] pub enum Sum { #[prost(message, tag="1")] @@ -438,14 +436,11 @@ pub struct LightClientAttackEvidence { #[prost(message, optional, tag="5")] pub timestamp: ::core::option::Option, } -#[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct EvidenceList { #[prost(message, repeated, tag="1")] - #[serde(with = "crate::serializers::nullable")] pub evidence: ::prost::alloc::vec::Vec, } -#[derive(::serde::Deserialize, ::serde::Serialize)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { #[prost(message, optional, tag="1")] diff --git a/tools/proto-compiler/src/constants.rs b/tools/proto-compiler/src/constants.rs index 98be71f53..c99a2a270 100644 --- a/tools/proto-compiler/src/constants.rs +++ b/tools/proto-compiler/src/constants.rs @@ -53,7 +53,6 @@ const RENAME_SRPUBKEY: &str = r#"#[serde(rename = "tendermint/PubKeySr25519", wi const RENAME_DUPLICATEVOTE: &str = r#"#[serde(rename = "tendermint/DuplicateVoteEvidence")]"#; const RENAME_LIGHTCLIENTATTACK: &str = r#"#[serde(rename = "tendermint/LightClientAttackEvidence")]"#; -const EVIDENCE_VARIANT: &str = r#"#[serde(from = "crate::serializers::evidence::EvidenceVariant", into = "crate::serializers::evidence::EvidenceVariant")]"#; const ALIAS_VALIDATOR_POWER_QUOTED: &str = r#"#[serde(alias = "ValidatorPower", with = "crate::serializers::from_str")]"#; const ALIAS_TOTAL_VOTING_POWER_QUOTED: &str = @@ -70,9 +69,7 @@ pub static CUSTOM_TYPE_ATTRIBUTES: &[(&str, &str)] = &[ (".tendermint.libs.bits.BitArray", SERIALIZED), (".tendermint.types.EvidenceParams", SERIALIZED), (".tendermint.types.BlockIDFlag", PRIMITIVE_ENUM), - (".tendermint.types.Block", SERIALIZED), (".tendermint.types.Data", SERIALIZED), - (".tendermint.types.EvidenceList", SERIALIZED), (".tendermint.types.Evidence", SERIALIZED), (".tendermint.types.DuplicateVoteEvidence", SERIALIZED), (".tendermint.types.Vote", SERIALIZED), @@ -95,7 +92,6 @@ pub static CUSTOM_TYPE_ATTRIBUTES: &[(&str, &str)] = &[ (".tendermint.types.Validator", SERIALIZED), (".tendermint.types.CanonicalVote", SERIALIZED), (".tendermint.types.BlockMeta", SERIALIZED), - (".tendermint.types.Evidence", EVIDENCE_VARIANT), (".tendermint.types.TxProof", SERIALIZED), (".tendermint.crypto.Proof", SERIALIZED), ]; @@ -150,7 +146,6 @@ pub static CUSTOM_FIELD_ATTRIBUTES: &[(&str, &str)] = &[ (".tendermint.types.Header.evidence_hash", HEXSTRING), (".tendermint.types.Header.proposer_address", HEXSTRING), (".tendermint.types.Data.txs", NULLABLEVECARRAY), - (".tendermint.types.EvidenceList.evidence", NULLABLE), (".tendermint.types.Commit.height", QUOTED), (".tendermint.types.Commit.signatures", NULLABLE), (".tendermint.types.CommitSig.validator_address", HEXSTRING),