Skip to content

Commit

Permalink
Merge pull request #3313 from autonomys/fraud-cleanups
Browse files Browse the repository at this point in the history
Rename fraud proof type for clarity
  • Loading branch information
teor2345 authored Dec 13, 2024
2 parents b51b689 + f91b832 commit 3d5483e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion crates/sp-domains-fraud-proof/src/fraud_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ pub struct InvalidExtrinsicsRootProof {
pub valid_bundle_digests: Vec<ValidBundleDigest>,

/// The storage proof used during verification
pub invalid_extrinsics_data_proof: InvalidExtrinsicsDataProof,
pub invalid_inherent_extrinsic_proof: InvalidInherentExtrinsicProof,

/// Optional sudo extrinsic call storage proof
pub domain_sudo_call_proof: DomainSudoCallStorageProof,
Expand Down
6 changes: 3 additions & 3 deletions crates/sp-domains-fraud-proof/src/storage_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub enum VerificationError {
RuntimeRegistryStorageProof(StorageProofVerificationError),
DynamicCostOfStorageStorageProof(StorageProofVerificationError),
DigestStorageProof(StorageProofVerificationError),
BlockFessStorageProof(StorageProofVerificationError),
BlockFeesStorageProof(StorageProofVerificationError),
TransfersStorageProof(StorageProofVerificationError),
ExtrinsicStorageProof(StorageProofVerificationError),
DomainSudoCallStorageProof(StorageProofVerificationError),
Expand Down Expand Up @@ -414,7 +414,7 @@ impl MaybeDomainRuntimeUpgradedProof {
}

#[derive(Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo)]
pub struct InvalidExtrinsicsDataProof {
pub struct InvalidInherentExtrinsicProof {
/// Block randomness storage proof
pub block_randomness_proof: BlockRandomnessProof,

Expand All @@ -434,7 +434,7 @@ pub struct InvalidExtrinsicsDataProof {
pub domain_chain_allowlist_proof: DomainChainsAllowlistUpdateStorageProof,
}

impl InvalidExtrinsicsDataProof {
impl InvalidInherentExtrinsicProof {
#[cfg(feature = "std")]
#[allow(clippy::let_and_return)]
pub fn generate<
Expand Down
8 changes: 4 additions & 4 deletions crates/sp-domains-fraud-proof/src/verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ where
{
let InvalidExtrinsicsRootProof {
valid_bundle_digests,
invalid_extrinsics_data_proof,
invalid_inherent_extrinsic_proof,
domain_sudo_call_proof,
} = fraud_proof;

let mut domain_inherent_extrinsic_data =
invalid_extrinsics_data_proof.verify::<CBlock, SKP>(domain_id, runtime_id, &state_root)?;
let mut domain_inherent_extrinsic_data = invalid_inherent_extrinsic_proof
.verify::<CBlock, SKP>(domain_id, runtime_id, &state_root)?;

let domain_sudo_call = <DomainSudoCallStorageProof as BasicStorageProof<CBlock>>::verify::<SKP>(
domain_sudo_call_proof.clone(),
Expand Down Expand Up @@ -381,7 +381,7 @@ where
)
.map_err(|err| {
VerificationError::StorageProof(
storage_proof::VerificationError::BlockFessStorageProof(err),
storage_proof::VerificationError::BlockFeesStorageProof(err),
)
})?;

Expand Down
8 changes: 4 additions & 4 deletions domains/client/domain-operator/src/fraud_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ where
self.maybe_generate_domain_runtime_code_proof_for_receipt(domain_id, local_receipt)?;

let maybe_runtime_id =
self.is_domain_runtime_updraded_at(domain_id, consensus_block_hash)?;
self.is_domain_runtime_upgraded_at(domain_id, consensus_block_hash)?;

let invalid_extrinsics_data_proof = InvalidExtrinsicsDataProof::generate(
let invalid_inherent_extrinsic_proof = InvalidInherentExtrinsicProof::generate(
&self.storage_key_provider,
self.consensus_client.as_ref(),
domain_id,
Expand All @@ -404,15 +404,15 @@ where
maybe_domain_runtime_code_proof,
proof: FraudProofVariant::InvalidExtrinsicsRoot(InvalidExtrinsicsRootProof {
valid_bundle_digests,
invalid_extrinsics_data_proof,
invalid_inherent_extrinsic_proof,
domain_sudo_call_proof,
}),
};

Ok(invalid_domain_extrinsics_root_proof)
}

pub fn is_domain_runtime_updraded_at(
pub fn is_domain_runtime_upgraded_at(
&self,
domain_id: DomainId,
at: CBlock::Hash,
Expand Down

0 comments on commit 3d5483e

Please sign in to comment.