Skip to content

Commit

Permalink
signing off
Browse files Browse the repository at this point in the history
  • Loading branch information
coachchucksol committed Jan 21, 2025
1 parent 722ed89 commit 01fc34f
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 16 deletions.
6 changes: 3 additions & 3 deletions core/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ pub const MAX_VAULTS: usize = 64;
pub const MAX_OPERATORS: usize = 256;
pub const MIN_EPOCHS_BEFORE_STALL: u64 = 1;
pub const MAX_EPOCHS_BEFORE_STALL: u64 = 50;
pub const MIN_EPOCHS_BEFORE_CLAIM: u64 = 10;
pub const MAX_EPOCHS_BEFORE_CLAIM: u64 = 50;
pub const MIN_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM: u64 = 10;
pub const MAX_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM: u64 = 50;
pub const MIN_SLOTS_AFTER_CONSENSUS: u64 = 1000;
pub const MAX_SLOTS_AFTER_CONSENSUS: u64 = 50 * DEFAULT_SLOTS_PER_EPOCH;
const PRECISE_CONSENSUS_NUMERATOR: u128 = 2;
Expand All @@ -28,7 +28,7 @@ pub fn precise_consensus() -> Result<PreciseNumber, TipRouterError> {
}

pub const DEFAULT_CONSENSUS_REACHED_SLOT: u64 = u64::MAX;
pub const MAX_REALLOC_BYTES: u64 = MAX_PERMITTED_DATA_INCREASE as u64; // TODO just use this?
pub const MAX_REALLOC_BYTES: u64 = MAX_PERMITTED_DATA_INCREASE as u64;

pub const WEIGHT_PRECISION: u128 = 1_000_000_000;
pub const SWITCHBOARD_MAX_STALE_SLOTS: u64 = 100;
Expand Down
4 changes: 0 additions & 4 deletions core/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,6 @@ mod tests {
// ADJUSTED FEE ERROR
let error = FeeConfig::new(&ok_wallet, MAX_FEE_BPS, OK_FEE, OK_FEE, OK_EPOCH);
assert_eq!(error.err().unwrap(), TipRouterError::DenominatorIsZero);

//TODO should it be an error if adjusted fee is 0?
// let error = FeeConfig::new(ok_wallet, MAX_FEE_BPS - 1, 1000, OK_FEE, OK_EPOCH);
// assert_eq!(error.err().unwrap(), TipRouterError::DenominatorIsZero);
}

#[test]
Expand Down
2 changes: 0 additions & 2 deletions integration_tests/tests/fixtures/test_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ pub struct TestNcn {
pub vaults: Vec<VaultRoot>,
}

//TODO implement for more fine-grained relationship control
#[allow(dead_code)]

pub struct TestNcnNode {
pub ncn_root: NcnRoot,
pub operator_root: OperatorRoot,
Expand Down
7 changes: 4 additions & 3 deletions program/src/admin_initialize_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ use jito_tip_router_core::{
account_payer::AccountPayer,
config::Config,
constants::{
MAX_EPOCHS_BEFORE_CLAIM, MAX_EPOCHS_BEFORE_STALL, MAX_FEE_BPS, MAX_SLOTS_AFTER_CONSENSUS,
MIN_EPOCHS_BEFORE_CLAIM, MIN_EPOCHS_BEFORE_STALL, MIN_SLOTS_AFTER_CONSENSUS,
MAX_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM, MAX_EPOCHS_BEFORE_STALL, MAX_FEE_BPS,
MAX_SLOTS_AFTER_CONSENSUS, MIN_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM,
MIN_EPOCHS_BEFORE_STALL, MIN_SLOTS_AFTER_CONSENSUS,
},
error::TipRouterError,
fees::FeeConfig,
Expand Down Expand Up @@ -56,7 +57,7 @@ pub fn process_admin_initialize_config(
return Err(TipRouterError::InvalidEpochsBeforeStall.into());
}

if !(MIN_EPOCHS_BEFORE_CLAIM..=MAX_EPOCHS_BEFORE_CLAIM)
if !(MIN_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM..=MAX_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM)
.contains(&epochs_after_consensus_before_claim)
{
return Err(TipRouterError::InvalidEpochsBeforeClaim.into());
Expand Down
9 changes: 6 additions & 3 deletions program/src/admin_set_parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ use jito_restaking_core::ncn::Ncn;
use jito_tip_router_core::{
config::Config,
constants::{
MAX_EPOCHS_BEFORE_CLAIM, MAX_EPOCHS_BEFORE_STALL, MAX_SLOTS_AFTER_CONSENSUS,
MIN_EPOCHS_BEFORE_CLAIM, MIN_EPOCHS_BEFORE_STALL, MIN_SLOTS_AFTER_CONSENSUS,
MAX_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM, MAX_EPOCHS_BEFORE_STALL,
MAX_SLOTS_AFTER_CONSENSUS, MIN_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM,
MIN_EPOCHS_BEFORE_STALL, MIN_SLOTS_AFTER_CONSENSUS,
},
error::TipRouterError,
};
Expand Down Expand Up @@ -55,7 +56,9 @@ pub fn process_admin_set_parameters(
}

if let Some(epochs) = epochs_after_consensus_before_claim {
if !(MIN_EPOCHS_BEFORE_CLAIM..=MAX_EPOCHS_BEFORE_CLAIM).contains(&epochs) {
if !(MIN_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM..=MAX_EPOCHS_AFTER_CONSENSUS_BEFORE_CLAIM)
.contains(&epochs)
{
return Err(TipRouterError::InvalidEpochsBeforeClaim.into());
}
msg!("Updated epochs_after_consensus_before_claim to {}", epochs);
Expand Down
1 change: 0 additions & 1 deletion program/src/realloc_operator_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ pub fn process_realloc_operator_snapshot(
let current_slot = Clock::get()?.slot;
let (_, ncn_epoch_length) = load_ncn_epoch(restaking_config, current_slot, None)?;

//TODO move to helper function
let (is_active, ncn_operator_index): (bool, u64) = {
let ncn_operator_state_data = ncn_operator_state.data.borrow();
let ncn_operator_state_account =
Expand Down

0 comments on commit 01fc34f

Please sign in to comment.