Skip to content

Commit d9ef016

Browse files
Seulgi Kimmajecty
authored andcommitted
Remove stratum
1 parent 04e44a0 commit d9ef016

File tree

24 files changed

+15
-1079
lines changed

24 files changed

+15
-1079
lines changed

Cargo.lock

Lines changed: 0 additions & 32 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ codechain-sync = { path = "sync" }
3131
codechain-timer = { path = "util/timer" }
3232
codechain-types = { path = "types" }
3333
codechain-vm = { path = "vm" }
34-
codechain-stratum = { path = "stratum" }
3534
ctrlc = { git = "https://github.com/paritytech/rust-ctrlc.git" }
3635
fdlimit = "0.1"
3736
finally-block = "0.1"

core/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ codechain-network = { path = "../network" }
1717
codechain-state = { path = "../state" }
1818
codechain-timer = { path = "../util/timer" }
1919
codechain-types = { path = "../types" }
20-
codechain-stratum = { path = "../stratum" }
2120
codechain-vm = { path = "../vm" }
2221
crossbeam-channel = "0.3"
2322
hyper = { git = "https://github.com/paritytech/hyper", default-features = false }

core/src/client/client.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -544,18 +544,6 @@ impl EngineClient for Client {
544544
}
545545
}
546546

547-
/// Submit a seal for a block in the mining queue.
548-
fn submit_seal(&self, block_hash: BlockHash, seal: Vec<Bytes>) {
549-
if self.importer.miner.submit_seal(self, block_hash, seal).is_err() {
550-
cwarn!(CLIENT, "Wrong internal seal submission!")
551-
}
552-
}
553-
554-
/// Convert PoW difficulty to target.
555-
fn score_to_target(&self, score: &U256) -> U256 {
556-
self.engine.score_to_target(score)
557-
}
558-
559547
/// Update the best block as the given block hash.
560548
///
561549
/// Used in Tendermint, when going to the commit step.

