|
16 | 16 | */ |
17 | 17 |
|
18 | 18 | use crate::{ |
19 | | - block_production_suspension::{BlockProductionSuspender, GLOBAL_BLOCK_SUSPENDER}, |
| 19 | + block_production_suspension::{BlockProductionSuspender, SuspendBlockProductionTrait}, |
20 | 20 | test::mocks::verifier_mock::VerifierMock, |
21 | 21 | BlockImport, Error, Result, |
22 | 22 | }; |
23 | 23 | use core::marker::PhantomData; |
24 | 24 | use itp_sgx_crypto::aes::Aes; |
25 | 25 | use itp_sgx_externalities::SgxExternalities; |
26 | 26 | use itp_test::mock::onchain_mock::OnchainMock; |
27 | | -use itp_types::H256; |
| 27 | +use itp_types::{MrEnclave, H256}; |
28 | 28 | use its_primitives::traits::{ShardIdentifierFor, SignedBlock as SignedSidechainBlockTrait}; |
29 | 29 | use sp_core::Pair; |
30 | 30 | use sp_runtime::traits::Block as ParentchainBlockTrait; |
31 | 31 | use std::{collections::VecDeque, sync::RwLock}; |
32 | 32 |
|
| 33 | +pub struct MockBlockProductionSuspender; |
| 34 | + |
| 35 | +impl SuspendBlockProductionTrait for MockBlockProductionSuspender { |
| 36 | + fn current_mr_enclave(&self) -> Result<MrEnclave> { |
| 37 | + Ok(Default::default()) |
| 38 | + } |
| 39 | + |
| 40 | + fn suspend_for_production(&self) -> Result<()> { |
| 41 | + Ok(()) |
| 42 | + } |
| 43 | + |
| 44 | + fn resume_for_production(&self) -> Result<()> { |
| 45 | + Ok(()) |
| 46 | + } |
| 47 | + |
| 48 | + fn is_production_suspended(&self) -> Result<bool> { |
| 49 | + Ok(false) |
| 50 | + } |
| 51 | +} |
| 52 | + |
33 | 53 | /// Block importer mock. |
34 | 54 | pub struct BlockImportMock<ParentchainBlock, SignedSidechainBlock> |
35 | 55 | where |
|
99 | 119 | type SidechainState = SgxExternalities; |
100 | 120 | type StateCrypto = Aes; |
101 | 121 | type Context = OnchainMock; |
102 | | - type BlockSuspender = BlockProductionSuspender; |
| 122 | + type BlockSuspender = MockBlockProductionSuspender; |
103 | 123 |
|
104 | 124 | fn verifier( |
105 | 125 | &self, |
@@ -131,7 +151,7 @@ where |
131 | 151 | } |
132 | 152 |
|
133 | 153 | fn block_suspender(&self) -> Self::BlockSuspender { |
134 | | - GLOBAL_BLOCK_SUSPENDER.clone() |
| 154 | + MockBlockProductionSuspender |
135 | 155 | } |
136 | 156 |
|
137 | 157 | fn state_key(&self) -> Result<Self::StateCrypto> { |
|
0 commit comments