diff --git a/domains/client/block-preprocessor/src/lib.rs b/domains/client/block-preprocessor/src/lib.rs index de37e7fec5..bc7e98f38d 100644 --- a/domains/client/block-preprocessor/src/lib.rs +++ b/domains/client/block-preprocessor/src/lib.rs @@ -18,7 +18,7 @@ use crate::inherents::is_runtime_upgraded; use codec::Encode; use domain_runtime_primitives::opaque::AccountId; use sc_client_api::BlockBackend; -use sp_api::{ApiError, Core, ProvideRuntimeApi}; +use sp_api::{ApiError, ProvideRuntimeApi}; use sp_blockchain::HeaderBackend; use sp_core::H256; use sp_domains::core_api::DomainCoreApi; @@ -29,8 +29,7 @@ use sp_domains::{ }; use sp_messenger::MessengerApi; use sp_mmr_primitives::MmrApi; -use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header, NumberFor}; -use sp_runtime::DigestItem; +use sp_runtime::traits::{Block as BlockT, Hash as HashT, NumberFor}; use sp_state_machine::LayoutV1; use sp_subspace_mmr::ConsensusChainMmrLeafProof; use sp_weights::Weight; @@ -208,13 +207,6 @@ where Vec>, Vec<(Option, Block::Extrinsic)>, )> { - let consensus_spec_version = self - .consensus_client - .runtime_api() - .version(at_consensus_hash) - .map_err(sp_blockchain::Error::RuntimeApiError)? - .spec_version; - let mut inboxed_bundles = Vec::with_capacity(bundles.len()); let mut valid_extrinsics = Vec::new(); @@ -230,42 +222,16 @@ where // NOTE: The receipt's `domain_block_number` is verified by the consensus runtime while // the `domain_block_hash` is not (which is take care of by the fraud proof) so we can't // check the parent domain block hash here. - // TODO: remove consensus runtime version check before next network - if consensus_spec_version >= 6 - && bundle.receipt().domain_block_number != parent_domain_number - { - // If there consensus runtime just upgraded to spec version 6, which bring the receipt - // gap check, the bundle that included in the same block is doesn't perform the check - // because the new runtime take effect in the next block so skip the check here too. - let is_consensus_runtime_upgraded_to_6 = { - let consensus_header = self - .consensus_client - .header(at_consensus_hash)? - .ok_or_else(|| { - sp_blockchain::Error::Backend(format!( - "Consensus block header of {at_consensus_hash:?} unavailable" - )) - })?; - - let runtime_upgraded = consensus_header - .digest() - .logs() - .iter() - .any(|di| di == &DigestItem::RuntimeEnvironmentUpdated); - - runtime_upgraded && consensus_spec_version == 6 - }; - if !is_consensus_runtime_upgraded_to_6 { - return Err(sp_blockchain::Error::RuntimeApiError( - ApiError::Application( - format!( - "Unexpected bundle in consensus block: {:?}, something must be wrong", - at_consensus_hash - ) - .into(), - ), - )); - } + if bundle.receipt().domain_block_number != parent_domain_number { + return Err(sp_blockchain::Error::RuntimeApiError( + ApiError::Application( + format!( + "Unexpected bundle in consensus block: {:?}, something must be wrong", + at_consensus_hash + ) + .into(), + ), + )); } let extrinsic_root = bundle.extrinsics_root();