diff --git a/Cargo.lock b/Cargo.lock index 473a9a2a48..1e3a7da76c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2248,7 +2248,6 @@ dependencies = [ "beacon-api-types", "bincode 2.0.0-rc.3", "ethereum-light-client-types", - "protos", "serde", "unionlabs", ] diff --git a/generated/rust/protos/Cargo.toml b/generated/rust/protos/Cargo.toml index 590dc5c172..f2511fbc32 100644 --- a/generated/rust/protos/Cargo.toml +++ b/generated/rust/protos/Cargo.toml @@ -360,7 +360,6 @@ proto_full = [ ## @@protoc_insertion_point(features) client = ["tonic"] default = ["proto_full", "std"] -eth-abi = ["ethers", "std"] json-schema = ["schemars"] std = ["prost/std", "serde/std"] diff --git a/lib/berachain-light-client-types/Cargo.toml b/lib/berachain-light-client-types/Cargo.toml index edb3f0029b..5105b80327 100644 --- a/lib/berachain-light-client-types/Cargo.toml +++ b/lib/berachain-light-client-types/Cargo.toml @@ -8,7 +8,6 @@ alloy = { workspace = true, features = ["sol-types"], opti beacon-api-types = { workspace = true } bincode = { workspace = true, features = ["alloc", "derive"], optional = true } ethereum-light-client-types = { workspace = true } -protos = { workspace = true, optional = true, features = ["union+ibc+lightclients+berachain+v1"] } serde = { workspace = true, optional = true, features = ["derive"] } unionlabs = { workspace = true } @@ -22,5 +21,4 @@ bincode = [ "beacon-api-types/bincode", ] ethabi = ["unionlabs/ethabi", "dep:alloy"] -proto = ["dep:protos"] serde = ["beacon-api-types/serde", "ethereum-light-client-types/serde", "dep:serde"] diff --git a/lib/unionlabs/src/aptos/signature.rs b/lib/unionlabs/src/aptos/signature.rs index 0bd9c72bd7..dd0ca68510 100644 --- a/lib/unionlabs/src/aptos/signature.rs +++ b/lib/unionlabs/src/aptos/signature.rs @@ -1,11 +1,7 @@ use macros::model; -use unionlabs_primitives::{FixedBytesError, H768}; +use unionlabs_primitives::H768; -#[model(proto( - raw(protos::union::ibc::lightclients::movement::v1::AggregateSignature), - into, - from -))] +#[model] #[cfg_attr(feature = "bincode", derive(bincode::Encode, bincode::Decode))] pub struct AggregateSignature { pub validator_bitmask: ValidatorBitmask, @@ -17,41 +13,3 @@ pub struct AggregateSignature { pub struct ValidatorBitmask { pub inner: Vec, } - -impl From - for protos::union::ibc::lightclients::movement::v1::AggregateSignature -{ - fn from(value: AggregateSignature) -> Self { - Self { - validator_bitmask: value.validator_bitmask.inner, - sig: value.sig.map(Into::into).unwrap_or_default(), - } - } -} - -#[derive(Debug, Clone, PartialEq, thiserror::Error)] -pub enum TryFromAggregateSignatureError { - #[error("invalid sig")] - Sig(#[from] FixedBytesError), -} - -impl TryFrom - for AggregateSignature -{ - type Error = TryFromAggregateSignatureError; - - fn try_from( - value: protos::union::ibc::lightclients::movement::v1::AggregateSignature, - ) -> Result { - Ok(Self { - validator_bitmask: ValidatorBitmask { - inner: value.validator_bitmask, - }, - sig: if value.sig.is_empty() { - None - } else { - Some(value.sig.try_into()?) - }, - }) - } -} diff --git a/lib/unionlabs/src/linea/proof.rs b/lib/unionlabs/src/linea/proof.rs index 42b99a82a4..0bbb76c703 100644 --- a/lib/unionlabs/src/linea/proof.rs +++ b/lib/unionlabs/src/linea/proof.rs @@ -1,14 +1,6 @@ use macros::model; use serde::{Deserialize, Serialize}; -use crate::errors::{required, MissingField}; - -#[derive(Debug, PartialEq, Clone, thiserror::Error)] -pub enum TryFromMerkleProofError { - #[error(transparent)] - MissingField(#[from] MissingField), -} - #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct MerklePath { @@ -18,32 +10,7 @@ pub struct MerklePath { pub proof_related_nodes: Vec>, } -impl From for protos::union::ibc::lightclients::linea::v1::MerklePath { - fn from(value: MerklePath) -> Self { - Self { - value: value.value, - proof_related_nodes: value.proof_related_nodes, - } - } -} - -impl From for MerklePath { - fn from(value: protos::union::ibc::lightclients::linea::v1::MerklePath) -> Self { - Self { - value: value.value, - proof_related_nodes: value.proof_related_nodes, - } - } -} - -#[model( - proto( - raw(protos::union::ibc::lightclients::linea::v1::InclusionProof), - into, - from - ), - no_serde -)] +#[model(no_serde)] #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct InclusionProof { @@ -53,38 +20,7 @@ pub struct InclusionProof { pub proof: MerklePath, } -impl From for protos::union::ibc::lightclients::linea::v1::InclusionProof { - fn from(value: InclusionProof) -> Self { - Self { - key: value.key, - leaf_index: value.leaf_index, - merkle_path: Some(value.proof.into()), - } - } -} - -impl TryFrom for InclusionProof { - type Error = TryFromMerkleProofError; - - fn try_from( - value: protos::union::ibc::lightclients::linea::v1::InclusionProof, - ) -> Result { - Ok(Self { - key: value.key, - leaf_index: value.leaf_index, - proof: required!(value.merkle_path)?.into(), - }) - } -} - -#[model( - proto( - raw(protos::union::ibc::lightclients::linea::v1::NonInclusionProof), - into, - from - ), - no_serde -)] +#[model(no_serde)] #[derive(Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct NonInclusionProof { @@ -96,34 +32,6 @@ pub struct NonInclusionProof { pub right_proof: MerklePath, } -impl From for protos::union::ibc::lightclients::linea::v1::NonInclusionProof { - fn from(value: NonInclusionProof) -> Self { - Self { - key: value.key, - left_leaf_index: value.left_leaf_index, - left_proof: Some(value.left_proof.into()), - right_leaf_index: value.right_leaf_index, - right_proof: Some(value.right_proof.into()), - } - } -} - -impl TryFrom for NonInclusionProof { - type Error = TryFromMerkleProofError; - - fn try_from( - value: protos::union::ibc::lightclients::linea::v1::NonInclusionProof, - ) -> Result { - Ok(Self { - key: value.key, - left_leaf_index: value.left_leaf_index, - left_proof: required!(value.left_proof)?.into(), - right_leaf_index: value.right_leaf_index, - right_proof: required!(value.right_proof)?.into(), - }) - } -} - #[derive(Clone, PartialEq, Debug, Serialize, Deserialize)] #[serde(untagged)] pub enum MerkleProof { @@ -131,42 +39,6 @@ pub enum MerkleProof { NonInclusion(NonInclusionProof), } -impl From for protos::union::ibc::lightclients::linea::v1::MerkleProof { - fn from(value: MerkleProof) -> Self { - Self { - proof: Some(match value { - MerkleProof::Inclusion(inclusion) => { - protos::union::ibc::lightclients::linea::v1::merkle_proof::Proof::Inclusion( - inclusion.into(), - ) - } - MerkleProof::NonInclusion(noninclusion) => { - protos::union::ibc::lightclients::linea::v1::merkle_proof::Proof::Noninclusion( - noninclusion.into(), - ) - } - }), - } - } -} - -impl TryFrom for MerkleProof { - type Error = TryFromMerkleProofError; - - fn try_from( - value: protos::union::ibc::lightclients::linea::v1::MerkleProof, - ) -> Result { - Ok(match required!(value.proof)? { - protos::union::ibc::lightclients::linea::v1::merkle_proof::Proof::Inclusion( - inclusion, - ) => MerkleProof::Inclusion(inclusion.try_into()?), - protos::union::ibc::lightclients::linea::v1::merkle_proof::Proof::Noninclusion( - noninclusion, - ) => MerkleProof::NonInclusion(noninclusion.try_into()?), - }) - } -} - #[derive(Clone, Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct GetProof { diff --git a/tools/rust-proto.nix b/tools/rust-proto.nix index caea5d23a0..178713b5d4 100644 --- a/tools/rust-proto.nix +++ b/tools/rust-proto.nix @@ -80,10 +80,6 @@ _: { "prost/std" "serde/std" ]; - eth-abi = [ - "ethers" - "std" - ]; client = [ "tonic" ]; json-schema = [ "schemars" ]; # nix attrsets don't preserve order, use this to replace with the insertion point (see command below) diff --git a/voyager/modules/consensus/berachain/Cargo.toml b/voyager/modules/consensus/berachain/Cargo.toml index 766f0125dc..dc28bac732 100644 --- a/voyager/modules/consensus/berachain/Cargo.toml +++ b/voyager/modules/consensus/berachain/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] alloy = { workspace = true, features = ["rpc", "rpc-types", "transports", "transport-http", "transport-ws", "reqwest", "provider-ws"] } beacon-api-types = { workspace = true, features = ["serde", "ssz"] } -berachain-light-client-types = { workspace = true, features = ["proto", "serde"] } +berachain-light-client-types = { workspace = true, features = ["serde"] } cometbft-rpc = { workspace = true } dashmap = { workspace = true } enumorph = { workspace = true } diff --git a/voyager/plugins/client-update/berachain/Cargo.toml b/voyager/plugins/client-update/berachain/Cargo.toml index 44af29ed26..1e725c43d6 100644 --- a/voyager/plugins/client-update/berachain/Cargo.toml +++ b/voyager/plugins/client-update/berachain/Cargo.toml @@ -6,7 +6,7 @@ version = "0.1.0" [dependencies] alloy = { workspace = true, features = ["rpc", "rpc-types", "transports", "transport-http", "transport-ws", "reqwest", "provider-ws"] } beacon-api-types = { workspace = true, features = ["serde", "ssz"] } -berachain-light-client-types = { workspace = true, features = ["proto", "serde"] } +berachain-light-client-types = { workspace = true, features = ["serde"] } cometbft-rpc = { workspace = true } cometbft-types.workspace = true dashmap = { workspace = true }