core/src/client/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,12 +100,6 @@ pub trait EngineClient: Sync + Send + BlockChainTrait + ImportBlock {
100100
/// Make a new block and seal it.
101101
fn update_sealing(&self, parent_block: BlockId, allow_empty_block: bool);
102102

103-
/// Submit a seal for a block in the mining queue.
104-
fn submit_seal(&self, block_hash: BlockHash, seal: Vec<Bytes>);
105-
106-
/// Convert PoW difficulty to target.
107-
fn score_to_target(&self, score: &U256) -> U256;
108-
109103
/// Update the best block as the given block hash
110104
///
111105
/// Used in Tendermint, when going to the commit step.

core/src/client/test_client.rs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -623,16 +623,6 @@ impl super::EngineClient for TestBlockChainClient {
623623
self.miner.update_sealing(self, parent_block, allow_empty_block)
624624
}
625625

626-
fn submit_seal(&self, block_hash: BlockHash, seal: Vec<Bytes>) {
627-
if self.miner.submit_seal(self, block_hash, seal).is_err() {
628-
cwarn!(CLIENT, "Wrong internal seal submission!")
629-
}
630-
}
631-
632-
fn score_to_target(&self, _score: &U256) -> U256 {
633-
U256::zero()
634-
}
635-
636626
fn update_best_as_committed(&self, _block_hash: BlockHash) {}
637627

638628
fn get_kvdb(&self) -> Arc<dyn KeyValueDB> {

core/src/consensus/simple_poa/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,7 @@ mod tests {
186186
let b = OpenBlock::try_new(engine, db, &genesis_header, Default::default(), vec![]).unwrap();
187187
let term_common_params = CommonParams::default_for_test();
188188
let b = b.close_and_lock(&genesis_header, Some(&term_common_params)).unwrap();
189-
if let Some(seal) = engine.generate_seal(Some(b.block()), &genesis_header).seal_fields() {
190-
b.seal_block(seal);
191-
}
189+
assert_eq!(None, engine.generate_seal(Some(b.block()), &genesis_header).seal_fields());
192190
}
193191

194192
#[test]

core/src/consensus/tendermint/mod.rs

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -127,19 +127,16 @@ const SEAL_FIELDS: usize = 4;
127127
mod tests {
128128
use ccrypto::blake256;
129129
use ckey::Address;
130-
use ctypes::{CommonParams, Header};
131-
use primitives::Bytes;
130+
use ctypes::Header;
132131

133132
use super::super::BitSet;
134133
use super::message::VoteStep;
135134
use crate::account_provider::AccountProvider;
136-
use crate::block::{ClosedBlock, OpenBlock};
137135
use crate::client::TestBlockChainClient;
138-
use crate::consensus::{CodeChainEngine, EngineError, Seal};
136+
use crate::consensus::{EngineError, Seal};
139137
use crate::error::BlockError;
140138
use crate::error::Error;
141139
use crate::scheme::Scheme;
142-
use crate::tests::helpers::get_temp_state_db;
143140

144141
use super::*;
145142

@@ -155,29 +152,12 @@ mod tests {
155152
(scheme, tap, test_client)
156153
}
157154

158-
fn propose_default(scheme: &Scheme, proposer: Address) -> (ClosedBlock, Vec<Bytes>) {
159-
let db = get_temp_state_db();
160-
let db = scheme.ensure_genesis_state(db).unwrap();
161-
let genesis_header = scheme.genesis_header();
162-
let b = OpenBlock::try_new(scheme.engine.as_ref(), db, &genesis_header, proposer, vec![]).unwrap();
163-
let seal = scheme.engine.generate_seal(None, &genesis_header).seal_fields().unwrap();
164-
let term_common_params = CommonParams::default_for_test();
165-
let b = b.close(&genesis_header, Some(&term_common_params)).unwrap();
166-
(b, seal)
167-
}
168-
169155
fn insert_and_unlock(tap: &Arc<AccountProvider>, acc: &str) -> Address {
170156
let addr = tap.insert_account(blake256(acc).into(), &acc.into()).unwrap();
171157
tap.unlock_account_permanently(addr, acc.into()).unwrap();
172158
addr
173159
}
174160

175-
fn insert_and_register(tap: &Arc<AccountProvider>, engine: &dyn CodeChainEngine, acc: &str) -> Address {
176-
let addr = insert_and_unlock(tap, acc);
177-
engine.set_signer(tap.clone(), addr);
178-
addr
179-
}
180-
181161
#[test]
182162
fn has_valid_metadata() {
183163
use std::time::Duration;
@@ -209,17 +189,6 @@ mod tests {
209189
}
210190
}
211191

212-
#[test]
213-
#[ignore] // FIXME
214-
fn generate_seal() {
215-
let (scheme, tap, _c) = setup();
216-
217-
let proposer = insert_and_register(&tap, scheme.engine.as_ref(), "1");
218-
219-
let (b, seal) = propose_default(&scheme, proposer);
220-
b.lock().seal_block(seal);
221-
}
222-
223192
#[test]
224193
#[ignore] // FIXME
225194
fn parent_block_existence_checking() {

core/src/error.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ pub enum Error {
177177
Engine(EngineError),
178178
/// Key error.
179179
Key(KeyError),
180-
/// PoW hash is invalid or out of date.
181-
PowHashInvalid,
182-
/// The value of the nonce or mishash is invalid.
183-
PowInvalid,
184180
Scheme(SchemeError),
185181
/// Account Provider error.
186182
AccountProvider(AccountProviderError),
@@ -200,8 +196,6 @@ impl fmt::Display for Error {
200196
Error::Import(err) => err.fmt(f),
201197
Error::Engine(err) => err.fmt(f),
202198
Error::Key(err) => err.fmt(f),
203-
Error::PowHashInvalid => f.write_str("Invalid or out of date PoW hash."),
204-
Error::PowInvalid => f.write_str("Invalid nonce or mishash"),
205199
Error::Scheme(err) => err.fmt(f),
206200
Error::AccountProvider(err) => err.fmt(f),
207201
Error::Trie(err) => err.fmt(f),

core/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ extern crate codechain_logger as clogger;
2727
extern crate codechain_merkle as cmerkle;
2828
extern crate codechain_network as cnetwork;
2929
extern crate codechain_state as cstate;
30-
extern crate codechain_stratum as cstratum;
3130
extern crate codechain_timer as ctimer;
3231
extern crate codechain_types as ctypes;
3332
extern crate codechain_vm as cvm;
@@ -71,7 +70,7 @@ pub use crate::client::{
7170
pub use crate::consensus::{EngineType, TimeGapParams};
7271
pub use crate::db::{COL_STATE, NUM_COLUMNS};
7372
pub use crate::error::{BlockImportError, Error, ImportError};
74-
pub use crate::miner::{MemPoolFees, Miner, MinerOptions, MinerService, Stratum, StratumConfig, StratumError};
73+
pub use crate::miner::{MemPoolFees, Miner, MinerOptions, MinerService};
7574
pub use crate::scheme::Scheme;
7675
pub use crate::service::ClientService;
7776
pub use crate::transaction::{

0 commit comments

Comments
 (0)