Skip to content

Commit 5682e61

Browse files
committed
Remove unused code and add TODO for core domain runtime upgrade
1 parent 47e635c commit 5682e61

3 files changed

Lines changed: 3 additions & 128 deletions

File tree

domains/client/domain-executor/src/core_executor.rs

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use sc_consensus::ForkChoiceStrategy;
1414
use sc_network::NetworkService;
1515
use sp_api::ProvideRuntimeApi;
1616
use sp_blockchain::HeaderBackend;
17-
use sp_consensus::{BlockStatus, SelectChain};
17+
use sp_consensus::SelectChain;
1818
use sp_consensus_slots::Slot;
1919
use sp_core::traits::{CodeExecutor, SpawnEssentialNamed, SpawnNamed};
2020
use sp_core::H256;
@@ -203,69 +203,6 @@ where
203203
})
204204
}
205205

206-
/// Checks the status of the given block hash in the Parachain.
207-
///
208-
/// Returns `true` if the block could be found and is good to be build on.
209-
#[allow(unused)]
210-
fn check_block_status(
211-
&self,
212-
hash: Block::Hash,
213-
number: <Block::Header as HeaderT>::Number,
214-
) -> bool {
215-
match self.client.block_status(&BlockId::Hash(hash)) {
216-
Ok(BlockStatus::Queued) => {
217-
tracing::debug!(
218-
target: LOG_TARGET,
219-
block_hash = ?hash,
220-
"Skipping candidate production, because block is still queued for import.",
221-
);
222-
false
223-
}
224-
Ok(BlockStatus::InChainWithState) => true,
225-
Ok(BlockStatus::InChainPruned) => {
226-
tracing::error!(
227-
target: LOG_TARGET,
228-
"Skipping candidate production, because block `{:?}` is already pruned!",
229-
hash,
230-
);
231-
false
232-
}
233-
Ok(BlockStatus::KnownBad) => {
234-
tracing::error!(
235-
target: LOG_TARGET,
236-
block_hash = ?hash,
237-
"Block is tagged as known bad and is included in the relay chain! Skipping candidate production!",
238-
);
239-
false
240-
}
241-
Ok(BlockStatus::Unknown) => {
242-
if number.is_zero() {
243-
tracing::error!(
244-
target: LOG_TARGET,
245-
block_hash = ?hash,
246-
"Could not find the header of the genesis block in the database!",
247-
);
248-
} else {
249-
tracing::debug!(
250-
target: LOG_TARGET,
251-
block_hash = ?hash,
252-
"Skipping candidate production, because block is unknown.",
253-
);
254-
}
255-
false
256-
}
257-
Err(e) => {
258-
tracing::error!(
259-
target: LOG_TARGET,
260-
block_hash = ?hash,
261-
error = ?e,
262-
"Failed to get block status.",
263-
);
264-
false
265-
}
266-
}
267-
}
268-
269206
/// The background is that a receipt received from the network points to a future block
270207
/// from the local view, so we need to wait for the receipt for the block at the same
271208
/// height to be produced locally in order to check the validity of the external receipt.

domains/client/domain-executor/src/domain_worker.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ where
314314
Ok(Some(header)) => header,
315315
};
316316

317+
// TODO: handle the core domain runtime upgrade properly.
317318
let maybe_new_runtime = if header
318319
.digest()
319320
.logs

domains/client/domain-executor/src/system_executor.rs

Lines changed: 1 addition & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use sc_consensus::ForkChoiceStrategy;
1414
use sc_network::NetworkService;
1515
use sp_api::ProvideRuntimeApi;
1616
use sp_blockchain::HeaderBackend;
17-
use sp_consensus::{BlockStatus, SelectChain};
17+
use sp_consensus::SelectChain;
1818
use sp_consensus_slots::Slot;
1919
use sp_core::traits::{CodeExecutor, SpawnEssentialNamed, SpawnNamed};
2020
use sp_core::H256;
@@ -193,69 +193,6 @@ where
193193
})
194194
}
195195

196-
/// Checks the status of the given block hash in the Parachain.
197-
///
198-
/// Returns `true` if the block could be found and is good to be build on.
199-
#[allow(unused)]
200-
fn check_block_status(
201-
&self,
202-
hash: Block::Hash,
203-
number: <Block::Header as HeaderT>::Number,
204-
) -> bool {
205-
match self.client.block_status(&BlockId::Hash(hash)) {
206-
Ok(BlockStatus::Queued) => {
207-
tracing::debug!(
208-
target: LOG_TARGET,
209-
block_hash = ?hash,
210-
"Skipping candidate production, because block is still queued for import.",
211-
);
212-
false
213-
}
214-
Ok(BlockStatus::InChainWithState) => true,
215-
Ok(BlockStatus::InChainPruned) => {
216-
tracing::error!(
217-
target: LOG_TARGET,
218-
"Skipping candidate production, because block `{:?}` is already pruned!",
219-
hash,
220-
);
221-
false
222-
}
223-
Ok(BlockStatus::KnownBad) => {
224-
tracing::error!(
225-
target: LOG_TARGET,
226-
block_hash = ?hash,
227-
"Block is tagged as known bad and is included in the relay chain! Skipping candidate production!",
228-
);
229-
false
230-
}
231-
Ok(BlockStatus::Unknown) => {
232-
if number.is_zero() {
233-
tracing::error!(
234-
target: LOG_TARGET,
235-
block_hash = ?hash,
236-
"Could not find the header of the genesis block in the database!",
237-
);
238-
} else {
239-
tracing::debug!(
240-
target: LOG_TARGET,
241-
block_hash = ?hash,
242-
"Skipping candidate production, because block is unknown.",
243-
);
244-
}
245-
false
246-
}
247-
Err(e) => {
248-
tracing::error!(
249-
target: LOG_TARGET,
250-
block_hash = ?hash,
251-
error = ?e,
252-
"Failed to get block status.",
253-
);
254-
false
255-
}
256-
}
257-
}
258-
259196
/// The background is that a receipt received from the network points to a future block
260197
/// from the local view, so we need to wait for the receipt for the block at the same
261198
/// height to be produced locally in order to check the validity of the external receipt.

0 commit comments

Comments
 (0)