Skip to content

Commit

Permalink
Mock IBC Test: Handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
zbuc committed Aug 16, 2024
1 parent 56cb002 commit b40b908
Show file tree
Hide file tree
Showing 44 changed files with 1,659 additions and 139 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
pull_request:
# Don't run Rust tests if only docs changed.
paths-ignore:
- 'docs/**'
- "docs/**"

jobs:
test:
Expand Down Expand Up @@ -48,7 +48,9 @@ jobs:
fi
- name: Run tests with nextest
run: cargo nextest run --release --features migration
# run: cargo nextest run --release --features migration
# only run ibc_handshake test for debugging
run: cargo nextest run --release --features migration ibc_handshake
env:
CARGO_TERM_COLOR: always

Expand Down
3 changes: 2 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use {
self::common::{BuilderExt, TestNodeExt, ValidatorDataReadExt},
anyhow::anyhow,
cnidarium::TempStorage,
common::TempStorageExt as _,
decaf377_rdsa::{SigningKey, SpendAuth, VerificationKey},
penumbra_app::{
genesis::{self, AppState},
Expand Down Expand Up @@ -32,7 +33,7 @@ const EPOCH_DURATION: u64 = 8;
async fn app_can_define_and_delegate_to_a_validator() -> anyhow::Result<()> {
// Install a test logger, acquire some temporary storage, and start the test node.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Configure an AppState with slightly shorter epochs than usual.
let app_state = AppState::Content(
Expand Down
3 changes: 2 additions & 1 deletion crates/core/app/tests/app_can_deposit_into_community_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use {
self::common::BuilderExt,
anyhow::anyhow,
cnidarium::TempStorage,
common::TempStorageExt as _,
penumbra_app::{
genesis::{self, AppState},
server::consensus::Consensus,
Expand All @@ -28,7 +29,7 @@ mod common;
async fn app_can_deposit_into_community_pool() -> anyhow::Result<()> {
// Install a test logger, and acquire some temporary storage.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Define our application state, and start the test node.
let mut test_node = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use {
self::common::ValidatorDataReadExt,
anyhow::anyhow,
cnidarium::TempStorage,
common::TempStorageExt as _,
decaf377_rdsa::VerificationKey,
penumbra_app::{
genesis::{AppState, Content},
Expand Down Expand Up @@ -49,7 +50,7 @@ const PROPOSAL_VOTING_BLOCKS: u64 = 3;
async fn app_can_disable_community_pool_spends() -> anyhow::Result<()> {
// Install a test logger, and acquire some temporary storage.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Define a helper to get the current community pool balance.
let pool_balance = || async { storage.latest_snapshot().community_pool_balance().await };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use {
self::common::ValidatorDataReadExt,
anyhow::anyhow,
cnidarium::TempStorage,
common::TempStorageExt as _,
decaf377_rdsa::VerificationKey,
penumbra_app::{
genesis::{AppState, Content},
Expand Down Expand Up @@ -49,7 +50,7 @@ const PROPOSAL_VOTING_BLOCKS: u64 = 3;
async fn app_can_propose_community_pool_spends() -> anyhow::Result<()> {
// Install a test logger, and acquire some temporary storage.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Define a helper to get the current community pool balance.
let pool_balance = || async { storage.latest_snapshot().community_pool_balance().await };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use {
self::common::BuilderExt,
anyhow::anyhow,
cnidarium::TempStorage,
common::TempStorageExt as _,
penumbra_app::{
genesis::{self, AppState},
server::consensus::Consensus,
Expand All @@ -27,7 +28,7 @@ mod common;
async fn app_can_spend_notes_and_detect_outputs() -> anyhow::Result<()> {
// Install a test logger, acquire some temporary storage, and start the test node.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;
let mut test_node = {
let app_state = AppState::Content(
genesis::Content::default().with_chain_id(TestNode::<()>::CHAIN_ID.to_string()),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use {
anyhow::Context,
cnidarium::TempStorage,
common::TempStorageExt as _,
penumbra_app::{
genesis::{AppState, Content},
server::consensus::Consensus,
Expand Down Expand Up @@ -37,7 +38,7 @@ const COUNT: usize = SWEEP_COUNT + 1;
async fn app_can_sweep_a_collection_of_small_notes() -> anyhow::Result<()> {
// Install a test logger, and acquire some temporary storage.
let guard = common::set_tracing_subscriber_with_env_filter("info".into());
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Instantiate a mock tendermint proxy, which we will connect to the test node.
let proxy = penumbra_mock_tendermint_proxy::TestNodeProxy::new::<Consensus>();
Expand Down
3 changes: 2 additions & 1 deletion crates/core/app/tests/app_can_undelegate_from_a_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use {
self::common::{BuilderExt, TestNodeExt, ValidatorDataReadExt},
anyhow::anyhow,
cnidarium::TempStorage,
common::TempStorageExt as _,
decaf377_fmd::Precision,
penumbra_app::{
genesis::{self, AppState},
Expand Down Expand Up @@ -37,7 +38,7 @@ const UNBONDING_DELAY: u64 = 4;
async fn app_can_undelegate_from_a_validator() -> anyhow::Result<()> {
// Install a test logger, acquire some temporary storage, and start the test node.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Helper function to get the latest block height.
let get_latest_height = || async {
Expand Down
5 changes: 4 additions & 1 deletion crates/core/app/tests/app_check_dex_vcb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ use std::{ops::Deref, sync::Arc};
/// This bug was fixed in #4643.
async fn dex_vcb_tracks_multiswap() -> anyhow::Result<()> {
let mut rng = rand_chacha::ChaChaRng::seed_from_u64(1776);
let storage = TempStorage::new().await?.apply_default_genesis().await?;
let storage = TempStorage::new_with_penumbra_prefixes()
.await?
.apply_default_genesis()
.await?;
let mut state = Arc::new(StateDelta::new(storage.latest_snapshot()));

// Create the first swap:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use {
self::common::{BuilderExt, ValidatorDataReadExt},
cnidarium::TempStorage,
common::TempStorageExt as _,
decaf377_rdsa::{SigningKey, SpendAuth, VerificationKey},
penumbra_app::{
genesis::{self, AppState},
Expand All @@ -23,7 +24,7 @@ mod common;
async fn app_rejects_validator_definitions_with_invalid_auth_sigs() -> anyhow::Result<()> {
// Install a test logger, and acquire some temporary storage.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Start the test node.
let mut node = {
Expand Down
5 changes: 3 additions & 2 deletions crates/core/app/tests/app_reproduce_testnet_75_vcb_close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@ use {
self::common::BuilderExt,
anyhow::anyhow,
cnidarium::TempStorage,
common::TempStorageExt as _,
penumbra_app::{
genesis::{self, AppState},
server::consensus::Consensus,
},
penumbra_asset::{Value, STAKING_TOKEN_ASSET_ID},
penumbra_auction::StateReadExt as _,
penumbra_auction::{
auction::{
dutch::{ActionDutchAuctionEnd, ActionDutchAuctionSchedule, DutchAuctionDescription},
AuctionNft,
},
component::AuctionStoreRead,
StateReadExt as _,
},
penumbra_keys::test_keys,
penumbra_mock_client::MockClient,
Expand Down Expand Up @@ -65,7 +66,7 @@ async fn app_can_reproduce_tesnet_75_vcb_close() -> anyhow::Result<()> {

common::set_tracing_subscriber_with_env_filter(filter)
};
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;
let app_state = AppState::Content(
genesis::Content::default().with_chain_id(TestNode::<()>::CHAIN_ID.to_string()),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use {
self::common::{BuilderExt, ValidatorDataReadExt},
anyhow::Context,
cnidarium::TempStorage,
common::TempStorageExt as _,
penumbra_app::{
genesis::{self, AppState},
server::consensus::Consensus,
Expand All @@ -18,7 +19,7 @@ mod common;
async fn app_tracks_uptime_for_genesis_validator_missing_blocks() -> anyhow::Result<()> {
// Install a test logger, acquire some temporary storage, and start the test node.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Start the test node.
let mut node = {
Expand Down Expand Up @@ -60,7 +61,7 @@ async fn app_tracks_uptime_for_genesis_validator_missing_blocks() -> anyhow::Res
let height = 4;
for i in 1..=height {
node.block()
.with_signatures(Default::default())
.without_signatures()
.execute()
.tap(|_| trace!(%i, "executing block with no signatures"))
.instrument(error_span!("executing block with no signatures", %i))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use {
self::common::{BuilderExt, ValidatorDataReadExt},
anyhow::Context,
cnidarium::TempStorage,
common::TempStorageExt as _,
penumbra_app::{
genesis::{self, AppState},
server::consensus::Consensus,
Expand All @@ -18,7 +19,7 @@ mod common;
async fn app_tracks_uptime_for_genesis_validator_missing_blocks() -> anyhow::Result<()> {
// Install a test logger, acquire some temporary storage, and start the test node.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Start the test node.
let mut node = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use {
self::common::{BuilderExt, TestNodeExt, ValidatorDataReadExt},
cnidarium::TempStorage,
common::TempStorageExt as _,
decaf377_rdsa::{SigningKey, SpendAuth, VerificationKey},
penumbra_app::{
genesis::{self, AppState},
Expand Down Expand Up @@ -32,7 +33,7 @@ async fn app_tracks_uptime_for_validators_only_once_active() -> anyhow::Result<(

// Install a test logger, acquire some temporary storage, and start the test node.
let guard = common::set_tracing_subscriber();
let storage = TempStorage::new().await?;
let storage = TempStorage::new_with_penumbra_prefixes().await?;

// Configure an AppState with slightly shorter epochs than usual.
let app_state = AppState::Content(
Expand Down
Loading

0 comments on commit b40b908

Please sign in to comment.