Skip to content

Commit e319619

Browse files
authored
Combine 3 Hook Api fix amendments (#648)
1 parent 2073b56 commit e319619

File tree

10 files changed

+4304
-32
lines changed

10 files changed

+4304
-32
lines changed

src/ripple/app/hook/impl/applyHook.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4239,7 +4239,7 @@ DEFINE_HOOK_FUNCTION(
42394239
// eg) Amounts field value = 0x5C => 0xF0, 0x5C
42404240
if ((*upto & 0xF0U) == 0xF0U)
42414241
{
4242-
if (view.rules().enabled(fixStoSubarray) && *upto == 0xF0U)
4242+
if (view.rules().enabled(fixHookAPI20251128) && *upto == 0xF0U)
42434243
{
42444244
// field value > 15
42454245
upto++;
@@ -4484,7 +4484,7 @@ DEFINE_HOOK_FUNCTION(
44844484
return MEM_OVERLAP;
44854485
}
44864486

4487-
if (fread_len > 0 && view.rules().enabled(fixStoEmplaceFieldIdCheck))
4487+
if (fread_len > 0 && view.rules().enabled(fixHookAPI20251128))
44884488
{
44894489
// inject field should be valid sto object and it's field id should
44904490
// match the field_id
@@ -4748,7 +4748,7 @@ DEFINE_HOOK_FUNCTION(
47484748
std::unique_ptr<STTx const> stpTrans;
47494749
stpTrans = std::make_unique<STTx const>(std::ref(sitTrans));
47504750

4751-
if (!view.rules().enabled(fixEtxnFeeBase))
4751+
if (!view.rules().enabled(fixHookAPI20251128))
47524752
return Transactor::calculateBaseFee(
47534753
*(applyCtx.app.openLedger().current()), *stpTrans)
47544754
.drops();

src/ripple/app/tx/impl/Transactor.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1519,7 +1519,7 @@ Transactor::doTSH(
15191519
for (auto& weakTsh : additionalWeakTSH_)
15201520
tsh.emplace_back(weakTsh, false);
15211521

1522-
if (view.rules().enabled(fixEtxnFeeBase))
1522+
if (view.rules().enabled(fixHookAPI20251128))
15231523
{
15241524
// if account_ is not included in tsh , add it only once
15251525
bool found = false;
@@ -1547,7 +1547,7 @@ Transactor::doTSH(
15471547
// blindly nominate any TSHes they find but
15481548
// obviously we will never execute OTXN account
15491549
// as a TSH because they already had first execution
1550-
if (!view.rules().enabled(fixEtxnFeeBase))
1550+
if (!view.rules().enabled(fixHookAPI20251128))
15511551
{
15521552
if (tshAccountID == account_)
15531553
continue;
@@ -1564,10 +1564,10 @@ Transactor::doTSH(
15641564

15651565
touchAccount(view, tshAccountID);
15661566

1567-
if (view.rules().enabled(fixEtxnFeeBase))
1567+
if (view.rules().enabled(fixHookAPI20251128))
15681568
{
1569-
// After fixEtxnFeeBase, the otxn account is prosessed as touched
1570-
// account
1569+
// After fixHookAPI20251128, the otxn account is prosessed as
1570+
// touched account
15711571
if (tshAccountID == account_)
15721572
continue;
15731573
}

src/ripple/protocol/Feature.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ namespace detail {
7474
// Feature.cpp. Because it's only used to reserve storage, and determine how
7575
// large to make the FeatureBitset, it MAY be larger. It MUST NOT be less than
7676
// the actual number of amendments. A LogicError on startup will verify this.
77-
static constexpr std::size_t numFeatures = 92;
77+
static constexpr std::size_t numFeatures = 90;
7878

7979
/** Amendments that this server supports and the default voting behavior.
8080
Whether they are enabled depends on the Rules defined in the validated
@@ -377,10 +377,7 @@ extern uint256 const featureCron;
377377
extern uint256 const fixInvalidTxFlags;
378378
extern uint256 const featureExtendedHookState;
379379
extern uint256 const fixCronStacking;
380-
extern uint256 const fixEtxnFeeBase;
381-
extern uint256 const fixStoEmplaceFieldIdCheck;
382-
extern uint256 const fixStoSubarray;
383-
380+
extern uint256 const fixHookAPI20251128;
384381
} // namespace ripple
385382

386383
#endif

src/ripple/protocol/impl/Feature.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -483,9 +483,7 @@ REGISTER_FEATURE(Cron, Supported::yes, VoteBehavior::De
483483
REGISTER_FIX (fixInvalidTxFlags, Supported::yes, VoteBehavior::DefaultYes);
484484
REGISTER_FEATURE(ExtendedHookState, Supported::yes, VoteBehavior::DefaultNo);
485485
REGISTER_FIX (fixCronStacking, Supported::yes, VoteBehavior::DefaultYes);
486-
REGISTER_FIX (fixEtxnFeeBase, Supported::yes, VoteBehavior::DefaultYes);
487-
REGISTER_FIX (fixStoEmplaceFieldIdCheck, Supported::yes, VoteBehavior::DefaultYes);
488-
REGISTER_FIX (fixStoSubarray, Supported::yes, VoteBehavior::DefaultYes);
486+
REGISTER_FIX (fixHookAPI20251128, Supported::yes, VoteBehavior::DefaultYes);
489487

490488
// The following amendments are obsolete, but must remain supported
491489
// because they could potentially get enabled.

src/test/app/GenesisMint_test.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ struct GenesisMint_test : public beast::unit_test::suite
192192
}
193193
auto const postCoins = env.current()->info().drops;
194194
auto const txnFee =
195-
env.current()->rules().enabled(fixEtxnFeeBase) ? 0 : 10;
195+
env.current()->rules().enabled(fixHookAPI20251128) ? 0 : 10;
196196
BEAST_EXPECT(
197197
initCoins - 1'000'000 /* txn fee */
198198
- txnFee /* emitted txn fee */
@@ -630,7 +630,7 @@ struct GenesisMint_test : public beast::unit_test::suite
630630

631631
auto const postCoins = env.current()->info().drops;
632632
auto const txnFee =
633-
env.current()->rules().enabled(fixEtxnFeeBase) ? 0 : 10;
633+
env.current()->rules().enabled(fixHookAPI20251128) ? 0 : 10;
634634
BEAST_EXPECT(
635635
initCoins - 1'000'000 /* txn fee */ -
636636
txnFee /* emitted txn fee */
@@ -699,7 +699,7 @@ struct GenesisMint_test : public beast::unit_test::suite
699699
auto const sa = supported_amendments();
700700
testWithFeats(sa);
701701
testWithFeats(sa - fixXahauV1);
702-
testWithFeats(sa - fixEtxnFeeBase);
702+
testWithFeats(sa - fixHookAPI20251128);
703703
}
704704
};
705705

0 commit comments

Comments
 (0)