Skip to content

Commit

Permalink
Merge pull request #71 from SurfingNerd/release_9_1
Browse files Browse the repository at this point in the history
Release 9.1
  • Loading branch information
SurfingNerd authored Sep 29, 2023
2 parents a1cfb22 + 36ef6c9 commit 27e083a
Show file tree
Hide file tree
Showing 33 changed files with 353 additions and 152 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- ubuntu-latest
# - macos-latest
toolchain:
- 1.59
- 1.72
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout sources
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ jobs:
strategy:
matrix:
platform:
- ubuntu-16.04
- ubuntu-20.04
# - macos-latest
toolchain:
- 1.59
- 1.72
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout sources
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:

- name: Upload Linux build
uses: actions/upload-artifact@v2
if: matrix.platform == 'ubuntu-16.04'
if: matrix.platform == 'ubuntu-20.04'
with:
name: linux-artifacts
path: artifacts
Expand All @@ -76,7 +76,7 @@ jobs:
zip-artifacts-creator:
name: Create zip artifacts
needs: build
runs-on: ubuntu-16.04
runs-on: ubuntu-20.04
steps:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
draft-release:
name: Draft Release
needs: zip-artifacts-creator
runs-on: ubuntu-16.04
runs-on: ubuntu-20.04
steps:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install 1.59 toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: 1.59
toolchain: 1.72
profile: minimal
override: true
- name: Run cargo check 1/3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.59
toolchain: 1.72
override: true
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## Diamond Node Software 3.3.5-hbbft-0.9.1

- [pruning protection for hbbft engine] https://github.com/DMDcoin/diamond-node/issues/6
- [reported fault: UnknownSender] https://github.com/DMDcoin/diamond-node/issues/69

## Diamond Node Software 3.3.5-hbbft-0.9.0

- Start of Alpha 2 Testnet
- Improved Stability
- Feature preparation for Hbbft Block Reward support

## Diamond Node Software 3.3.5-hbbft-0.8.9

Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
description = "Diamond Node"
name = "diamond-node"
# NOTE Make sure to update util/version/Cargo.toml as well
version = "3.3.5-hbbft-0.9.0"
version = "3.3.5-hbbft-0.9.1"
license = "GPL-3.0"
authors = [
"bit.diamonds developers",
Expand Down
7 changes: 7 additions & 0 deletions bin/oe/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ use ethcore::{
Balance, BlockChainClient, BlockChainReset, BlockId, DatabaseCompactionProfile,
ImportExportBlocks, Mode, Nonce, VMType,
},
exit::ShutdownManager,
miner::Miner,
verification::queue::VerifierSettings,
};
Expand Down Expand Up @@ -212,6 +213,7 @@ fn execute_import(cmd: ImportBlockchain) -> Result<(), String> {
// TODO [ToDr] don't use test miner here
// (actually don't require miner at all)
Arc::new(Miner::new_for_tests(&spec, None)),
ShutdownManager::null(),
)
.map_err(|e| format!("Client service error: {:?}", e))?;

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

Expand All @@ -367,6 +371,7 @@ fn execute_export(cmd: ExportBlockchain) -> Result<(), String> {
cmd.cache_config,
false,
cmd.max_round_blocks_to_import,
ShutdownManager::null(),
)?;
let client = service.client();

Expand Down Expand Up @@ -396,6 +401,7 @@ fn execute_export_state(cmd: ExportState) -> Result<(), String> {
cmd.cache_config,
true,
cmd.max_round_blocks_to_import,
ShutdownManager::null(),
)?;

let client = service.client();
Expand Down Expand Up @@ -514,6 +520,7 @@ fn execute_reset(cmd: ResetBlockchain) -> Result<(), String> {
cmd.cache_config,
false,
0,
ShutdownManager::null(),
)?;

