Revert "Define epoch-rewards partition data program id (#34862)"

This reverts commit 8aa726bfdf.
This commit is contained in:
Tyera Eulberg 2024-02-02 10:23:53 -07:00 committed by Tyera
parent 57634e4419
commit d7179e4fa0
2 changed files with 7 additions and 11 deletions

View File

@ -132,7 +132,7 @@ use {
},
epoch_info::EpochInfo,
epoch_rewards_partition_data::{
get_epoch_rewards_partition_data_address, EpochRewardsPartitionDataVersion,
get_epoch_rewards_partition_data_address, EpochRewardsPartitionDataVersion, HasherKind,
PartitionData,
},
epoch_schedule::EpochSchedule,
@ -3601,6 +3601,7 @@ impl Bank {
let epoch_rewards_partition_data = EpochRewardsPartitionDataVersion::V0(PartitionData {
num_partitions,
parent_blockhash,
hasher_kind: HasherKind::Sip13,
});
let address = get_epoch_rewards_partition_data_address(self.epoch());

View File

@ -8,14 +8,7 @@ pub enum EpochRewardsPartitionDataVersion {
V0(PartitionData),
}
impl EpochRewardsPartitionDataVersion {
pub fn get_hasher_kind(&self) -> HasherKind {
match self {
EpochRewardsPartitionDataVersion::V0(_) => HasherKind::Sip13,
}
}
}
#[repr(u8)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, Clone)]
pub enum HasherKind {
Sip13,
@ -28,12 +21,14 @@ pub struct PartitionData {
pub num_partitions: usize,
/// Blockhash of the last block of the previous epoch, used to create EpochRewardsHasher
pub parent_blockhash: Hash,
/// Kind of hasher used to generate partitions
pub hasher_kind: HasherKind,
}
pub fn get_epoch_rewards_partition_data_address(epoch: u64) -> Pubkey {
let (address, _bump_seed) = Pubkey::find_program_address(
&[b"EpochRewards", b"PartitionData", &epoch.to_le_bytes()],
&crate::sysvar::id(),
&[b"EpochRewardsPartitionData", &epoch.to_le_bytes()],
&crate::stake::program::id(),
);
address
}