Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zbuc committed Aug 20, 2024
1 parent 92fd7a5 commit 9a12043
Show file tree
Hide file tree
Showing 9 changed files with 475 additions and 201 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/core/app/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ impl App {
}

tracing::debug!(?jmt_root, "finished committing state");
println!("finished committing state {}", hex::encode(jmt_root));

// Get the latest version of the state, now that we've committed it.
self.state = Arc::new(StateDelta::new(storage.latest_snapshot()));
Expand Down
35 changes: 35 additions & 0 deletions crates/core/app/src/server/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,26 @@ impl Consensus {
// We don't need to print the block height, because it will already be
// included in the span modeling the abci request handling.
tracing::info!(time = ?begin_block.header.time, "beginning block");

let storage_revision_height = self.storage.latest_snapshot().version();
let storage_root = self.storage.latest_snapshot().root_hash().await?;
println!(
"BEFORE begin_block {} storage height is {} and storage root is {}",
begin_block.header.height,
storage_revision_height,
hex::encode(storage_root.0)
);
let events = self.app.begin_block(&begin_block).await;

let storage_revision_height = self.storage.latest_snapshot().version();
let storage_root = self.storage.latest_snapshot().root_hash().await?;
println!(
"AFTER begin_block {} storage height is {} and storage root is {}",
begin_block.header.height,
storage_revision_height,
hex::encode(storage_root.0)
);

Ok(response::BeginBlock { events })
}

Expand Down Expand Up @@ -240,9 +259,25 @@ impl Consensus {
}

async fn commit(&mut self) -> Result<response::Commit> {
let storage_revision_height = self.storage.latest_snapshot().version();
let storage_root = self.storage.latest_snapshot().root_hash().await?;
println!(
"BEFORE commit storage height is {} and storage root is {}",
storage_revision_height,
hex::encode(storage_root.0)
);

let app_hash = self.app.commit(self.storage.clone()).await;
tracing::info!(?app_hash, "committed block");

let storage_revision_height = self.storage.latest_snapshot().version();
let storage_root = self.storage.latest_snapshot().root_hash().await?;
println!(
"AFTER commit storage height is {} and storage root is {}",
storage_revision_height,
hex::encode(storage_root.0)
);

Ok(response::Commit {
data: app_hash.0.to_vec().into(),
retain_height: 0u32.into(),
Expand Down
Loading

0 comments on commit 9a12043

Please sign in to comment.