diff --git a/CHANGELOG.md b/CHANGELOG.md index 1a87ec3d7..42f84940c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/Cargo.lock b/Cargo.lock index e87e8216b..714d76f99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -428,7 +428,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "chain-abci" -version = "0.5.1" +version = "0.5.4" dependencies = [ "abci 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -445,6 +445,7 @@ dependencies = [ "env_logger 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "integer-encoding 1.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "itertools 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "kvdb-memorydb 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1080,7 +1081,7 @@ dependencies = [ name = "dev-utils" version = "0.5.0" dependencies = [ - "chain-abci 0.5.1", + "chain-abci 0.5.4", "chain-core 0.5.0", "chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "client-common 0.5.0", @@ -4055,7 +4056,7 @@ version = "0.5.0" dependencies = [ "abci 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", - "chain-abci 0.5.1", + "chain-abci 0.5.4", "chain-core 0.5.0", "chain-storage 0.5.0", "client-common 0.5.0", diff --git a/chain-abci/Cargo.toml b/chain-abci/Cargo.toml index 1c8afaa1d..0abe8b356 100644 --- a/chain-abci/Cargo.toml +++ b/chain-abci/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "chain-abci" -version = "0.5.1" +version = "0.5.4" authors = ["Crypto.com "] description = "Pre-alpha version prototype of Crypto.com Chain node (Tendermint ABCI application)" readme = "README.md" @@ -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" } diff --git a/chain-abci/src/staking/table.rs b/chain-abci/src/staking/table.rs index 5601e03be..7762d3efc 100644 --- a/chain-abci/src/staking/table.rs +++ b/chain-abci/src/staking/table.rs @@ -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}; @@ -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()); + } } } @@ -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 {