Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zbuc committed Aug 20, 2024
1 parent 67ebaf6 commit 10a2456
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 84 deletions.
96 changes: 12 additions & 84 deletions crates/core/app/tests/ibc_handshake.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down Expand Up @@ -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<Self, anyhow::Error> {
// // 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?;
// }
// }
10 changes: 10 additions & 0 deletions crates/test/mock-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ impl MockClient {
Ok(self)
}

pub async fn with_sync_to_inner_storage(
mut self,
storage: cnidarium::Storage,
) -> anyhow::Result<Self> {
let latest = storage.latest_snapshot();
self.sync_to_latest(latest).await?;

Ok(self)
}

pub async fn sync_to_latest<R: StateRead>(&mut self, state: R) -> anyhow::Result<()> {
let height = state.get_block_height().await?;
self.sync_to(height, state).await?;
Expand Down

0 comments on commit 10a2456

Please sign in to comment.