Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app: 🌸 add context messages to assorted errors #3880

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions crates/core/app/src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,10 @@ impl App {

/// Wrapper function for [`Self::deliver_tx`] that decodes from bytes.
pub async fn deliver_tx_bytes(&mut self, tx_bytes: &[u8]) -> Result<Vec<abci::Event>> {
let tx = Arc::new(Transaction::decode(tx_bytes)?);
self.deliver_tx(tx).await
let tx = Arc::new(Transaction::decode(tx_bytes).context("decoding transaction")?);
self.deliver_tx(tx)
.await
.context("failed to deliver transaction")
}

pub async fn deliver_tx(&mut self, tx: Arc<Transaction>) -> Result<Vec<abci::Event>> {
Expand Down Expand Up @@ -335,8 +337,14 @@ impl App {
async move { tx2.check_stateful(state2).await }.instrument(tracing::Span::current()),
);

stateless.await??;
stateful.await??;
stateless
.await
.context("waiting for check_stateless check tasks")?
.context("check_stateless failed")?;
stateful
.await
.context("waiting for check_stateful tasks")?
.context("check_stateful failed")?;

// At this point, the stateful checks should have completed,
// leaving us with exclusive access to the Arc<State>.
Expand All @@ -350,9 +358,12 @@ impl App {
let transaction = Arc::as_ref(&tx).clone();
state_tx
.put_block_transaction(height, transaction.into())
.await?;
.await
.context("storing transactions")?;

tx.execute(&mut state_tx).await?;
tx.execute(&mut state_tx)
.await
.context("executing transaction")?;

// At this point, we've completed execution successfully with no errors,
// so we can apply the transaction to the State. Otherwise, we'd have
Expand Down
Loading