Compare commits

..

1 Commits

Author SHA1 Message Date
Niq Dudfield
8b0be2d2f5 docs(freeze): canceling escrows with deep frozen assets is allowed 2025-07-09 10:26:24 +07:00
8 changed files with 40 additions and 853 deletions

View File

@@ -342,7 +342,8 @@ getTransactionalStakeHolders(STTx const& tx, ReadView const& rv)
case ttOFFER_CANCEL: case ttOFFER_CANCEL:
case ttTICKET_CREATE: case ttTICKET_CREATE:
case ttHOOK_SET: case ttHOOK_SET:
case ttOFFER_CREATE: { case ttOFFER_CREATE: // this is handled seperately
{
break; break;
} }

View File

@@ -1277,8 +1277,7 @@ CreateOffer::doApply()
if (result.second) if (result.second)
{ {
sb.apply(ctx_.rawView()); sb.apply(ctx_.rawView());
if (!view().rules().enabled(featureIOUIssuerWeakTSH)) addWeakTSHFromSandbox(sb);
addWeakTSHFromBalanceChanges(sb);
} }
else else
sbCancel.apply(ctx_.rawView()); sbCancel.apply(ctx_.rawView());

View File

@@ -425,8 +425,7 @@ Payment::doApply()
// on the TER. But always applying *should* // on the TER. But always applying *should*
// be safe. // be safe.
pv.apply(ctx_.rawView()); pv.apply(ctx_.rawView());
if (!view().rules().enabled(featureIOUIssuerWeakTSH)) addWeakTSHFromSandbox(pv);
addWeakTSHFromBalanceChanges(pv);
} }
// TODO: is this right? If the amount is the correct amount, was // TODO: is this right? If the amount is the correct amount, was

View File

