Skip to content

Commit

Permalink
runtime: verify consensus state integrity for queries
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrus committed Apr 26, 2022
1 parent e1d8665 commit 87a978f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions .changelog/4694.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runtime: verify consensus state integrity for queries
11 changes: 6 additions & 5 deletions runtime/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -462,11 +462,12 @@ impl Dispatcher {
let txn_dispatcher = txn_dispatcher.clone();

tokio::task::spawn_blocking(move || {
// For queries we don't do any consensus layer integrity verification.
let consensus_state = state
.consensus_verifier
.unverified_state(state.consensus_block)
.unwrap();
// Verify consensus state and runtime state root integrity before executing the query.
let consensus_state = state.consensus_verifier.verify(
state.consensus_block,
state.header.clone(),
state.epoch,
)?;

let cache = cache_set.query(Root {
namespace: state.header.namespace,
Expand Down

0 comments on commit 87a978f

Please sign in to comment.