mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 04:11:09 +00:00
Check that the validation code matches the parachain code (#3433)
This introduces a check to ensure that the parachain code matches the validation code stored in the relay chain state. If not, it will print a warning. This should be mainly useful for parachain builders to make sure they have setup everything correctly.
This commit is contained in:
@@ -30,7 +30,7 @@ use cumulus_primitives_core::relay_chain::BlockId;
|
||||
pub use cumulus_primitives_core::{
|
||||
relay_chain::{
|
||||
CommittedCandidateReceipt, Hash as PHash, Header as PHeader, InboundHrmpMessage,
|
||||
OccupiedCoreAssumption, SessionIndex, ValidatorId,
|
||||
OccupiedCoreAssumption, SessionIndex, ValidationCodeHash, ValidatorId,
|
||||
},
|
||||
InboundDownwardMessage, ParaId, PersistedValidationData,
|
||||
};
|
||||
@@ -194,6 +194,15 @@ pub trait RelayChainInterface: Send + Sync {
|
||||
relay_parent: PHash,
|
||||
relevant_keys: &Vec<Vec<u8>>,
|
||||
) -> RelayChainResult<StorageProof>;
|
||||
|
||||
/// Returns the validation code hash for the given `para_id` using the given
|
||||
/// `occupied_core_assumption`.
|
||||
async fn validation_code_hash(
|
||||
&self,
|
||||
relay_parent: PHash,
|
||||
para_id: ParaId,
|
||||
occupied_core_assumption: OccupiedCoreAssumption,
|
||||
) -> RelayChainResult<Option<ValidationCodeHash>>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
@@ -301,4 +310,15 @@ where
|
||||
async fn header(&self, block_id: BlockId) -> RelayChainResult<Option<PHeader>> {
|
||||
(**self).header(block_id).await
|
||||
}
|
||||
|
||||
async fn validation_code_hash(
|
||||
&self,
|
||||
relay_parent: PHash,
|
||||
para_id: ParaId,
|
||||
occupied_core_assumption: OccupiedCoreAssumption,
|
||||
) -> RelayChainResult<Option<ValidationCodeHash>> {
|
||||
(**self)
|
||||
.validation_code_hash(relay_parent, para_id, occupied_core_assumption)
|
||||
.await
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user