Skip to content

Commit

Permalink
Feature for mainnet compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
ebatsell committed Jun 3, 2024
1 parent 328b211 commit 64a1e7e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions programs/steward/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,7 @@ pub const EPOCH_PROGRESS_MAX: f64 = 0.99;
pub const NUM_EPOCHS_BETWEEN_SCORING_MAX: u64 = 100;
// Cannot score validators in under 100 slots, to submit 1 instruction per validator
pub const COMPUTE_SCORE_SLOT_RANGE_MIN: usize = 100;
#[cfg(feature = "mainnet-beta")]
pub const VALIDATOR_HISTORY_FIRST_RELIABLE_EPOCH: usize = 520;
#[cfg(not(feature = "mainnet-beta"))]
pub const VALIDATOR_HISTORY_FIRST_RELIABLE_EPOCH: usize = 0;
5 changes: 4 additions & 1 deletion programs/steward/src/score.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,10 @@ pub fn validator_score(

let historical_commission_max = validator
.history
.commission_range(0 as u16, current_epoch as u16) // TODO SOLUTION FOR FIRST_RELIABLE_EPOCH
.commission_range(
VALIDATOR_HISTORY_FIRST_RELIABLE_EPOCH as u16,
current_epoch as u16,
)
.iter()
.filter_map(|&i| i)
.max()
Expand Down
9 changes: 6 additions & 3 deletions tests/tests/steward/test_integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ async fn test_compute_scores() {
let tx = Transaction::new_signed_with_payer(
&[
// Only high because we are averaging 512 epochs
ComputeBudgetInstruction::set_compute_unit_limit(1_400_000),
ComputeBudgetInstruction::set_compute_unit_limit(600_000),
ComputeBudgetInstruction::request_heap_frame(128 * 1024),
compute_scores_ix.clone(),
],
Some(&fixture.keypair.pubkey()),
Expand Down Expand Up @@ -349,7 +350,8 @@ async fn test_compute_scores() {

let tx = Transaction::new_signed_with_payer(
&[
ComputeBudgetInstruction::set_compute_unit_limit(1_400_000),
ComputeBudgetInstruction::set_compute_unit_limit(600_000),
ComputeBudgetInstruction::request_heap_frame(128 * 1024),
compute_scores_ix.clone(),
],
Some(&fixture.keypair.pubkey()),
Expand Down Expand Up @@ -377,7 +379,8 @@ async fn test_compute_scores() {
let blockhash = fixture.get_latest_blockhash().await;
let tx = Transaction::new_signed_with_payer(
&[
ComputeBudgetInstruction::set_compute_unit_limit(1_400_000),
ComputeBudgetInstruction::set_compute_unit_limit(600_000),
ComputeBudgetInstruction::request_heap_frame(128 * 1024),
compute_scores_ix.clone(),
],
Some(&fixture.keypair.pubkey()),
Expand Down

0 comments on commit 64a1e7e

Please sign in to comment.