Skip to content

Commit 27e083a

Browse files
authored
Merge pull request #71 from SurfingNerd/release_9_1
Release 9.1
2 parents a1cfb22 + 36ef6c9 commit 27e083a

File tree

33 files changed

+353
-152
lines changed

33 files changed

+353
-152
lines changed

.github/workflows/build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- ubuntu-latest
1616
# - macos-latest
1717
toolchain:
18-
- 1.59
18+
- 1.72
1919
runs-on: ${{ matrix.platform }}
2020
steps:
2121
- name: Checkout sources

.github/workflows/build.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ jobs:
1717
strategy:
1818
matrix:
1919
platform:
20-
- ubuntu-16.04
20+
- ubuntu-20.04
2121
# - macos-latest
2222
toolchain:
23-
- 1.59
23+
- 1.72
2424
runs-on: ${{ matrix.platform }}
2525
steps:
2626
- name: Checkout sources
@@ -61,7 +61,7 @@ jobs:
6161

6262
- name: Upload Linux build
6363
uses: actions/upload-artifact@v2
64-
if: matrix.platform == 'ubuntu-16.04'
64+
if: matrix.platform == 'ubuntu-20.04'
6565
with:
6666
name: linux-artifacts
6767
path: artifacts
@@ -76,7 +76,7 @@ jobs:
7676
zip-artifacts-creator:
7777
name: Create zip artifacts
7878
needs: build
79-
runs-on: ubuntu-16.04
79+
runs-on: ubuntu-20.04
8080
steps:
8181
- name: Set env
8282
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
@@ -197,7 +197,7 @@ jobs:
197197
draft-release:
198198
name: Draft Release
199199
needs: zip-artifacts-creator
200-
runs-on: ubuntu-16.04
200+
runs-on: ubuntu-20.04
201201
steps:
202202
- name: Set env
203203
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV

.github/workflows/check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Install 1.59 toolchain
1919
uses: actions-rs/toolchain@v1
2020
with:
21-
toolchain: 1.59
21+
toolchain: 1.72
2222
profile: minimal
2323
override: true
2424
- name: Run cargo check 1/3

.github/workflows/fmt.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- uses: actions-rs/toolchain@v1
1212
with:
1313
profile: minimal
14-
toolchain: 1.59
14+
toolchain: 1.72
1515
override: true
1616
- run: rustup component add rustfmt
1717
- uses: actions-rs/cargo@v1

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## Diamond Node Software 3.3.5-hbbft-0.9.1
2+
3+
- [pruning protection for hbbft engine] https://github.com/DMDcoin/diamond-node/issues/6
4+
- [reported fault: UnknownSender] https://github.com/DMDcoin/diamond-node/issues/69
5+
6+
## Diamond Node Software 3.3.5-hbbft-0.9.0
7+
8+
- Start of Alpha 2 Testnet
9+
- Improved Stability
10+
- Feature preparation for Hbbft Block Reward support
111

212
## Diamond Node Software 3.3.5-hbbft-0.8.9
313

Cargo.lock

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "Diamond Node"
33
name = "diamond-node"
44
# NOTE Make sure to update util/version/Cargo.toml as well
5-
version = "3.3.5-hbbft-0.9.0"
5+
version = "3.3.5-hbbft-0.9.1"
66
license = "GPL-3.0"
77
authors = [
88
"bit.diamonds developers",

bin/oe/blockchain.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ use ethcore::{
3434
Balance, BlockChainClient, BlockChainReset, BlockId, DatabaseCompactionProfile,
3535
ImportExportBlocks, Mode, Nonce, VMType,
3636
},
37+
exit::ShutdownManager,
3738
miner::Miner,
3839
verification::queue::VerifierSettings,
3940
};
@@ -212,6 +213,7 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
212213
// TODO [ToDr] don't use test miner here
213214
// (actually don't require miner at all)
214215
Arc::new(Miner::new_for_tests(&spec, None)),
216+
ShutdownManager::null(),
215217
)
216218
.map_err(|e| format!("Client service error: {:?}", e))?;
217219

@@ -277,6 +279,7 @@ fn start_client(
277279
cache_config: CacheConfig,
278280
require_fat_db: bool,
279281
max_round_blocks_to_import: usize,
282+
shutdown: ShutdownManager,
280283
) -> Result<ClientService, String> {
281284
// load spec file
282285
let spec = spec.spec(&dirs.cache)?;
@@ -347,6 +350,7 @@ fn start_client(
347350
// It's fine to use test version here,
348351
// since we don't care about miner parameters at all
349352
Arc::new(Miner::new_for_tests(&spec, None)),
353+
shutdown,
350354
)
351355
.map_err(|e| format!("Client service error: {:?}", e))?;
352356

@@ -367,6 +371,7 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
367371
cmd.cache_config,
368372
false,
369373
cmd.max_round_blocks_to_import,
374+
ShutdownManager::null(),
370375
)?;
371376
let client = service.client();
372377

