diff --git a/Cargo.lock b/Cargo.lock index dae3d294..948b10ca 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -569,7 +569,7 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "basecoin" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=d2da442#d2da442d55497d450ede672fef30a60597c84b28" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ecebd5f#ecebd5f50af03a0d40088ea11471ada00253a56f" dependencies = [ "basecoin-app", "basecoin-modules", @@ -591,7 +591,7 @@ dependencies = [ [[package]] name = "basecoin-app" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=d2da442#d2da442d55497d450ede672fef30a60597c84b28" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ecebd5f#ecebd5f50af03a0d40088ea11471ada00253a56f" dependencies = [ "basecoin-modules", "basecoin-store", @@ -610,7 +610,7 @@ dependencies = [ [[package]] name = "basecoin-modules" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=d2da442#d2da442d55497d450ede672fef30a60597c84b28" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ecebd5f#ecebd5f50af03a0d40088ea11471ada00253a56f" dependencies = [ "base64 0.21.7", "basecoin-store", @@ -627,7 +627,7 @@ dependencies = [ "serde_derive", "serde_json", "sha2 0.10.8", - "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", "tendermint 0.34.1", "tendermint-rpc", "tonic", @@ -637,7 +637,7 @@ dependencies = [ [[package]] name = "basecoin-store" version = "0.1.0" -source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=d2da442#d2da442d55497d450ede672fef30a60597c84b28" +source = "git+https://github.com/informalsystems/basecoin-rs.git?rev=ecebd5f#ecebd5f50af03a0d40088ea11471ada00253a56f" dependencies = [ "displaydoc", "ics23", @@ -5504,7 +5504,7 @@ dependencies = [ [[package]] name = "sov-celestia-client" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1#fc7303e1bf6b6f227dca35ec8920ffa8877f7c1d" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427#210b142772047b416a940c147c7784f441d2aa9d" dependencies = [ "borsh", "derive_more", @@ -5515,7 +5515,7 @@ dependencies = [ "prost", "serde", "sha2 0.10.8", - "sov-celestia-client-types 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", + "sov-celestia-client-types 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", "tendermint 0.34.1", "tendermint-light-client-verifier", "tendermint-proto 0.34.1", @@ -5558,6 +5558,7 @@ dependencies = [ "schemars", "serde", "sov-ibc-proto 0.1.0", + "sov-rollup-interface", "tendermint 0.34.1", "tendermint-light-client-verifier", "tendermint-proto 0.34.1", @@ -5567,7 +5568,7 @@ dependencies = [ [[package]] name = "sov-celestia-client-types" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1#fc7303e1bf6b6f227dca35ec8920ffa8877f7c1d" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427#210b142772047b416a940c147c7784f441d2aa9d" dependencies = [ "base64 0.21.7", "bytes", @@ -5580,7 +5581,8 @@ dependencies = [ "jmt", "prost", "serde", - "sov-ibc-proto 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", + "sov-ibc-proto 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", + "sov-rollup-interface", "tendermint 0.34.1", "tendermint-light-client-verifier", "tendermint-proto 0.34.1", @@ -5632,7 +5634,7 @@ dependencies = [ [[package]] name = "sov-consensus-state-tracker" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1#fc7303e1bf6b6f227dca35ec8920ffa8877f7c1d" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427#210b142772047b416a940c147c7784f441d2aa9d" dependencies = [ "anyhow", "base64 0.21.7", @@ -5642,8 +5644,8 @@ dependencies = [ "prost", "serde", "sov-celestia-adapter", - "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", - "sov-ibc 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", + "sov-ibc 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", "sov-mock-da", "sov-modules-api", "sov-modules-core", @@ -5704,7 +5706,7 @@ dependencies = [ [[package]] name = "sov-ibc" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1#fc7303e1bf6b6f227dca35ec8920ffa8877f7c1d" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427#210b142772047b416a940c147c7784f441d2aa9d" dependencies = [ "ahash 0.8.6", "anyhow", @@ -5721,8 +5723,8 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.8", - "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", - "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", + "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", "sov-modules-api", "sov-rollup-interface", "sov-state", @@ -5753,11 +5755,11 @@ dependencies = [ "serde_json", "sha2 0.10.8", "sov-bank", - "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", + "sov-celestia-client 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", "sov-chain-state", - "sov-consensus-state-tracker 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", - "sov-ibc 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", - "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1)", + "sov-consensus-state-tracker 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", + "sov-ibc 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", + "sov-ibc-transfer 0.1.0 (git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427)", "sov-kernels", "sov-mock-zkvm", "sov-modules-api", @@ -5791,7 +5793,7 @@ dependencies = [ [[package]] name = "sov-ibc-proto" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1#fc7303e1bf6b6f227dca35ec8920ffa8877f7c1d" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427#210b142772047b416a940c147c7784f441d2aa9d" dependencies = [ "ibc-proto", "informalsystems-pbjson", @@ -5836,7 +5838,7 @@ dependencies = [ [[package]] name = "sov-ibc-transfer" version = "0.1.0" -source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=fc7303e1#fc7303e1bf6b6f227dca35ec8920ffa8877f7c1d" +source = "git+https://github.com/informalsystems/sovereign-ibc.git?rev=210b1427#210b142772047b416a940c147c7784f441d2aa9d" dependencies = [ "anyhow", "base64 0.21.7", diff --git a/clients/sov-celestia/src/client_state/misbehaviour.rs b/clients/sov-celestia/src/client_state/misbehaviour.rs index 3f5cee2d..581d54f6 100644 --- a/clients/sov-celestia/src/client_state/misbehaviour.rs +++ b/clients/sov-celestia/src/client_state/misbehaviour.rs @@ -71,7 +71,7 @@ where )?; // TODO: Determine what sort of checks we need to carry out for detecting - // `AggregatedProofData` misbehaviour. + // `AggregatedProof` misbehaviour. Ok(()) } diff --git a/clients/sov-celestia/src/client_state/update_client.rs b/clients/sov-celestia/src/client_state/update_client.rs index 678989ae..76d51f8f 100644 --- a/clients/sov-celestia/src/client_state/update_client.rs +++ b/clients/sov-celestia/src/client_state/update_client.rs @@ -39,8 +39,8 @@ where verifier, )?; - // TODO: Implement the verification of the `AggregatedProofData`. - // aggregated_proof_date.verify()?; + // TODO: Implement the verification of the `AggregatedProof`. + // aggregated_proof.verify()?; Ok(()) } diff --git a/clients/sov-celestia/types/Cargo.toml b/clients/sov-celestia/types/Cargo.toml index 03b7dbb7..1875d082 100644 --- a/clients/sov-celestia/types/Cargo.toml +++ b/clients/sov-celestia/types/Cargo.toml @@ -41,6 +41,9 @@ tendermint = { workspace = true } tendermint-proto = { workspace = true } tendermint-light-client-verifier = { workspace = true } +# sovereign dependencies +sov-rollup-interface = { workspace = true } + [features] default = ["std"] std = [ diff --git a/clients/sov-celestia/types/src/client_message/aggregated_proof.rs b/clients/sov-celestia/types/src/client_message/aggregated_proof.rs index 54dea2b4..0674fb2c 100644 --- a/clients/sov-celestia/types/src/client_message/aggregated_proof.rs +++ b/clients/sov-celestia/types/src/client_message/aggregated_proof.rs @@ -1,90 +1,117 @@ +//! Defines the aggregated proof data structures, and their conversions to and +//! from the raw Protobuf types for the Sovereign SDK rollups. +//! +//! Note: Since Rust protobuf types currently live in `sovereign-ibc`, +//! additionally we are in the midst of development where aggregated proof +//! definitions are evolving, and want to leverage client-specific methods and +//! implementations. As a result, we're keeping a set of domain types identical +//! to those in the Sovereign SDK, at least for now. This facilitates easier +//! development and minimizes dependencies on the Sovereign SDK repository. +//! Looking ahead, we may consider merging these two into a potential shared +//! client-side library. + use core::fmt::{Display, Error as FmtError, Formatter}; use ibc_core::client::types::Height; use ibc_core::primitives::prelude::*; use ibc_core::primitives::proto::Protobuf; +use sov_rollup_interface::zk::aggregated_proof::{ + AggregatedProof as SovAggregatedProof, + AggregatedProofPublicData as SovAggregatedProofPublicData, CodeCommitment as SovCodeCommitment, + SerializedAggregatedProof as SovSerializedAggregatedProof, +}; use crate::client_message::pretty::PrettySlice; use crate::error::Error; use crate::proto::types::v1::{ - AggregatedProof as RawAggregatedProof, AggregatedProofData as RawAggregatedProofData, + AggregatedProof as RawAggregatedProof, AggregatedProofPublicData as RawAggregatedProofPublicData, CodeCommitment as RawCodeCommitment, - ValidityCondition as RawValidityCondition, + SerializedAggregatedProof as RawSerializedAggregatedProof, + SerializedValidityCondition as RawSerializedValidityCondition, }; /// Defines the aggregated proof data structure for the Sovereign SDK rollups #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct AggregatedProofData { - pub public_input: AggregatedProofPublicData, - pub aggregated_proof: AggregatedProof, +pub struct AggregatedProof { + pub public_data: AggregatedProofPublicData, + pub serialized_proof: SerializedAggregatedProof, } -impl AggregatedProofData { - pub fn new(public_input: AggregatedProofPublicData, aggregated_proof: AggregatedProof) -> Self { +impl AggregatedProof { + pub fn new( + public_data: AggregatedProofPublicData, + serialized_proof: SerializedAggregatedProof, + ) -> Self { Self { - public_input, - aggregated_proof, + public_data, + serialized_proof, } } - pub fn public_input(&self) -> &AggregatedProofPublicData { - &self.public_input + pub fn public_data(&self) -> &AggregatedProofPublicData { + &self.public_data } - pub fn aggregated_proof(&self) -> &AggregatedProof { - &self.aggregated_proof + pub fn serialized_proof(&self) -> &SerializedAggregatedProof { + &self.serialized_proof } pub fn validate_basic(&self) -> Result<(), Error> { - self.public_input.basic_validate()?; + self.public_data.basic_validate()?; - if self.aggregated_proof.is_empty() { - return Err(Error::empty("aggregated proof")); + if self.serialized_proof.is_empty() { + return Err(Error::empty("serialized proof")); } Ok(()) } } -impl Display for AggregatedProofData { +impl Display for AggregatedProof { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { write!( f, - "AggregatedProofData {{ aggregated_proof_public_input: {}, aggregated_proof: {} }}", - &self.public_input, self.aggregated_proof + "AggregatedProof {{ aggregated_proof_public_data: {}, serialized_proof: {} }}", + &self.public_data, self.serialized_proof ) } } -impl Protobuf for AggregatedProofData {} +impl Protobuf for AggregatedProof {} -impl TryFrom for AggregatedProofData { +impl TryFrom for AggregatedProof { type Error = Error; - fn try_from(raw: RawAggregatedProofData) -> Result { + fn try_from(raw: RawAggregatedProof) -> Result { Ok(Self { - public_input: raw - .public_input - .ok_or(Error::missing("public input"))? + public_data: raw + .public_data + .ok_or(Error::missing("public data"))? .try_into()?, - aggregated_proof: raw - .aggregated_proof - .ok_or(Error::missing("aggregated proof"))? + serialized_proof: raw + .serialized_proof + .ok_or(Error::missing("serialized proof"))? .into(), }) } } -impl From for RawAggregatedProofData { - fn from(value: AggregatedProofData) -> Self { +impl From for RawAggregatedProof { + fn from(value: AggregatedProof) -> Self { Self { - public_input: Some(value.public_input.into()), - aggregated_proof: Some(value.aggregated_proof.into()), + public_data: Some(value.public_data.into()), + serialized_proof: Some(value.serialized_proof.into()), } } } +impl From for SovAggregatedProof { + fn from(value: AggregatedProof) -> Self { + Self::new(value.serialized_proof.into(), value.public_data.into()) + } +} + /// Defines the public properties of the AggregatedProof for the Sovereign SDK /// rollups, utilized for verifying the proof. #[derive(Clone, Debug, PartialEq, Eq)] @@ -94,7 +121,7 @@ pub struct AggregatedProofPublicData { pub initial_slot_number: Height, pub final_slot_number: Height, pub genesis_state_root: Root, - pub input_state_root: Root, + pub initial_state_root: Root, pub final_state_root: Root, pub initial_slot_hash: Vec, pub final_slot_hash: Vec, @@ -160,12 +187,12 @@ impl Display for AggregatedProofPublicData { fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { write!( f, - "AggregatedProofPublicData {{ validity_conditions: {}, initial_slot_number: {}, final_slot_number: {}, initial_slot_hash: {}, final_slot_hash: {}, genesis_state_root: {}, input_state_root: {}, post_state_root: {}, code_commitment: {} }}", + "AggregatedProofPublicData {{ validity_conditions: {}, initial_slot_number: {}, final_slot_number: {}, initial_slot_hash: {}, final_slot_hash: {}, genesis_state_root: {}, initial_state_root: {}, final_state_root: {}, code_commitment: {} }}", PrettySlice(&self.validity_conditions), self.initial_slot_number, self.final_slot_number, hex::encode(self.genesis_state_root.as_ref()), - hex::encode(self.input_state_root.as_ref()), + hex::encode(self.initial_state_root.as_ref()), hex::encode(self.final_state_root.as_ref()), hex::encode(&self.initial_slot_hash), hex::encode(&self.final_slot_hash), @@ -174,6 +201,26 @@ impl Display for AggregatedProofPublicData { } } +impl From for SovAggregatedProofPublicData { + fn from(value: AggregatedProofPublicData) -> Self { + Self { + validity_conditions: value + .validity_conditions + .into_iter() + .map(|vc| vc.0) + .collect(), + initial_slot_number: value.initial_slot_number.revision_height(), + final_slot_number: value.final_slot_number.revision_height(), + genesis_state_root: value.genesis_state_root.into(), + initial_state_root: value.initial_state_root.into(), + final_state_root: value.final_state_root.into(), + initial_slot_hash: value.initial_slot_hash, + final_slot_hash: value.final_slot_hash, + code_commitment: value.code_commitment.into(), + } + } +} + impl Protobuf for AggregatedProofPublicData {} impl TryFrom for AggregatedProofPublicData { @@ -189,7 +236,7 @@ impl TryFrom for AggregatedProofPublicData { initial_slot_number: Height::new(0, raw.initial_slot_number)?, final_slot_number: Height::new(0, raw.final_slot_number)?, genesis_state_root: raw.genesis_state_root.try_into()?, - input_state_root: raw.initial_state_root.try_into()?, + initial_state_root: raw.initial_state_root.try_into()?, final_state_root: raw.final_state_root.try_into()?, initial_slot_hash: raw.initial_slot_hash, final_slot_hash: raw.final_slot_hash, @@ -212,7 +259,7 @@ impl From for RawAggregatedProofPublicData { initial_slot_number: value.initial_slot_number.revision_height(), final_slot_number: value.final_slot_number.revision_height(), genesis_state_root: value.genesis_state_root.into(), - initial_state_root: value.input_state_root.into(), + initial_state_root: value.initial_state_root.into(), final_state_root: value.final_state_root.into(), initial_slot_hash: value.initial_slot_hash, final_slot_hash: value.final_slot_hash, @@ -227,6 +274,10 @@ impl From for RawAggregatedProofPublicData { pub struct ValidityCondition(Vec); impl ValidityCondition { + pub fn into_inner(self) -> Vec { + self.0 + } + pub fn as_slice(&self) -> &[u8] { &self.0 } @@ -251,15 +302,15 @@ impl From> for ValidityCondition { } } -impl Protobuf for ValidityCondition {} +impl Protobuf for ValidityCondition {} -impl From for ValidityCondition { - fn from(raw: RawValidityCondition) -> Self { +impl From for ValidityCondition { + fn from(raw: RawSerializedValidityCondition) -> Self { Self(raw.validity_condition) } } -impl From for RawValidityCondition { +impl From for RawSerializedValidityCondition { fn from(value: ValidityCondition) -> Self { Self { validity_condition: value.0, @@ -273,6 +324,10 @@ impl From for RawValidityCondition { pub struct CodeCommitment(Vec); impl CodeCommitment { + pub fn into_inner(self) -> Vec { + self.0 + } + pub fn as_slice(&self) -> &[u8] { &self.0 } @@ -308,16 +363,26 @@ impl From for CodeCommitment { impl From for RawCodeCommitment { fn from(value: CodeCommitment) -> Self { Self { - code_commitment: value.0, + code_commitment: value.0.to_vec(), } } } +impl From for SovCodeCommitment { + fn from(value: CodeCommitment) -> Self { + Self(value.0) + } +} + #[derive(Clone, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] -pub struct AggregatedProof(Vec); +pub struct SerializedAggregatedProof(Vec); + +impl SerializedAggregatedProof { + pub fn into_inner(self) -> Vec { + self.0 + } -impl AggregatedProof { pub fn as_slice(&self) -> &[u8] { &self.0 } @@ -327,32 +392,42 @@ impl AggregatedProof { } } -impl Display for AggregatedProof { +impl Display for SerializedAggregatedProof { fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result { if self.0.is_empty() { - return write!(f, "AggregatedProof([])"); + return write!(f, "SerializedAggregatedProof([])"); } - write!(f, "AggregatedProof(0x{})", hex::encode(&self.0)) + write!(f, "SerializedAggregatedProof(0x{})", hex::encode(&self.0)) } } -impl From> for AggregatedProof { +impl From> for SerializedAggregatedProof { fn from(proof: Vec) -> Self { Self(proof) } } -impl Protobuf for AggregatedProof {} +impl Protobuf for SerializedAggregatedProof {} -impl From for AggregatedProof { - fn from(raw: RawAggregatedProof) -> Self { - Self(raw.proof) +impl From for SerializedAggregatedProof { + fn from(raw: RawSerializedAggregatedProof) -> Self { + Self(raw.raw_aggregated_proof) } } -impl From for RawAggregatedProof { - fn from(value: AggregatedProof) -> Self { - Self { proof: value.0 } +impl From for RawSerializedAggregatedProof { + fn from(value: SerializedAggregatedProof) -> Self { + Self { + raw_aggregated_proof: value.0, + } + } +} + +impl From for SovSerializedAggregatedProof { + fn from(value: SerializedAggregatedProof) -> Self { + Self { + raw_aggregated_proof: value.0, + } } } diff --git a/clients/sov-celestia/types/src/client_message/header.rs b/clients/sov-celestia/types/src/client_message/header.rs index ab7d4fb4..c2b4cae0 100644 --- a/clients/sov-celestia/types/src/client_message/header.rs +++ b/clients/sov-celestia/types/src/client_message/header.rs @@ -8,7 +8,7 @@ use ibc_core::primitives::Timestamp; use tendermint::chain::Id as TmChainId; use tendermint_light_client_verifier::types::TrustedBlockState; -use super::aggregated_proof::AggregatedProofData; +use super::aggregated_proof::AggregatedProof; use crate::consensus_state::SovTmConsensusState; use crate::error::Error; use crate::proto::tendermint::v1::Header as RawSovTmHeader; @@ -19,7 +19,7 @@ pub const SOV_TENDERMINT_HEADER_TYPE_URL: &str = "/ibc.lightclients.sovereign.te #[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] pub struct Header { pub da_header: H, - pub aggregated_proof_data: AggregatedProofData, + pub aggregated_proof: AggregatedProof, } impl Debug for Header { @@ -32,8 +32,8 @@ impl Display for Header { fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> { write!( f, - "Header {{ da_header: {}, aggregated_proof_data: {} }}", - &self.da_header, &self.aggregated_proof_data + "Header {{ da_header: {}, aggregated_proof: {} }}", + &self.da_header, &self.aggregated_proof ) } } @@ -49,7 +49,7 @@ impl SovTmHeader { /// Returns the height of the Sovereign-Tendermint header. pub fn height(&self) -> Height { - self.aggregated_proof_data.public_input.final_slot_number() + self.aggregated_proof.public_data.final_slot_number() } /// Returns the trusted height of the Sovereign-Tendermint header, which @@ -63,7 +63,7 @@ impl SovTmHeader { pub fn validate_basic(&self) -> Result<(), Error> { self.da_header.validate_basic().map_err(Error::source)?; - self.aggregated_proof_data.validate_basic()?; + self.aggregated_proof.validate_basic()?; if self.height() != self.da_header.height() { return Err(Error::mismatch(format!( @@ -109,14 +109,14 @@ impl TryFrom for SovTmHeader { let da_header = TmHeader::try_from(raw_da_header).map_err(Error::source)?; - let aggregated_proof_data = value - .aggregated_proof_data + let aggregated_proof = value + .aggregated_proof .ok_or(Error::missing("missing aggregated proof"))? .try_into()?; Ok(Header { da_header, - aggregated_proof_data, + aggregated_proof, }) } } @@ -125,7 +125,7 @@ impl From for RawSovTmHeader { fn from(value: SovTmHeader) -> RawSovTmHeader { RawSovTmHeader { tendermint_header: Some(value.da_header.into()), - aggregated_proof_data: Some(value.aggregated_proof_data.into()), + aggregated_proof: Some(value.aggregated_proof.into()), } } } diff --git a/clients/sov-celestia/types/src/client_message/mod.rs b/clients/sov-celestia/types/src/client_message/mod.rs index 5d2143a1..820f218e 100644 --- a/clients/sov-celestia/types/src/client_message/mod.rs +++ b/clients/sov-celestia/types/src/client_message/mod.rs @@ -84,24 +84,24 @@ pub mod test_util { // ------------------------------------------------------------------------- #[derive(typed_builder::TypedBuilder, Debug)] - #[builder(build_method(into = AggregatedProofData))] - pub struct AggregatedProofDataConfig { - pub public_input: PublicInputConfig, + #[builder(build_method(into = AggregatedProof))] + pub struct AggregatedProofConfig { + pub public_data: PublicDataConfig, #[builder(default = vec![0; 32].into())] - pub aggregated_proof: AggregatedProof, + pub serialized_proof: SerializedAggregatedProof, } - impl From for AggregatedProofData { - fn from(config: AggregatedProofDataConfig) -> Self { + impl From for AggregatedProof { + fn from(config: AggregatedProofConfig) -> Self { Self { - public_input: config.public_input.into(), - aggregated_proof: config.aggregated_proof, + public_data: config.public_data.into(), + serialized_proof: config.serialized_proof, } } } #[derive(typed_builder::TypedBuilder, Debug)] - pub struct PublicInputConfig { + pub struct PublicDataConfig { #[builder(default = vec![vec![0; 32].into()])] pub validity_conditions: Vec, pub initial_slot_number: Height, @@ -109,7 +109,7 @@ pub mod test_util { #[builder(default = Root::from([0; 32]))] pub genesis_state_root: Root, #[builder(default = Root::from([0; 32]))] - pub input_state_root: Root, + pub initial_state_root: Root, #[builder(default = Root::from([0; 32]))] pub final_state_root: Root, #[builder(default = vec![0; 32])] @@ -120,14 +120,14 @@ pub mod test_util { pub code_commitment: CodeCommitment, } - impl From for AggregatedProofPublicData { - fn from(config: PublicInputConfig) -> Self { + impl From for AggregatedProofPublicData { + fn from(config: PublicDataConfig) -> Self { Self { validity_conditions: config.validity_conditions, initial_slot_number: config.initial_slot_number, final_slot_number: config.final_slot_number, genesis_state_root: config.genesis_state_root, - input_state_root: config.input_state_root, + initial_state_root: config.initial_state_root, final_state_root: config.final_state_root, initial_slot_hash: config.initial_slot_hash, final_slot_hash: config.final_slot_hash, @@ -142,9 +142,9 @@ pub mod test_util { final_slot_number: Height, final_state_root: Root, ) -> SovTmHeader { - let aggregated_proof_data = AggregatedProofDataConfig::builder() - .public_input( - PublicInputConfig::builder() + let aggregated_proof = AggregatedProofConfig::builder() + .public_data( + PublicDataConfig::builder() .initial_slot_number(initial_slot_number) .final_slot_number(final_slot_number) .final_state_root(final_state_root) @@ -154,7 +154,7 @@ pub mod test_util { HeaderConfig::builder() .da_header(da_header) - .aggregated_proof_data(aggregated_proof_data) + .aggregated_proof(aggregated_proof) .build() } } diff --git a/clients/sov-celestia/types/src/client_state/mod.rs b/clients/sov-celestia/types/src/client_state/mod.rs index f34a1db9..1e3698a8 100644 --- a/clients/sov-celestia/types/src/client_state/mod.rs +++ b/clients/sov-celestia/types/src/client_state/mod.rs @@ -87,19 +87,19 @@ pub mod test_util { use ibc_client_tendermint::types::Header as TmHeader; - use crate::client_message::{AggregatedProofData, SovTmHeader}; + use crate::client_message::{AggregatedProof, SovTmHeader}; #[derive(typed_builder::TypedBuilder, Debug)] #[builder(build_method(into = SovTmHeader))] pub struct HeaderConfig { pub da_header: TmHeader, - pub aggregated_proof_data: AggregatedProofData, + pub aggregated_proof: AggregatedProof, } impl From for SovTmHeader { fn from(config: HeaderConfig) -> Self { Self { da_header: config.da_header, - aggregated_proof_data: config.aggregated_proof_data, + aggregated_proof: config.aggregated_proof, } } } diff --git a/clients/sov-celestia/types/src/consensus_state/definition.rs b/clients/sov-celestia/types/src/consensus_state/definition.rs index e2a03e40..f0fae308 100644 --- a/clients/sov-celestia/types/src/consensus_state/definition.rs +++ b/clients/sov-celestia/types/src/consensus_state/definition.rs @@ -120,8 +120,8 @@ impl From for SovTmConsensusState { Self { root: CommitmentRoot::from_bytes( header - .aggregated_proof_data - .public_input + .aggregated_proof + .public_data .final_state_root .as_ref(), ), diff --git a/mocks/Cargo.toml b/mocks/Cargo.toml index 8242a9ea..51d120a2 100644 --- a/mocks/Cargo.toml +++ b/mocks/Cargo.toml @@ -32,10 +32,10 @@ tracing = "0.1.36" typed-builder = "0.18.0" # internal dependencies -sov-ibc = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "fc7303e1" } -sov-ibc-transfer = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "fc7303e1" } -sov-consensus-state-tracker = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "fc7303e1" } -sov-celestia-client = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "fc7303e1", features = ["test-util"] } +sov-ibc = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "210b1427" } +sov-ibc-transfer = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "210b1427" } +sov-consensus-state-tracker = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "210b1427" } +sov-celestia-client = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "210b1427", features = ["test-util"] } # ibc dependencies ibc-core = { workspace = true } @@ -46,7 +46,7 @@ ibc-query = { workspace = true } ibc-testkit = { workspace = true } # cosmos dependencies -basecoin = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "d2da442" } +basecoin = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "ecebd5f" } tendermint = { workspace = true } tendermint-testgen = { workspace = true } diff --git a/proto/README.md b/proto/README.md index b6508a59..4c267729 100644 --- a/proto/README.md +++ b/proto/README.md @@ -1,11 +1,12 @@ -# sov-ibc-proto +
+

