Skip to content

Commit

Permalink
app: 🦅 Consensus::end_block never errors (#4011)
Browse files Browse the repository at this point in the history
`Consensus::end_block` never returns an `Err(_)` value, so it does not
need to return a `Result<T, E>`.

cherry-picked out ouf #4001.
  • Loading branch information
cratelyn authored Mar 12, 2024
1 parent 2d88336 commit 03444d4
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions crates/core/app/src/server/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,9 @@ impl Consensus {
Request::DeliverTx(deliver_tx) => {
Response::DeliverTx(self.deliver_tx(deliver_tx).instrument(span.clone()).await)
}
Request::EndBlock(end_block) => Response::EndBlock(
self.end_block(end_block)
.instrument(span)
.await
.expect("end_block must succeed"),
),
Request::EndBlock(end_block) => {
Response::EndBlock(self.end_block(end_block).instrument(span).await)
}
Request::Commit => Response::Commit(
self.commit()
.instrument(span)
Expand Down Expand Up @@ -218,7 +215,7 @@ impl Consensus {
}
}

async fn end_block(&mut self, end_block: request::EndBlock) -> Result<response::EndBlock> {
async fn end_block(&mut self, end_block: request::EndBlock) -> response::EndBlock {
tracing::info!(height = ?end_block.height, "ending block");
let events = self.app.end_block(&end_block).await;
trace_events(&events);
Expand All @@ -234,11 +231,11 @@ impl Consensus {
"sending validator updates to tendermint"
);

Ok(response::EndBlock {
response::EndBlock {
validator_updates,
consensus_param_updates: None,
events,
})
}
}

async fn commit(&mut self) -> Result<response::Commit> {
Expand Down

0 comments on commit 03444d4

Please sign in to comment.