From 66abcda9e9cffac4d71a4990f22ded8fd5496147 Mon Sep 17 00:00:00 2001 From: Christian Krueger Date: Thu, 28 Nov 2024 12:06:58 -0600 Subject: [PATCH] fixed thing --- core/src/epoch_reward_router.rs | 136 +++++++++++++----- core/src/error.rs | 2 + core/src/instruction.rs | 1 + core/src/lib.rs | 1 + core/src/ncn_fee_group.rs | 48 ++++--- core/src/operator_epoch_reward_router.rs | 89 ++++++++++-- core/src/rewards.rs | 27 ++++ program/src/distribute_rewards.rs | 95 ++++++++++++ ...initialize_operator_epoch_reward_router.rs | 7 +- program/src/lib.rs | 3 + program/src/set_config_fees.rs | 2 +- 11 files changed, 346 insertions(+), 65 deletions(-) create mode 100644 core/src/rewards.rs create mode 100644 program/src/distribute_rewards.rs diff --git a/core/src/epoch_reward_router.rs b/core/src/epoch_reward_router.rs index 4bb7ebc..173e41a 100644 --- a/core/src/epoch_reward_router.rs +++ b/core/src/epoch_reward_router.rs @@ -5,57 +5,93 @@ use solana_program::{account_info::AccountInfo, msg, program_error::ProgramError use spl_math::precise_number::PreciseNumber; use crate::{ - ballot_box::BallotBox, discriminators::Discriminators, error::TipRouterError, fees::Fees, - ncn_fee_group::NcnFeeGroup, operator_epoch_reward_router::OperatorEpochRewardRouter, + ballot_box::BallotBox, + discriminators::Discriminators, + error::TipRouterError, + fees::{FeeConfig, Fees}, + ncn_fee_group::NcnFeeGroup, + operator_epoch_reward_router::OperatorEpochRewardRouter, }; -#[derive(Debug, Clone, PartialEq, Eq, Copy, Zeroable, ShankType, Pod, ShankType)] +#[derive(Default, Debug, Clone, PartialEq, Eq, Copy, Zeroable, ShankType, Pod)] #[repr(C)] -pub struct RewardRoutes { - destination: Pubkey, +pub struct OperatorRewards { rewards: PodU64, - reserved: [u8; 128], +} + +impl OperatorRewards { + pub fn rewards(self) -> u64 { + self.rewards.into() + } +} + +#[derive(Debug, Clone, PartialEq, Eq, Copy, Zeroable, ShankType, Pod)] +#[repr(C)] +pub struct RewardRoutes { + operator: Pubkey, + rewards: [OperatorRewards; 8], } impl Default for RewardRoutes { fn default() -> Self { Self { - destination: Pubkey::default(), - rewards: PodU64::from(0), - reserved: [0; 128], + operator: Pubkey::default(), + rewards: [OperatorRewards::default(); NcnFeeGroup::FEE_GROUP_COUNT], } } } impl RewardRoutes { pub const fn destination(&self) -> Pubkey { - self.destination + self.operator } pub fn set_destination(&mut self, destination: Pubkey) { - self.destination = destination; + self.operator = destination; } - pub fn rewards(&self) -> u64 { - self.rewards.into() + pub fn rewards(&self, ncn_fee_group: NcnFeeGroup) -> Result { + let group_index = ncn_fee_group.group_index()?; + Ok(self.rewards[group_index].rewards()) } - pub fn increment_rewards(&mut self, rewards: u64) -> Result<(), TipRouterError> { - self.rewards = PodU64::from( - self.rewards() - .checked_add(rewards) - .ok_or(TipRouterError::ArithmeticOverflow)?, - ); + pub fn set_rewards( + &mut self, + ncn_fee_group: NcnFeeGroup, + rewards: u64, + ) -> Result<(), TipRouterError> { + let group_index = ncn_fee_group.group_index()?; + self.rewards[group_index].rewards = PodU64::from(rewards); + Ok(()) } - pub fn decrement_rewards(&mut self, rewards: u64) -> Result<(), TipRouterError> { - self.rewards = PodU64::from( - self.rewards() - .checked_sub(rewards) - .ok_or(TipRouterError::ArithmeticUnderflowError)?, - ); - Ok(()) + pub fn increment_rewards( + &mut self, + ncn_fee_group: NcnFeeGroup, + rewards: u64, + ) -> Result<(), TipRouterError> { + let current_rewards = self.rewards(ncn_fee_group)?; + + let new_rewards = current_rewards + .checked_add(rewards) + .ok_or(TipRouterError::ArithmeticOverflow)?; + + self.set_rewards(ncn_fee_group, new_rewards) + } + + pub fn decrement_rewards( + &mut self, + ncn_fee_group: NcnFeeGroup, + rewards: u64, + ) -> Result<(), TipRouterError> { + let current_rewards = self.rewards(ncn_fee_group)?; + + let new_rewards = current_rewards + .checked_sub(rewards) + .ok_or(TipRouterError::ArithmeticOverflow)?; + + self.set_rewards(ncn_fee_group, new_rewards) } } @@ -183,6 +219,36 @@ impl EpochRewardRouter { Ok(()) } + pub fn distribute_dao_rewards( + &mut self, + fee_config: &FeeConfig, + destination: &Pubkey, + ) -> Result { + if destination.ne(&fee_config.fee_wallet()) { + return Err(TipRouterError::DestinationMismatch); + } + + let dao_rewards = self.doa_rewards(); + + self.decrement_dao_rewards(dao_rewards)?; + + Ok(self.doa_rewards()) + } + + // pub fn distribute_ncn_rewards( + // &mut self, + // destination: &Pubkey, + // ) -> Result { + + // for route in + + // let group_rewards = self.ncn_rewards(group)?; + + // self.decrement_ncn_rewards(group, group_rewards)?; + + // Ok(self.ncn_rewards(group)?) + // } + pub fn process_incoming_rewards(&mut self, account_balance: u64) -> Result<(), TipRouterError> { let total_rewards = self.total_rewards()?; @@ -265,6 +331,7 @@ impl EpochRewardRouter { let operator_epoch_reward_router = OperatorEpochRewardRouter::find_program_address( program_id, + *group, &operator, &self.ncn, self.ncn_epoch.into(), @@ -272,6 +339,7 @@ impl EpochRewardRouter { .0; self.insert_or_increment_operator_rewards( + *group, operator_epoch_reward_router, operator_rewards, )?; @@ -360,6 +428,7 @@ impl EpochRewardRouter { pub fn insert_or_increment_operator_rewards( &mut self, + ncn_fee_group: NcnFeeGroup, operator: Pubkey, rewards: u64, ) -> Result<(), TipRouterError> { @@ -368,16 +437,16 @@ impl EpochRewardRouter { } for operator_reward in self.reward_routes.iter_mut() { - if operator_reward.destination == operator { - operator_reward.increment_rewards(rewards)?; + if operator_reward.operator == operator { + operator_reward.increment_rewards(ncn_fee_group, rewards)?; return Ok(()); } } for operator_reward in self.reward_routes.iter_mut() { - if operator_reward.destination == Pubkey::default() { - operator_reward.destination = operator; - operator_reward.rewards = PodU64::from(rewards); + if operator_reward.operator == Pubkey::default() { + operator_reward.operator = operator; + operator_reward.increment_rewards(ncn_fee_group, rewards)?; return Ok(()); } } @@ -387,6 +456,7 @@ impl EpochRewardRouter { pub fn decrement_operator_rewards( &mut self, + ncn_fee_group: NcnFeeGroup, operator: Pubkey, rewards: u64, ) -> Result<(), TipRouterError> { @@ -395,8 +465,8 @@ impl EpochRewardRouter { } for operator_reward in self.reward_routes.iter_mut() { - if operator_reward.destination == operator { - operator_reward.decrement_rewards(rewards)?; + if operator_reward.operator == operator { + operator_reward.decrement_rewards(ncn_fee_group, rewards)?; return Ok(()); } } diff --git a/core/src/error.rs b/core/src/error.rs index 7a73bfd..b1fc598 100644 --- a/core/src/error.rs +++ b/core/src/error.rs @@ -88,6 +88,8 @@ pub enum TipRouterError { OperatorRewardListFull, #[error("Operator Reward not found")] OperatorRewardNotFound, + #[error("Destination mismatch")] + DestinationMismatch, } impl DecodeError for TipRouterError { diff --git a/core/src/instruction.rs b/core/src/instruction.rs index ae0d9ad..b532192 100644 --- a/core/src/instruction.rs +++ b/core/src/instruction.rs @@ -164,6 +164,7 @@ pub enum TipRouterInstruction { #[account(6, name = "restaking_program_id")] #[account(7, name = "system_program")] InitializeOperatorEpochRewardRouter{ + ncn_fee_group: u8, first_slot_of_ncn_epoch: Option, }, diff --git a/core/src/lib.rs b/core/src/lib.rs index f4e3473..90115e8 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -10,6 +10,7 @@ pub mod loaders; pub mod ncn_config; pub mod ncn_fee_group; pub mod operator_epoch_reward_router; +pub mod rewards; pub mod stake_weight; pub mod tracked_mints; pub mod weight_entry; diff --git a/core/src/ncn_fee_group.rs b/core/src/ncn_fee_group.rs index 9e8eb68..9fa72f4 100644 --- a/core/src/ncn_fee_group.rs +++ b/core/src/ncn_fee_group.rs @@ -38,6 +38,32 @@ impl Default for NcnFeeGroup { } } +impl TryFrom for NcnFeeGroup { + type Error = TipRouterError; + + fn try_from(group: u8) -> Result { + match group { + 0x0 => Ok(Self::new(NcnFeeGroupType::Default)), + 0x1 => Ok(Self::new(NcnFeeGroupType::JTO)), + 0x2 => Ok(Self::new(NcnFeeGroupType::Reserved2)), + 0x3 => Ok(Self::new(NcnFeeGroupType::Reserved3)), + 0x4 => Ok(Self::new(NcnFeeGroupType::Reserved4)), + 0x5 => Ok(Self::new(NcnFeeGroupType::Reserved5)), + 0x6 => Ok(Self::new(NcnFeeGroupType::Reserved6)), + 0x7 => Ok(Self::new(NcnFeeGroupType::Reserved7)), + // 0x8 => Ok(Self::new(NcnFeeGroupType::Reserved8)), + // 0x9 => Ok(Self::new(NcnFeeGroupType::Reserved9)), + // 0xA => Ok(Self::new(NcnFeeGroupType::ReservedA)), + // 0xB => Ok(Self::new(NcnFeeGroupType::ReservedB)), + // 0xC => Ok(Self::new(NcnFeeGroupType::ReservedC)), + // 0xD => Ok(Self::new(NcnFeeGroupType::ReservedD)), + // 0xE => Ok(Self::new(NcnFeeGroupType::ReservedE)), + // 0xF => Ok(Self::new(NcnFeeGroupType::ReservedF)), + _ => Err(TipRouterError::InvalidNcnFeeGroup), + } + } +} + impl NcnFeeGroup { pub const FEE_GROUP_COUNT: usize = 8; @@ -63,28 +89,6 @@ impl NcnFeeGroup { } } - pub const fn from_u8(group: u8) -> Result { - match group { - 0x0 => Ok(Self::new(NcnFeeGroupType::Default)), - 0x1 => Ok(Self::new(NcnFeeGroupType::JTO)), - 0x2 => Ok(Self::new(NcnFeeGroupType::Reserved2)), - 0x3 => Ok(Self::new(NcnFeeGroupType::Reserved3)), - 0x4 => Ok(Self::new(NcnFeeGroupType::Reserved4)), - 0x5 => Ok(Self::new(NcnFeeGroupType::Reserved5)), - 0x6 => Ok(Self::new(NcnFeeGroupType::Reserved6)), - 0x7 => Ok(Self::new(NcnFeeGroupType::Reserved7)), - // 0x8 => Ok(Self::new(NcnFeeGroupType::Reserved8)), - // 0x9 => Ok(Self::new(NcnFeeGroupType::Reserved9)), - // 0xA => Ok(Self::new(NcnFeeGroupType::ReservedA)), - // 0xB => Ok(Self::new(NcnFeeGroupType::ReservedB)), - // 0xC => Ok(Self::new(NcnFeeGroupType::ReservedC)), - // 0xD => Ok(Self::new(NcnFeeGroupType::ReservedD)), - // 0xE => Ok(Self::new(NcnFeeGroupType::ReservedE)), - // 0xF => Ok(Self::new(NcnFeeGroupType::ReservedF)), - _ => Err(TipRouterError::InvalidNcnFeeGroup), - } - } - pub const fn group_type(&self) -> Result { match self.group { 0x0 => Ok(NcnFeeGroupType::Default), diff --git a/core/src/operator_epoch_reward_router.rs b/core/src/operator_epoch_reward_router.rs index 6fff19f..d2aa9e2 100644 --- a/core/src/operator_epoch_reward_router.rs +++ b/core/src/operator_epoch_reward_router.rs @@ -6,14 +6,66 @@ use solana_program::{account_info::AccountInfo, msg, program_error::ProgramError use spl_math::precise_number::PreciseNumber; use crate::{ - discriminators::Discriminators, epoch_reward_router::RewardRoutes, - epoch_snapshot::OperatorSnapshot, error::TipRouterError, + discriminators::Discriminators, epoch_snapshot::OperatorSnapshot, error::TipRouterError, + ncn_fee_group::NcnFeeGroup, }; +#[derive(Debug, Clone, PartialEq, Eq, Copy, Zeroable, ShankType, Pod, ShankType)] +#[repr(C)] +pub struct RewardRoutes { + destination: Pubkey, + rewards: PodU64, + reserved: [u8; 128], +} + +impl Default for RewardRoutes { + fn default() -> Self { + Self { + destination: Pubkey::default(), + rewards: PodU64::from(0), + reserved: [0; 128], + } + } +} + +impl RewardRoutes { + pub const fn destination(&self) -> Pubkey { + self.destination + } + + pub fn set_destination(&mut self, destination: Pubkey) { + self.destination = destination; + } + + pub fn rewards(&self) -> u64 { + self.rewards.into() + } + + pub fn increment_rewards(&mut self, rewards: u64) -> Result<(), TipRouterError> { + self.rewards = PodU64::from( + self.rewards() + .checked_add(rewards) + .ok_or(TipRouterError::ArithmeticOverflow)?, + ); + Ok(()) + } + + pub fn decrement_rewards(&mut self, rewards: u64) -> Result<(), TipRouterError> { + self.rewards = PodU64::from( + self.rewards() + .checked_sub(rewards) + .ok_or(TipRouterError::ArithmeticUnderflowError)?, + ); + Ok(()) + } +} + // PDA'd ["epoch_reward_router", NCN, NCN_EPOCH_SLOT] #[derive(Debug, Clone, Copy, Zeroable, ShankType, Pod, AccountDeserialize, ShankAccount)] #[repr(C)] pub struct OperatorEpochRewardRouter { + ncn_fee_group: NcnFeeGroup, + operator: Pubkey, ncn: Pubkey, @@ -41,8 +93,16 @@ impl Discriminator for OperatorEpochRewardRouter { } impl OperatorEpochRewardRouter { - pub fn new(operator: Pubkey, ncn: Pubkey, ncn_epoch: u64, bump: u8, slot_created: u64) -> Self { + pub fn new( + ncn_fee_group: NcnFeeGroup, + operator: Pubkey, + ncn: Pubkey, + ncn_epoch: u64, + bump: u8, + slot_created: u64, + ) -> Self { Self { + ncn_fee_group, operator, ncn, ncn_epoch: PodU64::from(ncn_epoch), @@ -56,10 +116,16 @@ impl OperatorEpochRewardRouter { } } - pub fn seeds(operator: &Pubkey, ncn: &Pubkey, ncn_epoch: u64) -> Vec> { + pub fn seeds( + ncn_fee_group: NcnFeeGroup, + operator: &Pubkey, + ncn: &Pubkey, + ncn_epoch: u64, + ) -> Vec> { Vec::from_iter( [ b"operator_epoch_reward_router".to_vec(), + vec![ncn_fee_group.group], operator.to_bytes().to_vec(), ncn.to_bytes().to_vec(), ncn_epoch.to_le_bytes().to_vec(), @@ -71,11 +137,12 @@ impl OperatorEpochRewardRouter { pub fn find_program_address( program_id: &Pubkey, + ncn_fee_group: NcnFeeGroup, operator: &Pubkey, ncn: &Pubkey, ncn_epoch: u64, ) -> (Pubkey, u8, Vec>) { - let seeds = Self::seeds(operator, ncn, ncn_epoch); + let seeds = Self::seeds(ncn_fee_group, operator, ncn, ncn_epoch); let seeds_iter: Vec<_> = seeds.iter().map(|s| s.as_slice()).collect(); let (pda, bump) = Pubkey::find_program_address(&seeds_iter, program_id); (pda, bump, seeds) @@ -83,6 +150,7 @@ impl OperatorEpochRewardRouter { pub fn load( program_id: &Pubkey, + ncn_fee_group: NcnFeeGroup, operator: &Pubkey, ncn: &Pubkey, ncn_epoch: u64, @@ -105,9 +173,14 @@ impl OperatorEpochRewardRouter { msg!("Epoch Reward Router account discriminator is invalid"); return Err(ProgramError::InvalidAccountData); } - if account - .key - .ne(&Self::find_program_address(program_id, operator, ncn, ncn_epoch).0) + if account.key.ne(&Self::find_program_address( + program_id, + ncn_fee_group, + operator, + ncn, + ncn_epoch, + ) + .0) { msg!("Epoch Reward Router account is not at the correct PDA"); return Err(ProgramError::InvalidAccountData); diff --git a/core/src/rewards.rs b/core/src/rewards.rs new file mode 100644 index 0000000..7cba3b3 --- /dev/null +++ b/core/src/rewards.rs @@ -0,0 +1,27 @@ +use bytemuck::{Pod, Zeroable}; +use shank::ShankType; + +use crate::error::TipRouterError; + +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[repr(u8)] +pub enum RewardType { + DAO = 0x0, + NCN = 0x1, + Operator = 0x2, + Vault = 0x3, +} + +impl TryFrom for RewardType { + type Error = TipRouterError; + + fn try_from(value: u8) -> Result { + match value { + 0x0 => Ok(RewardType::DAO), + 0x1 => Ok(RewardType::NCN), + 0x2 => Ok(RewardType::Operator), + 0x3 => Ok(RewardType::Vault), + _ => Err(TipRouterError::InvalidNcnFeeGroup), + } + } +} diff --git a/program/src/distribute_rewards.rs b/program/src/distribute_rewards.rs new file mode 100644 index 0000000..38d71a8 --- /dev/null +++ b/program/src/distribute_rewards.rs @@ -0,0 +1,95 @@ +use jito_bytemuck::AccountDeserialize; +use jito_restaking_core::{config::Config, ncn::Ncn, operator::Operator}; +use jito_tip_router_core::{ + epoch_reward_router::EpochRewardRouter, + epoch_snapshot::{EpochSnapshot, OperatorSnapshot}, + loaders::load_ncn_epoch, + ncn_config::NcnConfig, + operator_epoch_reward_router::OperatorEpochRewardRouter, + rewards::RewardType, +}; +use solana_program::{ + account_info::AccountInfo, clock::Clock, entrypoint::ProgramResult, msg, + program_error::ProgramError, pubkey::Pubkey, sysvar::Sysvar, +}; + +/// Initializes a Epoch Reward Router +/// Can be backfilled for previous epochs +pub fn process_distribute_rewards( + program_id: &Pubkey, + accounts: &[AccountInfo], + reward_type: u8, + first_slot_of_ncn_epoch: Option, +) -> ProgramResult { + let [restaking_config, ncn_config, ncn, operator, epoch_reward_router, operator_epoch_reward_router, destination, restaking_program] = + accounts + else { + return Err(ProgramError::NotEnoughAccountKeys); + }; + + if restaking_program.key.ne(&jito_restaking_program::id()) { + msg!("Incorrect restaking program ID"); + return Err(ProgramError::InvalidAccountData); + } + + Config::load(restaking_program.key, restaking_config, false)?; + Ncn::load(restaking_program.key, ncn, false)?; + Operator::load(restaking_program.key, operator, false)?; + + let current_slot = Clock::get()?.slot; + let (ncn_epoch, _) = load_ncn_epoch(restaking_config, current_slot, first_slot_of_ncn_epoch)?; + + NcnConfig::load(program_id, ncn.key, ncn_config, false)?; + EpochRewardRouter::load(program_id, ncn.key, ncn_epoch, epoch_reward_router, true)?; + OperatorEpochRewardRouter::load( + program_id, + operator.key, + ncn.key, + ncn_epoch, + operator_epoch_reward_router, + true, + )?; + + let reward_type = RewardType::try_from(reward_type)?; + + let rewards = match reward_type { + RewardType::DAO => { + process_epoch_reward(&epoch_reward_router)?; + } + RewardType::NCN => { + process_epoch_reward_pool(&epoch_reward_router)?; + } + RewardType::OperatorReward => { + process_operator_epoch_reward_pool(&operator_epoch_reward_router)?; + } + RewardType::Vault => { + process_epoch_reward_pool(&epoch_reward_router)?; + } + }; + + // Send rewards + {} + + // let operator_snapshot = { + // let operator_snapshot_data = operator_snapshot.try_borrow_data()?; + // let operator_snapshot_account = + // OperatorSnapshot::try_from_slice_unchecked(&operator_snapshot_data)?; + + // *operator_snapshot_account + // }; + + // let account_balance = **operator_epoch_reward_router.try_borrow_lamports()?; + + // let mut operator_epoch_reward_router_data = + // operator_epoch_reward_router.try_borrow_mut_data()?; + // let operator_epoch_reward_router_account = + // OperatorEpochRewardRouter::try_from_slice_unchecked_mut( + // &mut operator_epoch_reward_router_data, + // )?; + + // operator_epoch_reward_router_account.process_incoming_rewards(account_balance)?; + + // operator_epoch_reward_router_account.process_reward_pool(&operator_snapshot)?; + + Ok(()) +} diff --git a/program/src/initialize_operator_epoch_reward_router.rs b/program/src/initialize_operator_epoch_reward_router.rs index aa3bcbf..87768ef 100644 --- a/program/src/initialize_operator_epoch_reward_router.rs +++ b/program/src/initialize_operator_epoch_reward_router.rs @@ -7,7 +7,7 @@ use jito_jsm_core::{ }; use jito_restaking_core::{config::Config, ncn::Ncn, operator::Operator}; use jito_tip_router_core::{ - ballot_box::BallotBox, loaders::load_ncn_epoch, + ballot_box::BallotBox, loaders::load_ncn_epoch, ncn_fee_group::NcnFeeGroup, operator_epoch_reward_router::OperatorEpochRewardRouter, }; use solana_program::{ @@ -20,6 +20,7 @@ use solana_program::{ pub fn process_initialize_operator_epoch_reward_router( program_id: &Pubkey, accounts: &[AccountInfo], + ncn_fee_group: u8, first_slot_of_ncn_epoch: Option, ) -> ProgramResult { let [restaking_config, ncn, operator, ballot_box, operator_reward_router, payer, restaking_program, system_program] = @@ -41,6 +42,8 @@ pub fn process_initialize_operator_epoch_reward_router( load_system_program(system_program)?; load_signer(payer, true)?; + let ncn_fee_group = NcnFeeGroup::try_from(ncn_fee_group)?; + let current_slot = Clock::get()?.slot; let (ncn_epoch, _) = load_ncn_epoch(restaking_config, current_slot, first_slot_of_ncn_epoch)?; @@ -61,6 +64,7 @@ pub fn process_initialize_operator_epoch_reward_router( mut operator_reward_router_seeds, ) = OperatorEpochRewardRouter::find_program_address( program_id, + ncn_fee_group, operator.key, ncn.key, ncn_epoch, @@ -96,6 +100,7 @@ pub fn process_initialize_operator_epoch_reward_router( OperatorEpochRewardRouter::try_from_slice_unchecked_mut(&mut operator_reward_router_data)?; *operator_reward_router_account = OperatorEpochRewardRouter::new( + ncn_fee_group, *operator.key, *ncn.key, ncn_epoch, diff --git a/program/src/lib.rs b/program/src/lib.rs index 76d670b..a54af29 100644 --- a/program/src/lib.rs +++ b/program/src/lib.rs @@ -1,4 +1,5 @@ mod admin_update_weight_table; +mod distribute_rewards; mod initialize_epoch_reward_router; mod initialize_epoch_snapshot; mod initialize_ncn_config; @@ -122,12 +123,14 @@ pub fn process_instruction( process_initialize_epoch_reward_router(program_id, accounts, first_slot_of_ncn_epoch) } TipRouterInstruction::InitializeOperatorEpochRewardRouter { + ncn_fee_group, first_slot_of_ncn_epoch, } => { msg!("Instruction: InitializeOperatorEpochRewardRouter"); process_initialize_operator_epoch_reward_router( program_id, accounts, + ncn_fee_group, first_slot_of_ncn_epoch, ) } diff --git a/program/src/set_config_fees.rs b/program/src/set_config_fees.rs index 268bd8b..cb3c142 100644 --- a/program/src/set_config_fees.rs +++ b/program/src/set_config_fees.rs @@ -57,7 +57,7 @@ pub fn process_set_config_fees( } let new_ncn_fee_group = if let Some(new_ncn_fee_group) = new_ncn_fee_group { - Some(NcnFeeGroup::from_u8(new_ncn_fee_group)?) + Some(NcnFeeGroup::try_from(new_ncn_fee_group)?) } else { None };