Skip to content

Commit fb4a2fa

Browse files
committed
feat: update (most) pox4 scenario tests
1 parent f746932 commit fb4a2fa

File tree

7 files changed

+117
-78
lines changed

7 files changed

+117
-78
lines changed

stackslib/src/burnchains/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ impl PoxConstants {
517517
}
518518
}
519519

520-
/// The first block of the prepare phase during `reward_cycle`. This is the prepare phase _for the next cycle_.
520+
/// The first block of the prepare phase during `reward_cycle`. This is the prepare phase _for the next cycle_.
521521
pub fn prepare_phase_start(&self, first_block_height: u64, reward_cycle: u64) -> u64 {
522522
let reward_cycle_start =
523523
self.reward_cycle_to_block_height(first_block_height, reward_cycle);

stackslib/src/chainstate/burn/db/sortdb.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3908,11 +3908,11 @@ impl<'a> SortitionDBConn<'a> {
39083908
tip: &SortitionId,
39093909
reward_cycle_id: u64,
39103910
) -> Result<SortitionId, db_error> {
3911-
let reward_cycle_of_prepare_phase = reward_cycle_id.checked_sub(1).ok_or_else(|| db_error::Other("No prepare phase exists for cycle 0".into()))?;
3912-
let prepare_phase_start = pox_constants.prepare_phase_start(
3913-
first_block_height,
3914-
reward_cycle_of_prepare_phase,
3915-
);
3911+
let reward_cycle_of_prepare_phase = reward_cycle_id
3912+
.checked_sub(1)
3913+
.ok_or_else(|| db_error::Other("No prepare phase exists for cycle 0".into()))?;
3914+
let prepare_phase_start =
3915+
pox_constants.prepare_phase_start(first_block_height, reward_cycle_of_prepare_phase);
39163916

39173917
let first_sortition =
39183918
get_ancestor_sort_id(self, prepare_phase_start, tip)?.ok_or_else(|| {

stackslib/src/chainstate/coordinator/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,6 @@ pub trait RewardSetProvider {
299299
&self,
300300
chainstate: &mut StacksChainState,
301301
cycle: u64,
302-
burnchain: &Burnchain,
303302
sortdb: &SortitionDB,
304303
block_id: &StacksBlockId,
305304
) -> Result<RewardSet, Error>;
@@ -374,11 +373,10 @@ impl<'a, T: BlockEventDispatcher> RewardSetProvider for OnChainRewardSetProvider
374373
&self,
375374
chainstate: &mut StacksChainState,
376375
reward_cycle: u64,
377-
burnchain: &Burnchain,
378376
sortdb: &SortitionDB,
379377
block_id: &StacksBlockId,
380378
) -> Result<RewardSet, Error> {
381-
self.read_reward_set_nakamoto(chainstate, reward_cycle, burnchain, sortdb, block_id, false)
379+
self.read_reward_set_nakamoto(chainstate, reward_cycle, sortdb, block_id, false)
382380
}
383381
}
384382

stackslib/src/chainstate/coordinator/tests.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,6 @@ impl RewardSetProvider for StubbedRewardSetProvider {
522522
&self,
523523
chainstate: &mut StacksChainState,
524524
cycle: u64,
525-
burnchain: &Burnchain,
526525
sortdb: &SortitionDB,
527526
block_id: &StacksBlockId,
528527
) -> Result<RewardSet, CoordError> {

stackslib/src/chainstate/nakamoto/coordinator/mod.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ impl<'a, T: BlockEventDispatcher> OnChainRewardSetProvider<'a, T> {
9090
&self,
9191
chainstate: &mut StacksChainState,
9292
cycle: u64,
93-
burnchain: &Burnchain,
9493
sortdb: &SortitionDB,
9594
block_id: &StacksBlockId,
9695
debug_log: bool,
@@ -547,13 +546,8 @@ pub fn load_nakamoto_reward_set<U: RewardSetProvider>(
547546
"cycle_start_height" => %cycle_start_height,
548547
"burnchain_height" => %anchor_block_sn.block_height);
549548

550-
let reward_set = provider.get_reward_set_nakamoto(
551-
chain_state,
552-
reward_cycle,
553-
burnchain,
554-
sort_db,
555-
&block_id,
556-
)?;
549+
let reward_set =
550+
provider.get_reward_set_nakamoto(chain_state, reward_cycle, sort_db, &block_id)?;
557551
debug!(
558552
"Stacks anchor block (ch {}) {} cycle {} is processed",
559553
&anchor_block_header.consensus_hash, &block_id, reward_cycle;

0 commit comments

Comments
 (0)