Skip to content

Commit

Permalink
runtime: Validate block namespace against runtime ID
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Jan 15, 2021
1 parent a33cb5e commit 08a365e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions runtime/src/dispatcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,16 @@ impl Dispatcher {
"check_only" => check_only,
);

// Verify that the runtime ID matches the block's namespace. This is a protocol violation
// as the compute node should never change the runtime ID.
if block.header.namespace != protocol.get_runtime_id() {
panic!(
"block namespace does not match runtime id (namespace: {:?} runtime ID: {:?})",
block.header.namespace,
protocol.get_runtime_id(),
);
}

// Create a new context and dispatch the batch.
let ctx = ctx.freeze();
cache.maybe_replace(Root {
Expand Down

0 comments on commit 08a365e

Please sign in to comment.