diff --git a/src/ripple/app/tx/impl/Import.cpp b/src/ripple/app/tx/impl/Import.cpp index d136c7d67..14af32963 100644 --- a/src/ripple/app/tx/impl/Import.cpp +++ b/src/ripple/app/tx/impl/Import.cpp @@ -1224,7 +1224,13 @@ Import::doApply() create ? STAmount(bonusAmount) : STAmount(mSourceBalance); uint64_t creditDrops = burn.xrp().drops(); - if (elapsed < 2'000'000) + + if (view().rules().enabled(featureZeroB2M)) + { + // B2M xrp is disabled by amendment + creditDrops = 0; + } + else if (elapsed < 2'000'000) { // first 2MM ledgers // the ratio is 1:1 diff --git a/src/ripple/protocol/Feature.h b/src/ripple/protocol/Feature.h index d6e3c3eea..74ea0ae1c 100644 --- a/src/ripple/protocol/Feature.h +++ b/src/ripple/protocol/Feature.h @@ -74,7 +74,7 @@ namespace detail { // Feature.cpp. Because it's only used to reserve storage, and determine how // large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than // the actual number of amendments. A LogicError on startup will verify this. -static constexpr std::size_t numFeatures = 68; +static constexpr std::size_t numFeatures = 69; /** Amendments that this server supports and the default voting behavior. Whether they are enabled depends on the Rules defined in the validated @@ -356,6 +356,7 @@ extern uint256 const featureHooksUpdate1; extern uint256 const fixXahauV1; extern uint256 const fixXahauV2; extern uint256 const featureRemit; +extern uint256 const featureZeroB2M; } // namespace ripple diff --git a/src/ripple/protocol/impl/Feature.cpp b/src/ripple/protocol/impl/Feature.cpp index 565aa0eab..bd23d3e58 100644 --- a/src/ripple/protocol/impl/Feature.cpp +++ b/src/ripple/protocol/impl/Feature.cpp @@ -462,6 +462,7 @@ REGISTER_FEATURE(HooksUpdate1, Supported::yes, VoteBehavior::De REGISTER_FIX (fixXahauV1, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FIX (fixXahauV2, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FEATURE(Remit, Supported::yes, VoteBehavior::DefaultNo); +REGISTER_FEATURE(ZeroB2M, Supported::yes, VoteBehavior::DefaultNo); // The following amendments are obsolete, but must remain supported // because they could potentially get enabled. diff --git a/src/test/app/Import_test.cpp b/src/test/app/Import_test.cpp index 3c73ade2c..d85a0420b 100644 --- a/src/test/app/Import_test.cpp +++ b/src/test/app/Import_test.cpp @@ -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 @@ class Import_test : public beast::unit_test::suite using namespace test::jtx; FeatureBitset const all{supported_amendments()}; testWithFeats(all - fixXahauV2); + testWithFeats(all - featureZeroB2M); testWithFeats(all); }