diff --git a/crates/core/app/tests/ibc_handshake.rs b/crates/core/app/tests/ibc_handshake.rs index b2bbac492a..1c5cbc190c 100644 --- a/crates/core/app/tests/ibc_handshake.rs +++ b/crates/core/app/tests/ibc_handshake.rs @@ -1,86 +1,46 @@ use { anyhow::{Context as _, Result}, - cnidarium::{ - ArcStateDeltaExt, Snapshot, StateDelta, StateRead as _, StateWrite as _, Storage, - TempStorage, - }, + cnidarium::{StateRead as _, TempStorage}, common::{ ibc_tests::{get_verified_genesis, MockRelayer, TestNodeWithIBC, ValidatorKeys}, - BuilderExt as _, TempStorageExt as _, + TempStorageExt as _, }, - ibc_proto::{ - google::protobuf::Any, - ibc::core::{ - client::v1::{ - query_client::QueryClient as IbcClientQueryClient, QueryClientStateRequest, - QueryConsensusStateRequest, - }, - connection::v1::QueryConnectionRequest, - }, + ibc_proto::ibc::core::client::v1::{ + query_client::QueryClient as IbcClientQueryClient, QueryClientStateRequest, }, ibc_types::{ core::{ client::{msgs::MsgCreateClient, ClientId, Height}, - commitment::{MerklePath, MerklePrefix, MerkleProof, MerkleRoot}, - connection::ConnectionEnd, + commitment::{MerkleProof, MerkleRoot}, }, lightclients::tendermint::{ - client_state::{ - AllowUpdate, ClientState as TendermintClientState, TENDERMINT_CLIENT_STATE_TYPE_URL, - }, - consensus_state::ConsensusState as TendermintConsensusState, + client_state::{AllowUpdate, ClientState as TendermintClientState}, TrustThreshold, }, - path::{ClientStatePath, ConnectionPath, Path}, + path::ClientStatePath, DomainType as _, }, once_cell::sync::Lazy, - penumbra_app::{ - app::{MAX_BLOCK_TXS_PAYLOAD_BYTES, MAX_EVIDENCE_SIZE_BYTES}, - genesis::{self, AppState}, - server::consensus::Consensus, - }, - penumbra_ibc::{ - component::proof_verification, IbcRelay, MerklePrefixExt, IBC_COMMITMENT_PREFIX, - IBC_PROOF_SPECS, IBC_SUBSTORE_PREFIX, - }, + penumbra_app::server::consensus::Consensus, + penumbra_ibc::{IbcRelay, MerklePrefixExt, IBC_COMMITMENT_PREFIX, IBC_PROOF_SPECS}, penumbra_keys::{keys::SpendKey, test_keys}, penumbra_mock_client::MockClient, penumbra_mock_consensus::TestNode, - penumbra_num::Amount, - penumbra_proof_params::spend, penumbra_proto::{ cnidarium::v1::{ query_service_client::QueryServiceClient as CnidariumQueryServiceClient, KeyValueRequest, }, - core::{ - component::{ - sct::v1::{ - query_service_client::QueryServiceClient as SctQueryServiceClient, - EpochByHeightRequest, - }, - stake::v1::Validator, - }, - keys::v1::{GovernanceKey as ProtoGovernanceKey, IdentityKey as ProtoIdentityKey}, - }, util::tendermint_proxy::v1::{ tendermint_proxy_service_client::TendermintProxyServiceClient, GetBlockByHeightRequest, }, - DomainType, Message as _, StateReadProto as _, StateWriteProto as _, + DomainType, Message as _, }, - penumbra_sct::epoch::Epoch, - penumbra_shielded_pool::genesis::Allocation, - penumbra_stake::{DelegationToken, GovernanceKey, IdentityKey}, penumbra_test_subscriber::set_tracing_subscriber_with_env_filter, penumbra_transaction::{TransactionParameters, TransactionPlan}, - sha2::Digest, - std::{fs::File, io::Write as _, str::FromStr as _, sync::Arc, time::Duration}, + std::{str::FromStr as _, time::Duration}, tap::{Tap, TapFallible as _}, - tendermint::{consensus::params::AbciParams, public_key::Algorithm, Hash}, - tendermint_config::{ - net::Address as TendermintAddress, NodeKey, PrivValidatorKey, TendermintConfig, - }, + tendermint::Hash, tokio::time, tonic::transport::Channel, }; @@ -932,35 +892,3 @@ async fn real_cometbft_tests() -> Result<()> { Ok(()) } - -// // the builder api put the state of the node in a weird place where you couldn't -// // actually make API requests in between -// #[instrument(level = "info", skip_all, fields(height, time))] -// pub async fn begin(self) -> Result { -// // Calling `finish` finishes the previous block -// // and prepares the current block. -// let (test_node, block) = self.finish()?; - -// let Block { -// // The header for the current block -// header, -// data, -// evidence: _, -// // Votes for the previous block -// last_commit, -// .. -// } = block.clone().tap(|block| { -// tracing::span::Span::current() -// .record("height", block.header.height.value()) -// .record("time", block.header.time.unix_timestamp()); -// }); -// let last_commit_info = Self::last_commit_info(last_commit); - -// let height = header.height; -// trace!("sending block"); -// test_node.begin_block(header, last_commit_info).await?; -// for tx in data { -// let tx = tx.into(); -// test_node.deliver_tx(tx).await?; -// } -// } diff --git a/crates/test/mock-client/src/lib.rs b/crates/test/mock-client/src/lib.rs index ea7ecbe960..a46a29e86c 100644 --- a/crates/test/mock-client/src/lib.rs +++ b/crates/test/mock-client/src/lib.rs @@ -42,6 +42,16 @@ impl MockClient { Ok(self) } + pub async fn with_sync_to_inner_storage( + mut self, + storage: cnidarium::Storage, + ) -> anyhow::Result { + let latest = storage.latest_snapshot(); + self.sync_to_latest(latest).await?; + + Ok(self) + } + pub async fn sync_to_latest(&mut self, state: R) -> anyhow::Result<()> { let height = state.get_block_height().await?; self.sync_to(height, state).await?;