diff --git a/crates/pallet-domains/src/lib.rs b/crates/pallet-domains/src/lib.rs index ae43b8a0f7..6741d30159 100644 --- a/crates/pallet-domains/src/lib.rs +++ b/crates/pallet-domains/src/lib.rs @@ -248,7 +248,7 @@ mod pallet { use sp_std::fmt::Debug; use sp_subspace_mmr::MmrProofVerifier; use subspace_core_primitives::{Randomness, U256}; - use subspace_runtime_primitives::StorageFee; + use subspace_runtime_primitives::{Moment, StorageFee}; #[pallet::config] pub trait Config: frame_system::Config> { @@ -1913,8 +1913,11 @@ mod pallet { Into::::into(Self::extrinsics_shuffling_seed()).to_fixed_bytes(), ); + let timestamp = Moment::default(); + let invalid_inherent_extrinsic_data = InvalidInherentExtrinsicData { extrinsics_shuffling_seed, + timestamp, }; BlockInvalidInherentExtrinsicData::::set(Some(invalid_inherent_extrinsic_data)); diff --git a/crates/sp-domains-fraud-proof/src/storage_proof.rs b/crates/sp-domains-fraud-proof/src/storage_proof.rs index 9aaaf29180..3c4f8afaf3 100644 --- a/crates/sp-domains-fraud-proof/src/storage_proof.rs +++ b/crates/sp-domains-fraud-proof/src/storage_proof.rs @@ -38,7 +38,6 @@ pub enum VerificationError { RuntimeCodeNotFound, UnexpectedDomainRuntimeUpgrade, InvalidInherentExtrinsicStorageProof(StorageProofVerificationError), - TimestampStorageProof(StorageProofVerificationError), SuccessfulBundlesStorageProof(StorageProofVerificationError), TransactionByteFeeStorageProof(StorageProofVerificationError), DomainAllowlistUpdatesStorageProof(StorageProofVerificationError), @@ -56,7 +55,6 @@ pub enum VerificationError { #[derive(Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo)] pub enum FraudProofStorageKeyRequest { InvalidInherentExtrinsicData, - Timestamp, SuccessfulBundles(DomainId), TransactionByteFee, DomainAllowlistUpdates(DomainId), @@ -73,7 +71,6 @@ impl FraudProofStorageKeyRequest { Self::InvalidInherentExtrinsicData => { VerificationError::InvalidInherentExtrinsicStorageProof(err) } - Self::Timestamp => VerificationError::TimestampStorageProof(err), Self::SuccessfulBundles(_) => VerificationError::SuccessfulBundlesStorageProof(err), Self::TransactionByteFee => VerificationError::TransactionByteFeeStorageProof(err), Self::DomainAllowlistUpdates(_) => { @@ -188,17 +185,6 @@ impl BasicStorageProof for DomainChainsAllowlistUpdateStor } } -#[derive(Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo)] -pub struct TimestampStorageProof(StorageProof); - -impl_storage_proof!(TimestampStorageProof); -impl BasicStorageProof for TimestampStorageProof { - type StorageValue = Moment; - fn storage_key_request(_key: Self::Key) -> FraudProofStorageKeyRequest> { - FraudProofStorageKeyRequest::Timestamp - } -} - #[derive(Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo)] pub struct DynamicCostOfStorageProof(StorageProof); @@ -409,6 +395,9 @@ impl MaybeDomainRuntimeUpgradedProof { pub struct InvalidInherentExtrinsicData { /// Extrinsics shuffling seed, derived from block randomness pub extrinsics_shuffling_seed: Randomness, + + /// Block timestamp + pub timestamp: Moment, } impl PassBy for InvalidInherentExtrinsicData { @@ -428,9 +417,6 @@ impl BasicStorageProof for InvalidInherentExtrinsicDataPro #[derive(Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo)] pub struct InvalidInherentExtrinsicProof { - /// Block timestamp storage proof - pub timestamp_proof: TimestampStorageProof, - /// Optional domain runtime code upgrade storage proof pub maybe_domain_runtime_upgrade_proof: MaybeDomainRuntimeUpgradedProof, @@ -447,7 +433,6 @@ pub struct InvalidInherentExtrinsicProof { /// The verified data from an `InvalidInherentExtrinsicProof` #[derive(Clone, Debug, Decode, Encode, Eq, PartialEq, TypeInfo)] pub struct InvalidInherentExtrinsicVerified { - pub timestamp: Moment, pub maybe_domain_runtime_upgrade: Option>, pub consensus_transaction_byte_fee: Balance, pub domain_chain_allowlist: DomainAllowlistUpdates, @@ -467,8 +452,6 @@ impl InvalidInherentExtrinsicProof { block_hash: Block::Hash, maybe_runtime_id: Option, ) -> Result { - let timestamp_proof = - TimestampStorageProof::generate(proof_provider, block_hash, (), storage_key_provider)?; let maybe_domain_runtime_upgrade_proof = MaybeDomainRuntimeUpgradedProof::generate( storage_key_provider, proof_provider, @@ -495,7 +478,6 @@ impl InvalidInherentExtrinsicProof { )?; Ok(Self { - timestamp_proof, maybe_domain_runtime_upgrade_proof, dynamic_cost_of_storage_proof, consensus_chain_byte_fee_proof, @@ -509,12 +491,6 @@ impl InvalidInherentExtrinsicProof { runtime_id: RuntimeId, state_root: &Block::Hash, ) -> Result { - let timestamp = >::verify::( - self.timestamp_proof.clone(), - (), - state_root, - )?; - let maybe_domain_runtime_upgrade = self .maybe_domain_runtime_upgrade_proof .verify::(runtime_id, state_root)?; @@ -546,7 +522,6 @@ impl InvalidInherentExtrinsicProof { )?; Ok(InvalidInherentExtrinsicVerified { - timestamp, maybe_domain_runtime_upgrade, consensus_transaction_byte_fee, domain_chain_allowlist, diff --git a/crates/sp-domains-fraud-proof/src/verification.rs b/crates/sp-domains-fraud-proof/src/verification.rs index 51535ed70c..5be342a688 100644 --- a/crates/sp-domains-fraud-proof/src/verification.rs +++ b/crates/sp-domains-fraud-proof/src/verification.rs @@ -92,7 +92,7 @@ where let shuffling_seed = invalid_inherent_extrinsic_data.extrinsics_shuffling_seed; let domain_inherent_extrinsic_data = DomainInherentExtrinsicData { - timestamp: inherent_extrinsic_verified.timestamp, + timestamp: invalid_inherent_extrinsic_data.timestamp, maybe_domain_runtime_upgrade: inherent_extrinsic_verified.maybe_domain_runtime_upgrade, consensus_transaction_byte_fee: inherent_extrinsic_verified.consensus_transaction_byte_fee, domain_chain_allowlist: inherent_extrinsic_verified.domain_chain_allowlist, diff --git a/crates/subspace-runtime/src/lib.rs b/crates/subspace-runtime/src/lib.rs index 2ee201c0a1..4908890a6b 100644 --- a/crates/subspace-runtime/src/lib.rs +++ b/crates/subspace-runtime/src/lib.rs @@ -1041,9 +1041,6 @@ impl FraudProofStorageKeyProvider> for StorageKeyProvider { FraudProofStorageKeyRequest::InvalidInherentExtrinsicData => { pallet_domains::BlockInvalidInherentExtrinsicData::::hashed_key().to_vec() } - FraudProofStorageKeyRequest::Timestamp => { - pallet_timestamp::Now::::hashed_key().to_vec() - } FraudProofStorageKeyRequest::SuccessfulBundles(domain_id) => { pallet_domains::SuccessfulBundles::::hashed_key_for(domain_id) } diff --git a/test/subspace-test-runtime/src/lib.rs b/test/subspace-test-runtime/src/lib.rs index ee36d26082..af728ac5a1 100644 --- a/test/subspace-test-runtime/src/lib.rs +++ b/test/subspace-test-runtime/src/lib.rs @@ -1118,9 +1118,6 @@ impl FraudProofStorageKeyProvider> for StorageKeyProvider { FraudProofStorageKeyRequest::InvalidInherentExtrinsicData => { pallet_domains::BlockInvalidInherentExtrinsicData::::hashed_key().to_vec() } - FraudProofStorageKeyRequest::Timestamp => { - pallet_timestamp::Now::::hashed_key().to_vec() - } FraudProofStorageKeyRequest::SuccessfulBundles(domain_id) => { pallet_domains::SuccessfulBundles::::hashed_key_for(domain_id) }