diff --git a/Cargo.lock b/Cargo.lock index fa84496bfd7..c18c3f723d3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2745,6 +2745,7 @@ dependencies = [ "sc-cli", "sc-client-api", "sc-consensus", + "sc-domains", "sc-service", "sc-transaction-pool", "sc-transaction-pool-api", @@ -7573,9 +7574,8 @@ dependencies = [ "sp-externalities", "sp-io", "sp-runtime", - "sp-state-machine", "sp-std", - "sp-trie", + "sp-subspace-mmr", "sp-version", "subspace-core-primitives", "subspace-runtime-primitives", @@ -11591,6 +11591,7 @@ dependencies = [ "sp-runtime-interface", "sp-state-machine", "sp-std", + "sp-subspace-mmr", "sp-trie", "subspace-core-primitives", "subspace-runtime-primitives", diff --git a/crates/pallet-domains/src/lib.rs b/crates/pallet-domains/src/lib.rs index 3601632c712..c7bce007ac0 100644 --- a/crates/pallet-domains/src/lib.rs +++ b/crates/pallet-domains/src/lib.rs @@ -421,10 +421,6 @@ mod pallet { #[pallet::storage] pub type SuccessfulBundles = StorageMap<_, Identity, DomainId, Vec, ValueQuery>; - /// Fraud proofs submitted successfully in current block. - #[pallet::storage] - pub(super) type SuccessfulFraudProofs = - StorageMap<_, Identity, DomainId, Vec, ValueQuery>; /// Stores the next runtime id. #[pallet::storage] pub(super) type NextRuntimeId = StorageValue<_, RuntimeId, ValueQuery>; @@ -1176,8 +1172,6 @@ mod pallet { new_head_receipt_number: Some(new_head_receipt_number), }); - SuccessfulFraudProofs::::append(domain_id, fraud_proof.hash()); - Ok(Some(actual_weight).into()) } @@ -1530,8 +1524,6 @@ mod pallet { T::DomainBundleSubmitted::domain_bundle_submitted(domain_id); } - let _ = SuccessfulFraudProofs::::clear(u32::MAX, None); - Weight::zero() } @@ -1655,10 +1647,6 @@ impl Pallet { SuccessfulBundles::::get(domain_id) } - pub fn successful_fraud_proofs(domain_id: DomainId) -> Vec { - SuccessfulFraudProofs::::get(domain_id) - } - pub fn domain_runtime_code(domain_id: DomainId) -> Option> { RuntimeRegistry::::get(Self::runtime_id(domain_id)?) .and_then(|mut runtime_object| runtime_object.raw_genesis.take_runtime_code()) diff --git a/crates/sp-domains-fraud-proof/src/lib.rs b/crates/sp-domains-fraud-proof/src/lib.rs index bd450a43326..039e0682ce8 100644 --- a/crates/sp-domains-fraud-proof/src/lib.rs +++ b/crates/sp-domains-fraud-proof/src/lib.rs @@ -400,12 +400,6 @@ sp_api::decl_runtime_apis! { /// Submit the fraud proof via an unsigned extrinsic. fn submit_fraud_proof_unsigned(fraud_proof: FraudProof, Block::Hash, DomainHeader, H256>); - /// Extract the fraud proof handled successfully from the given extrinsics. - fn extract_fraud_proofs( - domain_id: DomainId, - extrinsics: Vec, - ) -> Vec>; - /// Reture the storage key used in fraud proof fn fraud_proof_storage_key(req: FraudProofStorageKeyRequest) -> Vec; } diff --git a/crates/subspace-fake-runtime-api/src/lib.rs b/crates/subspace-fake-runtime-api/src/lib.rs index fd031438a5b..dfcba5a3a5b 100644 --- a/crates/subspace-fake-runtime-api/src/lib.rs +++ b/crates/subspace-fake-runtime-api/src/lib.rs @@ -406,13 +406,6 @@ sp_api::impl_runtime_apis! { unreachable!() } - fn extract_fraud_proofs( - _domain_id: DomainId, - _extrinsics: Vec<::Extrinsic>, - ) -> Vec> { - unreachable!() - } - fn fraud_proof_storage_key(_req: FraudProofStorageKeyRequest) -> Vec { unreachable!() } diff --git a/crates/subspace-runtime/src/domains.rs b/crates/subspace-runtime/src/domains.rs index 7f2a781e295..6dbbb0dc43d 100644 --- a/crates/subspace-runtime/src/domains.rs +++ b/crates/subspace-runtime/src/domains.rs @@ -6,7 +6,6 @@ use crate::{Balance, Block, Domains, RuntimeCall, UncheckedExtrinsic}; use alloc::vec::Vec; use domain_runtime_primitives::opaque::Header as DomainHeader; use sp_domains::DomainId; -use sp_domains_fraud_proof::fraud_proof::FraudProof; use sp_runtime::traits::{Block as BlockT, NumberFor}; pub(crate) fn extract_successful_bundles( @@ -40,22 +39,3 @@ pub(crate) fn extract_bundle( _ => None, } } - -pub(crate) fn extract_fraud_proofs( - domain_id: DomainId, - extrinsics: Vec, -) -> Vec> { - let successful_fraud_proofs = Domains::successful_fraud_proofs(domain_id); - extrinsics - .into_iter() - .filter_map(|uxt| match uxt.function { - RuntimeCall::Domains(pallet_domains::Call::submit_fraud_proof { fraud_proof }) - if fraud_proof.domain_id() == domain_id - && successful_fraud_proofs.contains(&fraud_proof.hash()) => - { - Some(*fraud_proof) - } - _ => None, - }) - .collect() -} diff --git a/crates/subspace-runtime/src/lib.rs b/crates/subspace-runtime/src/lib.rs index 5e70117f067..3bac5fd595c 100644 --- a/crates/subspace-runtime/src/lib.rs +++ b/crates/subspace-runtime/src/lib.rs @@ -1366,13 +1366,6 @@ impl_runtime_apis! { Domains::submit_fraud_proof_unsigned(fraud_proof) } - fn extract_fraud_proofs( - domain_id: DomainId, - extrinsics: Vec<::Extrinsic>, - ) -> Vec> { - crate::domains::extract_fraud_proofs(domain_id, extrinsics) - } - fn fraud_proof_storage_key(req: FraudProofStorageKeyRequest) -> Vec { ::storage_key(req) } diff --git a/test/subspace-test-runtime/src/lib.rs b/test/subspace-test-runtime/src/lib.rs index 99e826719b0..bb9d071b1be 100644 --- a/test/subspace-test-runtime/src/lib.rs +++ b/test/subspace-test-runtime/src/lib.rs @@ -1068,25 +1068,6 @@ fn extract_bundle( } } -pub(crate) fn extract_fraud_proofs( - domain_id: DomainId, - extrinsics: Vec, -) -> Vec> { - let successful_fraud_proofs = Domains::successful_fraud_proofs(domain_id); - extrinsics - .into_iter() - .filter_map(|uxt| match uxt.function { - RuntimeCall::Domains(pallet_domains::Call::submit_fraud_proof { fraud_proof }) - if fraud_proof.domain_id() == domain_id - && successful_fraud_proofs.contains(&fraud_proof.hash()) => - { - Some(*fraud_proof) - } - _ => None, - }) - .collect() -} - struct RewardAddress([u8; 32]); impl From for RewardAddress { @@ -1534,13 +1515,6 @@ impl_runtime_apis! { Domains::submit_fraud_proof_unsigned(fraud_proof) } - fn extract_fraud_proofs( - domain_id: DomainId, - extrinsics: Vec<::Extrinsic>, - ) -> Vec> { - extract_fraud_proofs(domain_id, extrinsics) - } - fn fraud_proof_storage_key(req: FraudProofStorageKeyRequest) -> Vec { ::storage_key(req) }