Skip to content

Commit 18aeb3b

Browse files
authored
Merge pull request #76 from SurfingNerd/release_9_2
Release 0.9.2 pull request.
2 parents 35a78e1 + 58a0695 commit 18aeb3b

File tree

13 files changed

+107
-65
lines changed

13 files changed

+107
-65
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
## Diamond Node Software 3.3.5-hbbft-0.9.2
2+
3+
- [FIXED: pruning as root cause for stage 3 errors] https://github.com/DMDcoin/diamond-node/issues/68
4+
15
## Diamond Node Software 3.3.5-hbbft-0.9.1
26

3-
- [pruning protection for hbbft engine] https://github.com/DMDcoin/diamond-node/issues/6
7+
- [pruning protection for hbbft engine] https://github.com/DMDcoin/diamond-node/issues/62
48
- [reported fault: UnknownSender] https://github.com/DMDcoin/diamond-node/issues/69
59

610
## Diamond Node Software 3.3.5-hbbft-0.9.0

Cargo.lock

Lines changed: 3 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.1"
5+
version = "3.3.5-hbbft-0.9.2"
66
license = "GPL-3.0"
77
authors = [
88
"bit.diamonds developers",

README.md

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
# OpenEthereum
1+
# Diamond Node
22

3-
Fast and feature-rich multi-network Ethereum client.
4-
5-
[» Download the latest release «](https://github.com/openethereum/openethereum/releases/latest)
3+
Node client for the protocol version 4 of the bit.diamonds network.
64

75
[![GPL licensed][license-badge]][license-url]
86
[![Build Status][ci-badge]][ci-url]
97
[![Discord chat][chat-badge]][chat-url]
108

119
[license-badge]: https://img.shields.io/badge/license-GPL_v3-green.svg
1210
[license-url]: LICENSE
13-
[ci-badge]: https://github.com/openethereum/openethereum/workflows/Build%20and%20Test%20Suite/badge.svg
14-
[ci-url]: https://github.com/openethereum/openethereum/actions
15-
[chat-badge]: https://img.shields.io/discord/669192218728202270.svg?logo=discord
16-
[chat-url]: https://discord.io/openethereum
11+
[chat-url]: (https://dmdcoin.slack.com/)
1712

1813
## Table of Contents
1914

@@ -32,29 +27,25 @@ Fast and feature-rich multi-network Ethereum client.
3227

3328
## 1. Description <a id="chapter-001"></a>
3429

35-
**Built for mission-critical use**: Miners, service providers, and exchanges need fast synchronisation and maximum uptime. OpenEthereum provides the core infrastructure essential for speedy and reliable services.
36-
37-
- Clean, modular codebase for easy customisation
38-
- Advanced CLI-based client
39-
- Minimal memory and storage footprint
40-
- Synchronise in hours, not days with Warp Sync
41-
- Modular for light integration into your service or product
30+
diamond-node is the node software for the upcomming V4 of the diamond network.
31+
The Node Software is on a alpha level and still under active development.
4232

4333
## 2. Technical Overview <a id="chapter-002"></a>
4434

45-
OpenEthereum's goal is to be the fastest, lightest, and most secure Ethereum client. We are developing OpenEthereum using the **Rust programming language**. OpenEthereum is licensed under the GPLv3 and can be used for all your Ethereum needs.
35+
diamond-node builds on OpenEthereum, and shares a lot of base features,
36+
covered in the [OpenEthereum Documentation](https://openethereum.github.io/).
4637

47-
By default, OpenEthereum runs a JSON-RPC HTTP server on port `:8545` and a Web-Sockets server on port `:8546`. This is fully configurable and supports a number of APIs.
38+
By default, diamond-node runs a JSON-RPC HTTP server on port `:8545` and a Web-Sockets server on port `:8546`. This is fully configurable and supports a number of APIs.
4839

49-
If you run into problems while using OpenEthereum, check out the [old wiki for documentation](https://openethereum.github.io/), feel free to [file an issue in this repository](https://github.com/openethereum/openethereum/issues/new), or hop on our [Discord](https://discord.io/openethereum) chat room to ask a question. We are glad to help!
40+
If you run into problems while using diamond-node, feel free to [file an issue in this repository](https://github.com/dmdcoind/diamond-node/issues/new), or hop on our [Slack](https://dmdcoin.slack.com/), [Telegram](https://t.me/DMDcoin) or [Discord](https://discord.gg/TStv6gm) chat room to ask a question. We are glad to help!
5041

51-
You can download OpenEthereum's latest release at [the releases page](https://github.com/openethereum/openethereum/releases) or follow the instructions below to build from source. Read the [CHANGELOG.md](CHANGELOG.md) for a list of all changes between different versions.
42+
We do not provide binaries and suggest to build from source.
5243

5344
## 3. Building <a id="chapter-003"></a>
5445

5546
### 3.1 Build Dependencies <a id="chapter-0031"></a>
5647

57-
OpenEthereum requires **latest stable Rust version** to build.
48+
diamond-node requires **latest stable Rust version** to build.
5849

5950
We recommend installing Rust through [rustup](https://www.rustup.rs/). If you don't already have `rustup`, you can install it like this:
6051

@@ -63,7 +54,7 @@ We recommend installing Rust through [rustup](https://www.rustup.rs/). If you do
6354
$ curl https://sh.rustup.rs -sSf | sh
6455
```
6556

66-
OpenEthereum also requires `clang` (>= 9.0), `clang++`, `pkg-config`, `file`, `make`, and `cmake` packages to be installed.
57+
diamond-node also requires `clang` (>= 9.0), `clang++`, `pkg-config`, `file`, `make`, and `cmake` packages to be installed.
6758

6859
- OSX:
6960
```bash
@@ -83,14 +74,14 @@ Once you have `rustup` installed, then you need to install:
8374
* [Perl](https://www.perl.org)
8475
* [Yasm](https://yasm.tortall.net)
8576

86-
Make sure that these binaries are in your `PATH`. After that, you should be able to build OpenEthereum from source.
77+
Make sure that these binaries are in your `PATH`. After that, you should be able to build diamond-node from source.
8778

8879
### 3.2 Build from Source Code <a id="chapter-0032"></a>
8980

9081
```bash
9182
# download OpenEthereum code
92-
$ git clone https://github.com/openethereum/openethereum
93-
$ cd openethereum
83+
$ git clone https://github.com/DMDcoin/diamond-node
84+
$ cd diamond-node
9485

9586
# build in release mode
9687
$ cargo build --release --features final
@@ -116,26 +107,26 @@ This always compiles the latest nightly builds. If you want to build stable, do
116107
$ git checkout stable
117108
```
118109

119-
### 3.3 Starting OpenEthereum <a id="chapter-0034"></a>
110+
### 3.3 Starting diamond-node <a id="chapter-0034"></a>
120111

121112
#### Manually
122113

123-
To start OpenEthereum manually, just run
114+
To start diamond-node manually, just run
124115

125116
```bash
126117
$ ./target/release/openethereum
127118
```
128119

129-
so OpenEthereum begins syncing the Ethereum blockchain.
120+
so diamond-node begins syncing the Ethereum blockchain.
130121

131122
#### Using `systemd` service file
132123

133-
To start OpenEthereum as a regular user using `systemd` init:
124+
To start diamond-node as a regular user using `systemd` init:
134125

135126
1. Copy `./scripts/openethereum.service` to your
136127
`systemd` user directory (usually `~/.config/systemd/user`).
137128
2. Copy release to bin folder, write `sudo install ./target/release/openethereum /usr/bin/openethereum`
138-
3. To configure OpenEthereum, see [our wiki](https://openethereum.github.io/Configuring-OpenEthereum) for details.
129+
3. To configure diamond-node, see [our wiki](https://openethereum.github.io/Configuring-OpenEthereum) for details.
139130

140131
## 4. Testing <a id="chapter-004"></a>
141132

bin/oe/cli/usage_header.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
OpenEthereum Client.
2-
By Wood/Paronyan/Kotewicz/Drwięga/Volf/Greeff
1+
diamond-node bit.diamonds Node Software
2+
By Haller/Forstenlechner/Wood/Paronyan/Kotewicz/Drwięga/Volf/Greeff
33
Habermeier/Czaban/Gotchac/Redman/Nikolsky
44
Schoedon/Tang/Adolfsson/Silva/Palm/Hirsz et al.
55
Copyright 2015-2020 Parity Technologies (UK) Ltd.

bin/oe/metrics.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ fn handle_request(
5959
elapsed.as_millis() as i64,
6060
);
6161

62+
reg.register_version();
63+
6264
let mut buffer = vec![];
6365
let encoder = prometheus::TextEncoder::new();
6466
let metric_families = reg.registry().gather();

crates/ethcore/src/client/client.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ impl Client {
13131313
break;
13141314
}
13151315
match state_db.journal_db().earliest_era() {
1316-
Some(mut earliest_era) if earliest_era + self.history <= latest_era => {
1316+
Some(earliest_era) if earliest_era + self.history <= latest_era => {
13171317
let freeze_at = self.snapshotting_at.load(AtomicOrdering::SeqCst);
13181318
if freeze_at > 0 && freeze_at == earliest_era {
13191319
// Note: journal_db().mem_used() can be used for a more accurate memory
@@ -1326,9 +1326,10 @@ impl Client {
13261326

13271327
// if the engine still needs that block, we are not going to prune it.
13281328
if let Some(protected_block) = self.engine.pruning_protection_block_number() {
1329-
if earliest_era < protected_block {
1329+
if earliest_era > protected_block {
13301330
info!(target: "pruning", "Detected attempt from pruning ancient block that is still required by the engine. protected block: {protected_block}, earliest_era: {earliest_era}");
1331-
earliest_era = protected_block - 1;
1331+
//earliest_era = protected_block - 1;
1332+
break;
13321333
}
13331334
}
13341335
trace!(target: "client", "Pruning state for ancient era {}", earliest_era);

crates/ethcore/src/engines/hbbft/hbbft_engine.rs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ impl IoHandler<()> for TransitionHandler {
357357
trace!(target: "consensus", "All Operation that had to be done after syncing have been done now.");
358358
}
359359
} else if timer == ENGINE_VALIDATOR_CANDIDATE_ACTIONS {
360-
warn!(target: "consensus", "do_validator_engine_actions");
361360
if let Err(err) = self.engine.do_validator_engine_actions() {
362361
error!(target: "consensus", "do_validator_engine_actions failed: {:?}", err);
363362
}
@@ -1106,20 +1105,6 @@ impl HoneyBadgerBFT {
11061105
}
11071106
}
11081107

1109-
/// hbbft protects the start of the current posdao epoch start from being pruned.
1110-
pub fn pruning_protection_block_number(&self) -> Option<u64> {
1111-
// we try to get a read lock for 500 ms.
1112-
// that is a very long duration, but the information is important.
1113-
if let Some(hbbft_state_lock) = self.hbbft_state.try_read_for(Duration::from_millis(500)) {
1114-
return Some(hbbft_state_lock.get_current_posdao_epoch_start_block());
1115-
} else {
1116-
// better a potential stage 3 verification error instead of a deadlock ?!
1117-
// https://github.com/DMDcoin/diamond-node/issues/68
1118-
warn!(target: "engine", "could not aquire read lock for retrieving the pruning_protection_block_number. Stage 3 verification error might follow up.");
1119-
return None;
1120-
}
1121-
}
1122-
11231108
/** returns if the signer of hbbft is tracked as available in the hbbft contracts. */
11241109
pub fn is_available(&self) -> Result<bool, Error> {
11251110
match self.signer.read().as_ref() {
@@ -1602,6 +1587,25 @@ impl Engine<EthereumMachine> for HoneyBadgerBFT {
16021587
fn prometheus_metrics(&self, registry: &mut stats::PrometheusRegistry) {
16031588
self.hbbft_message_dispatcher.prometheus_metrics(registry);
16041589
}
1590+
1591+
/// hbbft protects the start of the current posdao epoch start from being pruned.
1592+
fn pruning_protection_block_number(&self) -> Option<u64> {
1593+
// we try to get a read lock for 500 ms.
1594+
// that is a very long duration, but the information is important.
1595+
if let Some(hbbft_state_lock) = self.hbbft_state.try_read_for(Duration::from_millis(500)) {
1596+
if let Some(last_epoch_start_block) =
1597+
hbbft_state_lock.get_last_posdao_epoch_start_block()
1598+
{
1599+
return Some(last_epoch_start_block);
1600+
}
1601+
return Some(hbbft_state_lock.get_current_posdao_epoch_start_block());
1602+
} else {
1603+
// better a potential stage 3 verification error instead of a deadlock ?!
1604+
// https://github.com/DMDcoin/diamond-node/issues/68
1605+
warn!(target: "engine", "could not aquire read lock for retrieving the pruning_protection_block_number. Stage 3 verification error might follow up.");
1606+
return None;
1607+
}
1608+
}
16051609
}
16061610

16071611
#[cfg(test)]

crates/ethcore/src/engines/hbbft/hbbft_state.rs

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ pub(crate) struct HbbftState {
4040
public_master_key: Option<PublicKey>,
4141
current_posdao_epoch: u64,
4242
current_posdao_epoch_start_block: u64,
43+
last_posdao_epoch_start_block: Option<u64>,
4344
future_messages_cache: BTreeMap<u64, Vec<(NodeId, HbMessage)>>,
4445
}
4546

@@ -51,6 +52,7 @@ impl HbbftState {
5152
public_master_key: None,
5253
current_posdao_epoch: 0,
5354
current_posdao_epoch_start_block: 0,
55+
last_posdao_epoch_start_block: None,
5456
future_messages_cache: BTreeMap::new(),
5557
}
5658
}
@@ -91,13 +93,19 @@ impl HbbftState {
9193
}
9294

9395
let posdao_epoch_start = get_posdao_epoch_start(&*client, block_id).ok()?;
94-
let synckeygen = initialize_synckeygen(
96+
let synckeygen = match initialize_synckeygen(
9597
&*client,
9698
signer,
9799
BlockId::Number(posdao_epoch_start.low_u64()),
98100
ValidatorType::Current,
99-
)
100-
.ok()?;
101+
) {
102+
Ok(synckey) => synckey,
103+
Err(e) => {
104+
error!(target: "engine", "error initializing synckeygen for block: {:?}: {:?}", block_id, e);
105+
return None;
106+
}
107+
};
108+
101109
assert!(synckeygen.is_ready());
102110

103111
let (pks, sks) = synckeygen.generate().ok()?;
@@ -109,6 +117,7 @@ impl HbbftState {
109117
self.honey_badger = None;
110118
// Set the current POSDAO epoch #
111119
self.current_posdao_epoch = target_posdao_epoch;
120+
self.last_posdao_epoch_start_block = Some(self.current_posdao_epoch_start_block);
112121
self.current_posdao_epoch_start_block = posdao_epoch_start.as_u64();
113122

114123
trace!(target: "engine", "Switched hbbft state to epoch {}.", self.current_posdao_epoch);
@@ -481,7 +490,7 @@ impl HbbftState {
481490
Ok(synckeygen) => synckeygen,
482491
Err(e) => {
483492
let diff = parent_block_nr - posdao_epoch_start.low_u64();
484-
error!(target: "consensus", "Synckeygen failed. parent block: {} epoch_start: {} diff {} with error: {:?} ", parent_block_nr, posdao_epoch_start, diff, e);
493+
error!(target: "consensus", "Error: Synckeygen failed. parent block: {} epoch_start: {} diff {} with error: {:?}. current posdao: {:?} target epoch {:?}", parent_block_nr, posdao_epoch_start, diff, e, self.current_posdao_epoch, target_posdao_epoch);
485494
return false;
486495
}
487496
};
@@ -544,4 +553,8 @@ impl HbbftState {
544553
pub fn get_current_posdao_epoch_start_block(&self) -> u64 {
545554
self.current_posdao_epoch_start_block
546555
}
556+
557+
pub fn get_last_posdao_epoch_start_block(&self) -> Option<u64> {
558+
self.last_posdao_epoch_start_block
559+
}
547560
}

crates/ethcore/src/engines/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -575,6 +575,12 @@ pub trait Engine<M: Machine>: Sync + Send {
575575
true
576576
}
577577

578+
/// allows engines to define a block that should not get pruned in the DB.
579+
/// This is useful for engines that need to keep a certain block in the DB.
580+
fn pruning_protection_block_number(&self) -> Option<u64> {
581+
None
582+
}
583+
578584
/// Optional entry point for adding engine specific metrics.
579585
fn prometheus_metrics(&self, _registry: &mut stats::PrometheusRegistry) {}
580586
}
@@ -709,12 +715,6 @@ pub trait EthEngine: Engine<::machine::EthereumMachine> {
709715
fn minimum_gas_price(&self) -> Option<U256> {
710716
None
711717
}
712-
713-
/// allows engines to define a block that should not get pruned in the DB.
714-
/// This is useful for engines that need to keep a certain block in the DB.
715-
fn pruning_protection_block_number(&self) -> Option<u64> {
716-
None
717-
}
718718
}
719719

720720
// convenience wrappers for existing functions.

0 commit comments

Comments
 (0)