@@ -396,6 +401,7 @@ fn execute_export_state(cmd: ExportState) -> Result<(), String> {
396401
cmd.cache_config,
397402
true,
398403
cmd.max_round_blocks_to_import,
404+
ShutdownManager::null(),
399405
)?;
400406

401407
let client = service.client();
@@ -514,6 +520,7 @@ fn execute_reset(cmd: ResetBlockchain) -> Result<(), String> {
514520
cmd.cache_config,
515521
false,
516522
0,
523+
ShutdownManager::null(),
517524
)?;
518525

519526
let client = service.client();

bin/oe/lib.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ use crate::{
127127
use std::alloc::System;
128128

129129
pub use self::{configuration::Configuration, run::RunningClient};
130+
pub use ethcore::exit::ShutdownManager;
130131
pub use ethcore_logger::{setup_log, Config as LoggerConfig, RotatingLogger};
131132
pub use parity_rpc::PubSubSession;
132133

@@ -199,13 +200,17 @@ pub enum ExecutionAction {
199200
Running(RunningClient),
200201
}
201202

202-
fn execute(command: Execute, logger: Arc<RotatingLogger>) -> Result<ExecutionAction, String> {
203+
fn execute(
204+
command: Execute,
205+
logger: Arc<RotatingLogger>,
206+
shutdown: ShutdownManager,
207+
) -> Result<ExecutionAction, String> {
203208
#[cfg(feature = "deadlock_detection")]
204209
run_deadlock_detection_thread();
205210

206211
match command.cmd {
207212
Cmd::Run(run_cmd) => {
208-
let outcome = run::execute(run_cmd, logger)?;
213+
let outcome = run::execute(run_cmd, logger, shutdown)?;
209214
Ok(ExecutionAction::Running(outcome))
210215
}
211216
Cmd::Version => Ok(ExecutionAction::Instant(Some(Args::print_version()))),
@@ -250,6 +255,10 @@ fn execute(command: Execute, logger: Arc<RotatingLogger>) -> Result<ExecutionAct
250255
///
251256
/// On error, returns what to print on stderr.
252257
// FIXME: totally independent logging capability, see https://github.com/openethereum/openethereum/issues/10252
253-
pub fn start(conf: Configuration, logger: Arc<RotatingLogger>) -> Result<ExecutionAction, String> {
254-
execute(conf.into_command()?, logger)
258+
pub fn start(
259+
conf: Configuration,
260+
logger: Arc<RotatingLogger>,
261+
shutdown: ShutdownManager,
262+
) -> Result<ExecutionAction, String> {
263+
execute(conf.into_command()?, logger, shutdown)
255264
}

bin/oe/main.rs

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,25 @@ extern crate ethcore_logger;
3333
#[cfg(windows)]
3434
extern crate winapi;
3535

36+
extern crate ethcore;
37+
3638
use std::{
3739
io::Write,
38-
process,
40+
process::{self},
3941
sync::{
4042
atomic::{AtomicBool, Ordering},
4143
Arc,
4244
},
4345
};
4446

4547
use ansi_term::Colour;
46-
use diamond_node::{start, ExecutionAction};
48+
use diamond_node::{start, ExecutionAction, ShutdownManager};
49+
use ethcore::exit::ExitStatus;
4750
use ethcore_logger::setup_log;
4851
use fdlimit::raise_fd_limit;
4952
use parity_daemonize::AsHandle;
5053
use parking_lot::{Condvar, Mutex};
5154

52-
#[derive(Debug)]
53-
/// Status used to exit or restart the program.
54-
struct ExitStatus {
55-
/// Whether the program panicked.
56-
panicking: bool,
57-
/// Whether the program should exit.
58-
should_exit: bool,
59-
}
60-
6155
fn main() -> Result<(), i32> {
6256
let conf = {
6357
let args = std::env::args().collect::<Vec<_>>();
@@ -92,20 +86,17 @@ fn main() -> Result<(), i32> {
9286
// increase max number of open files
9387
raise_fd_limit();
9488

95-
let exit = Arc::new((
96-
Mutex::new(ExitStatus {
97-
panicking: false,
98-
should_exit: false,
99-
}),
100-
Condvar::new(),
101-
));
89+
//let lockMutex =
90+
91+
let exit = Arc::new((Mutex::new(ExitStatus::new()), Condvar::new()));
10292

10393
// Double panic can happen. So when we lock `ExitStatus` after the main thread is notified, it cannot be locked
10494
// again.
10595
let exiting = Arc::new(AtomicBool::new(false));
10696

10797
trace!(target: "mode", "Not hypervised: not setting exit handlers.");
108-
let exec = start(conf, logger);
98+
let shutdown = ShutdownManager::new(&exit);
99+
let exec = start(conf, logger, shutdown);
109100

110101
match exec {
111102
Ok(result) => match result {
@@ -122,10 +113,7 @@ fn main() -> Result<(), i32> {
122113
warn!("Panic occured, see stderr for details");
123114
eprintln!("{}", panic_msg);
124115
if !exiting.swap(true, Ordering::SeqCst) {
125-
*e.0.lock() = ExitStatus {
126-
panicking: true,
127-
should_exit: true,
128-
};
116+
*e.0.lock() = ExitStatus::new_panicking();
129117
e.1.notify_all();
130118
}
131119
}
@@ -136,10 +124,7 @@ fn main() -> Result<(), i32> {
136124
let exiting = exiting.clone();
137125
move || {
138126
if !exiting.swap(true, Ordering::SeqCst) {
139-
*e.0.lock() = ExitStatus {
140-
panicking: false,
141-
should_exit: true,
142-
};
127+
*e.0.lock() = ExitStatus::new_should_exit();
143128
e.1.notify_all();
144129
}
145130
}
@@ -160,13 +145,13 @@ fn main() -> Result<(), i32> {
160145

161146
// Wait for signal
162147
let mut lock = exit.0.lock();
163-
if !lock.should_exit {
148+
if !lock.should_exit() {
164149
let _ = exit.1.wait(&mut lock);
165150
}
166151

167152
client.shutdown();
168153

169-
if lock.panicking {
154+
if lock.is_panicking() {
170155
return Err(1);
171156
}
172157
}

bin/oe/run.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ use ethcore::{
4646
client::{
4747
BlockChainClient, BlockInfo, ChainSyncing, Client, DatabaseCompactionProfile, Mode, VMType,
4848
},
49+
exit::ShutdownManager,
4950
miner::{self, stratum, Miner, MinerOptions, MinerService},
5051
snapshot::{self, SnapshotConfiguration},
5152
verification::queue::VerifierSettings,
@@ -163,7 +164,11 @@ impl ChainSyncing for SyncProviderWrapper {
163164
/// Executes the given run command.
164165
///
165166
/// On error, returns what to print on stderr.
166-
pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient, String> {
167+
pub fn execute(
168+
cmd: RunCmd,
169+
logger: Arc<RotatingLogger>,
170+
shutdown: ShutdownManager,
171+
) -> Result<RunningClient, String> {
167172
// load spec
168173
let spec = cmd.spec.spec(&cmd.dirs.cache)?;
169174

@@ -378,6 +383,7 @@ pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient
378383
restoration_db_handler,
379384
&cmd.dirs.ipc_path(),
380385
miner.clone(),
386+
shutdown,
381387
)
382388
.map_err(|e| format!("Client service error: {:?}", e))?;
383389

bin/oe/snapshot.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ use std::{
2525
use crate::{hash::keccak, types::ids::BlockId};
2626
use ethcore::{
2727
client::{DatabaseCompactionProfile, Mode, VMType},
28+
exit::ShutdownManager,
2829
miner::Miner,
2930
snapshot::{
3031
io::{PackedReader, PackedWriter, SnapshotReader},
@@ -239,6 +240,7 @@ impl SnapshotCommand {
239240
// TODO [ToDr] don't use test miner here
240241
// (actually don't require miner at all)
241242
Arc::new(Miner::new_for_tests(&spec, None)),
243+
ShutdownManager::null(),
242244
)
243245
.map_err(|e| format!("Client service error: {:?}", e))?;
244246

crates/ethcore/service/src/service.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use blockchain::{BlockChainDB, BlockChainDBHandler};
2626
use ethcore::{
2727
client::{ChainNotify, Client, ClientConfig, ClientIoMessage},
2828
error::{Error as EthcoreError, ErrorKind},
29+
exit::ShutdownManager,
2930
miner::Miner,
3031
snapshot::{
3132
service::{Service as SnapshotService, ServiceParams as SnapServiceParams},
@@ -55,6 +56,7 @@ impl ClientService {
5556
restoration_db_handler: Box<dyn BlockChainDBHandler>,
5657
_ipc_path: &Path,
5758
miner: Arc<Miner>,
59+
shutdown: ShutdownManager,
5860
) -> Result<ClientService, Error> {
5961
let io_service = IoService::<ClientIoMessage>::start("Client")?;
6062

@@ -71,6 +73,7 @@ impl ClientService {
7173
blockchain_db.clone(),
7274
miner.clone(),
7375
io_service.channel(),
76+
shutdown,
7477
)?;
7578
miner.set_io_channel(io_service.channel());
7679
miner.set_in_chain_checker(&client.clone());
@@ -269,6 +272,7 @@ mod tests {
269272
restoration_db_handler,
270273
tempdir.path(),
271274
Arc::new(Miner::new_for_tests(&spec, None)),
275+
ShutdownManager::null(),
272276
);
273277
assert!(service.is_ok());
274278
drop(service.unwrap());

0 commit comments

Comments
 (0)