From e8e14e72b9fbc442db912d1555541cc17d246485 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 25 Jan 2023 11:57:53 +0000 Subject: [PATCH] includes rent_epoch in vote-accounts sanity checks (backport #29861) (#29874) includes rent_epoch in vote-accounts sanity checks (#29861) https://github.com/solana-labs/solana/pull/26479 preserves rent epoch for rent-exempt accounts. Since the feature got activated, vote accounts in stakes-cache have identical rent_epoch field as the accounts in accounts-db. The commit verifies this in stakes-cache sanity checks. (cherry picked from commit 8a146361d18eda39548c0f4da54f7c6a2196f343) Co-authored-by: behzad nouri --- runtime/src/stakes.rs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/runtime/src/stakes.rs b/runtime/src/stakes.rs index e4fb84df62327d..f8ea7fb007bef3 100644 --- a/runtime/src/stakes.rs +++ b/runtime/src/stakes.rs @@ -235,18 +235,9 @@ impl Stakes { None => return Err(Error::VoteAccountNotFound(*pubkey)), Some(account) => account, }; - // Ignoring rent_epoch until the feature for - // preserve_rent_epoch_for_rent_exempt_accounts is activated. let vote_account = vote_account.account(); - if vote_account.lamports() != account.lamports() - || vote_account.owner() != account.owner() - || vote_account.executable() != account.executable() - || vote_account.data() != account.data() - { - error!( - "vote account mismatch: {}, {:?}, {:?}", - pubkey, vote_account, account - ); + if vote_account != &account { + error!("vote account mismatch: {pubkey}, {vote_account:?}, {account:?}"); return Err(Error::VoteAccountMismatch(*pubkey)); } } @@ -266,7 +257,7 @@ impl Stakes { if VoteState::is_correct_size_and_initialized(account.data()) && VoteAccount::try_from(account.clone()).is_ok() { - error!("vote account not cached: {}, {:?}", pubkey, account); + error!("vote account not cached: {pubkey}, {account:?}"); return Err(Error::VoteAccountNotCached(pubkey)); } }