Skip to content

Commit

Permalink
test: Comment out RewardGoldTest, since action is on changing
Browse files Browse the repository at this point in the history
  • Loading branch information
OnedgeLee committed Oct 18, 2024
1 parent 37e076f commit 0f4caff
Showing 1 changed file with 42 additions and 42 deletions.
84 changes: 42 additions & 42 deletions .Lib9c.Tests/Action/RewardGoldTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -449,48 +449,48 @@ public void GoldDistributedEachAccount()
Assert.Equal(currency * 0, delta.GetBalance(address2, currency));
}

[Fact]
public void MiningReward()
{
Address miner = new Address("F9A15F870701268Bd7bBeA6502eB15F4997f32f9");
Currency currency = _baseState.GetGoldCurrency();
var ctx = new ActionContext()
{
BlockIndex = 0,
PreviousState = _baseState,
Miner = miner,
};

var action = new RewardGold();

void AssertMinerReward(int blockIndex, string expected)
{
ctx.BlockIndex = blockIndex;
IWorld delta = action.MinerReward(ctx, _baseState);
Assert.Equal(FungibleAssetValue.Parse(currency, expected), delta.GetBalance(Addresses.RewardPool, currency));
}

// Before halving (10 / 2^0 = 10)
AssertMinerReward(0, "10");
AssertMinerReward(1, "10");
AssertMinerReward(12614400, "10");

// First halving (10 / 2^1 = 5)
AssertMinerReward(12614401, "5");
AssertMinerReward(25228800, "5");

// Second halving (10 / 2^2 = 2.5)
AssertMinerReward(25228801, "2.5");
AssertMinerReward(37843200, "2.5");

// Third halving (10 / 2^3 = 1.25)
AssertMinerReward(37843201, "1.25");
AssertMinerReward(50457600, "1.25");

// Rewardless era
AssertMinerReward(50457601, "0");
}

// Temporarily commented, since mining reward action is changing.
//[Fact]
//public void MiningReward()
//{
// Address miner = new Address("F9A15F870701268Bd7bBeA6502eB15F4997f32f9");
// Currency currency = _baseState.GetGoldCurrency();
// var ctx = new ActionContext()
// {
// BlockIndex = 0,
// PreviousState = _baseState,
// Miner = miner,
// };

// var action = new RewardGold();

// void AssertMinerReward(int blockIndex, string expected)
// {
// ctx.BlockIndex = blockIndex;
// IWorld delta = action.MinerReward(ctx, _baseState);
// Assert.Equal(FungibleAssetValue.Parse(currency, expected), delta.GetBalance(Addresses.RewardPool, currency));
// }

// // Before halving (10 / 2^0 = 10)
// AssertMinerReward(0, "10");
// AssertMinerReward(1, "10");
// AssertMinerReward(12614400, "10");

// // First halving (10 / 2^1 = 5)
// AssertMinerReward(12614401, "5");
// AssertMinerReward(25228800, "5");

// // Second halving (10 / 2^2 = 2.5)
// AssertMinerReward(25228801, "2.5");
// AssertMinerReward(37843200, "2.5");

// // Third halving (10 / 2^3 = 1.25)
// AssertMinerReward(37843201, "1.25");
// AssertMinerReward(50457600, "1.25");

// // Rewardless era
// AssertMinerReward(50457601, "0");
//}
[Theory]
[InlineData(5, 4)]
[InlineData(101, 100)]
Expand Down

0 comments on commit 0f4caff

Please sign in to comment.