Skip to content

Commit

Permalink
Amendment: featureRemit (#278)
Browse files Browse the repository at this point in the history
* Remit Amendment

Co-authored-by: Denis Angell <dangell@transia.co>

Co-authored-by: Richard Holland <richard.holland@starstone.co.nz>
  • Loading branch information
dangell7 and RichardAH committed Mar 10, 2024
1 parent caa8b38 commit 75aba53
Show file tree
Hide file tree
Showing 27 changed files with 4,108 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Builds/CMake/RippledCore.cmake
Expand Up @@ -455,6 +455,7 @@ target_sources (rippled PRIVATE
src/ripple/app/tx/impl/GenesisMint.cpp
src/ripple/app/tx/impl/Import.cpp
src/ripple/app/tx/impl/Invoke.cpp
src/ripple/app/tx/impl/Remit.cpp
src/ripple/app/tx/impl/SetSignerList.cpp
src/ripple/app/tx/impl/SetTrust.cpp
src/ripple/app/tx/impl/SignerEntries.cpp
Expand Down Expand Up @@ -740,6 +741,7 @@ if (tests)
src/test/app/RCLCensorshipDetector_test.cpp
src/test/app/RCLValidations_test.cpp
src/test/app/Regression_test.cpp
src/test/app/Remit_test.cpp
src/test/app/SHAMapStore_test.cpp
src/test/app/SetAuth_test.cpp
src/test/app/SetRegularKey_test.cpp
Expand Down Expand Up @@ -889,6 +891,7 @@ if (tests)
src/test/jtx/impl/rate.cpp
src/test/jtx/impl/regkey.cpp
src/test/jtx/impl/reward.cpp
src/test/jtx/impl/remit.cpp
src/test/jtx/impl/sendmax.cpp
src/test/jtx/impl/seq.cpp
src/test/jtx/impl/sig.cpp
Expand Down
1 change: 1 addition & 0 deletions hook/tts.h
Expand Up @@ -31,6 +31,7 @@
#define ttURITOKEN_BUY 47
#define ttURITOKEN_CREATE_SELL_OFFER 48
#define ttURITOKEN_CANCEL_SELL_OFFER 49
#define ttREMIT 95
#define ttGENESIS_MINT 96
#define ttIMPORT 97
#define ttCLAIM_REWARD 98
Expand Down
39 changes: 39 additions & 0 deletions src/ripple/app/hook/impl/applyHook.cpp
Expand Up @@ -70,6 +70,45 @@ getTransactionalStakeHolders(STTx const& tx, ReadView const& rv)

switch (tt)
{
case ttREMIT: {
if (destAcc)
ADD_TSH(*destAcc, tshSTRONG);

if (tx.isFieldPresent(sfInform))
{
auto const inform = tx.getAccountID(sfInform);
if (*otxnAcc != inform && *destAcc != inform)
ADD_TSH(inform, tshWEAK);
}

if (tx.isFieldPresent(sfURITokenIDs))
{
STVector256 tokenIds = tx.getFieldV256(sfURITokenIDs);
for (uint256 const klRaw : tokenIds)
{
Keylet const id{ltURI_TOKEN, klRaw};
if (!rv.exists(id))
continue;

auto const ut = rv.read(id);
if (!ut ||
ut->getFieldU16(sfLedgerEntryType) != ltURI_TOKEN)
continue;

auto const owner = ut->getAccountID(sfOwner);
auto const issuer = ut->getAccountID(sfIssuer);
if (issuer != owner && issuer != *destAcc)
{
ADD_TSH(
issuer,
(ut->getFlags() & lsfBurnable) ? tshSTRONG
: tshWEAK);
}
}
}
break;
}

case ttIMPORT: {
if (tx.isFieldPresent(sfIssuer))
ADD_TSH(tx.getAccountID(sfIssuer), fixV2 ? tshWEAK : tshSTRONG);
Expand Down
3 changes: 2 additions & 1 deletion src/ripple/app/tx/impl/InvariantCheck.cpp
Expand Up @@ -597,7 +597,8 @@ ValidNewAccountRoot::finalize(
return false;
}

if ((tt == ttPAYMENT || tt == ttIMPORT || tt == ttGENESIS_MINT) &&
if ((tt == ttPAYMENT || tt == ttIMPORT || tt == ttGENESIS_MINT ||
tt == ttREMIT) &&
result == tesSUCCESS)
{
std::uint32_t const startingSeq{
Expand Down

0 comments on commit 75aba53

Please sign in to comment.