-
Notifications
You must be signed in to change notification settings - Fork 995
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(voyager): make client-update for state lenses generic (#3461)
- Loading branch information
Showing
16 changed files
with
169 additions
and
508 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
[package] | ||
edition.workspace = true | ||
license-file.workspace = true | ||
name = "state-lens-light-client-types" | ||
repository.workspace = true | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
alloy = { workspace = true, features = ["sol-types"], optional = true } | ||
bincode = { workspace = true, features = ["alloc", "derive"], optional = true } | ||
protos = { workspace = true, optional = true, features = ["proto_full", "serde"] } | ||
serde = { workspace = true, optional = true, features = ["derive"] } | ||
thiserror = { workspace = true } | ||
unionlabs = { workspace = true, features = ["ethabi", "proto"] } | ||
|
||
[features] | ||
bincode = ["dep:bincode", "unionlabs/bincode"] | ||
default = [] | ||
ethabi = ["unionlabs/ethabi", "dep:alloy", "dep:protos"] | ||
serde = ["dep:serde"] | ||
|
||
[lints] | ||
workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use unionlabs::{ibc::core::client::height::Height, primitives::Bytes}; | ||
|
||
#[derive(Debug, Clone, PartialEq)] | ||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] | ||
#[cfg_attr(feature = "bincode", derive(bincode::Encode, bincode::Decode))] | ||
pub struct Header { | ||
pub l1_height: Height, | ||
pub l2_height: Height, | ||
/// Proof of the L2 consensus state as stored in the state of the L1. | ||
pub l2_consensus_state_proof: Bytes, | ||
pub l2_consensus_state: Bytes, | ||
} | ||
|
||
#[cfg(feature = "ethabi")] | ||
pub mod ethabi { | ||
use alloy::sol_types::SolValue; | ||
use unionlabs::{ | ||
encoding::{Encode, EthAbi}, | ||
impl_ethabi_via_try_from_into, | ||
union::ics23, | ||
}; | ||
|
||
use crate::Header; | ||
|
||
impl_ethabi_via_try_from_into!(Header => SolHeader); | ||
|
||
impl Encode<EthAbi> for Header { | ||
fn encode(self) -> Vec<u8> { | ||
Into::<SolHeader>::into(self).abi_encode_params() | ||
} | ||
} | ||
|
||
alloy::sol! { | ||
struct SolHeader { | ||
uint64 l1Height; | ||
uint64 l2Height; | ||
bytes l2InclusionProof; | ||
bytes l2ConsensusState; | ||
} | ||
} | ||
|
||
impl From<Header> for SolHeader { | ||
fn from(value: Header) -> Self { | ||
Self { | ||
l1Height: value.l1_height.height(), | ||
l2Height: value.l2_height.height(), | ||
l2InclusionProof: value.l2_consensus_state_proof.into(), | ||
l2ConsensusState: value.l2_consensus_state.into(), | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
mod header; | ||
|
||
pub use header::Header; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
[package] | ||
edition = "2021" | ||
name = "voyager-client-update-plugin-state-lens" | ||
version = "0.1.0" | ||
|
||
[dependencies] | ||
alloy = { workspace = true, features = ["rpc", "rpc-types", "transports", "transport-http", "transport-ws", "reqwest", "provider-ws"] } | ||
enumorph = { workspace = true } | ||
ibc-union-spec = { workspace = true } | ||
ics23 = { workspace = true } | ||
jsonrpsee = { workspace = true, features = ["macros", "server", "tracing"] } | ||
macros = { workspace = true } | ||
protos = { workspace = true } | ||
serde = { workspace = true, features = ["derive"] } | ||
serde_json = { workspace = true } | ||
state-lens-light-client-types = { workspace = true, features = ["serde"] } | ||
tokio = { workspace = true } | ||
tracing = { workspace = true } | ||
tracing-subscriber = { workspace = true } | ||
unionlabs = { workspace = true } | ||
voyager-message = { workspace = true } | ||
voyager-vm = { workspace = true } |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.