Skip to content

Commit

Permalink
wallet: remove validator rewards key
Browse files Browse the repository at this point in the history
  • Loading branch information
tzemanovic committed Oct 26, 2022
1 parent 2020451 commit eb8ef57
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 21 deletions.
5 changes: 0 additions & 5 deletions apps/src/lib/wallet/alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,6 @@ pub fn validator_consensus_key(validator_alias: &Alias) -> Alias {
format!("{validator_alias}-consensus-key").into()
}

/// Default alias of a validator's staking rewards key
pub fn validator_rewards_key(validator_alias: &Alias) -> Alias {
format!("{validator_alias}-rewards-key").into()
}

/// Default alias of a validator's Tendermint node key
pub fn validator_tendermint_node_key(validator_alias: &Alias) -> Alias {
format!("{validator_alias}-tendermint-node-key").into()
Expand Down
11 changes: 0 additions & 11 deletions apps/src/lib/wallet/pre_genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ pub struct ValidatorWallet {
pub account_key: Rc<common::SecretKey>,
/// Cryptographic keypair for consensus key
pub consensus_key: Rc<common::SecretKey>,
/// Cryptographic keypair for rewards key
pub rewards_key: Rc<common::SecretKey>,
/// Cryptographic keypair for Tendermint node key
pub tendermint_node_key: Rc<common::SecretKey>,
}
Expand All @@ -54,8 +52,6 @@ pub struct ValidatorStore {
pub account_key: wallet::StoredKeypair,
/// Cryptographic keypair for consensus key
pub consensus_key: wallet::StoredKeypair,
/// Cryptographic keypair for rewards key
pub rewards_key: wallet::StoredKeypair,
/// Cryptographic keypair for Tendermint node key
pub tendermint_node_key: wallet::StoredKeypair,
/// Special validator keys
Expand Down Expand Up @@ -107,7 +103,6 @@ impl ValidatorWallet {

let password = if store.account_key.is_encrypted()
|| store.consensus_key.is_encrypted()
|| store.rewards_key.is_encrypted()
|| store.account_key.is_encrypted()
{
Some(wallet::read_password("Enter decryption password: "))
Expand All @@ -119,16 +114,13 @@ impl ValidatorWallet {
store.account_key.get(true, password.clone())?;
let consensus_key =
store.consensus_key.get(true, password.clone())?;
let rewards_key =
store.rewards_key.get(true, password.clone())?;
let tendermint_node_key =
store.tendermint_node_key.get(true, password)?;

Ok(Self {
store,
account_key,
consensus_key,
rewards_key,
tendermint_node_key,
})
}
Expand All @@ -149,7 +141,6 @@ impl ValidatorWallet {
SchemeType::Ed25519,
&password,
);
let (rewards_key, rewards_sk) = gen_key_to_store(scheme, &password);
let (tendermint_node_key, tendermint_node_sk) = gen_key_to_store(
// Note that TM only allows ed25519 for node IDs
SchemeType::Ed25519,
Expand All @@ -159,15 +150,13 @@ impl ValidatorWallet {
let store = ValidatorStore {
account_key,
consensus_key,
rewards_key,
tendermint_node_key,
validator_keys,
};
Self {
store,
account_key: account_sk,
consensus_key: consensus_sk,
rewards_key: rewards_sk,
tendermint_node_key: tendermint_node_sk,
}
}
Expand Down
5 changes: 0 additions & 5 deletions apps/src/lib/wallet/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -392,15 +392,13 @@ impl Store {
other: pre_genesis::ValidatorWallet,
) {
let account_key_alias = alias::validator_key(&validator_alias);
let rewards_key_alias = alias::validator_rewards_key(&validator_alias);
let consensus_key_alias =
alias::validator_consensus_key(&validator_alias);
let tendermint_node_key_alias =
alias::validator_tendermint_node_key(&validator_alias);

let keys = [
(account_key_alias.clone(), other.store.account_key),
(rewards_key_alias.clone(), other.store.rewards_key),
(consensus_key_alias.clone(), other.store.consensus_key),
(
tendermint_node_key_alias.clone(),
Expand All @@ -410,12 +408,10 @@ impl Store {
self.keys.extend(keys.into_iter());

let account_pk = other.account_key.ref_to();
let rewards_pk = other.rewards_key.ref_to();
let consensus_pk = other.consensus_key.ref_to();
let tendermint_node_pk = other.tendermint_node_key.ref_to();
let addresses = [
(account_key_alias.clone(), (&account_pk).into()),
(rewards_key_alias.clone(), (&rewards_pk).into()),
(consensus_key_alias.clone(), (&consensus_pk).into()),
(
tendermint_node_key_alias.clone(),
Expand All @@ -426,7 +422,6 @@ impl Store {

let pkhs = [
((&account_pk).into(), account_key_alias),
((&rewards_pk).into(), rewards_key_alias),
((&consensus_pk).into(), consensus_key_alias),
((&tendermint_node_pk).into(), tendermint_node_key_alias),
];
Expand Down

0 comments on commit eb8ef57

Please sign in to comment.