Skip to content

Commit abfc5b1

Browse files
authored
Merge pull request #3341 from autonomys/cleanup-compatibility-code
Remove unneeded compatibility code
2 parents 9ce216e + aee81f7 commit abfc5b1

File tree

1 file changed

+12
-46
lines changed
  • domains/client/block-preprocessor/src

1 file changed

+12
-46
lines changed

domains/client/block-preprocessor/src/lib.rs

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use crate::inherents::is_runtime_upgraded;
1818
use codec::Encode;
1919
use domain_runtime_primitives::opaque::AccountId;
2020
use sc_client_api::BlockBackend;
21-
use sp_api::{ApiError, Core, ProvideRuntimeApi};
21+
use sp_api::{ApiError, ProvideRuntimeApi};
2222
use sp_blockchain::HeaderBackend;
2323
use sp_core::H256;
2424
use sp_domains::core_api::DomainCoreApi;
@@ -29,8 +29,7 @@ use sp_domains::{
2929
};
3030
use sp_messenger::MessengerApi;
3131
use sp_mmr_primitives::MmrApi;
32-
use sp_runtime::traits::{Block as BlockT, Hash as HashT, Header, NumberFor};
33-
use sp_runtime::DigestItem;
32+
use sp_runtime::traits::{Block as BlockT, Hash as HashT, NumberFor};
3433
use sp_state_machine::LayoutV1;
3534
use sp_subspace_mmr::ConsensusChainMmrLeafProof;
3635
use sp_weights::Weight;
@@ -208,13 +207,6 @@ where
208207
Vec<InboxedBundle<Block::Hash>>,
209208
Vec<(Option<AccountId>, Block::Extrinsic)>,
210209
)> {
211-
let consensus_spec_version = self
212-
.consensus_client
213-
.runtime_api()
214-
.version(at_consensus_hash)
215-
.map_err(sp_blockchain::Error::RuntimeApiError)?
216-
.spec_version;
217-
218210
let mut inboxed_bundles = Vec::with_capacity(bundles.len());
219211
let mut valid_extrinsics = Vec::new();
220212

@@ -230,42 +222,16 @@ where
230222
// NOTE: The receipt's `domain_block_number` is verified by the consensus runtime while
231223
// the `domain_block_hash` is not (which is take care of by the fraud proof) so we can't
232224
// check the parent domain block hash here.
233-
// TODO: remove consensus runtime version check before next network
234-
if consensus_spec_version >= 6
235-
&& bundle.receipt().domain_block_number != parent_domain_number
236-
{
237-
// If there consensus runtime just upgraded to spec version 6, which bring the receipt
238-
// gap check, the bundle that included in the same block is doesn't perform the check
239-
// because the new runtime take effect in the next block so skip the check here too.
240-
let is_consensus_runtime_upgraded_to_6 = {
241-
let consensus_header = self
242-
.consensus_client
243-
.header(at_consensus_hash)?
244-
.ok_or_else(|| {
245-
sp_blockchain::Error::Backend(format!(
246-
"Consensus block header of {at_consensus_hash:?} unavailable"
247-
))
248-
})?;
249-
250-
let runtime_upgraded = consensus_header
251-
.digest()
252-
.logs()
253-
.iter()
254-
.any(|di| di == &DigestItem::RuntimeEnvironmentUpdated);
255-
256-
runtime_upgraded && consensus_spec_version == 6
257-
};
258-
if !is_consensus_runtime_upgraded_to_6 {
259-
return Err(sp_blockchain::Error::RuntimeApiError(
260-
ApiError::Application(
261-
format!(
262-
"Unexpected bundle in consensus block: {:?}, something must be wrong",
263-
at_consensus_hash
264-
)
265-
.into(),
266-
),
267-
));
268-
}
225+
if bundle.receipt().domain_block_number != parent_domain_number {
226+
return Err(sp_blockchain::Error::RuntimeApiError(
227+
ApiError::Application(
228+
format!(
229+
"Unexpected bundle in consensus block: {:?}, something must be wrong",
230+
at_consensus_hash
231+
)
232+
.into(),
233+
),
234+
));
269235
}
270236

271237
let extrinsic_root = bundle.extrinsics_root();

0 commit comments

Comments
 (0)