ZeroB2M amendment (#293)

* ZeroB2M amendment

Co-authored-by: Denis Angell <dangell@transia.co>
This commit is contained in:
RichardAH
2024-03-22 10:49:35 +11:00
committed by GitHub
parent d24c134612
commit 7cd8f0a03a
4 changed files with 131 additions and 39 deletions

View File

@@ -3000,7 +3000,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - feeDrops
auto const totalBurn = XRP(1000) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = XRP(zeroBurn ? 0 : 1000) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3111,7 +3113,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - feeDrops
auto const totalBurn = XRP(1000) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = XRP(zeroBurn ? 0 : 1000) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3178,7 +3182,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - feeDrops
auto const totalBurn = drops(48) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 48) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3242,7 +3248,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - feeDrops
auto const totalBurn = XRP(1000) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = XRP(zeroBurn ? 0 : 1000) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3299,7 +3307,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - feeDrops
auto const totalBurn = XRP(1000) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = XRP(zeroBurn ? 0 : 1000) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3363,7 +3373,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - feeDrops
auto const totalBurn = drops(48) - ((3 * feeDrops) * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn =
drops(zeroBurn ? 0 : 48) - ((3 * feeDrops) * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3433,7 +3446,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - fee drops
auto const totalBurn = drops(10) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 10) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3500,7 +3515,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + reward amount
auto const totalBurn = drops(12) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 12) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3560,7 +3577,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - initial value
auto const totalBurn = drops(12) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 12) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3622,7 +3641,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + reward amount
auto const totalBurn = drops(48) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 48) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3684,7 +3705,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - feeDrops
auto const totalBurn = drops(12) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 12) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3754,7 +3777,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - fee drops
auto const totalBurn = drops(12) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 12) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3825,7 +3850,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - fee drops
auto const totalBurn = drops(12) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 12) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3897,7 +3924,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - fee drops
auto const totalBurn = drops(48) - ((3 * feeDrops) * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn =
drops(zeroBurn ? 0 : 48) - ((3 * feeDrops) * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -3971,7 +4001,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - fee drops
auto const totalBurn = drops(12) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 12) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -4040,7 +4072,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - fee drops
auto const totalBurn = drops(12) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 12) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -4113,7 +4147,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops - fee drops
auto const totalBurn = drops(48) - ((3 * feeDrops) * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn =
drops(zeroBurn ? 0 : 48) - ((3 * feeDrops) * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -4303,7 +4340,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = (burn drops + burn fee drops) - reward
auto const totalBurn = XRP(2) + drops(12) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn =
XRP(zeroBurn ? 0 : 2) + drops(zeroBurn ? 0 : 12) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -4385,7 +4425,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = (burn drops + burn fee drops) - fee drops
auto const totalBurn = XRP(2) + drops(12) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn =
XRP(zeroBurn ? 0 : 2) + drops(zeroBurn ? 0 : 12) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -4543,7 +4586,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = (burn drops + burn fee drops) - fee drops
auto const totalBurn = XRP(2) + drops(12) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = XRP(zeroBurn ? 0 : 2) +
drops(zeroBurn ? 0 : 12) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -4634,7 +4680,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = (burn drops + burn fee drops) - fee drops
auto const totalBurn = XRP(2) + drops(12) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = XRP(zeroBurn ? 0 : 2) +
drops(zeroBurn ? 0 : 12) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -4713,7 +4762,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = (burn drops + burn fee drops) - fee drops
auto const totalBurn = XRP(2) + drops(12) - (feeDrops * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = XRP(zeroBurn ? 0 : 2) +
drops(zeroBurn ? 0 : 12) - (feeDrops * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -4793,7 +4845,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = (burn drops + burn fee drops) - fee drops
auto const totalBurn = XRP(2) + drops(48) - ((3 * feeDrops) * 10);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = XRP(zeroBurn ? 0 : 2) +
drops(zeroBurn ? 0 : 48) - ((3 * feeDrops) * 10);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5055,7 +5110,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// fixXahauV2
auto const mintXAH = fixV2 ? XRP(1000) : XRP(0);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const mintXAH = fixV2 ? XRP(zeroBurn ? 0 : 1000) : XRP(0);
// confirm fee was burned mint / no mint
auto const postAlice = env.balance(alice);
BEAST_EXPECT(postAlice == preAlice - XRP(1) + mintXAH);
@@ -5074,7 +5131,8 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn
auto const totalBurn = fixV2 ? XRP(0) : XRP(1000) - (feeDrops * 10);
auto const totalBurn =
fixV2 ? XRP(0) : XRP(zeroBurn ? 0 : 1000) - (feeDrops * 10);
// confirm fee was minted / not minted
auto const postAlice2 = env.balance(alice);
@@ -5318,7 +5376,9 @@ class Import_test : public beast::unit_test::suite
auto const preAlice = env.balance(alice);
BEAST_EXPECT(preAlice == XRP(0));
STAmount burnFee = XRP(1000) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
STAmount burnFee = XRP(zeroBurn ? 0 : 1000) + XRP(2);
auto const xpopJson = import::loadXpop(ImportTCAccountSet::w_seed);
Json::Value tx = import::import(alice, xpopJson);
tx[jss::Sequence] = 0;
@@ -5356,7 +5416,9 @@ class Import_test : public beast::unit_test::suite
auto const preAlice = env.balance(alice);
BEAST_EXPECT(preAlice == XRP(0));
STAmount burnFee = XRP(1000) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
STAmount burnFee = XRP(zeroBurn ? 0 : 1000) + XRP(2);
auto const xpopJson = import::loadXpop(ImportTCAccountSet::w_seed);
Json::Value tx = import::import(alice, xpopJson);
tx[jss::Sequence] = 0;
@@ -5387,7 +5449,9 @@ class Import_test : public beast::unit_test::suite
auto const preAlice = env.balance(alice);
BEAST_EXPECT(preAlice == XRP(0));
STAmount burnFee = XRP(1000) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
STAmount burnFee = XRP(zeroBurn ? 0 : 1000) + XRP(2);
auto const xpopJson = import::loadXpop(ImportTCAccountSet::w_seed);
Json::Value tx = import::import(alice, xpopJson);
tx[jss::Sequence] = 0;
@@ -5447,7 +5511,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + reward amount
auto const totalBurn = drops(10) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 10) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5504,7 +5570,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + reward amount
auto const totalBurn = drops(10) + XRP(20);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn = drops(zeroBurn ? 0 : 10) + XRP(20);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5558,7 +5626,10 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + reward amount
auto const totalBurn = drops(99'999'939'799'000'000) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const totalBurn =
drops(zeroBurn ? 0 : 99'999'939'799'000'000) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5615,7 +5686,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + Init Reward
auto const creditDrops = XRP(1'000) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const creditDrops = XRP(zeroBurn ? 0 : 1'000) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5658,7 +5731,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + Init Reward
auto const creditDrops = XRP(1'000) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const creditDrops = XRP(zeroBurn ? 0 : 1'000) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5702,7 +5777,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + Init Reward
auto const creditDrops = drops(999999964) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const creditDrops = drops(zeroBurn ? 0 : 999999964) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5744,7 +5821,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + Init Reward
auto const creditDrops = drops(892857142) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const creditDrops = drops(zeroBurn ? 0 : 892857142) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5786,7 +5865,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + Init Reward
auto const creditDrops = drops(357142857) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const creditDrops = drops(zeroBurn ? 0 : 357142857) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5828,7 +5909,9 @@ class Import_test : public beast::unit_test::suite
env.close();
// total burn = burn drops + Init Reward
auto const creditDrops = drops(35) + XRP(2);
bool const zeroBurn =
env.current()->rules().enabled(featureZeroB2M);
auto const creditDrops = drops(zeroBurn ? 0 : 35) + XRP(2);
// confirm fee was minted
auto const postAlice = env.balance(alice);
@@ -5932,6 +6015,7 @@ public:
using namespace test::jtx;
FeatureBitset const all{supported_amendments()};
testWithFeats(all - fixXahauV2);
testWithFeats(all - featureZeroB2M);
testWithFeats(all);
}