From 67573b0a39e856df32a97e70a6ae9260a966d0cd Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Wed, 8 Jan 2025 16:49:59 +0100 Subject: [PATCH 01/13] Add ChainId to CometClientState --- .../src/components/encoding/cairo.rs | 4 +- .../src/impls/messages/create_client.rs | 1 + .../src/types/cosmos/client_state.rs | 52 ++++++++++++++++--- .../src/contexts/encoding/cairo.rs | 6 ++- 4 files changed, 53 insertions(+), 10 deletions(-) diff --git a/relayer/crates/starknet-chain-components/src/components/encoding/cairo.rs b/relayer/crates/starknet-chain-components/src/components/encoding/cairo.rs index 48de308f..d840415c 100644 --- a/relayer/crates/starknet-chain-components/src/components/encoding/cairo.rs +++ b/relayer/crates/starknet-chain-components/src/components/encoding/cairo.rs @@ -10,6 +10,7 @@ use hermes_cairo_encoding_components::impls::encode_mut::vec::EncodeList; use hermes_cairo_encoding_components::strategy::ViaCairo; pub use hermes_encoding_components::traits::decode_mut::MutDecoderComponent; pub use hermes_encoding_components::traits::encode_mut::MutEncoderComponent; +use ibc::core::host::types::identifiers::ChainId; use starknet::core::types::{Felt, U256}; use crate::types::channel_id::{ @@ -22,7 +23,7 @@ use crate::types::connection_id::{ EncodeConnectionCounterparty, EncodeConnectionEnd, EncodeConnectionId, EncodeConnectionState, }; use crate::types::cosmos::client_state::{ - ClientStatus, CometClientState, EncodeClientStatus, EncodeCometClientState, + ClientStatus, CometClientState, EncodeChainId, EncodeClientStatus, EncodeCometClientState, }; use crate::types::cosmos::consensus_state::{CometConsensusState, EncodeCometConsensusState}; use crate::types::cosmos::height::{EncodeHeight, Height}; @@ -122,6 +123,7 @@ delegate_components! { (ViaCairo, CometClientState): EncodeCometClientState, (ViaCairo, CometConsensusState): EncodeCometConsensusState, (ViaCairo, ClientId): EncodeClientId, + (ViaCairo, ChainId): EncodeChainId, (ViaCairo, ConnectionId): EncodeConnectionId, (ViaCairo, ConnectionCounterparty): EncodeConnectionCounterparty, (ViaCairo, ConnectionState): EncodeConnectionState, diff --git a/relayer/crates/starknet-chain-components/src/impls/messages/create_client.rs b/relayer/crates/starknet-chain-components/src/impls/messages/create_client.rs index a3ab8214..69d38ed9 100644 --- a/relayer/crates/starknet-chain-components/src/impls/messages/create_client.rs +++ b/relayer/crates/starknet-chain-components/src/impls/messages/create_client.rs @@ -64,6 +64,7 @@ where trusting_period: payload.client_state.trusting_period.as_secs(), unbonding_period: payload.client_state.unbonding_period.as_secs(), status: ClientStatus::Active, + chain_id: payload.client_state.chain_id, }; let consensus_state = CometConsensusState { diff --git a/relayer/crates/starknet-chain-components/src/types/cosmos/client_state.rs b/relayer/crates/starknet-chain-components/src/types/cosmos/client_state.rs index 004bd352..70e92fe7 100644 --- a/relayer/crates/starknet-chain-components/src/types/cosmos/client_state.rs +++ b/relayer/crates/starknet-chain-components/src/types/cosmos/client_state.rs @@ -31,6 +31,7 @@ pub struct CometClientState { pub trusting_period: u64, pub unbonding_period: u64, pub status: ClientStatus, + pub chain_id: ChainId, } #[derive(Debug)] @@ -75,9 +76,8 @@ where false // todo } - fn client_state_chain_id(_client_state: &CometClientState) -> ChainId { - // FIXME: Store Cosmos chain ID in CometClientState and return it here - ChainId::new("cosmos").unwrap() + fn client_state_chain_id(client_state: &CometClientState) -> ChainId { + client_state.chain_id.clone() } } @@ -89,6 +89,7 @@ delegate_components! { EncodeField, EncodeField, EncodeField, + EncodeField, ], >, MutDecoderComponent: DecodeFrom, @@ -96,17 +97,24 @@ delegate_components! { } impl Transformer for EncodeCometClientState { - type From = Product![Height, u64, u64, ClientStatus]; + type From = Product![Height, u64, u64, ClientStatus, ChainId]; type To = CometClientState; fn transform( - product![latest_height, trusting_period, unbonding_period, status]: Self::From, + product![ + latest_height, + trusting_period, + unbonding_period, + status, + chain_id + ]: Self::From, ) -> CometClientState { CometClientState { latest_height, trusting_period, unbonding_period, status, + chain_id, } } } @@ -149,10 +157,8 @@ impl Transformer for EncodeClientStatus { impl From for Any { fn from(client_state: CometClientState) -> Self { - let chain_revision_number = client_state.latest_height.revision_number; - IbcCometClientState::new( - ChainId::new(&format!("cosmos-{}", chain_revision_number)).expect("no error"), + client_state.chain_id, TrustThreshold::ONE_THIRD, Duration::from_secs(client_state.trusting_period), Duration::from_secs(client_state.unbonding_period), @@ -173,3 +179,33 @@ impl From for Any { .into() } } + +pub struct EncodeChainId; + +delegate_components! { + EncodeChainId { + [ + MutEncoderComponent, + MutDecoderComponent, + ]: EncodeVariantFrom, + } +} + +impl TransformerRef for EncodeChainId { + type From = ChainId; + type To<'a> = (String, u64); + + fn transform<'a>(value: &'a Self::From) -> Self::To<'a> { + (value.as_str().to_string(), value.revision_number()) + } +} + +impl Transformer for EncodeChainId { + type From = (String, u64); + type To = ChainId; + + fn transform((id, revision_number): Self::From) -> Self::To { + let chain_id_str = format!("{id}-{revision_number}"); + ChainId::new(&chain_id_str).unwrap() + } +} diff --git a/relayer/crates/starknet-chain-context/src/contexts/encoding/cairo.rs b/relayer/crates/starknet-chain-context/src/contexts/encoding/cairo.rs index e53152eb..7c022659 100644 --- a/relayer/crates/starknet-chain-context/src/contexts/encoding/cairo.rs +++ b/relayer/crates/starknet-chain-context/src/contexts/encoding/cairo.rs @@ -46,6 +46,7 @@ use hermes_starknet_chain_components::types::messages::ibc::ibc_transfer::{ }; use hermes_starknet_chain_components::types::messages::ibc::packet::Packet; use hermes_starknet_chain_components::types::register::{MsgRegisterApp, MsgRegisterClient}; +use ibc::core::host::types::identifiers::ChainId; use starknet::core::types::{Felt, U256}; use crate::impls::error::HandleStarknetChainError; @@ -131,7 +132,10 @@ pub trait CanUseCairoEncoding: + CanEncodeAndDecode + CanEncodeAndDecode + CanEncodeAndDecode - + CanEncodeAndDecode + //+ CanEncodeAndDecode + + CanEncode + //+ CanEncode + //+ CanDecode + CanEncodeAndDecode + CanEncodeAndDecode + CanEncodeAndDecode From b21de5c6af1f62c2c3c5e050c79375024e92d899 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Wed, 8 Jan 2025 17:30:11 +0100 Subject: [PATCH 02/13] use MutEncoder and MutDecoder --- .../src/types/cosmos/client_state.rs | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/relayer/crates/starknet-chain-components/src/types/cosmos/client_state.rs b/relayer/crates/starknet-chain-components/src/types/cosmos/client_state.rs index 70e92fe7..97e15133 100644 --- a/relayer/crates/starknet-chain-components/src/types/cosmos/client_state.rs +++ b/relayer/crates/starknet-chain-components/src/types/cosmos/client_state.rs @@ -13,6 +13,8 @@ use hermes_cosmos_chain_components::components::client::ClientStateTypeComponent use hermes_encoding_components::impls::encode_mut::combine::CombineEncoders; use hermes_encoding_components::impls::encode_mut::field::EncodeField; use hermes_encoding_components::impls::encode_mut::from::DecodeFrom; +use hermes_encoding_components::traits::decode_mut::{CanDecodeMut, MutDecoder}; +use hermes_encoding_components::traits::encode_mut::{CanEncodeMut, MutEncoder}; use hermes_encoding_components::traits::transform::{Transformer, TransformerRef}; use hermes_wasm_encoding_components::components::{MutDecoderComponent, MutEncoderComponent}; use ibc::clients::tendermint::types::{ @@ -182,30 +184,30 @@ impl From for Any { pub struct EncodeChainId; -delegate_components! { - EncodeChainId { - [ - MutEncoderComponent, - MutDecoderComponent, - ]: EncodeVariantFrom, - } -} - -impl TransformerRef for EncodeChainId { - type From = ChainId; - type To<'a> = (String, u64); - - fn transform<'a>(value: &'a Self::From) -> Self::To<'a> { - (value.as_str().to_string(), value.revision_number()) +impl MutEncoder for EncodeChainId +where + Encoding: CanEncodeMut, +{ + fn encode_mut( + encoding: &Encoding, + chain_id: &ChainId, + buffer: &mut Encoding::EncodeBuffer, + ) -> Result<(), Encoding::Error> { + let chain_id_str = chain_id.as_str().to_string(); + encoding.encode_mut(&chain_id_str, buffer)?; + Ok(()) } } -impl Transformer for EncodeChainId { - type From = (String, u64); - type To = ChainId; - - fn transform((id, revision_number): Self::From) -> Self::To { - let chain_id_str = format!("{id}-{revision_number}"); - ChainId::new(&chain_id_str).unwrap() +impl MutDecoder for EncodeChainId +where + Encoding: CanDecodeMut + CanRaiseError<&'static str>, +{ + fn decode_mut<'a>( + encoding: &Encoding, + buffer: &mut Encoding::DecodeBuffer<'a>, + ) -> Result { + let chain_id_str = encoding.decode_mut(buffer)?; + ChainId::new(&chain_id_str).map_err(|_| Encoding::raise_error("invalid chain id")) } } From dc556536a9418bd3cf4a8ee499374d1e69de5eb0 Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Wed, 8 Jan 2025 17:41:17 +0100 Subject: [PATCH 03/13] Fix clippy --- .../starknet-chain-context/src/contexts/encoding/cairo.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/relayer/crates/starknet-chain-context/src/contexts/encoding/cairo.rs b/relayer/crates/starknet-chain-context/src/contexts/encoding/cairo.rs index 7c022659..e53152eb 100644 --- a/relayer/crates/starknet-chain-context/src/contexts/encoding/cairo.rs +++ b/relayer/crates/starknet-chain-context/src/contexts/encoding/cairo.rs @@ -46,7 +46,6 @@ use hermes_starknet_chain_components::types::messages::ibc::ibc_transfer::{ }; use hermes_starknet_chain_components::types::messages::ibc::packet::Packet; use hermes_starknet_chain_components::types::register::{MsgRegisterApp, MsgRegisterClient}; -use ibc::core::host::types::identifiers::ChainId; use starknet::core::types::{Felt, U256}; use crate::impls::error::HandleStarknetChainError; @@ -132,10 +131,7 @@ pub trait CanUseCairoEncoding: + CanEncodeAndDecode + CanEncodeAndDecode + CanEncodeAndDecode - //+ CanEncodeAndDecode - + CanEncode - //+ CanEncode - //+ CanDecode + + CanEncodeAndDecode + CanEncodeAndDecode + CanEncodeAndDecode + CanEncodeAndDecode From ecb9b2119cff9241a0244465449959c00d3591d5 Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Thu, 9 Jan 2025 12:35:03 +0100 Subject: [PATCH 04/13] Update CometClientState in Cairo to add chain_id field --- .../packages/clients/src/cometbft/client_state.cairo | 3 ++- cairo-contracts/packages/testkit/src/configs/cometbft.cairo | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cairo-contracts/packages/clients/src/cometbft/client_state.cairo b/cairo-contracts/packages/clients/src/cometbft/client_state.cairo index ad7f32df..297381b5 100644 --- a/cairo-contracts/packages/clients/src/cometbft/client_state.cairo +++ b/cairo-contracts/packages/clients/src/cometbft/client_state.cairo @@ -2,12 +2,13 @@ use core::num::traits::Zero; use starknet_ibc_clients::cometbft::CometErrors; use starknet_ibc_core::client::{Height, HeightPartialOrd, Status, StatusTrait}; -#[derive(Clone, Debug, Drop, Hash, PartialEq, Serde, starknet::Store)] +#[derive(Clone, Debug, Drop, PartialEq, Serde, starknet::Store)] pub struct CometClientState { pub latest_height: Height, pub trusting_period: u64, pub unbonding_period: u64, pub status: Status, + pub chain_id: ByteArray, } #[generate_trait] diff --git a/cairo-contracts/packages/testkit/src/configs/cometbft.cairo b/cairo-contracts/packages/testkit/src/configs/cometbft.cairo index dcad5358..fdaa44e7 100644 --- a/cairo-contracts/packages/testkit/src/configs/cometbft.cairo +++ b/cairo-contracts/packages/testkit/src/configs/cometbft.cairo @@ -36,6 +36,7 @@ pub impl CometClientConfigImpl of CometClientConfigTrait { trusting_period: *self.trusting_period, unbonding_period: *self.unbonding_period, status: Status::Active, + chain_id: "dummy_chain", }; Serde::serialize(@client_state, ref serialized_client_state); From e1611838d13f0ff19582eea630ff2db3758479c6 Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Fri, 10 Jan 2025 10:43:24 +0100 Subject: [PATCH 05/13] Add chain ID type to StarknetClientState as Felt type --- light-client/Cargo.lock | 1779 ++++++++++++++++- light-client/Cargo.toml | 2 + .../ibc-client-starknet-types/Cargo.toml | 1 + .../src/client_state.rs | 2 + .../src/encoding/components.rs | 6 + .../src/encoding/impls/client_state.rs | 12 +- .../src/encoding/impls/felt.rs | 38 + .../src/encoding/impls/mod.rs | 1 + light-client/ibc-client-starknet/Cargo.toml | 1 + .../src/client_state/execution.rs | 4 + .../src/encoding/context.rs | 2 + relayer/Cargo.lock | 1 + .../src/components/encoding/protobuf.rs | 2 + .../impls/payload_builders/create_client.rs | 6 + .../src/impls/types/client.rs | 6 +- 15 files changed, 1835 insertions(+), 28 deletions(-) create mode 100644 light-client/ibc-client-starknet-types/src/encoding/impls/felt.rs diff --git a/light-client/Cargo.lock b/light-client/Cargo.lock index a07cb52c..25e9ff5e 100644 --- a/light-client/Cargo.lock +++ b/light-client/Cargo.lock @@ -2,6 +2,32 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + [[package]] name = "ahash" version = "0.8.11" @@ -20,6 +46,21 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.94" @@ -159,18 +200,61 @@ version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +[[package]] +name = "async-trait" +version = "0.1.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f934833b4b7233644e5848f235df3f57ed8c80f1528a26c3dfa13d2147fa056" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "auto_impl" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "autocfg" version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + [[package]] name = "base16ct" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.7" @@ -195,6 +279,24 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d965446196e3b7decd44aa7ee49e31d630118f90ef12f97900f262eb915c951d" +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + [[package]] name = "blake2" version = "0.10.6" @@ -264,6 +366,18 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + [[package]] name = "byteorder" version = "1.5.0" @@ -470,6 +584,29 @@ dependencies = [ "cgp-component", ] +[[package]] +name = "chrono" +version = "0.4.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e36cc9d416881d2e24f9a963be5fb1cd90966419ac844274161d10488b3e825" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-targets 0.52.6", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + [[package]] name = "const-oid" version = "0.9.6" @@ -488,6 +625,22 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cosmos-sdk-proto" version = "0.26.1" @@ -598,6 +751,15 @@ dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "crossbeam-deque" version = "0.8.6" @@ -651,6 +813,15 @@ dependencies = [ "typenum", ] +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + [[package]] name = "curve25519-dalek" version = "4.1.3" @@ -702,6 +873,41 @@ dependencies = [ "serde", ] +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.90", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.90", +] + [[package]] name = "der" version = "0.7.9" @@ -719,6 +925,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", + "serde", ] [[package]] @@ -879,12 +1086,70 @@ dependencies = [ "zeroize", ] +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + [[package]] name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +[[package]] +name = "eth-keystore" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fda3bf123be441da5260717e0661c25a2fd9cb2b2c1d20bf2e05580047158ab" +dependencies = [ + "aes", + "ctr", + "digest 0.10.7", + "hex", + "hmac", + "pbkdf2", + "rand", + "scrypt", + "serde", + "serde_json", + "sha2 0.10.8", + "sha3", + "thiserror", + "uuid", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-rlp", + "impl-serde 0.4.0", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-rlp", + "impl-serde 0.4.0", + "primitive-types 0.12.2", + "uint 0.9.5", +] + [[package]] name = "ff" version = "0.13.0" @@ -907,9 +1172,22 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" dependencies = [ + "byteorder", + "rand", + "rustc-hex", "static_assertions", ] +[[package]] +name = "flate2" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c936bfdafb507ebbf50b8074c54fa31c5be9a1e7e5f467dd659697041407d07c" +dependencies = [ + "crc32fast", + "miniz_oxide", +] + [[package]] name = "flex-error" version = "0.4.4" @@ -919,6 +1197,27 @@ dependencies = [ "paste", ] +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + [[package]] name = "futures" version = "0.3.31" @@ -998,10 +1297,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + [[package]] name = "group" version = "0.13.0" @@ -1013,6 +1320,31 @@ dependencies = [ "subtle", ] +[[package]] +name = "h2" +version = "0.3.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fe527a889e1532da5c525686d96d4c2e74cdd345badf8dfef9f6b39dd5f5e8" +dependencies = [ + "bytes", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http", + "indexmap 2.7.0", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.13.2" @@ -1086,6 +1418,101 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "http" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "601cbb57e577e2f5ef5be8e7b83f0f63994f25aa94d673e54a92d5c516d101f1" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" +dependencies = [ + "bytes", + "http", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "0.14.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41dfc780fdec9373c01bae43289ea34c972e40ee3c9f6b3c8801a35f35586ce7" +dependencies = [ + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.61" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "ibc" version = "0.56.0" @@ -1120,8 +1547,8 @@ dependencies = [ "displaydoc", "ibc-core", "ibc-proto", - "primitive-types", - "uint", + "primitive-types 0.13.1", + "uint 0.10.0", ] [[package]] @@ -1162,6 +1589,7 @@ dependencies = [ "prost", "prost-types", "serde", + "starknet", ] [[package]] @@ -1187,6 +1615,7 @@ dependencies = [ "ibc-proto", "prost", "serde", + "starknet", "tendermint", ] @@ -1604,19 +2033,213 @@ dependencies = [ ] [[package]] -name = "impl-serde" -version = "0.5.0" +name = "icu_collections" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a143eada6a1ec4aefa5049037a26a6d597bfd64f8c026d07b77133e02b7dd0b" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" dependencies = [ - "serde", + "displaydoc", + "yoke", + "zerofrom", + "zerovec", ] [[package]] -name = "indexmap" -version = "2.7.0" +name = "icu_locid" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-serde" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a143eada6a1ec4aefa5049037a26a6d597bfd64f8c026d07b77133e02b7dd0b" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62f822373a4fe84d4bb149bf54e584a7f4abec90e072ed49cda0edea5b95471f" dependencies = [ "equivalent", "hashbrown 0.15.2", @@ -1632,6 +2255,21 @@ dependencies = [ "serde", ] +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + [[package]] name = "itertools" version = "0.10.5" @@ -1656,6 +2294,16 @@ version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674" +[[package]] +name = "js-sys" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6717b6b5b077764fb5966237269cb3c64edddde4b14ce42647430a78ced9e7b7" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + [[package]] name = "k256" version = "0.13.4" @@ -1677,18 +2325,78 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "lambdaworks-crypto" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbc2a4da0d9e52ccfe6306801a112e81a8fc0c76aa3e4449fefeda7fef72bb34" +dependencies = [ + "lambdaworks-math", + "serde", + "sha2 0.10.8", + "sha3", +] + +[[package]] +name = "lambdaworks-math" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1bd2632acbd9957afc5aeec07ad39f078ae38656654043bf16e046fa2730e23" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "libc" version = "0.2.168" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5aaeb2981e0606ca11d79718f8bb01164f1d6ed75080182d3abf017e6d244b6d" +[[package]] +name = "litemap" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + [[package]] name = "memchr" version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ffbe83022cedc1d264172192511ae958937694cd57ce297164951b8b3568394" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.52.0", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -1723,6 +2431,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.20.2" @@ -1747,12 +2464,53 @@ dependencies = [ "sha2 0.10.8", ] +[[package]] +name = "parity-scale-codec" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "paste" version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" +[[package]] +name = "pbkdf2" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + [[package]] name = "pin-project-lite" version = "0.2.15" @@ -1809,6 +2567,19 @@ dependencies = [ "elliptic-curve", ] +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde 0.4.0", + "uint 0.9.5", +] + [[package]] name = "primitive-types" version = "0.13.1" @@ -1816,8 +2587,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d15600a7d856470b7d278b3fe0e311fe28c2526348549f8ef2ff7db3299c87f5" dependencies = [ "fixed-hash", - "impl-serde", - "uint", + "impl-serde 0.5.0", + "uint 0.10.0", ] [[package]] @@ -1879,12 +2650,19 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + [[package]] name = "rand" version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ + "libc", "rand_chacha", "rand_core", ] @@ -1928,6 +2706,47 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "reqwest" +version = "0.11.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd67538700a17451e7cba03ac727fb961abb7607553461627b97de0b89cf4a62" +dependencies = [ + "base64 0.21.7", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "log", + "mime", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pemfile", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "system-configuration", + "tokio", + "tokio-rustls", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -1938,6 +2757,21 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "ripemd" version = "0.1.3" @@ -1947,6 +2781,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + [[package]] name = "rmp" version = "0.8.14" @@ -1969,6 +2813,18 @@ dependencies = [ "serde", ] +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + [[package]] name = "rustc_version" version = "0.4.1" @@ -1979,18 +2835,58 @@ dependencies = [ ] [[package]] -name = "ryu" -version = "1.0.18" +name = "rustls" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" +dependencies = [ + "log", + "ring", + "rustls-webpki", + "sct", +] [[package]] -name = "schemars" -version = "0.8.21" +name = "rustls-pemfile" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "dyn-clone", + "base64 0.21.7", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring", + "untrusted", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "salsa20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213" +dependencies = [ + "cipher", +] + +[[package]] +name = "schemars" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09c024468a378b7e36765cd36702b7a90cc3cba11654f6685c8f233408e89e92" +dependencies = [ + "dyn-clone", "schemars_derive", "serde", "serde_json", @@ -2008,6 +2904,28 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "scrypt" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f9e24d2b632954ded8ab2ef9fea0a0c769ea56ea98bddbafbad22caeeadf45d" +dependencies = [ + "hmac", + "pbkdf2", + "salsa20", + "sha2 0.10.8", +] + +[[package]] +name = "sct" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "sec1" version = "0.7.3" @@ -2088,6 +3006,17 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_json_pythonic" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62212da9872ca2a0cad0093191ee33753eddff9266cbbc1b4a602d13a3a768db" +dependencies = [ + "itoa", + "ryu", + "serde", +] + [[package]] name = "serde_repr" version = "0.1.19" @@ -2099,6 +3028,74 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "indexmap 1.9.3", + "serde", + "serde_json", + "serde_with_macros 2.3.3", + "time", +] + +[[package]] +name = "serde_with" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros 3.12.0", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "serde_with_macros" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "sha2" version = "0.9.9" @@ -2149,6 +3146,37 @@ dependencies = [ "rand_core", ] +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "socket2" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "spki" version = "0.7.3" @@ -2159,12 +3187,197 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "starknet" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e633a772f59214c296d5037c95c36b72792c9360323818da2b625c7b4ec4b49" +dependencies = [ + "starknet-accounts", + "starknet-contract", + "starknet-core 0.11.1", + "starknet-crypto", + "starknet-macros", + "starknet-providers", + "starknet-signers", +] + +[[package]] +name = "starknet-accounts" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee8a6b588a22c7e79f5d8d4e33413387db63a8beb98be8610138541794cc0a5" +dependencies = [ + "async-trait", + "auto_impl", + "starknet-core 0.11.1", + "starknet-crypto", + "starknet-providers", + "starknet-signers", + "thiserror", +] + +[[package]] +name = "starknet-contract" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5f91344f1e0b81873b6dc235c50ae4d084c6ea4dd4a1e3e27ad895803adb610" +dependencies = [ + "serde", + "serde_json", + "serde_with 2.3.3", + "starknet-accounts", + "starknet-core 0.11.1", + "starknet-providers", + "thiserror", +] + +[[package]] +name = "starknet-core" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d506e02a4083290d13b427dfe437fd95aa8b56315c455bb2f9cdeca76620d457" +dependencies = [ + "base64 0.21.7", + "crypto-bigint", + "flate2", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with 2.3.3", + "sha3", + "starknet-crypto", + "starknet-types-core", +] + +[[package]] +name = "starknet-core" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538240cbe6663c673fe77465f294da707080f39678dd7066761554899e46100" +dependencies = [ + "base64 0.21.7", + "crypto-bigint", + "flate2", + "hex", + "serde", + "serde_json", + "serde_json_pythonic", + "serde_with 3.12.0", + "sha3", + "starknet-crypto", + "starknet-types-core", +] + +[[package]] +name = "starknet-crypto" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded22ccf4cb9e572ce3f77de6066af53560cd2520d508876c83bb1e6b29d5cbc" +dependencies = [ + "crypto-bigint", + "hex", + "hmac", + "num-bigint", + "num-integer", + "num-traits", + "rfc6979", + "sha2 0.10.8", + "starknet-curve", + "starknet-types-core", + "zeroize", +] + +[[package]] +name = "starknet-curve" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcde6bd74269b8161948190ace6cf069ef20ac6e79cd2ba09b320efa7500b6de" +dependencies = [ + "starknet-types-core", +] + +[[package]] +name = "starknet-macros" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8986a940af916fc0a034f4e42c6ba76d94f1e97216d75447693dfd7aefaf3ef2" +dependencies = [ + "starknet-core 0.12.0", + "syn 2.0.90", +] + +[[package]] +name = "starknet-providers" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59c85e0a0f4563ae95dfeae14ea0f0c70610efc0ec2462505c64eff5765e7b97" +dependencies = [ + "async-trait", + "auto_impl", + "ethereum-types", + "flate2", + "getrandom", + "log", + "reqwest", + "serde", + "serde_json", + "serde_with 2.3.3", + "starknet-core 0.11.1", + "thiserror", + "url", +] + +[[package]] +name = "starknet-signers" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17da2139119dbe3aacf1d5d4338798a5c489d17f424916ceb9d2efd83554f87" +dependencies = [ + "async-trait", + "auto_impl", + "crypto-bigint", + "eth-keystore", + "getrandom", + "rand", + "starknet-core 0.11.1", + "starknet-crypto", + "thiserror", +] + +[[package]] +name = "starknet-types-core" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa1b9e01ccb217ab6d475c5cda05dbb22c30029f7bb52b192a010a00d77a3d74" +dependencies = [ + "lambdaworks-crypto", + "lambdaworks-math", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + [[package]] name = "static_assertions" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "subtle" version = "2.6.1" @@ -2208,6 +3421,50 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + [[package]] name = "tendermint" version = "0.40.0" @@ -2293,6 +3550,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", + "itoa", "num-conv", "powerfmt", "serde", @@ -2317,10 +3575,67 @@ dependencies = [ ] [[package]] -name = "toml_datetime" -version = "0.6.8" +name = "tiny-keccak" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.43.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d61fa4ffa3de412bfea335c6ecff681de2b609ba3c77ef3e00e521813a9ed9e" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-rustls" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7fcaa8d55a2bdd6b83ace262b016eca0d79ee02818c5c1bcdf0305114081078" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" @@ -2328,17 +3643,60 @@ version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ - "indexmap", + "indexmap 2.7.0", "toml_datetime", "winnow", ] +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + [[package]] name = "typenum" version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + [[package]] name = "uint" version = "0.10.0" @@ -2363,18 +3721,297 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom", + "serde", +] + [[package]] name = "version_check" version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasm-bindgen" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a474f6281d1d70c17ae7aa6a613c87fce69a127e2624002df63dcb39d6cf6396" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f89bb38646b4f81674e8f5c3fb81b562be1fd936d84320f3264486418519c79" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.90", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.49" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38176d9b44ea84e9184eff0bc34cc167ed044f816accfe5922e54d84cf48eca2" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cc6181fd9a7492eef6fef1f33961e3695e4579b9872a6f7c83aee556666d4fe" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d7a95b763d3c45903ed6c81f156801839e5ee968bb07e534c44df0fcd330c2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.99" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "943aab3fdaaa029a6e0271b35ea10b72b943135afe9bffca82384098ad0e06a6" + +[[package]] +name = "web-sys" +version = "0.3.76" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04dd7223427d52553d3702c004d3b2fe07c148165faa56313cb00211e31c12bc" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.25.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + [[package]] name = "winnow" version = "0.6.20" @@ -2384,6 +4021,61 @@ dependencies = [ "memchr", ] +[[package]] +name = "winreg" +version = "0.50.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "synstructure", +] + [[package]] name = "zerocopy" version = "0.7.35" @@ -2405,6 +4097,27 @@ dependencies = [ "syn 2.0.90", ] +[[package]] +name = "zerofrom" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff3ee08c995dee1859d998dea82f7374f2826091dd9cd47def953cae446cd2e" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "595eed982f7d355beb85837f651fa22e90b3c044842dc7f2c2842c086f295808" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "synstructure", +] + [[package]] name = "zeroize" version = "1.8.1" @@ -2424,3 +4137,25 @@ dependencies = [ "quote", "syn 2.0.90", ] + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] diff --git a/light-client/Cargo.toml b/light-client/Cargo.toml index 4296fe4c..f32252f6 100644 --- a/light-client/Cargo.toml +++ b/light-client/Cargo.toml @@ -38,6 +38,8 @@ hermes-protobuf-encoding-components = { version = "0.1.0" } hermes-cosmos-encoding-components = { version = "0.1.0" } hermes-wasm-encoding-components = { version = "0.1.0" } +starknet = { version = "0.11.0" } + [workspace.lints.rust] unsafe_code = "forbid" dead_code = "deny" diff --git a/light-client/ibc-client-starknet-types/Cargo.toml b/light-client/ibc-client-starknet-types/Cargo.toml index ae641282..fe16b2a2 100644 --- a/light-client/ibc-client-starknet-types/Cargo.toml +++ b/light-client/ibc-client-starknet-types/Cargo.toml @@ -21,6 +21,7 @@ tendermint = { workspace = true } derive_more = { workspace = true } prost = { workspace = true } serde = { workspace = true, optional = true } +starknet = { workspace = true } cgp = { workspace = true } hermes-encoding-components = { workspace = true } hermes-protobuf-encoding-components = { workspace = true } diff --git a/light-client/ibc-client-starknet-types/src/client_state.rs b/light-client/ibc-client-starknet-types/src/client_state.rs index a5789fe3..c4352e77 100644 --- a/light-client/ibc-client-starknet-types/src/client_state.rs +++ b/light-client/ibc-client-starknet-types/src/client_state.rs @@ -1,5 +1,6 @@ use cgp::prelude::*; use ibc_core::client::types::Height; +use starknet::core::types::Felt; pub const STARKNET_CLIENT_STATE_TYPE_URL: &str = "/StarknetClientState"; @@ -7,4 +8,5 @@ pub const STARKNET_CLIENT_STATE_TYPE_URL: &str = "/StarknetClientState"; #[derive(Clone, Debug, PartialEq, derive_more::From, HasField)] pub struct StarknetClientState { pub latest_height: Height, + pub chain_id: Felt, } diff --git a/light-client/ibc-client-starknet-types/src/encoding/components.rs b/light-client/ibc-client-starknet-types/src/encoding/components.rs index 5a9a0044..3128d3b4 100644 --- a/light-client/ibc-client-starknet-types/src/encoding/components.rs +++ b/light-client/ibc-client-starknet-types/src/encoding/components.rs @@ -18,6 +18,7 @@ use hermes_protobuf_encoding_components::types::strategy::{ViaAny, ViaProtobuf}; use ibc_core::client::types::Height; use ibc_core::commitment_types::commitment::CommitmentRoot; use ibc_core::primitives::Timestamp; +use starknet::core::types::Felt; use crate::encoding::impls::client_state::EncodeStarknetClientState; use crate::encoding::impls::consensus_state::EncodeStarknetConsensusState; @@ -27,6 +28,7 @@ use crate::{ StarknetClientState, StarknetConsensusState, STARKNET_CLIENT_STATE_TYPE_URL, STARKNET_CONSENSUS_STATE_TYPE_URL, }; +use crate::encoding::impls::felt::EncodeFelt; cgp_preset! { StarknetLightClientEncodingComponents { @@ -68,6 +70,7 @@ delegate_components! { [ (ViaProtobuf, Any), (ViaProtobuf, Height), + (ViaProtobuf, Felt), (ViaProtobuf, StarknetClientState), (ViaProtobuf, StarknetConsensusState), (ViaProtobuf, StarknetHeader), @@ -93,6 +96,9 @@ delegate_components! { (ViaProtobuf, StarknetClientState): EncodeStarknetClientState, + (ViaProtobuf, Felt): + EncodeFelt, + (ViaProtobuf, StarknetConsensusState): EncodeStarknetConsensusState, diff --git a/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs b/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs index 9318cdbe..ca436d62 100644 --- a/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs +++ b/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs @@ -8,6 +8,7 @@ use hermes_protobuf_encoding_components::components::{MutDecoderComponent, MutEn use hermes_protobuf_encoding_components::impls::encode_mut::proto_field::decode_required::DecodeRequiredProtoField; use hermes_protobuf_encoding_components::impls::encode_mut::proto_field::encode::EncodeLengthDelimitedProtoField; use ibc_core::client::types::Height; +use starknet::core::types::Felt; use crate::StarknetClientState; @@ -21,22 +22,27 @@ delegate_components! { symbol!("latest_height"), EncodeLengthDelimitedProtoField<1, UseContext>, >, + EncodeField< + symbol!("chain_id"), + EncodeLengthDelimitedProtoField<2, UseContext>, + >, ]>, MutDecoderComponent: DecodeFrom< Self, CombineEncoders, + DecodeRequiredProtoField<2, UseContext>, ]> >, } } impl Transformer for EncodeStarknetClientState { - type From = Product![Height]; + type From = Product![Height, Felt]; type To = StarknetClientState; - fn transform(product![latest_height]: Self::From) -> Self::To { - StarknetClientState { latest_height } + fn transform(product![latest_height, chain_id]: Self::From) -> Self::To { + StarknetClientState { latest_height, chain_id } } } diff --git a/light-client/ibc-client-starknet-types/src/encoding/impls/felt.rs b/light-client/ibc-client-starknet-types/src/encoding/impls/felt.rs new file mode 100644 index 00000000..d9637718 --- /dev/null +++ b/light-client/ibc-client-starknet-types/src/encoding/impls/felt.rs @@ -0,0 +1,38 @@ +use core::str::FromStr; + +use cgp::prelude::{CanRaiseError, HasErrorType}; +use hermes_encoding_components::traits::decode_mut::{CanDecodeMut, MutDecoder}; +use hermes_encoding_components::traits::encode_mut::{CanEncodeMut, MutEncoder}; +use hermes_encoding_components::traits::types::encode_buffer::HasEncodeBufferType; +use starknet::core::types::Felt; + +pub struct EncodeFelt; + +impl MutEncoder for EncodeFelt +where + Encoding: HasEncodeBufferType + CanEncodeMut + HasErrorType, +{ + fn encode_mut( + encoding: &Encoding, + felt: &Felt, + buffer: &mut Encoding::EncodeBuffer, + ) -> Result<(), Encoding::Error> { + encoding.encode_mut(&felt.to_string(), buffer)?; + + Ok(()) + } +} + +impl MutDecoder for EncodeFelt +where + Encoding: CanDecodeMut + CanRaiseError<&'static str>, +{ + fn decode_mut( + encoding: &Encoding, + buffer: &mut Encoding::DecodeBuffer<'_>, + ) -> Result { + let felt_str = encoding.decode_mut(buffer)?; + + Felt::from_str(&felt_str).map_err(|_| Encoding::raise_error("invalid felt")) + } +} diff --git a/light-client/ibc-client-starknet-types/src/encoding/impls/mod.rs b/light-client/ibc-client-starknet-types/src/encoding/impls/mod.rs index 1e80278b..8f8921b1 100644 --- a/light-client/ibc-client-starknet-types/src/encoding/impls/mod.rs +++ b/light-client/ibc-client-starknet-types/src/encoding/impls/mod.rs @@ -1,3 +1,4 @@ pub mod client_state; pub mod consensus_state; pub mod header; +pub mod felt; diff --git a/light-client/ibc-client-starknet/Cargo.toml b/light-client/ibc-client-starknet/Cargo.toml index 6e58ccdf..43df4a94 100644 --- a/light-client/ibc-client-starknet/Cargo.toml +++ b/light-client/ibc-client-starknet/Cargo.toml @@ -17,6 +17,7 @@ workspace = true # external dependencies derive_more = { workspace = true } serde = { workspace = true, optional = true } +starknet = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } cgp = { workspace = true } diff --git a/light-client/ibc-client-starknet/src/client_state/execution.rs b/light-client/ibc-client-starknet/src/client_state/execution.rs index 54b328c9..9edd762b 100644 --- a/light-client/ibc-client-starknet/src/client_state/execution.rs +++ b/light-client/ibc-client-starknet/src/client_state/execution.rs @@ -1,3 +1,5 @@ +use core::str::FromStr; + use cgp::core::component::UseContext; use hermes_cosmos_encoding_components::impls::any::ConvertIbcAny; use hermes_encoding_components::impls::convert::ConvertVia; @@ -13,6 +15,7 @@ use ibc_core::host::types::identifiers::ClientId; use ibc_core::host::types::path::{ClientConsensusStatePath, ClientStatePath}; use ibc_core::primitives::proto::Any; use prost_types::Any as ProstAny; +use starknet::core::types::Felt; use super::ClientState; use crate::encoding::context::StarknetLightClientEncoding; @@ -61,6 +64,7 @@ where let new_client_state = ClientStateType { latest_height: header.height, + chain_id: Felt::from_str("dummy").unwrap(), // TODO: fill with correct info } .into(); diff --git a/light-client/ibc-client-starknet/src/encoding/context.rs b/light-client/ibc-client-starknet/src/encoding/context.rs index 3a0fffa1..39a31b4d 100644 --- a/light-client/ibc-client-starknet/src/encoding/context.rs +++ b/light-client/ibc-client-starknet/src/encoding/context.rs @@ -24,6 +24,7 @@ use ibc_core::commitment_types::commitment::CommitmentRoot; use ibc_core::host::types::error::DecodingError; use ibc_core::primitives::{Timestamp, TimestampError}; use prost::DecodeError; +use starknet::core::types::Felt; pub struct StarknetLightClientEncoding; @@ -179,6 +180,7 @@ pub trait CanUseStarknetLightClientEncoding: Async + CanEncodeAndDecode + CanEncodeAndDecode + + CanEncodeAndDecode + CanEncodeAndDecode + CanEncodeAndDecode + CanEncodeAndDecode diff --git a/relayer/Cargo.lock b/relayer/Cargo.lock index 3bd553cb..79739a15 100644 --- a/relayer/Cargo.lock +++ b/relayer/Cargo.lock @@ -2820,6 +2820,7 @@ dependencies = [ "ibc-core", "ibc-proto", "prost", + "starknet", "tendermint", ] diff --git a/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs b/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs index 344cb28a..9d3e0df1 100644 --- a/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs +++ b/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs @@ -33,6 +33,7 @@ use ibc::primitives::Timestamp; use ibc_client_starknet_types::encoding::components::StarknetLightClientEncodingComponents; use ibc_client_starknet_types::header::StarknetHeader; use prost_types::Any; +use starknet::core::types::Felt; use crate::types::client_state::{ ConvertWasmStarknetClientState, StarknetClientState, WasmStarknetClientState, @@ -121,6 +122,7 @@ delegate_components! { (ViaProtobuf, StarknetHeader), (ViaProtobuf, CommitmentRoot), (ViaProtobuf, Timestamp), + (ViaProtobuf, Felt) ]: StarknetLightClientEncodingComponents, } diff --git a/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs b/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs index fdd78457..93d912d6 100644 --- a/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs +++ b/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs @@ -1,4 +1,5 @@ use cgp::prelude::CanRaiseError; +use hermes_chain_components::traits::types::chain_id::HasChainId; use hermes_relayer_components::chain::traits::payload_builders::create_client::CreateClientPayloadBuilder; use hermes_relayer_components::chain::traits::queries::chain_status::CanQueryChainStatus; use hermes_relayer_components::chain::traits::types::create_client::{ @@ -7,6 +8,7 @@ use hermes_relayer_components::chain::traits::types::create_client::{ use ibc::core::client::types::error::ClientError; use ibc::core::client::types::Height; use ibc::primitives::Timestamp; +use starknet::core::types::Felt; use crate::types::client_state::{StarknetClientState, WasmStarknetClientState}; use crate::types::consensus_state::{StarknetConsensusState, WasmStarknetConsensusState}; @@ -25,6 +27,7 @@ where CreateClientPayloadOptions = StarknetCreateClientPayloadOptions, > + HasCreateClientPayloadType + CanQueryChainStatus + + HasChainId + CanRaiseError, { async fn build_create_client_payload( @@ -35,10 +38,13 @@ where let root = Vec::from(chain_status.block_hash.to_bytes_be()); + let chain_id = chain.chain_id(); + let client_state = WasmStarknetClientState { wasm_code_hash: create_client_options.wasm_code_hash.into(), client_state: StarknetClientState { latest_height: Height::new(0, 1).map_err(Chain::raise_error)?, + chain_id: chain_id.clone(), }, }; diff --git a/relayer/crates/starknet-chain-components/src/impls/types/client.rs b/relayer/crates/starknet-chain-components/src/impls/types/client.rs index d685abf9..31af9fb5 100644 --- a/relayer/crates/starknet-chain-components/src/impls/types/client.rs +++ b/relayer/crates/starknet-chain-components/src/impls/types/client.rs @@ -1,3 +1,4 @@ +use core::str::FromStr; use core::time::Duration; use cgp::core::Async; @@ -45,8 +46,7 @@ where false } - fn client_state_chain_id(_client_state: &WasmStarknetClientState) -> Chain::ChainId { - // FIXME: Return actual Starknet chain ID - Felt::ZERO + fn client_state_chain_id(client_state: &WasmStarknetClientState) -> Chain::ChainId { + Felt::from_str(&client_state.client_state.chain_id.to_string()).unwrap() } } From 7467f3191f12ad41fc5c34295b390f3581a9e41a Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Fri, 10 Jan 2025 11:16:02 +0100 Subject: [PATCH 06/13] Use String in Rust code for Chain ID in Starknet client state --- light-client/Cargo.lock | 5 +-- .../src/client_state.rs | 3 +- .../src/encoding/components.rs | 6 --- .../src/encoding/impls/client_state.rs | 2 +- .../src/encoding/impls/felt.rs | 38 ------------------- .../src/encoding/impls/mod.rs | 1 - light-client/ibc-client-starknet/Cargo.toml | 1 - .../src/client_state/execution.rs | 5 +-- .../src/encoding/context.rs | 2 - .../impls/payload_builders/create_client.rs | 7 +--- .../src/impls/types/chain_id.rs | 3 +- .../src/impls/types/client.rs | 6 +-- .../src/contexts/chain.rs | 4 +- 13 files changed, 12 insertions(+), 71 deletions(-) delete mode 100644 light-client/ibc-client-starknet-types/src/encoding/impls/felt.rs diff --git a/light-client/Cargo.lock b/light-client/Cargo.lock index 25e9ff5e..8e2b45f0 100644 --- a/light-client/Cargo.lock +++ b/light-client/Cargo.lock @@ -1589,7 +1589,6 @@ dependencies = [ "prost", "prost-types", "serde", - "starknet", ] [[package]] @@ -2361,9 +2360,9 @@ checksum = "4ee93343901ab17bd981295f2cf0026d4ad018c7c31ba84549a4ddbb47a45104" [[package]] name = "log" -version = "0.4.22" +version = "0.4.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "66182751e71089c2bc2045e441ba6c248d1a468f889bc3a6e316c3e213aa2611" [[package]] name = "memchr" diff --git a/light-client/ibc-client-starknet-types/src/client_state.rs b/light-client/ibc-client-starknet-types/src/client_state.rs index c4352e77..990f75d3 100644 --- a/light-client/ibc-client-starknet-types/src/client_state.rs +++ b/light-client/ibc-client-starknet-types/src/client_state.rs @@ -1,6 +1,5 @@ use cgp::prelude::*; use ibc_core::client::types::Height; -use starknet::core::types::Felt; pub const STARKNET_CLIENT_STATE_TYPE_URL: &str = "/StarknetClientState"; @@ -8,5 +7,5 @@ pub const STARKNET_CLIENT_STATE_TYPE_URL: &str = "/StarknetClientState"; #[derive(Clone, Debug, PartialEq, derive_more::From, HasField)] pub struct StarknetClientState { pub latest_height: Height, - pub chain_id: Felt, + pub chain_id: String, } diff --git a/light-client/ibc-client-starknet-types/src/encoding/components.rs b/light-client/ibc-client-starknet-types/src/encoding/components.rs index 3128d3b4..5a9a0044 100644 --- a/light-client/ibc-client-starknet-types/src/encoding/components.rs +++ b/light-client/ibc-client-starknet-types/src/encoding/components.rs @@ -18,7 +18,6 @@ use hermes_protobuf_encoding_components::types::strategy::{ViaAny, ViaProtobuf}; use ibc_core::client::types::Height; use ibc_core::commitment_types::commitment::CommitmentRoot; use ibc_core::primitives::Timestamp; -use starknet::core::types::Felt; use crate::encoding::impls::client_state::EncodeStarknetClientState; use crate::encoding::impls::consensus_state::EncodeStarknetConsensusState; @@ -28,7 +27,6 @@ use crate::{ StarknetClientState, StarknetConsensusState, STARKNET_CLIENT_STATE_TYPE_URL, STARKNET_CONSENSUS_STATE_TYPE_URL, }; -use crate::encoding::impls::felt::EncodeFelt; cgp_preset! { StarknetLightClientEncodingComponents { @@ -70,7 +68,6 @@ delegate_components! { [ (ViaProtobuf, Any), (ViaProtobuf, Height), - (ViaProtobuf, Felt), (ViaProtobuf, StarknetClientState), (ViaProtobuf, StarknetConsensusState), (ViaProtobuf, StarknetHeader), @@ -96,9 +93,6 @@ delegate_components! { (ViaProtobuf, StarknetClientState): EncodeStarknetClientState, - (ViaProtobuf, Felt): - EncodeFelt, - (ViaProtobuf, StarknetConsensusState): EncodeStarknetConsensusState, diff --git a/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs b/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs index ca436d62..230c121e 100644 --- a/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs +++ b/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs @@ -43,6 +43,6 @@ impl Transformer for EncodeStarknetClientState { type To = StarknetClientState; fn transform(product![latest_height, chain_id]: Self::From) -> Self::To { - StarknetClientState { latest_height, chain_id } + StarknetClientState { latest_height, chain_id: chain_id.to_string() } } } diff --git a/light-client/ibc-client-starknet-types/src/encoding/impls/felt.rs b/light-client/ibc-client-starknet-types/src/encoding/impls/felt.rs deleted file mode 100644 index d9637718..00000000 --- a/light-client/ibc-client-starknet-types/src/encoding/impls/felt.rs +++ /dev/null @@ -1,38 +0,0 @@ -use core::str::FromStr; - -use cgp::prelude::{CanRaiseError, HasErrorType}; -use hermes_encoding_components::traits::decode_mut::{CanDecodeMut, MutDecoder}; -use hermes_encoding_components::traits::encode_mut::{CanEncodeMut, MutEncoder}; -use hermes_encoding_components::traits::types::encode_buffer::HasEncodeBufferType; -use starknet::core::types::Felt; - -pub struct EncodeFelt; - -impl MutEncoder for EncodeFelt -where - Encoding: HasEncodeBufferType + CanEncodeMut + HasErrorType, -{ - fn encode_mut( - encoding: &Encoding, - felt: &Felt, - buffer: &mut Encoding::EncodeBuffer, - ) -> Result<(), Encoding::Error> { - encoding.encode_mut(&felt.to_string(), buffer)?; - - Ok(()) - } -} - -impl MutDecoder for EncodeFelt -where - Encoding: CanDecodeMut + CanRaiseError<&'static str>, -{ - fn decode_mut( - encoding: &Encoding, - buffer: &mut Encoding::DecodeBuffer<'_>, - ) -> Result { - let felt_str = encoding.decode_mut(buffer)?; - - Felt::from_str(&felt_str).map_err(|_| Encoding::raise_error("invalid felt")) - } -} diff --git a/light-client/ibc-client-starknet-types/src/encoding/impls/mod.rs b/light-client/ibc-client-starknet-types/src/encoding/impls/mod.rs index 8f8921b1..1e80278b 100644 --- a/light-client/ibc-client-starknet-types/src/encoding/impls/mod.rs +++ b/light-client/ibc-client-starknet-types/src/encoding/impls/mod.rs @@ -1,4 +1,3 @@ pub mod client_state; pub mod consensus_state; pub mod header; -pub mod felt; diff --git a/light-client/ibc-client-starknet/Cargo.toml b/light-client/ibc-client-starknet/Cargo.toml index 43df4a94..6e58ccdf 100644 --- a/light-client/ibc-client-starknet/Cargo.toml +++ b/light-client/ibc-client-starknet/Cargo.toml @@ -17,7 +17,6 @@ workspace = true # external dependencies derive_more = { workspace = true } serde = { workspace = true, optional = true } -starknet = { workspace = true } prost = { workspace = true } prost-types = { workspace = true } cgp = { workspace = true } diff --git a/light-client/ibc-client-starknet/src/client_state/execution.rs b/light-client/ibc-client-starknet/src/client_state/execution.rs index 9edd762b..d8b72f75 100644 --- a/light-client/ibc-client-starknet/src/client_state/execution.rs +++ b/light-client/ibc-client-starknet/src/client_state/execution.rs @@ -1,5 +1,3 @@ -use core::str::FromStr; - use cgp::core::component::UseContext; use hermes_cosmos_encoding_components::impls::any::ConvertIbcAny; use hermes_encoding_components::impls::convert::ConvertVia; @@ -15,7 +13,6 @@ use ibc_core::host::types::identifiers::ClientId; use ibc_core::host::types::path::{ClientConsensusStatePath, ClientStatePath}; use ibc_core::primitives::proto::Any; use prost_types::Any as ProstAny; -use starknet::core::types::Felt; use super::ClientState; use crate::encoding::context::StarknetLightClientEncoding; @@ -64,7 +61,7 @@ where let new_client_state = ClientStateType { latest_height: header.height, - chain_id: Felt::from_str("dummy").unwrap(), // TODO: fill with correct info + chain_id: "dummy".to_string(), // TODO: fill with correct info } .into(); diff --git a/light-client/ibc-client-starknet/src/encoding/context.rs b/light-client/ibc-client-starknet/src/encoding/context.rs index 39a31b4d..3a0fffa1 100644 --- a/light-client/ibc-client-starknet/src/encoding/context.rs +++ b/light-client/ibc-client-starknet/src/encoding/context.rs @@ -24,7 +24,6 @@ use ibc_core::commitment_types::commitment::CommitmentRoot; use ibc_core::host::types::error::DecodingError; use ibc_core::primitives::{Timestamp, TimestampError}; use prost::DecodeError; -use starknet::core::types::Felt; pub struct StarknetLightClientEncoding; @@ -180,7 +179,6 @@ pub trait CanUseStarknetLightClientEncoding: Async + CanEncodeAndDecode + CanEncodeAndDecode - + CanEncodeAndDecode + CanEncodeAndDecode + CanEncodeAndDecode + CanEncodeAndDecode diff --git a/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs b/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs index 93d912d6..3906b9dc 100644 --- a/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs +++ b/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs @@ -8,7 +8,6 @@ use hermes_relayer_components::chain::traits::types::create_client::{ use ibc::core::client::types::error::ClientError; use ibc::core::client::types::Height; use ibc::primitives::Timestamp; -use starknet::core::types::Felt; use crate::types::client_state::{StarknetClientState, WasmStarknetClientState}; use crate::types::consensus_state::{StarknetConsensusState, WasmStarknetConsensusState}; @@ -27,7 +26,7 @@ where CreateClientPayloadOptions = StarknetCreateClientPayloadOptions, > + HasCreateClientPayloadType + CanQueryChainStatus - + HasChainId + + HasChainId + CanRaiseError, { async fn build_create_client_payload( @@ -38,13 +37,11 @@ where let root = Vec::from(chain_status.block_hash.to_bytes_be()); - let chain_id = chain.chain_id(); - let client_state = WasmStarknetClientState { wasm_code_hash: create_client_options.wasm_code_hash.into(), client_state: StarknetClientState { latest_height: Height::new(0, 1).map_err(Chain::raise_error)?, - chain_id: chain_id.clone(), + chain_id: chain.chain_id().to_string(), }, }; diff --git a/relayer/crates/starknet-chain-components/src/impls/types/chain_id.rs b/relayer/crates/starknet-chain-components/src/impls/types/chain_id.rs index f4aad76e..e9a4593f 100644 --- a/relayer/crates/starknet-chain-components/src/impls/types/chain_id.rs +++ b/relayer/crates/starknet-chain-components/src/impls/types/chain_id.rs @@ -1,9 +1,8 @@ use cgp::core::Async; use hermes_relayer_components::chain::traits::types::chain_id::ProvideChainIdType; -use starknet::core::types::Felt; pub struct ProvideFeltChainId; impl ProvideChainIdType for ProvideFeltChainId { - type ChainId = Felt; + type ChainId = String; } diff --git a/relayer/crates/starknet-chain-components/src/impls/types/client.rs b/relayer/crates/starknet-chain-components/src/impls/types/client.rs index 31af9fb5..25d9a0c3 100644 --- a/relayer/crates/starknet-chain-components/src/impls/types/client.rs +++ b/relayer/crates/starknet-chain-components/src/impls/types/client.rs @@ -1,4 +1,3 @@ -use core::str::FromStr; use core::time::Duration; use cgp::core::Async; @@ -8,7 +7,6 @@ use hermes_relayer_components::chain::traits::types::client_state::{ }; use hermes_relayer_components::chain::traits::types::consensus_state::ProvideConsensusStateType; use hermes_relayer_components::chain::traits::types::height::HasHeightType; -use starknet::core::types::Felt; use crate::types::client_state::WasmStarknetClientState; use crate::types::consensus_state::WasmStarknetConsensusState; @@ -32,7 +30,7 @@ impl ClientStateFieldsGetter where Chain: HasHeightType + HasClientStateType - + HasChainIdType, + + HasChainIdType, { fn client_state_latest_height(client_state: &WasmStarknetClientState) -> u64 { client_state.client_state.latest_height.revision_height() @@ -47,6 +45,6 @@ where } fn client_state_chain_id(client_state: &WasmStarknetClientState) -> Chain::ChainId { - Felt::from_str(&client_state.client_state.chain_id.to_string()).unwrap() + client_state.client_state.chain_id.to_string() } } diff --git a/relayer/crates/starknet-chain-context/src/contexts/chain.rs b/relayer/crates/starknet-chain-context/src/contexts/chain.rs index 3ec6e5b8..cca42b9e 100644 --- a/relayer/crates/starknet-chain-context/src/contexts/chain.rs +++ b/relayer/crates/starknet-chain-context/src/contexts/chain.rs @@ -167,7 +167,7 @@ use crate::impls::error::HandleStarknetChainError; #[derive(HasField, Clone)] pub struct StarknetChain { pub runtime: HermesRuntime, - pub chain_id: Felt, + pub chain_id: String, pub rpc_client: Arc>, pub account: SingleOwnerAccount>, LocalWallet>, pub ibc_client_contract_address: Option, @@ -248,7 +248,7 @@ impl JsonRpcClientGetter for StarknetChainContextComponents { } impl ChainIdGetter for StarknetChainContextComponents { - fn chain_id(chain: &StarknetChain) -> &Felt { + fn chain_id(chain: &StarknetChain) -> &String { &chain.chain_id } } From 70009d7ee4a338ed28a70e10e166767dcbbe1feb Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Fri, 10 Jan 2025 11:18:57 +0100 Subject: [PATCH 07/13] Remove unnecessary Felt to Protobuf wiring --- .../src/components/encoding/protobuf.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs b/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs index 9d3e0df1..344cb28a 100644 --- a/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs +++ b/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs @@ -33,7 +33,6 @@ use ibc::primitives::Timestamp; use ibc_client_starknet_types::encoding::components::StarknetLightClientEncodingComponents; use ibc_client_starknet_types::header::StarknetHeader; use prost_types::Any; -use starknet::core::types::Felt; use crate::types::client_state::{ ConvertWasmStarknetClientState, StarknetClientState, WasmStarknetClientState, @@ -122,7 +121,6 @@ delegate_components! { (ViaProtobuf, StarknetHeader), (ViaProtobuf, CommitmentRoot), (ViaProtobuf, Timestamp), - (ViaProtobuf, Felt) ]: StarknetLightClientEncodingComponents, } From 7ced0466432fce79c759955dc8dad44180463f68 Mon Sep 17 00:00:00 2001 From: Luca Joss Date: Fri, 10 Jan 2025 12:17:26 +0100 Subject: [PATCH 08/13] Replace remaining Felt chainID types to String --- .../src/components/encoding/cairo.rs | 2 +- relayer/crates/starknet-cli/src/contexts/app.rs | 10 +++++----- .../src/contexts/bootstrap.rs | 2 +- .../src/build/components/relay/build.rs | 3 +-- .../crates/starknet-relayer/src/contexts/builder.rs | 5 ++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/relayer/crates/starknet-chain-components/src/components/encoding/cairo.rs b/relayer/crates/starknet-chain-components/src/components/encoding/cairo.rs index d840415c..b7d3ffdc 100644 --- a/relayer/crates/starknet-chain-components/src/components/encoding/cairo.rs +++ b/relayer/crates/starknet-chain-components/src/components/encoding/cairo.rs @@ -11,7 +11,7 @@ use hermes_cairo_encoding_components::strategy::ViaCairo; pub use hermes_encoding_components::traits::decode_mut::MutDecoderComponent; pub use hermes_encoding_components::traits::encode_mut::MutEncoderComponent; use ibc::core::host::types::identifiers::ChainId; -use starknet::core::types::{Felt, U256}; +use starknet::core::types::U256; use crate::types::channel_id::{ ChannelCounterparty, ChannelEnd, ChannelId, ChannelState, EncodeChannelCounterparty, diff --git a/relayer/crates/starknet-cli/src/contexts/app.rs b/relayer/crates/starknet-cli/src/contexts/app.rs index 1a7a8906..a6f9c088 100644 --- a/relayer/crates/starknet-cli/src/contexts/app.rs +++ b/relayer/crates/starknet-cli/src/contexts/app.rs @@ -137,22 +137,22 @@ delegate_components! { delegate_components! { StarknetParserComponents { - (QueryClientStateArgs, symbol!("chain_id")): ParseFromString, + (QueryClientStateArgs, symbol!("chain_id")): ParseFromString, (QueryClientStateArgs, symbol!("client_id")): ParseFromString, (QueryClientStateArgs, symbol!("height")): ParseFromOptionalString, - (QueryConsensusStateArgs, symbol!("chain_id")): ParseFromString, + (QueryConsensusStateArgs, symbol!("chain_id")): ParseFromString, (QueryConsensusStateArgs, symbol!("client_id")): ParseFromString, (QueryConsensusStateArgs, symbol!("query_height")): ParseFromOptionalString, (QueryConsensusStateArgs, symbol!("consensus_height")): ParseFromOptionalString, - (QueryChainStatusArgs, symbol!("chain_id")): ParseFromString, + (QueryChainStatusArgs, symbol!("chain_id")): ParseFromString, - (QueryBalanceArgs, symbol!("chain_id")): ParseFromString, + (QueryBalanceArgs, symbol!("chain_id")): ParseFromString, (QueryBalanceArgs, symbol!("address")): ParseFromString, (QueryBalanceArgs, symbol!("denom")): ParseFromString, - (UpdateClientArgs, symbol!("host_chain_id")): ParseFromString, + (UpdateClientArgs, symbol!("host_chain_id")): ParseFromString, (UpdateClientArgs, symbol!("client_id")): ParseFromString, (UpdateClientArgs, symbol!("counterparty_client_id")): ParseFromString, (UpdateClientArgs, symbol!("target_height")): ParseFromOptionalString, diff --git a/relayer/crates/starknet-integration-tests/src/contexts/bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/bootstrap.rs index da6566e1..a32efeeb 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/bootstrap.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/bootstrap.rs @@ -138,7 +138,7 @@ impl ChainDriverBuilder for StarknetBootstrapComponents { let chain = StarknetChain { runtime: runtime.clone(), - chain_id, + chain_id: chain_id.to_string(), rpc_client, account, ibc_client_contract_address: None, diff --git a/relayer/crates/starknet-relayer/src/build/components/relay/build.rs b/relayer/crates/starknet-relayer/src/build/components/relay/build.rs index 5d49d497..9c761492 100644 --- a/relayer/crates/starknet-relayer/src/build/components/relay/build.rs +++ b/relayer/crates/starknet-relayer/src/build/components/relay/build.rs @@ -5,7 +5,6 @@ use hermes_relayer_components::build::traits::builders::relay_builder::RelayBuil use hermes_relayer_components::multi::types::index::Index; use hermes_starknet_chain_components::types::client_id::ClientId as StarknetClientId; use ibc::core::host::types::identifiers::{ChainId, ClientId as CosmosClientId}; -use starknet::core::types::Felt; use crate::contexts::builder::{StarknetBuildComponents, StarknetBuilder}; use crate::contexts::starknet_to_cosmos_relay::StarknetToCosmosRelay; @@ -14,7 +13,7 @@ impl RelayBuilder, Index<1>> for StarknetBuildComponen async fn build_relay( build: &StarknetBuilder, _index: PhantomData<(Index<0>, Index<1>)>, - _src_chain_id: &Felt, + _src_chain_id: &String, dst_chain_id: &ChainId, src_client_id: &StarknetClientId, dst_client_id: &CosmosClientId, diff --git a/relayer/crates/starknet-relayer/src/contexts/builder.rs b/relayer/crates/starknet-relayer/src/contexts/builder.rs index 20f889a8..904621fb 100644 --- a/relayer/crates/starknet-relayer/src/contexts/builder.rs +++ b/relayer/crates/starknet-relayer/src/contexts/builder.rs @@ -26,7 +26,6 @@ use hermes_starknet_chain_context::contexts::chain::StarknetChain; use hermes_starknet_chain_context::impls::error::HandleStarknetChainError; use ibc::core::host::types::identifiers::{ChainId, ClientId as CosmosClientId}; use starknet::accounts::{ExecutionEncoding, SingleOwnerAccount}; -use starknet::core::types::Felt; use starknet::providers::jsonrpc::HttpTransport; use starknet::providers::{JsonRpcClient, Provider}; use starknet::signers::{LocalWallet, SigningKey}; @@ -89,7 +88,7 @@ impl ChainBuilder> for StarknetBuildComponents { async fn build_chain( build: &StarknetBuilder, _index: PhantomData>, - _chain_id: &Felt, + _chain_id: &String, ) -> Result { build.build_chain().await } @@ -143,7 +142,7 @@ impl StarknetBuilder { let context = StarknetChain { runtime: self.runtime.clone(), - chain_id, + chain_id: chain_id.to_string(), rpc_client, account, ibc_client_contract_address: None, From 546bd9830d9659716000522c708bbf7ddd6e17aa Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Fri, 10 Jan 2025 15:12:27 +0100 Subject: [PATCH 09/13] use ChainId for chain_id type --- .../ibc-client-starknet-types/src/client_state.rs | 3 ++- .../src/encoding/impls/client_state.rs | 9 ++++++--- .../src/client_state/execution.rs | 2 +- .../src/impls/payload_builders/create_client.rs | 5 +++-- .../src/impls/types/chain_id.rs | 3 ++- .../src/impls/types/client.rs | 5 +++-- .../starknet-chain-context/src/contexts/chain.rs | 9 ++++++--- relayer/crates/starknet-cli/src/contexts/app.rs | 12 ++++++------ .../src/contexts/bootstrap.rs | 2 +- .../src/build/components/relay/build.rs | 2 +- .../crates/starknet-relayer/src/contexts/builder.rs | 4 ++-- 11 files changed, 33 insertions(+), 23 deletions(-) diff --git a/light-client/ibc-client-starknet-types/src/client_state.rs b/light-client/ibc-client-starknet-types/src/client_state.rs index 990f75d3..1502c0f5 100644 --- a/light-client/ibc-client-starknet-types/src/client_state.rs +++ b/light-client/ibc-client-starknet-types/src/client_state.rs @@ -1,5 +1,6 @@ use cgp::prelude::*; use ibc_core::client::types::Height; +use ibc_core::host::types::identifiers::ChainId; pub const STARKNET_CLIENT_STATE_TYPE_URL: &str = "/StarknetClientState"; @@ -7,5 +8,5 @@ pub const STARKNET_CLIENT_STATE_TYPE_URL: &str = "/StarknetClientState"; #[derive(Clone, Debug, PartialEq, derive_more::From, HasField)] pub struct StarknetClientState { pub latest_height: Height, - pub chain_id: String, + pub chain_id: ChainId, } diff --git a/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs b/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs index 230c121e..2282d11d 100644 --- a/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs +++ b/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs @@ -8,7 +8,7 @@ use hermes_protobuf_encoding_components::components::{MutDecoderComponent, MutEn use hermes_protobuf_encoding_components::impls::encode_mut::proto_field::decode_required::DecodeRequiredProtoField; use hermes_protobuf_encoding_components::impls::encode_mut::proto_field::encode::EncodeLengthDelimitedProtoField; use ibc_core::client::types::Height; -use starknet::core::types::Felt; +use ibc_core::host::types::identifiers::ChainId; use crate::StarknetClientState; @@ -38,11 +38,14 @@ delegate_components! { } impl Transformer for EncodeStarknetClientState { - type From = Product![Height, Felt]; + type From = Product![Height, ChainId]; type To = StarknetClientState; fn transform(product![latest_height, chain_id]: Self::From) -> Self::To { - StarknetClientState { latest_height, chain_id: chain_id.to_string() } + StarknetClientState { + latest_height, + chain_id, + } } } diff --git a/light-client/ibc-client-starknet/src/client_state/execution.rs b/light-client/ibc-client-starknet/src/client_state/execution.rs index d8b72f75..6ee83a5e 100644 --- a/light-client/ibc-client-starknet/src/client_state/execution.rs +++ b/light-client/ibc-client-starknet/src/client_state/execution.rs @@ -61,7 +61,7 @@ where let new_client_state = ClientStateType { latest_height: header.height, - chain_id: "dummy".to_string(), // TODO: fill with correct info + chain_id: "dummy".parse().unwrap(), // TODO: fill with correct info } .into(); diff --git a/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs b/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs index 3906b9dc..e440835a 100644 --- a/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs +++ b/relayer/crates/starknet-chain-components/src/impls/payload_builders/create_client.rs @@ -7,6 +7,7 @@ use hermes_relayer_components::chain::traits::types::create_client::{ }; use ibc::core::client::types::error::ClientError; use ibc::core::client::types::Height; +use ibc::core::host::types::identifiers::ChainId; use ibc::primitives::Timestamp; use crate::types::client_state::{StarknetClientState, WasmStarknetClientState}; @@ -26,7 +27,7 @@ where CreateClientPayloadOptions = StarknetCreateClientPayloadOptions, > + HasCreateClientPayloadType + CanQueryChainStatus - + HasChainId + + HasChainId + CanRaiseError, { async fn build_create_client_payload( @@ -41,7 +42,7 @@ where wasm_code_hash: create_client_options.wasm_code_hash.into(), client_state: StarknetClientState { latest_height: Height::new(0, 1).map_err(Chain::raise_error)?, - chain_id: chain.chain_id().to_string(), + chain_id: chain.chain_id().clone(), }, }; diff --git a/relayer/crates/starknet-chain-components/src/impls/types/chain_id.rs b/relayer/crates/starknet-chain-components/src/impls/types/chain_id.rs index e9a4593f..8b2d890c 100644 --- a/relayer/crates/starknet-chain-components/src/impls/types/chain_id.rs +++ b/relayer/crates/starknet-chain-components/src/impls/types/chain_id.rs @@ -1,8 +1,9 @@ use cgp::core::Async; use hermes_relayer_components::chain::traits::types::chain_id::ProvideChainIdType; +use ibc::core::host::types::identifiers::ChainId; pub struct ProvideFeltChainId; impl ProvideChainIdType for ProvideFeltChainId { - type ChainId = String; + type ChainId = ChainId; } diff --git a/relayer/crates/starknet-chain-components/src/impls/types/client.rs b/relayer/crates/starknet-chain-components/src/impls/types/client.rs index 25d9a0c3..385db5d0 100644 --- a/relayer/crates/starknet-chain-components/src/impls/types/client.rs +++ b/relayer/crates/starknet-chain-components/src/impls/types/client.rs @@ -7,6 +7,7 @@ use hermes_relayer_components::chain::traits::types::client_state::{ }; use hermes_relayer_components::chain::traits::types::consensus_state::ProvideConsensusStateType; use hermes_relayer_components::chain::traits::types::height::HasHeightType; +use ibc::core::host::types::identifiers::ChainId; use crate::types::client_state::WasmStarknetClientState; use crate::types::consensus_state::WasmStarknetConsensusState; @@ -30,7 +31,7 @@ impl ClientStateFieldsGetter where Chain: HasHeightType + HasClientStateType - + HasChainIdType, + + HasChainIdType, { fn client_state_latest_height(client_state: &WasmStarknetClientState) -> u64 { client_state.client_state.latest_height.revision_height() @@ -45,6 +46,6 @@ where } fn client_state_chain_id(client_state: &WasmStarknetClientState) -> Chain::ChainId { - client_state.client_state.chain_id.to_string() + client_state.client_state.chain_id.clone() } } diff --git a/relayer/crates/starknet-chain-context/src/contexts/chain.rs b/relayer/crates/starknet-chain-context/src/contexts/chain.rs index cca42b9e..1f36368a 100644 --- a/relayer/crates/starknet-chain-context/src/contexts/chain.rs +++ b/relayer/crates/starknet-chain-context/src/contexts/chain.rs @@ -6,6 +6,7 @@ use cgp::core::field::impls::use_field::WithField; use cgp::core::types::impls::WithType; use cgp::prelude::*; use hermes_cairo_encoding_components::types::as_felt::AsFelt; +use hermes_chain_type_components::traits::fields::chain_id::HasChainId; use hermes_chain_type_components::traits::types::commitment_proof::HasCommitmentProofType; use hermes_chain_type_components::traits::types::height::HasHeightType; use hermes_chain_type_components::traits::types::message_response::HasMessageResponseType; @@ -153,7 +154,7 @@ use hermes_test_components::chain::traits::queries::balance::CanQueryBalance; use hermes_test_components::chain::traits::types::address::HasAddressType; use hermes_test_components::chain::traits::types::wallet::WalletTypeComponent; use ibc::core::channel::types::packet::Packet; -use ibc::core::host::types::identifiers::{PortId as IbcPortId, Sequence}; +use ibc::core::host::types::identifiers::{ChainId, PortId as IbcPortId, Sequence}; use starknet::accounts::SingleOwnerAccount; use starknet::core::types::Felt; use starknet::providers::jsonrpc::HttpTransport; @@ -167,7 +168,7 @@ use crate::impls::error::HandleStarknetChainError; #[derive(HasField, Clone)] pub struct StarknetChain { pub runtime: HermesRuntime, - pub chain_id: String, + pub chain_id: ChainId, pub rpc_client: Arc>, pub account: SingleOwnerAccount>, LocalWallet>, pub ibc_client_contract_address: Option, @@ -248,7 +249,7 @@ impl JsonRpcClientGetter for StarknetChainContextComponents { } impl ChainIdGetter for StarknetChainContextComponents { - fn chain_id(chain: &StarknetChain) -> &String { + fn chain_id(chain: &StarknetChain) -> &ChainId { &chain.chain_id } } @@ -263,6 +264,7 @@ pub trait CanUseStarknetChain: + HasDefaultEncoding + HasCommitmentProofType + HasAddressType
+ + HasChainId + HasSelectorType + HasBlobType> + HasCommitmentPrefixType> @@ -371,6 +373,7 @@ pub trait CanUseCosmosChainWithStarknet: HasClientStateType + HasUpdateClientPayloadType + HasInitConnectionOptionsType + + HasChainId + HasCounterpartyMessageHeight + HasClientStateFields + CanQueryClientState diff --git a/relayer/crates/starknet-cli/src/contexts/app.rs b/relayer/crates/starknet-cli/src/contexts/app.rs index a6f9c088..807d9975 100644 --- a/relayer/crates/starknet-cli/src/contexts/app.rs +++ b/relayer/crates/starknet-cli/src/contexts/app.rs @@ -64,7 +64,7 @@ use hermes_starknet_integration_tests::contexts::chain_driver::StarknetChainDriv use hermes_starknet_relayer::contexts::builder::StarknetBuilder; use hermes_test_components::chain_driver::traits::config::ConfigUpdater; use ibc::core::client::types::Height; -use ibc::core::host::types::identifiers::ClientId as CosmosClientId; +use ibc::core::host::types::identifiers::{ChainId, ClientId as CosmosClientId}; use starknet::core::types::Felt; use toml::to_string_pretty; @@ -137,22 +137,22 @@ delegate_components! { delegate_components! { StarknetParserComponents { - (QueryClientStateArgs, symbol!("chain_id")): ParseFromString, + (QueryClientStateArgs, symbol!("chain_id")): ParseFromString, (QueryClientStateArgs, symbol!("client_id")): ParseFromString, (QueryClientStateArgs, symbol!("height")): ParseFromOptionalString, - (QueryConsensusStateArgs, symbol!("chain_id")): ParseFromString, + (QueryConsensusStateArgs, symbol!("chain_id")): ParseFromString, (QueryConsensusStateArgs, symbol!("client_id")): ParseFromString, (QueryConsensusStateArgs, symbol!("query_height")): ParseFromOptionalString, (QueryConsensusStateArgs, symbol!("consensus_height")): ParseFromOptionalString, - (QueryChainStatusArgs, symbol!("chain_id")): ParseFromString, + (QueryChainStatusArgs, symbol!("chain_id")): ParseFromString, - (QueryBalanceArgs, symbol!("chain_id")): ParseFromString, + (QueryBalanceArgs, symbol!("chain_id")): ParseFromString, (QueryBalanceArgs, symbol!("address")): ParseFromString, (QueryBalanceArgs, symbol!("denom")): ParseFromString, - (UpdateClientArgs, symbol!("host_chain_id")): ParseFromString, + (UpdateClientArgs, symbol!("host_chain_id")): ParseFromString, (UpdateClientArgs, symbol!("client_id")): ParseFromString, (UpdateClientArgs, symbol!("counterparty_client_id")): ParseFromString, (UpdateClientArgs, symbol!("target_height")): ParseFromOptionalString, diff --git a/relayer/crates/starknet-integration-tests/src/contexts/bootstrap.rs b/relayer/crates/starknet-integration-tests/src/contexts/bootstrap.rs index a32efeeb..9873998d 100644 --- a/relayer/crates/starknet-integration-tests/src/contexts/bootstrap.rs +++ b/relayer/crates/starknet-integration-tests/src/contexts/bootstrap.rs @@ -138,7 +138,7 @@ impl ChainDriverBuilder for StarknetBootstrapComponents { let chain = StarknetChain { runtime: runtime.clone(), - chain_id: chain_id.to_string(), + chain_id: chain_id.to_string().parse().unwrap(), rpc_client, account, ibc_client_contract_address: None, diff --git a/relayer/crates/starknet-relayer/src/build/components/relay/build.rs b/relayer/crates/starknet-relayer/src/build/components/relay/build.rs index 9c761492..2e02cc33 100644 --- a/relayer/crates/starknet-relayer/src/build/components/relay/build.rs +++ b/relayer/crates/starknet-relayer/src/build/components/relay/build.rs @@ -13,7 +13,7 @@ impl RelayBuilder, Index<1>> for StarknetBuildComponen async fn build_relay( build: &StarknetBuilder, _index: PhantomData<(Index<0>, Index<1>)>, - _src_chain_id: &String, + _src_chain_id: &ChainId, dst_chain_id: &ChainId, src_client_id: &StarknetClientId, dst_client_id: &CosmosClientId, diff --git a/relayer/crates/starknet-relayer/src/contexts/builder.rs b/relayer/crates/starknet-relayer/src/contexts/builder.rs index 904621fb..f7ed8547 100644 --- a/relayer/crates/starknet-relayer/src/contexts/builder.rs +++ b/relayer/crates/starknet-relayer/src/contexts/builder.rs @@ -88,7 +88,7 @@ impl ChainBuilder> for StarknetBuildComponents { async fn build_chain( build: &StarknetBuilder, _index: PhantomData>, - _chain_id: &String, + _chain_id: &ChainId, ) -> Result { build.build_chain().await } @@ -142,7 +142,7 @@ impl StarknetBuilder { let context = StarknetChain { runtime: self.runtime.clone(), - chain_id: chain_id.to_string(), + chain_id: chain_id.to_string().parse().unwrap(), rpc_client, account, ibc_client_contract_address: None, From 9904ef4c128897a1d5108c6ee61a46da0bd53d7c Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Fri, 10 Jan 2025 15:44:26 +0100 Subject: [PATCH 10/13] debug: this compiles --- .../src/encoding/impls/client_state.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs b/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs index 2282d11d..15acdd5e 100644 --- a/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs +++ b/light-client/ibc-client-starknet-types/src/encoding/impls/client_state.rs @@ -22,30 +22,30 @@ delegate_components! { symbol!("latest_height"), EncodeLengthDelimitedProtoField<1, UseContext>, >, - EncodeField< - symbol!("chain_id"), - EncodeLengthDelimitedProtoField<2, UseContext>, - >, + // EncodeField< + // symbol!("chain_id"), + // EncodeLengthDelimitedProtoField<2, UseContext>, + // >, ]>, MutDecoderComponent: DecodeFrom< Self, CombineEncoders, - DecodeRequiredProtoField<2, UseContext>, + // DecodeRequiredProtoField<2, UseContext>, ]> >, } } impl Transformer for EncodeStarknetClientState { - type From = Product![Height, ChainId]; + type From = Product![Height /*ChainId*/]; type To = StarknetClientState; - fn transform(product![latest_height, chain_id]: Self::From) -> Self::To { + fn transform(product![latest_height /*chain_id*/]: Self::From) -> Self::To { StarknetClientState { latest_height, - chain_id, + chain_id: ChainId::new("starknet").unwrap(), } } } From 8fa350e9f23e5627ca0b44baaf8875ac206a454b Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Fri, 10 Jan 2025 16:10:42 +0100 Subject: [PATCH 11/13] wire ChainId encoding --- .../ibc-client-starknet-types/src/encoding/components.rs | 2 ++ .../src/components/encoding/protobuf.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/light-client/ibc-client-starknet-types/src/encoding/components.rs b/light-client/ibc-client-starknet-types/src/encoding/components.rs index 5a9a0044..329cb687 100644 --- a/light-client/ibc-client-starknet-types/src/encoding/components.rs +++ b/light-client/ibc-client-starknet-types/src/encoding/components.rs @@ -17,6 +17,7 @@ use hermes_protobuf_encoding_components::types::any::Any; use hermes_protobuf_encoding_components::types::strategy::{ViaAny, ViaProtobuf}; use ibc_core::client::types::Height; use ibc_core::commitment_types::commitment::CommitmentRoot; +use ibc_core::host::types::identifiers::ChainId; use ibc_core::primitives::Timestamp; use crate::encoding::impls::client_state::EncodeStarknetClientState; @@ -88,6 +89,7 @@ delegate_components! { (ViaProtobuf, Any), (ViaProtobuf, CommitmentRoot), (ViaProtobuf, Timestamp), + (ViaProtobuf, ChainId), ]: CosmosEncodingComponents, (ViaProtobuf, StarknetClientState): diff --git a/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs b/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs index 344cb28a..5afea294 100644 --- a/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs +++ b/relayer/crates/starknet-chain-components/src/components/encoding/protobuf.rs @@ -29,6 +29,7 @@ use hermes_wasm_encoding_components::types::consensus_state::WasmConsensusState; use ibc::clients::wasm_types::client_message::ClientMessage; use ibc::core::client::types::Height; use ibc::core::commitment_types::commitment::CommitmentRoot; +use ibc::core::host::types::identifiers::ChainId; use ibc::primitives::Timestamp; use ibc_client_starknet_types::encoding::components::StarknetLightClientEncodingComponents; use ibc_client_starknet_types::header::StarknetHeader; @@ -121,6 +122,7 @@ delegate_components! { (ViaProtobuf, StarknetHeader), (ViaProtobuf, CommitmentRoot), (ViaProtobuf, Timestamp), + (ViaProtobuf, ChainId), ]: StarknetLightClientEncodingComponents, } From e0ad541540fd5f7a44052aec9c8d0cc598a75f91 Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Fri, 10 Jan 2025 16:10:57 +0100 Subject: [PATCH 12/13] add cgp trait bounds --- .../starknet-chain-context/src/contexts/encoding/protobuf.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/relayer/crates/starknet-chain-context/src/contexts/encoding/protobuf.rs b/relayer/crates/starknet-chain-context/src/contexts/encoding/protobuf.rs index 913ad4c8..8cea847c 100644 --- a/relayer/crates/starknet-chain-context/src/contexts/encoding/protobuf.rs +++ b/relayer/crates/starknet-chain-context/src/contexts/encoding/protobuf.rs @@ -3,6 +3,7 @@ use cgp::core::error::{ErrorRaiserComponent, ErrorTypeComponent}; use cgp::prelude::*; use hermes_encoding_components::traits::convert::CanConvertBothWays; use hermes_encoding_components::traits::encode_and_decode::CanEncodeAndDecode; +use hermes_encoding_components::traits::encode_and_decode_mut::CanEncodeAndDecodeMut; use hermes_error::impls::ProvideHermesError; use hermes_protobuf_encoding_components::types::any::Any; use hermes_protobuf_encoding_components::types::strategy::{ViaAny, ViaProtobuf}; @@ -16,6 +17,8 @@ use hermes_starknet_chain_components::types::consensus_state::{ use hermes_wasm_encoding_components::types::client_state::WasmClientState; use hermes_wasm_encoding_components::types::consensus_state::WasmConsensusState; use ibc::clients::wasm_types::client_message::ClientMessage; +use ibc::core::commitment_types::commitment::CommitmentRoot; +use ibc::primitives::Timestamp; use ibc_client_starknet_types::header::StarknetHeader; use crate::impls::error::HandleStarknetChainError; @@ -58,6 +61,8 @@ pub trait CanUseStarknetProtobufEncoding: + CanConvertBothWays + CanConvertBothWays + CanConvertBothWays + + CanEncodeAndDecodeMut + + CanEncodeAndDecodeMut { } From 848eab5fa9d86caf6c1bf48b6ea983f72c90f52f Mon Sep 17 00:00:00 2001 From: Ranadeep Biswas Date: Fri, 10 Jan 2025 16:12:03 +0100 Subject: [PATCH 13/13] comment ChainId cgp bound which does not work --- light-client/ibc-client-starknet/src/encoding/context.rs | 1 + .../starknet-chain-context/src/contexts/encoding/protobuf.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/light-client/ibc-client-starknet/src/encoding/context.rs b/light-client/ibc-client-starknet/src/encoding/context.rs index 3a0fffa1..10b74154 100644 --- a/light-client/ibc-client-starknet/src/encoding/context.rs +++ b/light-client/ibc-client-starknet/src/encoding/context.rs @@ -190,6 +190,7 @@ pub trait CanUseStarknetLightClientEncoding: + CanConvertBothWays + CanEncodeAndDecodeMut + CanEncodeAndDecodeMut +// + CanEncodeAndDecodeMut { } diff --git a/relayer/crates/starknet-chain-context/src/contexts/encoding/protobuf.rs b/relayer/crates/starknet-chain-context/src/contexts/encoding/protobuf.rs index 8cea847c..5acf8fe2 100644 --- a/relayer/crates/starknet-chain-context/src/contexts/encoding/protobuf.rs +++ b/relayer/crates/starknet-chain-context/src/contexts/encoding/protobuf.rs @@ -63,6 +63,7 @@ pub trait CanUseStarknetProtobufEncoding: + CanConvertBothWays + CanEncodeAndDecodeMut + CanEncodeAndDecodeMut +// + CanEncodeAndDecodeMut { }