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

Commit

Permalink
chore: rename AggregatedProofPublicInfo to `AggregatedProofPublicDa…
Browse files Browse the repository at this point in the history
…ta` (#112)

* chore: rename AggregatedProofPublicInput to AggregatedProofPublicData

* deps: update basecoin rev
  • Loading branch information
Farhad-Shabani authored Mar 29, 2024
1 parent 0b4a8bc commit 0da37e3
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 60 deletions.
44 changes: 21 additions & 23 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 14 additions & 17 deletions clients/sov-celestia/types/src/client_message/aggregated_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,27 @@ use crate::client_message::pretty::PrettySlice;
use crate::error::Error;
use crate::proto::types::v1::{
AggregatedProof as RawAggregatedProof, AggregatedProofData as RawAggregatedProofData,
AggregatedProofPublicInput as RawAggregatedProofPublicInput,
CodeCommitment as RawCodeCommitment, ValidityCondition as RawValidityCondition,
AggregatedProofPublicData as RawAggregatedProofPublicData, CodeCommitment as RawCodeCommitment,
ValidityCondition as RawValidityCondition,
};

/// 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: AggregatedProofPublicInput,
pub public_input: AggregatedProofPublicData,
pub aggregated_proof: AggregatedProof,
}

impl AggregatedProofData {
pub fn new(
public_input: AggregatedProofPublicInput,
aggregated_proof: AggregatedProof,
) -> Self {
pub fn new(public_input: AggregatedProofPublicData, aggregated_proof: AggregatedProof) -> Self {
Self {
public_input,
aggregated_proof,
}
}

pub fn public_input(&self) -> &AggregatedProofPublicInput {
pub fn public_input(&self) -> &AggregatedProofPublicData {
&self.public_input
}

Expand Down Expand Up @@ -82,7 +79,7 @@ impl From<AggregatedProofData> for RawAggregatedProofData {
/// rollups, utilized for verifying the proof.
#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct AggregatedProofPublicInput {
pub struct AggregatedProofPublicData {
pub validity_conditions: Vec<ValidityCondition>,
pub initial_slot_number: Height,
pub final_slot_number: Height,
Expand All @@ -94,7 +91,7 @@ pub struct AggregatedProofPublicInput {
pub code_commitment: CodeCommitment,
}

impl AggregatedProofPublicInput {
impl AggregatedProofPublicData {
pub fn initial_slot_number(&self) -> Height {
self.initial_slot_number
}
Expand All @@ -116,11 +113,11 @@ impl AggregatedProofPublicInput {
}
}

impl Display for AggregatedProofPublicInput {
impl Display for AggregatedProofPublicData {
fn fmt(&self, f: &mut Formatter<'_>) -> core::fmt::Result {
write!(
f,
"AggregatedProofPublicInput {{ 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: {}, input_state_root: {}, post_state_root: {}, code_commitment: {} }}",
PrettySlice(&self.validity_conditions),
self.initial_slot_number,
self.final_slot_number,
Expand All @@ -134,12 +131,12 @@ impl Display for AggregatedProofPublicInput {
}
}

impl Protobuf<RawAggregatedProofPublicInput> for AggregatedProofPublicInput {}
impl Protobuf<RawAggregatedProofPublicData> for AggregatedProofPublicData {}

impl TryFrom<RawAggregatedProofPublicInput> for AggregatedProofPublicInput {
impl TryFrom<RawAggregatedProofPublicData> for AggregatedProofPublicData {
type Error = Error;

fn try_from(raw: RawAggregatedProofPublicInput) -> Result<Self, Self::Error> {
fn try_from(raw: RawAggregatedProofPublicData) -> Result<Self, Self::Error> {
Ok(Self {
validity_conditions: raw
.validity_conditions
Expand All @@ -161,8 +158,8 @@ impl TryFrom<RawAggregatedProofPublicInput> for AggregatedProofPublicInput {
}
}

impl From<AggregatedProofPublicInput> for RawAggregatedProofPublicInput {
fn from(value: AggregatedProofPublicInput) -> Self {
impl From<AggregatedProofPublicData> for RawAggregatedProofPublicData {
fn from(value: AggregatedProofPublicData) -> Self {
Self {
validity_conditions: value
.validity_conditions
Expand Down
2 changes: 1 addition & 1 deletion clients/sov-celestia/types/src/client_message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ pub mod test_util {
pub code_commitment: CodeCommitment,
}

impl From<PublicInputConfig> for AggregatedProofPublicInput {
impl From<PublicInputConfig> for AggregatedProofPublicData {
fn from(config: PublicInputConfig) -> Self {
Self {
validity_conditions: config.validity_conditions,
Expand Down
10 changes: 5 additions & 5 deletions mocks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ tracing = "0.1.36"
typed-builder = "0.18.0"

# internal dependencies
sov-ibc = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "66138b87" }
sov-ibc-transfer = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "66138b87" }
sov-consensus-state-tracker = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "66138b87" }
sov-celestia-client = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "66138b87", features = ["test-util"] }
sov-ibc = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "81e006fe" }
sov-ibc-transfer = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "81e006fe" }
sov-consensus-state-tracker = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "81e006fe" }
sov-celestia-client = { git = "https://github.com/informalsystems/sovereign-ibc.git", rev = "81e006fe", features = ["test-util"] }

# ibc dependencies
ibc-core = { workspace = true }
Expand All @@ -43,7 +43,7 @@ ibc-query = { workspace = true }
ibc-testkit = { workspace = true }

# cosmos dependencies
basecoin = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "8f9a6f1" }
basecoin = { git = "https://github.com/informalsystems/basecoin-rs.git", rev = "c7807d4" }
tendermint = { workspace = true }
tendermint-testgen = { workspace = true }

Expand Down
4 changes: 2 additions & 2 deletions proto/definitions/sovereign/types/v1/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import "gogoproto/gogo.proto";
// proof data information, and aggregated proof bytes.
message AggregatedProofData {
// the public input of the aggregated proof
AggregatedProofPublicInput public_input = 1;
AggregatedProofPublicData public_input = 1;
// the aggregated proof bytes
AggregatedProof aggregated_proof = 2;
}

// AggregatedProofPublicInput defines the public properties of the
// AggregatedProof for the Sovereign SDK rollups, utilized for verifying the
// proof.
message AggregatedProofPublicInput {
message AggregatedProofPublicData {
// The set of validity conditions for each block of the aggregated proof.
repeated ValidityCondition validity_conditions = 1 [
(gogoproto.nullable) = false,
Expand Down
Binary file modified proto/src/prost/proto_descriptor.bin
Binary file not shown.
8 changes: 4 additions & 4 deletions proto/src/prost/sovereign.types.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
pub struct AggregatedProofData {
/// the public input of the aggregated proof
#[prost(message, optional, tag = "1")]
pub public_input: ::core::option::Option<AggregatedProofPublicInput>,
pub public_input: ::core::option::Option<AggregatedProofPublicData>,
/// the aggregated proof bytes
#[prost(message, optional, tag = "2")]
pub aggregated_proof: ::core::option::Option<AggregatedProof>,
Expand All @@ -22,7 +22,7 @@ impl ::prost::Name for AggregatedProofData {
/// proof.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AggregatedProofPublicInput {
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<ValidityCondition>,
Expand Down Expand Up @@ -53,8 +53,8 @@ pub struct AggregatedProofPublicInput {
#[prost(message, optional, tag = "9")]
pub code_commitment: ::core::option::Option<CodeCommitment>,
}
impl ::prost::Name for AggregatedProofPublicInput {
const NAME: &'static str = "AggregatedProofPublicInput";
impl ::prost::Name for AggregatedProofPublicData {
const NAME: &'static str = "AggregatedProofPublicData";
const PACKAGE: &'static str = "sovereign.types.v1";
fn full_name() -> ::prost::alloc::string::String {
::prost::alloc::format!("sovereign.types.v1.{}", Self::NAME)
Expand Down
16 changes: 8 additions & 8 deletions proto/src/prost/sovereign.types.v1.serde.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl<'de> serde::Deserialize<'de> for AggregatedProofData {
deserializer.deserialize_struct("sovereign.types.v1.AggregatedProofData", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for AggregatedProofPublicInput {
impl serde::Serialize for AggregatedProofPublicData {
#[allow(deprecated)]
fn serialize<S>(&self, serializer: S) -> core::result::Result<S::Ok, S::Error>
where
Expand Down Expand Up @@ -237,7 +237,7 @@ impl serde::Serialize for AggregatedProofPublicInput {
if true {
len += 1;
}
let mut struct_ser = serializer.serialize_struct("sovereign.types.v1.AggregatedProofPublicInput", len)?;
let mut struct_ser = serializer.serialize_struct("sovereign.types.v1.AggregatedProofPublicData", len)?;
if true {
struct_ser.serialize_field("validityConditions", &self.validity_conditions)?;
}
Expand Down Expand Up @@ -275,7 +275,7 @@ impl serde::Serialize for AggregatedProofPublicInput {
struct_ser.end()
}
}
impl<'de> serde::Deserialize<'de> for AggregatedProofPublicInput {
impl<'de> serde::Deserialize<'de> for AggregatedProofPublicData {
#[allow(deprecated)]
fn deserialize<D>(deserializer: D) -> core::result::Result<Self, D::Error>
where
Expand Down Expand Up @@ -352,13 +352,13 @@ impl<'de> serde::Deserialize<'de> for AggregatedProofPublicInput {
}
struct GeneratedVisitor;
impl<'de> serde::de::Visitor<'de> for GeneratedVisitor {
type Value = AggregatedProofPublicInput;
type Value = AggregatedProofPublicData;

fn expecting(&self, formatter: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
formatter.write_str("struct sovereign.types.v1.AggregatedProofPublicInput")
formatter.write_str("struct sovereign.types.v1.AggregatedProofPublicData")
}

fn visit_map<V>(self, mut map_: V) -> core::result::Result<AggregatedProofPublicInput, V::Error>
fn visit_map<V>(self, mut map_: V) -> core::result::Result<AggregatedProofPublicData, V::Error>
where
V: serde::de::MapAccess<'de>,
{
Expand Down Expand Up @@ -443,7 +443,7 @@ impl<'de> serde::Deserialize<'de> for AggregatedProofPublicInput {
}
}
}
Ok(AggregatedProofPublicInput {
Ok(AggregatedProofPublicData {
validity_conditions: validity_conditions__.unwrap_or_default(),
initial_slot_number: initial_slot_number__.unwrap_or_default(),
final_slot_number: final_slot_number__.unwrap_or_default(),
Expand All @@ -456,7 +456,7 @@ impl<'de> serde::Deserialize<'de> for AggregatedProofPublicInput {
})
}
}
deserializer.deserialize_struct("sovereign.types.v1.AggregatedProofPublicInput", FIELDS, GeneratedVisitor)
deserializer.deserialize_struct("sovereign.types.v1.AggregatedProofPublicData", FIELDS, GeneratedVisitor)
}
}
impl serde::Serialize for CodeCommitment {
Expand Down

0 comments on commit 0da37e3

Please sign in to comment.