Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Commit

Permalink
cherry-picked 112d13a
Browse files Browse the repository at this point in the history
(+ small modification on chain-abci/src/staking/table.rs due to changes on master
and not including integration test modifications, as drone CI only operates
on master)

Problem (Fix #2203): validator crash after re-joined with different validator key

Solution:
- deduplicate staking address when doing cleanup
- index used_validator_addresses when initialize after load from storage
  • Loading branch information
tomtau committed Sep 4, 2020
1 parent 9ae6a58 commit 9aa7564
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
### Improvements
### Bug Fixes

*September 4, 2020*

This release contains a hotfix for the network halt issue in chain-abci.

## V0.5.4
### Bug Fixes

- *chain-abci* [2204](https://github.com/crypto-com/chain/pull/2204): deduplicate staking address when doing cleanup and index used_validator_addresses when initialize after load from storage

*May 20, 2020*

This release contains a hotfix for client-cli deposit transaction issue.
Expand Down
7 changes: 4 additions & 3 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion chain-abci/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chain-abci"
version = "0.5.1"
version = "0.5.4"
authors = ["Crypto.com <[email protected]>"]
description = "Pre-alpha version prototype of Crypto.com Chain node (Tendermint ABCI application)"
readme = "README.md"
Expand Down Expand Up @@ -34,6 +34,7 @@ structopt = "0.3"
secp256k1zkp = { git = "https://github.com/crypto-com/rust-secp256k1-zkp.git", rev = "f8759809f6e3fed793b37166f7cd91c57cdb2eab", features = ["recovery", "endomorphism"] }
parity-scale-codec = { features = ["derive"], version = "1.3" }
thiserror = "1.0"
itertools = "0.9"

[target.'cfg(target_os = "linux")'.dependencies]
enclave-u-common = { path = "../chain-tx-enclave/enclave-u-common" }
Expand Down
8 changes: 8 additions & 0 deletions chain-abci/src/staking/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use std::collections::{BTreeMap, BTreeSet, HashMap};

use core::cmp::Ordering;
use itertools::Itertools;
use parity_scale_codec::{Decode, Encode};
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -173,6 +174,12 @@ impl StakingTable {
.idx_validator_address
.insert(val.validator_address(), *addr)
.is_none());
for (val_addr, _) in val.used_validator_addresses.iter() {
assert!(self
.idx_validator_address
.insert(val_addr.clone(), *addr)
.is_none());
}
}
}

Expand Down Expand Up @@ -439,6 +446,7 @@ impl StakingTable {
let to_delete = self
.idx_validator_address
.values()
.unique()
.filter_map(|addr| {
let staking = heap.get(addr).unwrap();
if let Some(val) = &staking.validator {
Expand Down

0 comments on commit 9aa7564

Please sign in to comment.