From 6a38919ce3e693bdbf06fedf401a86d876fa71a6 Mon Sep 17 00:00:00 2001 From: dhruvja Date: Fri, 13 Oct 2023 22:40:53 +0530 Subject: [PATCH] fix formatting --- common/lib/src/varint.rs | 1 - common/sealable-trie/src/nodes.rs | 1 - common/sealable-trie/src/proof/serialisation.rs | 1 - common/sealable-trie/src/trie.rs | 1 - .../programs/solana-ibc/src/client_state.rs | 14 ++++++-------- .../programs/solana-ibc/src/consensus_state.rs | 11 ++++------- .../programs/solana-ibc/src/execution_context.rs | 6 +++++- solana/solana-ibc/programs/solana-ibc/src/tests.rs | 2 +- .../programs/solana-ibc/src/validation_context.rs | 2 +- solana/trie-example/src/lib.rs | 1 - solana/trie-example/src/trie.rs | 3 --- 11 files changed, 17 insertions(+), 26 deletions(-) diff --git a/common/lib/src/varint.rs b/common/lib/src/varint.rs index 63f6b4bd..aa76a235 100644 --- a/common/lib/src/varint.rs +++ b/common/lib/src/varint.rs @@ -113,7 +113,6 @@ impl borsh::BorshDeserialize for VarInt { } } - /// Small on-stack buffer. /// /// # Example diff --git a/common/sealable-trie/src/nodes.rs b/common/sealable-trie/src/nodes.rs index e714f9fd..c2396512 100644 --- a/common/sealable-trie/src/nodes.rs +++ b/common/sealable-trie/src/nodes.rs @@ -483,7 +483,6 @@ impl<'a> ValueRef<'a, bool> { pub fn sealed(self) -> Self { Self { is_sealed: true, hash: self.hash } } } - // ============================================================================= // Conversions diff --git a/common/sealable-trie/src/proof/serialisation.rs b/common/sealable-trie/src/proof/serialisation.rs index ebc393d7..21776a53 100644 --- a/common/sealable-trie/src/proof/serialisation.rs +++ b/common/sealable-trie/src/proof/serialisation.rs @@ -281,7 +281,6 @@ fn invalid_data(msg: String) -> io::Error { io::Error::new(io::ErrorKind::InvalidData, msg) } - #[test] fn test_item_borsh() { #[track_caller] diff --git a/common/sealable-trie/src/trie.rs b/common/sealable-trie/src/trie.rs index 2257bc5b..1e3fc246 100644 --- a/common/sealable-trie/src/trie.rs +++ b/common/sealable-trie/src/trie.rs @@ -328,7 +328,6 @@ impl> Trie { } } - #[cfg(test)] impl Trie> { /// Creates a test trie using a TestAllocator with given capacity. diff --git a/solana/solana-ibc/programs/solana-ibc/src/client_state.rs b/solana/solana-ibc/programs/solana-ibc/src/client_state.rs index b1e42bc6..35d855b4 100644 --- a/solana/solana-ibc/programs/solana-ibc/src/client_state.rs +++ b/solana/solana-ibc/programs/solana-ibc/src/client_state.rs @@ -12,22 +12,20 @@ use ibc::core::ics24_host::identifier::ClientId; use ibc::core::ics24_host::path::{ClientConsensusStatePath, Path}; use ibc::core::timestamp::Timestamp; use ibc::core::{ContextError, ValidationContext}; - +#[cfg(any(test, feature = "mocks"))] +use ibc::mock::client_state::{ + MockClientContext, MockClientState, MOCK_CLIENT_STATE_TYPE_URL, +}; use ibc::{Any, Height}; use ibc_proto::ibc::lightclients::tendermint::v1::ClientState as RawTmClientState; +#[cfg(any(test, feature = "mocks"))] +use ibc_proto::ibc::mock::ClientState as RawMockClientState; use ibc_proto::protobuf::Protobuf; use serde::{Deserialize, Serialize}; use super::consensus_state::AnyConsensusState; use crate::SolanaIbcStorage; -#[cfg(any(test, feature = "mocks"))] -use ibc_proto::ibc::mock::ClientState as RawMockClientState; -#[cfg(any(test, feature = "mocks"))] -use ibc::mock::client_state::{ - MockClientContext, MockClientState, MOCK_CLIENT_STATE_TYPE_URL, -}; - const TENDERMINT_CLIENT_STATE_TYPE_URL: &str = "/ibc.lightclients.tendermint.v1.ClientState"; diff --git a/solana/solana-ibc/programs/solana-ibc/src/consensus_state.rs b/solana/solana-ibc/programs/solana-ibc/src/consensus_state.rs index 545efbf7..36405dd4 100644 --- a/solana/solana-ibc/programs/solana-ibc/src/consensus_state.rs +++ b/solana/solana-ibc/programs/solana-ibc/src/consensus_state.rs @@ -3,19 +3,16 @@ use ibc::core::ics02_client::consensus_state::ConsensusState; use ibc::core::ics02_client::error::ClientError; use ibc::core::ics23_commitment::commitment::CommitmentRoot; use ibc::core::timestamp::Timestamp; - -use ibc_proto::google::protobuf::Any; -use ibc_proto::ibc::lightclients::tendermint::v1::ConsensusState as RawTmConsensusState; -use ibc_proto::protobuf::Protobuf; -use serde::{Deserialize, Serialize}; - - #[cfg(any(test, feature = "mocks"))] use ibc::mock::consensus_state::{ MockConsensusState, MOCK_CONSENSUS_STATE_TYPE_URL, }; +use ibc_proto::google::protobuf::Any; +use ibc_proto::ibc::lightclients::tendermint::v1::ConsensusState as RawTmConsensusState; #[cfg(any(test, feature = "mocks"))] use ibc_proto::ibc::mock::ConsensusState as RawMockConsensusState; +use ibc_proto::protobuf::Protobuf; +use serde::{Deserialize, Serialize}; const TENDERMINT_CONSENSUS_STATE_TYPE_URL: &str = "/ibc.lightclients.tendermint.v1.ConsensusState"; diff --git a/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs b/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs index c46704b3..bdfb21a4 100644 --- a/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs +++ b/solana/solana-ibc/programs/solana-ibc/src/execution_context.rs @@ -58,7 +58,11 @@ impl ClientExecutionContext for SolanaIbcStorage { consensus_state_path: ClientConsensusStatePath, consensus_state: Self::AnyConsensusState, ) -> Result { - msg!("store_consensus_state - path: {}, consensus_state: {:?}", consensus_state_path, consensus_state); + msg!( + "store_consensus_state - path: {}, consensus_state: {:?}", + consensus_state_path, + consensus_state + ); let consensus_state_key = ( consensus_state_path.client_id.to_string(), (consensus_state_path.epoch, consensus_state_path.height), diff --git a/solana/solana-ibc/programs/solana-ibc/src/tests.rs b/solana/solana-ibc/programs/solana-ibc/src/tests.rs index 8051b7b8..16ce4cff 100644 --- a/solana/solana-ibc/programs/solana-ibc/src/tests.rs +++ b/solana/solana-ibc/programs/solana-ibc/src/tests.rs @@ -89,7 +89,7 @@ fn anchor_test_deliver() -> Result<()> { .args(instruction::Deliver { messages: all_messages }) .payer(authority.clone()) .signer(&*authority) - .send_with_spinner_and_config(RpcSendTransactionConfig{ + .send_with_spinner_and_config(RpcSendTransactionConfig { skip_preflight: true, ..RpcSendTransactionConfig::default() })?; // ? gives us the log messages on the why the tx did fail ( better than unwrap ) diff --git a/solana/solana-ibc/programs/solana-ibc/src/validation_context.rs b/solana/solana-ibc/programs/solana-ibc/src/validation_context.rs index 0f014eaf..db2e48ee 100644 --- a/solana/solana-ibc/programs/solana-ibc/src/validation_context.rs +++ b/solana/solana-ibc/programs/solana-ibc/src/validation_context.rs @@ -1,7 +1,7 @@ use std::str::FromStr; use std::time::Duration; -use anchor_lang::prelude::{Pubkey, Clock, SolanaSysvar}; +use anchor_lang::prelude::{Clock, Pubkey, SolanaSysvar}; use ibc::core::ics02_client::error::ClientError; use ibc::core::ics03_connection::connection::ConnectionEnd; use ibc::core::ics03_connection::error::ConnectionError; diff --git a/solana/trie-example/src/lib.rs b/solana/trie-example/src/lib.rs index c28564d8..ce808e9d 100644 --- a/solana/trie-example/src/lib.rs +++ b/solana/trie-example/src/lib.rs @@ -72,7 +72,6 @@ impl TrieResultExt for Result { } } - /// Instruction to execute. pub(crate) enum Instruction<'a> { // Encoding: diff --git a/solana/trie-example/src/trie.rs b/solana/trie-example/src/trie.rs index 6456879c..57a83a5d 100644 --- a/solana/trie-example/src/trie.rs +++ b/solana/trie-example/src/trie.rs @@ -211,8 +211,6 @@ impl<'a, 'b> memory::Allocator for Allocator<'a, 'b> { } } - - impl<'a, 'b> core::ops::Deref for AccountTrie<'a, 'b> { type Target = sealable_trie::Trie>; fn deref(&self) -> &Self::Target { &self.0 } @@ -249,7 +247,6 @@ fn write( right } - #[test] fn test_header_encoding() { const ONE: CryptoHash = CryptoHash([1; 32]);