fix(pox-4-tests): Replace pox values REWARD_CYCLE_LENGTH and FIRST_BURNCHAIN_BLOCK_HEIGHT consts

This commit is contained in:
BowTiedRadone
2024-04-22 16:41:45 +03:00
committed by Nikos Baxevanis
parent e33895fa78
commit 5679afaca2
2 changed files with 13 additions and 4 deletions

View File

@@ -7,6 +7,10 @@ import {
StacksPrivateKey,
} from "@stacks/transactions";
import { StackingClient } from "@stacks/stacking";
import {
FIRST_BURNCHAIN_BLOCK_HEIGHT,
REWARD_CYCLE_LENGTH,
} from "./pox_Commands";
export type StxAddress = string;
export type BtcAddress = string;
@@ -53,7 +57,10 @@ export class Stub {
cvToValue(burnBlockHeightResult as ClarityValue),
);
const lastRefreshedCycle = this.lastRefreshedCycle;
const currentRewCycle = Math.floor((Number(burnBlockHeight) - 0) / 1050);
const currentRewCycle = Math.floor(
(Number(burnBlockHeight) - FIRST_BURNCHAIN_BLOCK_HEIGHT) /
REWARD_CYCLE_LENGTH,
);
// The `this.burnBlockHeight` instance member is used for logging purposes.
// However, it's not used in the actual implementation of the model and all
@@ -81,7 +88,7 @@ export class Stub {
stackerAddress,
) =>
this.stackers.get(stackerAddress)!.unlockHeight <=
burnBlockHeight + 1050
burnBlockHeight + REWARD_CYCLE_LENGTH
);
// Get the operator's ex-pool stackers by comparing their unlockHeight to
@@ -138,7 +145,8 @@ export class Stub {
// next empty reward slot)
else if (
wallet.unlockHeight > 0 &&
wallet.unlockHeight > burnBlockHeight + 1050 && wallet.isStackingSolo
wallet.unlockHeight > burnBlockHeight + REWARD_CYCLE_LENGTH &&
wallet.isStackingSolo
) {
this.nextRewardSetIndex++;
}

View File

@@ -74,7 +74,8 @@ export class DelegateStackExtendCommand implements PoxCommand {
const lastExtendCycle = firstExtendCycle + this.extendCount - 1;
const totalPeriod = lastExtendCycle - firstRewardCycle + 1;
const newUnlockHeight =
REWARD_CYCLE_LENGTH * (firstRewardCycle + totalPeriod - 1) + 0;
REWARD_CYCLE_LENGTH * (firstRewardCycle + totalPeriod - 1) +
FIRST_BURNCHAIN_BLOCK_HEIGHT;
const stackedAmount = stackerWallet.amountLocked;
return (