message: Include key block hash in the instance ID
diff: @@ -274,6 +274,7 @@ where
  &mut self,
  era_id: EraId,
  now: Timestamp,
  + key_block_hash: BlockHash,
  validators: BTreeMap<PublicKey, U512>,
  new_faulty: Vec<PublicKey>,
  faulty: HashSet<PublicKey>,
  @@ -285,7 +286,7 @@ where
  if self.open_eras.contains_key(&era_id) {
  panic!("{} already exists", era_id);
  }
  - let instance_id = instance_id(&self.protocol_config, era_id);
  + let instance_id = instance_id(&self.protocol_config, era_id, key_block_hash);
  info!(
  ?validators,
  @@ -497,6 +498,7 @@ where
  let start_height;
  let era_start_time;
  let seed;
  + let key_block_hash;
  let booking_block_hash = booking_blocks
  .get(&era_id)
  @@ -513,9 +515,11 @@ where
  .genesis_timestamp
  .expect("must have genesis start time if era ID is 0");
  seed = 0;
  + key_block_hash = BlockHash::default();
  } else {
  // If this is not era 0, there must be a key block for it.
  let key_block = key_blocks.get(&era_id).expect("missing key block");
  + key_block_hash = key_block.hash();
  start_height = key_block.height() + 1;
  era_start_time = key_block.timestamp();
  seed = Self::era_seed(*booking_block_hash, key_block.accumulated_seed());
  @@ -550,6 +554,7 @@ where
  let results = self.new_era(
  era_id,
  now,
  + key_block_hash,
  validators,
  new_faulty,
  faulty,
  @@ -856,6 +861,7 @@ where
  let mut outcomes = self.new_era(
  era_id,
  now,
  + switch_block_header.hash(),
  next_era_validators_weights.clone(),
  new_faulty,
  faulty,
  @@ -1383,11 +1389,16 @@ async fn execute_finalized_block<REv>(
  .await
  }
  -/// Computes the instance ID for an era, given the era ID and the chainspec hash.
  -fn instance_id(protocol_config: &ProtocolConfig, era_id: EraId) -> Digest {
  - Digest::hash_pair(protocol_config.chainspec_hash, era_id.to_le_bytes())
  - .value()
  - .into()
  +/// Computes the instance ID for an era, given the chainspec hash, era ID and the key block hash.
  +fn instance_id(
  + protocol_config: &ProtocolConfig,
  + era_id: EraId,
  + key_block_hash: BlockHash,
  +) -> Digest {
  + Digest::hash_pair(
  + key_block_hash.inner().value(),
  + Digest::hash_pair(protocol_config.chainspec_hash, era_id.to_le_bytes()).value(),
  + )
  }
  /// The number of past eras whose validators are still bonded. After this many eras, a former
  