Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0031e2e
IOUIssuerWeakTSH
tequdev Oct 29, 2024
29b978b
clang-format
tequdev Oct 29, 2024
b0678c7
fix
tequdev Nov 12, 2024
3ba4892
Merge branch 'dev' into IOUIssuerWeakTSH
tequdev Nov 12, 2024
21551c5
fix remit
tequdev Nov 14, 2024
bafe260
add EscrowCreate
tequdev Nov 15, 2024
1037d80
Add tests
tequdev Nov 15, 2024
a98d869
Merge branch 'dev' into IOUIssuerWeakTSH
tequdev Nov 15, 2024
98060d7
clang-format
tequdev Nov 15, 2024
9e4958c
Merge branch 'dev' into IOUIssuerWeakTSH
tequdev Nov 22, 2024
a05d58a
Update README.md (#396)
Ekiserrepe Nov 25, 2024
3879c52
Fix: failing assert (#397)
dangell7 Nov 28, 2024
3d01abf
Merge branch 'dev' into IOUIssuerWeakTSH
tequdev Dec 7, 2024
9b7aa7e
Merge branch 'dev' into IOUIssuerWeakTSH
tequdev Feb 12, 2025
db8de28
Merge branch 'dev' into IOUIssuerWeakTSH
tequdev Feb 27, 2025
78d74b3
Merge branch 'dev' into IOUIssuerWeakTSH
tequdev May 6, 2025
7489b28
fix tsh
dangell7 Apr 28, 2025
6db4a8c
amendment guard
tequdev May 7, 2025
383485f
update tests
tequdev May 7, 2025
8314c9a
fix ttCHECK_CREATE TSH
tequdev May 9, 2025
a432130
Merge branch 'dev' into IOUIssuerWeakTSH
tequdev May 14, 2025
8c2731a
support CheckCancel
tequdev May 31, 2025
8a8e3cb
fix comment
tequdev May 31, 2025
e6dc2c3
support URIToken(Burn,Buy,Mint,CancelSellOffer,CreateSellOffer), NFTo…
tequdev May 31, 2025
2ccae36
clang-format
tequdev May 31, 2025
97d1ba4
Merge branch 'dev' into IOUIssuerWeakTSH
RichardAH Jun 16, 2025
19cb999
add comments
tequdev Jun 19, 2025
80a365d
clang-format
tequdev Jun 19, 2025
a0d6d24
Merge branch 'dev' into IOUIssuerWeakTSH
tequdev Jul 3, 2025
fb1315d
Changed from processing for each tt processing in `getTransactionalSt…
tequdev Jul 3, 2025
86bc21b
fix
tequdev Jul 3, 2025
c92dcbe
Merge branch 'dev' into IOUIssuerWeakTSH
dangell7 Jul 9, 2025
c6b768b
remove unused variable
tequdev Jul 9, 2025
40a5d0c
Merge branch 'dev' into IOUIssuerWeakTSH
RichardAH Jul 9, 2025
30c5f24
fix bad merge
tequdev Jul 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/ripple/app/hook/impl/applyHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,7 @@ getTransactionalStakeHolders(STTx const& tx, ReadView const& rv)
case ttOFFER_CANCEL:
case ttTICKET_CREATE:
case ttHOOK_SET:
case ttOFFER_CREATE: // this is handled seperately
{
case ttOFFER_CREATE: {
break;
}

Expand Down
3 changes: 2 additions & 1 deletion src/ripple/app/tx/impl/CreateOffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,8 @@ CreateOffer::doApply()
if (result.second)
{
sb.apply(ctx_.rawView());
addWeakTSHFromSandbox(sb);
if (!view().rules().enabled(featureIOUIssuerWeakTSH))
addWeakTSHFromBalanceChanges(sb);
}
else
sbCancel.apply(ctx_.rawView());
Expand Down
3 changes: 2 additions & 1 deletion src/ripple/app/tx/impl/Payment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ Payment::doApply()
// on the TER. But always applying *should*
// be safe.
pv.apply(ctx_.rawView());
addWeakTSHFromSandbox(pv);
if (!view().rules().enabled(featureIOUIssuerWeakTSH))
addWeakTSHFromBalanceChanges(pv);
}

// TODO: is this right? If the amount is the correct amount, was
Expand Down
37 changes: 27 additions & 10 deletions src/ripple/app/tx/impl/Transactor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1477,15 +1477,15 @@ Transactor::doHookCallback(
}

void
Transactor::addWeakTSHFromSandbox(detail::ApplyViewBase const& pv)
Transactor::addWeakTSHFromBalanceChanges(detail::ApplyViewBase const& pv)
{
// If Hooks are enabled then non-issuers who have their TL balance
// modified by the execution of the path have the opportunity to have their
// weak hooks executed.
// modified by the execution of the transaction have the opportunity to have
// their weak hooks executed.
if (ctx_.view().rules().enabled(featureHooks))
{
// anyone whose balance changed as a result of this Pathing is a weak
// TSH
// anyone whose balance changed as a result of transaction processing is
// a weak TSH
auto bc = pv.balanceChanges(view());

for (auto const& entry : bc)
Expand All @@ -1506,15 +1506,13 @@ Transactor::addWeakTSHFromSandbox(detail::ApplyViewBase const& pv)
TER
Transactor::doTSH(
bool strong, // only strong iff true, only weak iff false
std::vector<std::pair<AccountID, bool>> tsh,
hook::HookStateMap& stateMap,
std::vector<hook::HookResult>& results,
std::shared_ptr<STObject const> const& provisionalMeta)
{
auto& view = ctx_.view();

std::vector<std::pair<AccountID, bool>> tsh =
hook::getTransactionalStakeHolders(ctx_.tx, view);

// add the extra TSH marked out by the specific transactor (if applicable)
if (!strong)
for (auto& weakTsh : additionalWeakTSH_)
Expand Down Expand Up @@ -1772,6 +1770,9 @@ Transactor::operator()()
// application to the ledger
std::map<AccountID, std::set<uint256>> aawMap;

std::vector<std::pair<AccountID, bool>> tsh =
hook::getTransactionalStakeHolders(ctx_.tx, ctx_.view());

// Pre-application (Strong TSH) Hooks are executed here
// These TSH have the right to rollback.
// Weak TSH and callback are executed post-application.
Expand Down Expand Up @@ -1800,7 +1801,7 @@ Transactor::operator()()
// (who have the right to rollback the txn), any weak TSH will be
// executed after doApply has been successful (callback as well)

result = doTSH(true, stateMap, hookResults, {});
result = doTSH(true, tsh, stateMap, hookResults, {});
}

// write state if all chains executed successfully
Expand Down Expand Up @@ -2054,7 +2055,23 @@ Transactor::operator()()
hook::HookStateMap stateMap;
std::vector<hook::HookResult> weakResults;

doTSH(false, stateMap, weakResults, proMeta);
if (view().rules().enabled(featureIOUIssuerWeakTSH))
{
// Regardless of the transaction type, if the result changes the
// trust line balance, add high and low accounts to weakTSH.
ApplyViewImpl& avi = dynamic_cast<ApplyViewImpl&>(ctx_.view());
addWeakTSHFromBalanceChanges(avi);
}

if (!view().rules().enabled(featureIOUIssuerWeakTSH))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this condition supposed to be inverted?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR changes getTransactionalStakeHolders() to be called only once, but since a second call is still needed when the feature is disabled, it is called here.

I will add a comment.

{
// before amendment enabled, we need to get TSHs after txn basic
// processing If the object is deleted in cancen txn, it may not
// be possible to obtain the appropriate TSH.
tsh = hook::getTransactionalStakeHolders(ctx_.tx, ctx_.view());
}

doTSH(false, tsh, stateMap, weakResults, proMeta);

// execute any hooks that nominated for 'again as weak'
for (auto const& [accID, hookHashes] : aawMap)
Expand Down
3 changes: 2 additions & 1 deletion src/ripple/app/tx/impl/Transactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ class Transactor
TER
doTSH(
bool strong, // only do strong TSH iff true, otheriwse only weak
std::vector<std::pair<AccountID, bool>> tsh,
hook::HookStateMap& stateMap,
std::vector<hook::HookResult>& result,
std::shared_ptr<STObject const> const& provisionalMeta);
Expand All @@ -213,7 +214,7 @@ class Transactor
std::shared_ptr<STObject const> const& provisionalMeta);

void
addWeakTSHFromSandbox(detail::ApplyViewBase const& pv);
addWeakTSHFromBalanceChanges(detail::ApplyViewBase const& pv);

// hooks amendment fields, these are unpopulated and unused unless
// featureHooks is enabled
Expand Down
3 changes: 2 additions & 1 deletion src/ripple/protocol/Feature.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 = 84;
static constexpr std::size_t numFeatures = 85;

/** Amendments that this server supports and the default voting behavior.
Whether they are enabled depends on the Rules defined in the validated
Expand Down Expand Up @@ -372,6 +372,7 @@ extern uint256 const fixRewardClaimFlags;
extern uint256 const fixProvisionalDoubleThreading;
extern uint256 const featureClawback;
extern uint256 const featureDeepFreeze;
extern uint256 const featureIOUIssuerWeakTSH;

} // namespace ripple

Expand Down
1 change: 1 addition & 0 deletions src/ripple/protocol/impl/Feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ REGISTER_FIX (fixRewardClaimFlags, Supported::yes, VoteBehavior::De
REGISTER_FEATURE(Clawback, Supported::yes, VoteBehavior::DefaultNo);
REGISTER_FIX (fixProvisionalDoubleThreading, Supported::yes, VoteBehavior::DefaultYes);
REGISTER_FEATURE(DeepFreeze, Supported::yes, VoteBehavior::DefaultNo);
REGISTER_FEATURE(IOUIssuerWeakTSH, Supported::yes, VoteBehavior::DefaultNo);

// The following amendments are obsolete, but must remain supported
// because they could potentially get enabled.
Expand Down
Loading
Loading