@@ -1477,15 +1477,15 @@ Transactor::doHookCallback(
} }
void void
Transactor::addWeakTSHFromBalanceChanges(detail::ApplyViewBase const& pv) Transactor::addWeakTSHFromSandbox(detail::ApplyViewBase const& pv)
{ {
// If Hooks are enabled then non-issuers who have their TL balance // If Hooks are enabled then non-issuers who have their TL balance
// modified by the execution of the transaction have the opportunity to have // modified by the execution of the path have the opportunity to have their
// their weak hooks executed. // weak hooks executed.
if (ctx_.view().rules().enabled(featureHooks)) if (ctx_.view().rules().enabled(featureHooks))
{ {
// anyone whose balance changed as a result of transaction processing is // anyone whose balance changed as a result of this Pathing is a weak
// a weak TSH // TSH
auto bc = pv.balanceChanges(view()); auto bc = pv.balanceChanges(view());
for (auto const& entry : bc) for (auto const& entry : bc)
@@ -1506,13 +1506,15 @@ Transactor::addWeakTSHFromBalanceChanges(detail::ApplyViewBase const& pv)
TER TER
Transactor::doTSH( Transactor::doTSH(
bool strong, // only strong iff true, only weak iff false bool strong, // only strong iff true, only weak iff false
std::vector<std::pair<AccountID, bool>> tsh,
hook::HookStateMap& stateMap, hook::HookStateMap& stateMap,
std::vector<hook::HookResult>& results, std::vector<hook::HookResult>& results,
std::shared_ptr<STObject const> const& provisionalMeta) std::shared_ptr<STObject const> const& provisionalMeta)
{ {
auto& view = ctx_.view(); 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) // add the extra TSH marked out by the specific transactor (if applicable)
if (!strong) if (!strong)
for (auto& weakTsh : additionalWeakTSH_) for (auto& weakTsh : additionalWeakTSH_)
@@ -1770,9 +1772,6 @@ Transactor::operator()()
// application to the ledger // application to the ledger
std::map<AccountID, std::set<uint256>> aawMap; 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 // Pre-application (Strong TSH) Hooks are executed here
// These TSH have the right to rollback. // These TSH have the right to rollback.
// Weak TSH and callback are executed post-application. // Weak TSH and callback are executed post-application.
@@ -1801,7 +1800,7 @@ Transactor::operator()()
// (who have the right to rollback the txn), any weak TSH will be // (who have the right to rollback the txn), any weak TSH will be
// executed after doApply has been successful (callback as well) // executed after doApply has been successful (callback as well)
result = doTSH(true, tsh, stateMap, hookResults, {}); result = doTSH(true, stateMap, hookResults, {});
} }
// write state if all chains executed successfully // write state if all chains executed successfully
@@ -2055,23 +2054,7 @@ Transactor::operator()()
hook::HookStateMap stateMap; hook::HookStateMap stateMap;
std::vector<hook::HookResult> weakResults; std::vector<hook::HookResult> weakResults;
if (view().rules().enabled(featureIOUIssuerWeakTSH)) doTSH(false, stateMap, weakResults, proMeta);
{
// 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))
{
// 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' // execute any hooks that nominated for 'again as weak'
for (auto const& [accID, hookHashes] : aawMap) for (auto const& [accID, hookHashes] : aawMap)

View File

@@ -188,7 +188,6 @@ protected:
TER TER
doTSH( doTSH(
bool strong, // only do strong TSH iff true, otheriwse only weak bool strong, // only do strong TSH iff true, otheriwse only weak
std::vector<std::pair<AccountID, bool>> tsh,
hook::HookStateMap& stateMap, hook::HookStateMap& stateMap,
std::vector<hook::HookResult>& result, std::vector<hook::HookResult>& result,
std::shared_ptr<STObject const> const& provisionalMeta); std::shared_ptr<STObject const> const& provisionalMeta);
@@ -214,7 +213,7 @@ protected:
std::shared_ptr<STObject const> const& provisionalMeta); std::shared_ptr<STObject const> const& provisionalMeta);
void void
addWeakTSHFromBalanceChanges(detail::ApplyViewBase const& pv); addWeakTSHFromSandbox(detail::ApplyViewBase const& pv);
// hooks amendment fields, these are unpopulated and unused unless // hooks amendment fields, these are unpopulated and unused unless
// featureHooks is enabled // featureHooks is enabled

View File

@@ -74,7 +74,7 @@ namespace detail {
// Feature.cpp. Because it's only used to reserve storage, and determine how // 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 // 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. // the actual number of amendments. A LogicError on startup will verify this.
static constexpr std::size_t numFeatures = 85; static constexpr std::size_t numFeatures = 84;
/** Amendments that this server supports and the default voting behavior. /** Amendments that this server supports and the default voting behavior.
Whether they are enabled depends on the Rules defined in the validated Whether they are enabled depends on the Rules defined in the validated
@@ -372,7 +372,6 @@ extern uint256 const fixRewardClaimFlags;
extern uint256 const fixProvisionalDoubleThreading; extern uint256 const fixProvisionalDoubleThreading;
extern uint256 const featureClawback; extern uint256 const featureClawback;
extern uint256 const featureDeepFreeze; extern uint256 const featureDeepFreeze;
extern uint256 const featureIOUIssuerWeakTSH;
} // namespace ripple } // namespace ripple

View File

@@ -478,7 +478,6 @@ REGISTER_FIX (fixRewardClaimFlags, Supported::yes, VoteBehavior::De
REGISTER_FEATURE(Clawback, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FEATURE(Clawback, Supported::yes, VoteBehavior::DefaultNo);
REGISTER_FIX (fixProvisionalDoubleThreading, Supported::yes, VoteBehavior::DefaultYes); REGISTER_FIX (fixProvisionalDoubleThreading, Supported::yes, VoteBehavior::DefaultYes);
REGISTER_FEATURE(DeepFreeze, Supported::yes, VoteBehavior::DefaultNo); REGISTER_FEATURE(DeepFreeze, Supported::yes, VoteBehavior::DefaultNo);
REGISTER_FEATURE(IOUIssuerWeakTSH, Supported::yes, VoteBehavior::DefaultNo);
// The following amendments are obsolete, but must remain supported // The following amendments are obsolete, but must remain supported
// because they could potentially get enabled. // because they could potentially get enabled.

File diff suppressed because it is too large Load Diff