Skip to content

Commit

Permalink
Add simple unexpectedly crashy testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
zbuc committed Aug 16, 2024
1 parent a78857d commit 3e3ea30
Show file tree
Hide file tree
Showing 12 changed files with 418 additions and 11 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

5 changes: 5 additions & 0 deletions crates/cnidarium/src/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,13 @@ impl Snapshot {
db: db.clone(),
};

println!("HERE_");
let (substore_value, substore_commitment_proof) = tokio::task::spawn_blocking({
let span = span.clone();
move || span.in_scope(|| substore.get_with_proof(substore_key_bytes))
})
.await??;
println!("HERE2");

proofs.push(substore_commitment_proof);

Expand All @@ -103,15 +105,18 @@ impl Snapshot {
db,
};

println!("HERE3");
let (_, main_commitment_proof) = tokio::task::spawn_blocking({
let span = span.clone();
move || span.in_scope(|| mainstore.get_with_proof(key_to_substore_root.into()))
})
.await??;
println!("HERE4");

proofs.push(main_commitment_proof);
}

println!("HERE5, substore_value: {:?}", substore_value);
Ok((
substore_value,
MerkleProof {
Expand Down
7 changes: 7 additions & 0 deletions crates/cnidarium/src/store/substore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,13 @@ impl SubstoreSnapshot {
) -> Result<(Option<Vec<u8>>, ics23::CommitmentProof)> {
let version = self.version();
let tree = jmt::Sha256Jmt::new(self);
let rh = tree.get_root_hash(version)?;
println!(
"HERE in SubstoreSnapshot get_with_proof, key: {}, version: {}, root hash: {}",
hex::encode(key.clone()),
version,
hex::encode(rh.0)
);
tree.get_with_ics23_proof(key, version)
}

Expand Down
3 changes: 3 additions & 0 deletions crates/core/app/tests/common/ibc_tests/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ pub struct TestNodeWithIBC {
}

#[allow(unused)]
/// This interacts with a node similarly to how a relayer would. We intentionally call
/// against the external gRPC interfaces to get the most comprehensive test coverage.
impl TestNodeWithIBC {
pub async fn new(
suffix: &str,
Expand Down Expand Up @@ -191,6 +193,7 @@ impl TestNodeWithIBC {
client_id: &ClientId,
height: &Height,
) -> Result<Option<(Height, ConsensusState)>> {
// TODO: this probably shouldn't reach into storage directly huh
self.storage
.clone()
.latest_snapshot()
Expand Down
1 change: 1 addition & 0 deletions crates/core/app/tests/common/temp_storage_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ pub trait TempStorageExt: Sized {

#[async_trait]
impl TempStorageExt for TempStorage {
// TODO: move this to an Ext trait for Storage instead of TempStorage
async fn new_with_penumbra_prefixes() -> anyhow::Result<TempStorage> {
TempStorage::new_with_prefixes(SUBSTORE_PREFIXES.to_vec()).await
}
Expand Down
Loading

0 comments on commit 3e3ea30

Please sign in to comment.