Skip to content

Commit

Permalink
add tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCardinalError committed Nov 8, 2024
1 parent 025c379 commit 50ff8d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 2 additions & 2 deletions test/Redistribution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ let node_2: string;
const overlay_2 = '0xa40db58e368ea6856a24c0264ebd73b049f3dc1c2347b1babc901d3e09842dec';
const stakeAmount_2 = '100000000000000000';
const effectiveStakeAmount_2 = '99999999999984000';
const effectiveStakeAmount_2_n_2 = '99999999999936000';
const effectiveStakeAmount_2_n_2 = '100000000000000000';
const nonce_2 = '0xb5555b33b5555b33b5555b33b5555b33b5555b33b5555b33b5555b33b5555b33';
const hash_2 = '0xb5555b33b5555b33b5555b33b5555b33b5555b33b5555b33b5555b33b5555b33';
const depth_2 = '0x06';
Expand All @@ -100,7 +100,7 @@ const hash_3 = '0xb5555b33b5555b33b5555b33b5555b33b5555b33b5555b33b5555b33b5555b
const depth_3 = '0x06';
const reveal_nonce_3 = '0xb5555b33b5555b33b5555b33b5555b33b5555b33b5555b33b5555b33b5555b33';
const height_3_n_2 = 3;
const effectiveStakeAmount_3 = '99999999999744000';
const effectiveStakeAmount_3 = '100000000000000000';

let node_4: string;
const overlay_4 = '0xaedb2a8007316805b4d64b249ea39c5a1c4a9ce51dc8432724241f41ecb02efb';
Expand Down
8 changes: 2 additions & 6 deletions test/Staking.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ describe('Staking', function () {
it('should make stake surplus withdrawal when height increases and then decreases', async function () {
const priceOracle = await ethers.getContract('PriceOracle', deployer);

await priceOracle.setPrice(26000);
await priceOracle.setPrice(24000);
const price = await priceOracle.currentPrice();

// We are doubling here as we are adding another "amount" with another stakeAmount_0
Expand All @@ -504,16 +504,12 @@ describe('Staking', function () {
// Mine 2 rounds so that values are valid, before that effectiveStake is zero as nodes cant play
await mineNBlocks(roundLength * 2);
const withdrawbleStakeBefore = await sr_staker_0.withdrawableStake();
// console.log('WD', withdrawbleStakeBefore.toString());
// console.log('POT', staked_before.potentialStake.toString());
// console.log('COM', staked_before.committedStake.toString() * price * 2 ** height_0_n_1);
// console.log('EFF', (await sr_staker_0.nodeEffectiveStake(staker_0)).toString());

// We are lowering height to 0 and again mining 2 rounds so values are valid
await sr_staker_0.manageStake(nonce_0, 0, height_0);
await mineNBlocks(roundLength * 2);
const staked_after = await sr_staker_0.stakes(staker_0);
await priceOracle.setPrice(24000);
// await priceOracle.setPrice(24000);

const withdrawbleStakeAfter = await sr_staker_0.withdrawableStake();
expect(withdrawbleStakeAfter.gt(withdrawbleStakeBefore)).to.be.true;
Expand Down

0 comments on commit 50ff8d2

Please sign in to comment.