let client = service.client();
Expand Down
17 changes: 13 additions & 4 deletions bin/oe/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ use crate::{
use std::alloc::System;

pub use self::{configuration::Configuration, run::RunningClient};
pub use ethcore::exit::ShutdownManager;
pub use ethcore_logger::{setup_log, Config as LoggerConfig, RotatingLogger};
pub use parity_rpc::PubSubSession;

Expand Down Expand Up @@ -199,13 +200,17 @@ pub enum ExecutionAction {
Running(RunningClient),
}

fn execute(command: Execute, logger: Arc<RotatingLogger>) -> Result<ExecutionAction, String> {
fn execute(
command: Execute,
logger: Arc<RotatingLogger>,
shutdown: ShutdownManager,
) -> Result<ExecutionAction, String> {
#[cfg(feature = "deadlock_detection")]
run_deadlock_detection_thread();

match command.cmd {
Cmd::Run(run_cmd) => {
let outcome = run::execute(run_cmd, logger)?;
let outcome = run::execute(run_cmd, logger, shutdown)?;
Ok(ExecutionAction::Running(outcome))
}
Cmd::Version => Ok(ExecutionAction::Instant(Some(Args::print_version()))),
Expand Down Expand Up @@ -250,6 +255,10 @@ fn execute(command: Execute, logger: Arc<RotatingLogger>) -> Result<ExecutionAct
///
/// On error, returns what to print on stderr.
// FIXME: totally independent logging capability, see https://github.com/openethereum/openethereum/issues/10252
pub fn start(conf: Configuration, logger: Arc<RotatingLogger>) -> Result<ExecutionAction, String> {
execute(conf.into_command()?, logger)
pub fn start(
conf: Configuration,
logger: Arc<RotatingLogger>,
shutdown: ShutdownManager,
) -> Result<ExecutionAction, String> {
execute(conf.into_command()?, logger, shutdown)
}
43 changes: 14 additions & 29 deletions bin/oe/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,25 @@ extern crate ethcore_logger;
#[cfg(windows)]
extern crate winapi;

extern crate ethcore;

use std::{
io::Write,
process,
process::{self},
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
};

use ansi_term::Colour;
use diamond_node::{start, ExecutionAction};
use diamond_node::{start, ExecutionAction, ShutdownManager};
use ethcore::exit::ExitStatus;
use ethcore_logger::setup_log;
use fdlimit::raise_fd_limit;
use parity_daemonize::AsHandle;
use parking_lot::{Condvar, Mutex};

#[derive(Debug)]
/// Status used to exit or restart the program.
struct ExitStatus {
/// Whether the program panicked.
panicking: bool,
/// Whether the program should exit.
should_exit: bool,
}

fn main() -> Result<(), i32> {
let conf = {
let args = std::env::args().collect::<Vec<_>>();
Expand Down Expand Up @@ -92,20 +86,17 @@ fn main() -> Result<(), i32> {
// increase max number of open files
raise_fd_limit();

let exit = Arc::new((
Mutex::new(ExitStatus {
panicking: false,
should_exit: false,
}),
Condvar::new(),
));
//let lockMutex =

let exit = Arc::new((Mutex::new(ExitStatus::new()), Condvar::new()));

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

trace!(target: "mode", "Not hypervised: not setting exit handlers.");
let exec = start(conf, logger);
let shutdown = ShutdownManager::new(&exit);
let exec = start(conf, logger, shutdown);

match exec {
Ok(result) => match result {
Expand All @@ -122,10 +113,7 @@ fn main() -> Result<(), i32> {
warn!("Panic occured, see stderr for details");
eprintln!("{}", panic_msg);
if !exiting.swap(true, Ordering::SeqCst) {
*e.0.lock() = ExitStatus {
panicking: true,
should_exit: true,
};
*e.0.lock() = ExitStatus::new_panicking();
e.1.notify_all();
}
}
Expand All @@ -136,10 +124,7 @@ fn main() -> Result<(), i32> {
let exiting = exiting.clone();
move || {
if !exiting.swap(true, Ordering::SeqCst) {
*e.0.lock() = ExitStatus {
panicking: false,
should_exit: true,
};
*e.0.lock() = ExitStatus::new_should_exit();
e.1.notify_all();
}
}
Expand All @@ -160,13 +145,13 @@ fn main() -> Result<(), i32> {

// Wait for signal
let mut lock = exit.0.lock();
if !lock.should_exit {
if !lock.should_exit() {
let _ = exit.1.wait(&mut lock);
}

client.shutdown();

if lock.panicking {
if lock.is_panicking() {
return Err(1);
}
}
Expand Down
8 changes: 7 additions & 1 deletion bin/oe/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ use ethcore::{
client::{
BlockChainClient, BlockInfo, ChainSyncing, Client, DatabaseCompactionProfile, Mode, VMType,
},
exit::ShutdownManager,
miner::{self, stratum, Miner, MinerOptions, MinerService},
snapshot::{self, SnapshotConfiguration},
verification::queue::VerifierSettings,
Expand Down Expand Up @@ -163,7 +164,11 @@ impl ChainSyncing for SyncProviderWrapper {
/// Executes the given run command.
///
/// On error, returns what to print on stderr.
pub fn execute(cmd: RunCmd, logger: Arc<RotatingLogger>) -> Result<RunningClient, String> {
pub fn execute(
cmd: RunCmd,
logger: Arc<RotatingLogger>,
shutdown: ShutdownManager,
) -> Result<RunningClient, String> {
// load spec
let spec = cmd.spec.spec(&cmd.dirs.cache)?;

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

Expand Down
2 changes: 2 additions & 0 deletions bin/oe/snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use std::{
use crate::{hash::keccak, types::ids::BlockId};
use ethcore::{
client::{DatabaseCompactionProfile, Mode, VMType},
exit::ShutdownManager,
miner::Miner,
snapshot::{
io::{PackedReader, PackedWriter, SnapshotReader},
Expand Down Expand Up @@ -239,6 +240,7 @@ impl SnapshotCommand {
// TODO [ToDr] don't use test miner here
// (actually don't require miner at all)
Arc::new(Miner::new_for_tests(&spec, None)),
ShutdownManager::null(),
)
.map_err(|e| format!("Client service error: {:?}", e))?;

Expand Down
4 changes: 4 additions & 0 deletions crates/ethcore/service/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ use blockchain::{BlockChainDB, BlockChainDBHandler};
use ethcore::{
client::{ChainNotify, Client, ClientConfig, ClientIoMessage},
error::{Error as EthcoreError, ErrorKind},
exit::ShutdownManager,
miner::Miner,
snapshot::{
service::{Service as SnapshotService, ServiceParams as SnapServiceParams},
Expand Down Expand Up @@ -55,6 +56,7 @@ impl ClientService {
restoration_db_handler: Box<dyn BlockChainDBHandler>,
_ipc_path: &Path,
miner: Arc<Miner>,
shutdown: ShutdownManager,
) -> Result<ClientService, Error> {
let io_service = IoService::<ClientIoMessage>::start("Client")?;

Expand All @@ -71,6 +73,7 @@ impl ClientService {
blockchain_db.clone(),
miner.clone(),
io_service.channel(),
shutdown,
)?;
miner.set_io_channel(io_service.channel());
miner.set_in_chain_checker(&client.clone());
Expand Down Expand Up @@ -269,6 +272,7 @@ mod tests {
restoration_db_handler,
tempdir.path(),
Arc::new(Miner::new_for_tests(&spec, None)),
ShutdownManager::null(),
);
assert!(service.is_ok());
drop(service.unwrap());
Expand Down
Loading

0 comments on commit 27e083a

Please sign in to comment.