sov-ibc-proto

+
-sov-ibc-proto encompasses essential protobuf definitions, a compiler, and -Rust-generated data structures crucial for IBC consumers, including IBC -relayers, modules, or light clients. This directory comprises the following -components: +Encompasses essential protobuf definitions, a compiler, and Rust-generated data +structures crucial for IBC consumers, including IBC relayers, modules, or light +clients. This directory comprises the following components: -- **Definitions**: Contains .proto files for both Sovereign SDK rollups and +- **Definitions**: Contains `.proto` files for both Sovereign SDK rollups and light clients, providing the foundational protobuf definitions. - **Compiler**: Includes a binary used by the `sync-protobuf.sh` script. This @@ -13,8 +14,8 @@ components: definitions. - **Library**: The `sov-ibc-proto` crate encapsulates the Protobuf-generated -data structures required for interacting either with IBC modules or light -clients. +data structures required for interacting either with Sovereign IBC modules or +light clients. ## Code Generation diff --git a/proto/definitions/ibc/lightclients/sovereign/tendermint/v1/sov_tendermint.proto b/proto/definitions/ibc/lightclients/sovereign/tendermint/v1/sov_tendermint.proto index 43fcf651..6667c9a4 100644 --- a/proto/definitions/ibc/lightclients/sovereign/tendermint/v1/sov_tendermint.proto +++ b/proto/definitions/ibc/lightclients/sovereign/tendermint/v1/sov_tendermint.proto @@ -117,9 +117,9 @@ message Header { (gogoproto.moretags) = "yaml:\"tendermint_header\"" ]; // the rollup aggregated proof data - .sovereign.types.v1.AggregatedProofData aggregated_proof_data = 2 [ + .sovereign.types.v1.AggregatedProof aggregated_proof = 2 [ (gogoproto.nullable) = false, - (gogoproto.moretags) = "yaml:\"aggregated_proof_data\"" + (gogoproto.moretags) = "yaml:\"aggregated_proof\"" ]; } diff --git a/proto/definitions/sovereign/types/v1/types.proto b/proto/definitions/sovereign/types/v1/types.proto index de1e1646..25b6c26b 100644 --- a/proto/definitions/sovereign/types/v1/types.proto +++ b/proto/definitions/sovereign/types/v1/types.proto @@ -4,21 +4,21 @@ package sovereign.types.v1; import "gogoproto/gogo.proto"; -// AggregatedProofData is the overarching structure, encompassing public input, -// proof data information, and aggregated proof bytes. -message AggregatedProofData { - // the public input of the aggregated proof - AggregatedProofPublicData public_input = 1; +// AggregatedProof is the overarching structure, encompassing public data, proof +// data information, and aggregated proof bytes. +message AggregatedProof { + // the public data of the aggregated proof + AggregatedProofPublicData public_data = 1; // the aggregated proof bytes - AggregatedProof aggregated_proof = 2; + SerializedAggregatedProof serialized_proof = 2; } -// AggregatedProofPublicInput defines the public properties of the +// AggregatedProofPublicData defines the public properties of the // AggregatedProof for the Sovereign SDK rollups, utilized for verifying the // proof. message AggregatedProofPublicData { // The set of validity conditions for each block of the aggregated proof. - repeated ValidityCondition validity_conditions = 1 [ + repeated SerializedValidityCondition validity_conditions = 1 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"validity_conditions\"" ]; @@ -45,16 +45,16 @@ message AggregatedProofPublicData { ]; } -// AggregatedProof defines the aggregated proof structure for the Sovereign SDK -// rollups. -message AggregatedProof { - // the rollup aggregated proof bytes covering a range of DA blocks - bytes proof = 1; +// SerializedAggregatedProof defines the raw aggregated proof structure for the +// Sovereign SDK rollups. +message SerializedAggregatedProof { + // the rollup raw aggregated proof bytes covering a range of DA blocks + bytes raw_aggregated_proof = 1; } -// ValidityCondition defines the validity condition for each block of the -// aggregated proof -message ValidityCondition { +// SerializedValidityCondition defines the serialized validity condition for +// each block of the aggregated proof +message SerializedValidityCondition { // the validity condition bytes validity_condition = 1; } diff --git a/proto/src/prost/ibc.lightclients.sovereign.tendermint.v1.rs b/proto/src/prost/ibc.lightclients.sovereign.tendermint.v1.rs index eb6e3064..abc87917 100644 --- a/proto/src/prost/ibc.lightclients.sovereign.tendermint.v1.rs +++ b/proto/src/prost/ibc.lightclients.sovereign.tendermint.v1.rs @@ -133,8 +133,8 @@ pub struct Header { >, /// the rollup aggregated proof data #[prost(message, optional, tag = "2")] - pub aggregated_proof_data: ::core::option::Option< - super::super::super::super::super::sovereign::types::v1::AggregatedProofData, + pub aggregated_proof: ::core::option::Option< + super::super::super::super::super::sovereign::types::v1::AggregatedProof, >, } impl ::prost::Name for Header { diff --git a/proto/src/prost/ibc.lightclients.sovereign.tendermint.v1.serde.rs b/proto/src/prost/ibc.lightclients.sovereign.tendermint.v1.serde.rs index 4bd6eee2..31b3110a 100644 --- a/proto/src/prost/ibc.lightclients.sovereign.tendermint.v1.serde.rs +++ b/proto/src/prost/ibc.lightclients.sovereign.tendermint.v1.serde.rs @@ -289,8 +289,8 @@ impl serde::Serialize for Header { if let Some(v) = self.tendermint_header.as_ref() { struct_ser.serialize_field("tendermintHeader", v)?; } - if let Some(v) = self.aggregated_proof_data.as_ref() { - struct_ser.serialize_field("aggregatedProofData", v)?; + if let Some(v) = self.aggregated_proof.as_ref() { + struct_ser.serialize_field("aggregatedProof", v)?; } struct_ser.end() } @@ -304,14 +304,14 @@ impl<'de> serde::Deserialize<'de> for Header { const FIELDS: &[&str] = &[ "tendermint_header", "tendermintHeader", - "aggregated_proof_data", - "aggregatedProofData", + "aggregated_proof", + "aggregatedProof", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { TendermintHeader, - AggregatedProofData, + AggregatedProof, } impl<'de> serde::Deserialize<'de> for GeneratedField { fn deserialize(deserializer: D) -> core::result::Result @@ -334,7 +334,7 @@ impl<'de> serde::Deserialize<'de> for Header { { match value { "tendermintHeader" | "tendermint_header" => Ok(GeneratedField::TendermintHeader), - "aggregatedProofData" | "aggregated_proof_data" => Ok(GeneratedField::AggregatedProofData), + "aggregatedProof" | "aggregated_proof" => Ok(GeneratedField::AggregatedProof), _ => Err(serde::de::Error::unknown_field(value, FIELDS)), } } @@ -355,7 +355,7 @@ impl<'de> serde::Deserialize<'de> for Header { V: serde::de::MapAccess<'de>, { let mut tendermint_header__ = None; - let mut aggregated_proof_data__ = None; + let mut aggregated_proof__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::TendermintHeader => { @@ -364,17 +364,17 @@ impl<'de> serde::Deserialize<'de> for Header { } tendermint_header__ = map_.next_value()?; } - GeneratedField::AggregatedProofData => { - if aggregated_proof_data__.is_some() { - return Err(serde::de::Error::duplicate_field("aggregatedProofData")); + GeneratedField::AggregatedProof => { + if aggregated_proof__.is_some() { + return Err(serde::de::Error::duplicate_field("aggregatedProof")); } - aggregated_proof_data__ = map_.next_value()?; + aggregated_proof__ = map_.next_value()?; } } } Ok(Header { tendermint_header: tendermint_header__, - aggregated_proof_data: aggregated_proof_data__, + aggregated_proof: aggregated_proof__, }) } } diff --git a/proto/src/prost/proto_descriptor.bin b/proto/src/prost/proto_descriptor.bin index f101329e..23311790 100644 Binary files a/proto/src/prost/proto_descriptor.bin and b/proto/src/prost/proto_descriptor.bin differ diff --git a/proto/src/prost/sovereign.types.v1.rs b/proto/src/prost/sovereign.types.v1.rs index 51fd3903..dc905da1 100644 --- a/proto/src/prost/sovereign.types.v1.rs +++ b/proto/src/prost/sovereign.types.v1.rs @@ -1,23 +1,23 @@ -/// AggregatedProofData is the overarching structure, encompassing public input, -/// proof data information, and aggregated proof bytes. +/// AggregatedProof is the overarching structure, encompassing public data, proof +/// data information, and aggregated proof bytes. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct AggregatedProofData { - /// the public input of the aggregated proof +pub struct AggregatedProof { + /// the public data of the aggregated proof #[prost(message, optional, tag = "1")] - pub public_input: ::core::option::Option, + pub public_data: ::core::option::Option, /// the aggregated proof bytes #[prost(message, optional, tag = "2")] - pub aggregated_proof: ::core::option::Option, + pub serialized_proof: ::core::option::Option, } -impl ::prost::Name for AggregatedProofData { - const NAME: &'static str = "AggregatedProofData"; +impl ::prost::Name for AggregatedProof { + const NAME: &'static str = "AggregatedProof"; const PACKAGE: &'static str = "sovereign.types.v1"; fn full_name() -> ::prost::alloc::string::String { ::prost::alloc::format!("sovereign.types.v1.{}", Self::NAME) } } -/// AggregatedProofPublicInput defines the public properties of the +/// AggregatedProofPublicData defines the public properties of the /// AggregatedProof for the Sovereign SDK rollups, utilized for verifying the /// proof. #[allow(clippy::derive_partial_eq_without_eq)] @@ -25,7 +25,7 @@ impl ::prost::Name for AggregatedProofData { pub struct AggregatedProofPublicData { /// The set of validity conditions for each block of the aggregated proof. #[prost(message, repeated, tag = "1")] - pub validity_conditions: ::prost::alloc::vec::Vec, + pub validity_conditions: ::prost::alloc::vec::Vec, /// the initial slot number of the rollup from which the proof captures the /// rollup's transition from the initial state root. #[prost(uint64, tag = "2")] @@ -60,33 +60,33 @@ impl ::prost::Name for AggregatedProofPublicData { ::prost::alloc::format!("sovereign.types.v1.{}", Self::NAME) } } -/// AggregatedProof defines the aggregated proof structure for the Sovereign SDK -/// rollups. +/// SerializedAggregatedProof defines the raw aggregated proof structure for the +/// Sovereign SDK rollups. #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct AggregatedProof { - /// the rollup aggregated proof bytes covering a range of DA blocks +pub struct SerializedAggregatedProof { + /// the rollup raw aggregated proof bytes covering a range of DA blocks #[prost(bytes = "vec", tag = "1")] - pub proof: ::prost::alloc::vec::Vec, + pub raw_aggregated_proof: ::prost::alloc::vec::Vec, } -impl ::prost::Name for AggregatedProof { - const NAME: &'static str = "AggregatedProof"; +impl ::prost::Name for SerializedAggregatedProof { + const NAME: &'static str = "SerializedAggregatedProof"; const PACKAGE: &'static str = "sovereign.types.v1"; fn full_name() -> ::prost::alloc::string::String { ::prost::alloc::format!("sovereign.types.v1.{}", Self::NAME) } } -/// ValidityCondition defines the validity condition for each block of the -/// aggregated proof +/// SerializedValidityCondition defines the serialized validity condition for +/// each block of the aggregated proof #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] -pub struct ValidityCondition { +pub struct SerializedValidityCondition { /// the validity condition #[prost(bytes = "vec", tag = "1")] pub validity_condition: ::prost::alloc::vec::Vec, } -impl ::prost::Name for ValidityCondition { - const NAME: &'static str = "ValidityCondition"; +impl ::prost::Name for SerializedValidityCondition { + const NAME: &'static str = "SerializedValidityCondition"; const PACKAGE: &'static str = "sovereign.types.v1"; fn full_name() -> ::prost::alloc::string::String { ::prost::alloc::format!("sovereign.types.v1.{}", Self::NAME) diff --git a/proto/src/prost/sovereign.types.v1.serde.rs b/proto/src/prost/sovereign.types.v1.serde.rs index b41e377f..291ce199 100644 --- a/proto/src/prost/sovereign.types.v1.serde.rs +++ b/proto/src/prost/sovereign.types.v1.serde.rs @@ -9,10 +9,15 @@ impl serde::Serialize for AggregatedProof { if true { len += 1; } - let mut struct_ser = serializer.serialize_struct("sovereign.types.v1.AggregatedProof", len)?; if true { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("proof", pbjson::private::base64::encode(&self.proof).as_str())?; + len += 1; + } + let mut struct_ser = serializer.serialize_struct("sovereign.types.v1.AggregatedProof", len)?; + if let Some(v) = self.public_data.as_ref() { + struct_ser.serialize_field("publicData", v)?; + } + if let Some(v) = self.serialized_proof.as_ref() { + struct_ser.serialize_field("serializedProof", v)?; } struct_ser.end() } @@ -24,12 +29,16 @@ impl<'de> serde::Deserialize<'de> for AggregatedProof { D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "proof", + "public_data", + "publicData", + "serialized_proof", + "serializedProof", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Proof, + PublicData, + SerializedProof, } impl<'de> serde::Deserialize<'de> for GeneratedField { fn deserialize(deserializer: D) -> core::result::Result @@ -51,7 +60,8 @@ impl<'de> serde::Deserialize<'de> for AggregatedProof { E: serde::de::Error, { match value { - "proof" => Ok(GeneratedField::Proof), + "publicData" | "public_data" => Ok(GeneratedField::PublicData), + "serializedProof" | "serialized_proof" => Ok(GeneratedField::SerializedProof), _ => Err(serde::de::Error::unknown_field(value, FIELDS)), } } @@ -71,135 +81,31 @@ impl<'de> serde::Deserialize<'de> for AggregatedProof { where V: serde::de::MapAccess<'de>, { - let mut proof__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Proof => { - if proof__.is_some() { - return Err(serde::de::Error::duplicate_field("proof")); - } - proof__ = - Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) - ; - } - } - } - Ok(AggregatedProof { - proof: proof__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("sovereign.types.v1.AggregatedProof", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for AggregatedProofData { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> core::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if true { - len += 1; - } - if true { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("sovereign.types.v1.AggregatedProofData", len)?; - if let Some(v) = self.public_input.as_ref() { - struct_ser.serialize_field("publicInput", v)?; - } - if let Some(v) = self.aggregated_proof.as_ref() { - struct_ser.serialize_field("aggregatedProof", v)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for AggregatedProofData { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "public_input", - "publicInput", - "aggregated_proof", - "aggregatedProof", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - PublicInput, - AggregatedProof, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> core::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> core::result::Result - where - E: serde::de::Error, - { - match value { - "publicInput" | "public_input" => Ok(GeneratedField::PublicInput), - "aggregatedProof" | "aggregated_proof" => Ok(GeneratedField::AggregatedProof), - _ => Err(serde::de::Error::unknown_field(value, FIELDS)), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = AggregatedProofData; - - fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct sovereign.types.v1.AggregatedProofData") - } - - fn visit_map(self, mut map_: V) -> core::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut public_input__ = None; - let mut aggregated_proof__ = None; + let mut public_data__ = None; + let mut serialized_proof__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::PublicInput => { - if public_input__.is_some() { - return Err(serde::de::Error::duplicate_field("publicInput")); + GeneratedField::PublicData => { + if public_data__.is_some() { + return Err(serde::de::Error::duplicate_field("publicData")); } - public_input__ = map_.next_value()?; + public_data__ = map_.next_value()?; } - GeneratedField::AggregatedProof => { - if aggregated_proof__.is_some() { - return Err(serde::de::Error::duplicate_field("aggregatedProof")); + GeneratedField::SerializedProof => { + if serialized_proof__.is_some() { + return Err(serde::de::Error::duplicate_field("serializedProof")); } - aggregated_proof__ = map_.next_value()?; + serialized_proof__ = map_.next_value()?; } } } - Ok(AggregatedProofData { - public_input: public_input__, - aggregated_proof: aggregated_proof__, + Ok(AggregatedProof { + public_data: public_data__, + serialized_proof: serialized_proof__, }) } } - deserializer.deserialize_struct("sovereign.types.v1.AggregatedProofData", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("sovereign.types.v1.AggregatedProof", FIELDS, GeneratedVisitor) } } impl serde::Serialize for AggregatedProofPublicData { @@ -554,7 +460,102 @@ impl<'de> serde::Deserialize<'de> for CodeCommitment { deserializer.deserialize_struct("sovereign.types.v1.CodeCommitment", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ValidityCondition { +impl serde::Serialize for SerializedAggregatedProof { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> core::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if true { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("sovereign.types.v1.SerializedAggregatedProof", len)?; + if true { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("rawAggregatedProof", pbjson::private::base64::encode(&self.raw_aggregated_proof).as_str())?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for SerializedAggregatedProof { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "raw_aggregated_proof", + "rawAggregatedProof", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + RawAggregatedProof, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> core::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> core::result::Result + where + E: serde::de::Error, + { + match value { + "rawAggregatedProof" | "raw_aggregated_proof" => Ok(GeneratedField::RawAggregatedProof), + _ => Err(serde::de::Error::unknown_field(value, FIELDS)), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SerializedAggregatedProof; + + fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + formatter.write_str("struct sovereign.types.v1.SerializedAggregatedProof") + } + + fn visit_map(self, mut map_: V) -> core::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut raw_aggregated_proof__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::RawAggregatedProof => { + if raw_aggregated_proof__.is_some() { + return Err(serde::de::Error::duplicate_field("rawAggregatedProof")); + } + raw_aggregated_proof__ = + Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) + ; + } + } + } + Ok(SerializedAggregatedProof { + raw_aggregated_proof: raw_aggregated_proof__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("sovereign.types.v1.SerializedAggregatedProof", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for SerializedValidityCondition { #[allow(deprecated)] fn serialize(&self, serializer: S) -> core::result::Result where @@ -565,7 +566,7 @@ impl serde::Serialize for ValidityCondition { if true { len += 1; } - let mut struct_ser = serializer.serialize_struct("sovereign.types.v1.ValidityCondition", len)?; + let mut struct_ser = serializer.serialize_struct("sovereign.types.v1.SerializedValidityCondition", len)?; if true { #[allow(clippy::needless_borrow)] struct_ser.serialize_field("validityCondition", pbjson::private::base64::encode(&self.validity_condition).as_str())?; @@ -573,7 +574,7 @@ impl serde::Serialize for ValidityCondition { struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ValidityCondition { +impl<'de> serde::Deserialize<'de> for SerializedValidityCondition { #[allow(deprecated)] fn deserialize(deserializer: D) -> core::result::Result where @@ -618,13 +619,13 @@ impl<'de> serde::Deserialize<'de> for ValidityCondition { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ValidityCondition; + type Value = SerializedValidityCondition; fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - formatter.write_str("struct sovereign.types.v1.ValidityCondition") + formatter.write_str("struct sovereign.types.v1.SerializedValidityCondition") } - fn visit_map(self, mut map_: V) -> core::result::Result + fn visit_map(self, mut map_: V) -> core::result::Result where V: serde::de::MapAccess<'de>, { @@ -641,11 +642,11 @@ impl<'de> serde::Deserialize<'de> for ValidityCondition { } } } - Ok(ValidityCondition { + Ok(SerializedValidityCondition { validity_condition: validity_condition__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("sovereign.types.v1.ValidityCondition", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("sovereign.types.v1.SerializedValidityCondition", FIELDS, GeneratedVisitor) } }