Skip to content

Commit

Permalink
Merge branch 'tomas/remove-evidence-params' (#325)
Browse files Browse the repository at this point in the history
* tomas/remove-evidence-params:
  changelog: add #1248
  shell: skip and log outdated evidence in the shell
  shell: remove TM consensus evidence parameters
  update the changelog config to namada repo
  [ci] wasm checksums update
  ledger: debug log some ABCI++ requests
  ledger: make prepare_proposal and process_proposal stateless
  ledger: refactor tx_queue
  scripts/get_tendermint: update for ABCI++ temp fork release
  test/e2e/ledger: enable ignored tests for ABCI++ workaround
  shell: process transaction when `ProcessProposal` hasn't (non-validator)
  make: remove "*-abci-plus-plus"
  all: remove "ABCI" conditional compilation
  deps: remove ABCI dependencies, use ABCI++ as default
  changelog: add #247
  test/e2e: update assert_success/failure to first consume output
  [ci] improve e2e log upload to add validator logs
  • Loading branch information
tzemanovic committed Aug 24, 2022
2 parents b2507c9 + 80e9916 commit b6e235d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 50 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Replace Tendermint consensus evidence parameters with
application level evidence filter for outdated evidence.
([#1248](https://github.com/anoma/anoma/pull/1248))
12 changes: 0 additions & 12 deletions apps/src/lib/node/ledger/shell/finalize_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,18 +488,6 @@ where
let update = ValidatorUpdate { pub_key, power };
response.validator_updates.push(update);
});

// Update evidence parameters
let (epoch_duration, _gas) =
parameters::read_epoch_parameter(&self.storage)
.expect("Couldn't read epoch duration parameters");
let pos_params = self.storage.read_pos_params();
let evidence_params =
self.get_evidence_params(&epoch_duration, &pos_params);
response.consensus_param_updates = Some(ConsensusParams {
evidence: Some(evidence_params),
..response.consensus_param_updates.take().unwrap_or_default()
});
}
}

Expand Down
9 changes: 0 additions & 9 deletions apps/src/lib/node/ledger/shell/init_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,6 @@ where
);
ibc::init_genesis_storage(&mut self.storage);

let evidence_params = self.get_evidence_params(
&genesis.parameters.epoch_duration,
&genesis.pos_params,
);
response.consensus_params = Some(ConsensusParams {
evidence: Some(evidence_params),
..response.consensus_params.unwrap_or_default()
});

// Set the initial validator set
for validator in genesis.validators {
let mut abci_validator = abci::ValidatorUpdate::default();
Expand Down
10 changes: 8 additions & 2 deletions apps/src/lib/node/ledger/shell/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ use namada::ledger::storage::write_log::WriteLog;
use namada::ledger::storage::{
DBIter, Sha256Hasher, Storage, StorageHasher, DB,
};
use namada::ledger::{ibc, parameters, pos};
use namada::ledger::{ibc, pos};
use namada::proto::{self, Tx};
use namada::types::chain::ChainId;
use namada::types::key::*;
Expand All @@ -50,7 +50,6 @@ use tendermint_proto::abci::{
RequestPrepareProposal, ValidatorUpdate,
};
use tendermint_proto::crypto::public_key;
use tendermint_proto::types::ConsensusParams;
use thiserror::Error;
use tokio::sync::mpsc::UnboundedSender;
use tower_abci::{request, response};
Expand Down Expand Up @@ -411,6 +410,13 @@ where
continue;
}
};
if evidence_epoch + pos_params.unbonding_len <= current_epoch {
tracing::info!(
"Skipping outdated evidence from epoch \
{evidence_epoch}"
);
continue;
}
let slash_type = match EvidenceType::from_i32(evidence.r#type) {
Some(r#type) => match r#type {
EvidenceType::DuplicateVote => {
Expand Down
27 changes: 0 additions & 27 deletions apps/src/lib/node/ledger/shell/queries.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
//! Shell methods for querying state
use std::cmp::max;
use borsh::{BorshDeserialize, BorshSerialize};
use ferveo_common::TendermintValidator;
use namada::ledger::parameters::EpochDuration;
use namada::ledger::pos::PosParams;
use namada::types::address::Address;
use namada::types::key;
use namada::types::key::dkg_session_keys::DkgPublicKey;
use namada::types::storage::{Key, PrefixValue};
use namada::types::token::{self, Amount};
use tendermint_proto::crypto::{ProofOp, ProofOps};
use tendermint_proto::google::protobuf;
use tendermint_proto::types::EvidenceParams;

use super::*;
use crate::node::ledger::response;
Expand Down Expand Up @@ -263,28 +258,6 @@ where
}
}

pub fn get_evidence_params(
&self,
epoch_duration: &EpochDuration,
pos_params: &PosParams,
) -> EvidenceParams {
// Minimum number of epochs before tokens are unbonded and can be
// withdrawn
let len_before_unbonded = max(pos_params.unbonding_len as i64 - 1, 0);
let max_age_num_blocks: i64 =
epoch_duration.min_num_of_blocks as i64 * len_before_unbonded;
let min_duration_secs = epoch_duration.min_duration.0 as i64;
let max_age_duration = Some(protobuf::Duration {
seconds: min_duration_secs * len_before_unbonded,
nanos: 0,
});
EvidenceParams {
max_age_num_blocks,
max_age_duration,
..EvidenceParams::default()
}
}

/// Lookup data about a validator from their protocol signing key
#[allow(dead_code)]
pub fn get_validator_from_protocol_pk(
Expand Down

0 comments on commit b6e235d

Please sign in to comment.