Skip to content

Commit

Permalink
[fold] fix universal flag
Browse files Browse the repository at this point in the history
  • Loading branch information
dangell7 committed Jan 3, 2025
1 parent 187fffc commit 98b83e8
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 66 deletions.
43 changes: 21 additions & 22 deletions include/xrpl/protocol/TxFlags.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,8 @@ namespace ripple {
// clang-format off
// Universal Transaction flags:
constexpr std::uint32_t tfFullyCanonicalSig = 0x80000000;
constexpr std::uint32_t tfInnerBatchTxn = 0x40000000;
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig;
constexpr std::uint32_t tfUniversalV2 = tfFullyCanonicalSig | tfInnerBatchTxn;
constexpr std::uint32_t tfInnerBatchTxn = 0x40000000;
constexpr std::uint32_t tfUniversal = tfFullyCanonicalSig | tfInnerBatchTxn;
constexpr std::uint32_t tfUniversalMask = ~(tfFullyCanonicalSig | tfInnerBatchTxn);

// AccountSet flags:
Expand All @@ -71,7 +70,7 @@ constexpr std::uint32_t tfOptionalAuth = 0x00080000;
constexpr std::uint32_t tfDisallowXRP = 0x00100000;
constexpr std::uint32_t tfAllowXRP = 0x00200000;
constexpr std::uint32_t tfAccountSetMask =
~(tfUniversalV2 | tfRequireDestTag | tfOptionalDestTag | tfRequireAuth |
~(tfUniversal | tfRequireDestTag | tfOptionalDestTag | tfRequireAuth |
tfOptionalAuth | tfDisallowXRP | tfAllowXRP);

// AccountSet SetFlag/ClearFlag values
Expand Down Expand Up @@ -101,15 +100,15 @@ constexpr std::uint32_t tfFillOrKill = 0x00040000;
constexpr std::uint32_t tfSell = 0x00080000;

constexpr std::uint32_t tfOfferCreateMask =
~(tfUniversalV2 | tfPassive | tfImmediateOrCancel | tfFillOrKill | tfSell);
~(tfUniversal | tfPassive | tfImmediateOrCancel | tfFillOrKill | tfSell);

// Payment flags:
constexpr std::uint32_t tfNoRippleDirect = 0x00010000;
constexpr std::uint32_t tfPartialPayment = 0x00020000;
constexpr std::uint32_t tfLimitQuality = 0x00040000;
constexpr std::uint32_t tfPaymentMask =
~(tfUniversalV2 | tfPartialPayment | tfLimitQuality | tfNoRippleDirect);
constexpr std::uint32_t tfMPTPaymentMask = ~(tfUniversalV2 | tfPartialPayment);
~(tfUniversal | tfPartialPayment | tfLimitQuality | tfNoRippleDirect);
constexpr std::uint32_t tfMPTPaymentMask = ~(tfUniversal | tfPartialPayment);

// TrustSet flags:
constexpr std::uint32_t tfSetfAuth = 0x00010000;
Expand All @@ -118,7 +117,7 @@ constexpr std::uint32_t tfClearNoRipple = 0x00040000;
constexpr std::uint32_t tfSetFreeze = 0x00100000;
constexpr std::uint32_t tfClearFreeze = 0x00200000;
constexpr std::uint32_t tfTrustSetMask =
~(tfUniversalV2 | tfSetfAuth | tfSetNoRipple | tfClearNoRipple | tfSetFreeze |
~(tfUniversal | tfSetfAuth | tfSetNoRipple | tfClearNoRipple | tfSetFreeze |
tfClearFreeze);

// EnableAmendment flags:
Expand All @@ -128,7 +127,7 @@ constexpr std::uint32_t tfLostMajority = 0x00020000;
// PaymentChannelClaim flags:
constexpr std::uint32_t tfRenew = 0x00010000;
constexpr std::uint32_t tfClose = 0x00020000;
constexpr std::uint32_t tfPayChanClaimMask = ~(tfUniversalV2 | tfRenew | tfClose);
constexpr std::uint32_t tfPayChanClaimMask = ~(tfUniversal | tfRenew | tfClose);

// NFTokenMint flags:
constexpr std::uint32_t const tfBurnable = 0x00000001;
Expand All @@ -145,16 +144,16 @@ constexpr std::uint32_t const tfMPTCanTrade = lsfMPTCanTrade;
constexpr std::uint32_t const tfMPTCanTransfer = lsfMPTCanTransfer;
constexpr std::uint32_t const tfMPTCanClawback = lsfMPTCanClawback;
constexpr std::uint32_t const tfMPTokenIssuanceCreateMask =
~(tfUniversalV2 | tfMPTCanLock | tfMPTRequireAuth | tfMPTCanEscrow | tfMPTCanTrade | tfMPTCanTransfer | tfMPTCanClawback);
~(tfUniversal | tfMPTCanLock | tfMPTRequireAuth | tfMPTCanEscrow | tfMPTCanTrade | tfMPTCanTransfer | tfMPTCanClawback);

// MPTokenAuthorize flags:
constexpr std::uint32_t const tfMPTUnauthorize = 0x00000001;
constexpr std::uint32_t const tfMPTokenAuthorizeMask = ~(tfUniversalV2 | tfMPTUnauthorize);
constexpr std::uint32_t const tfMPTokenAuthorizeMask = ~(tfUniversal | tfMPTUnauthorize);

// MPTokenIssuanceSet flags:
constexpr std::uint32_t const tfMPTLock = 0x00000001;
constexpr std::uint32_t const tfMPTUnlock = 0x00000002;
constexpr std::uint32_t const tfMPTokenIssuanceSetMask = ~(tfUniversalV2 | tfMPTLock | tfMPTUnlock);
constexpr std::uint32_t const tfMPTokenIssuanceSetMask = ~(tfUniversal | tfMPTLock | tfMPTUnlock);

// MPTokenIssuanceDestroy flags:
constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
Expand All @@ -173,24 +172,24 @@ constexpr std::uint32_t const tfMPTokenIssuanceDestroyMask = ~tfUniversal;
// tfTrustLine flag as a way to prevent the attack. But until the
// amendment passes we still need to keep the old behavior available.
constexpr std::uint32_t const tfNFTokenMintOldMask =
~(tfUniversalV2 | tfBurnable | tfOnlyXRP | tfTrustLine | tfTransferable);
~(tfUniversal | tfBurnable | tfOnlyXRP | tfTrustLine | tfTransferable);

constexpr std::uint32_t const tfNFTokenMintMask =
~(tfUniversalV2 | tfBurnable | tfOnlyXRP | tfTransferable);
~(tfUniversal | tfBurnable | tfOnlyXRP | tfTransferable);

// NFTokenCreateOffer flags:
constexpr std::uint32_t const tfSellNFToken = 0x00000001;
constexpr std::uint32_t const tfNFTokenCreateOfferMask =
~(tfUniversalV2 | tfSellNFToken);
~(tfUniversal | tfSellNFToken);

// NFTokenCancelOffer flags:
constexpr std::uint32_t const tfNFTokenCancelOfferMask = ~tfUniversalV2;
constexpr std::uint32_t const tfNFTokenCancelOfferMask = ~tfUniversal;

// NFTokenAcceptOffer flags:
constexpr std::uint32_t const tfNFTokenAcceptOfferMask = ~tfUniversalV2;
constexpr std::uint32_t const tfNFTokenAcceptOfferMask = ~tfUniversal;

// Clawback flags:
constexpr std::uint32_t const tfClawbackMask = ~tfUniversalV2;
constexpr std::uint32_t const tfClawbackMask = ~tfUniversal;

// AMM Flags:
constexpr std::uint32_t tfLPToken = 0x00010000;
Expand All @@ -207,24 +206,24 @@ constexpr std::uint32_t tfWithdrawSubTx =
constexpr std::uint32_t tfDepositSubTx =
tfLPToken | tfSingleAsset | tfTwoAsset | tfOneAssetLPToken |
tfLimitLPToken | tfTwoAssetIfEmpty;
constexpr std::uint32_t tfWithdrawMask = ~(tfUniversalV2 | tfWithdrawSubTx);
constexpr std::uint32_t tfDepositMask = ~(tfUniversalV2 | tfDepositSubTx);
constexpr std::uint32_t tfWithdrawMask = ~(tfUniversal | tfWithdrawSubTx);
constexpr std::uint32_t tfDepositMask = ~(tfUniversal | tfDepositSubTx);

// AMMClawback flags:
constexpr std::uint32_t tfClawTwoAssets = 0x00000001;
constexpr std::uint32_t tfAMMClawbackMask = ~(tfUniversal | tfClawTwoAssets);

// BridgeModify flags:
constexpr std::uint32_t tfClearAccountCreateAmount = 0x00010000;
constexpr std::uint32_t tfBridgeModifyMask = ~(tfUniversalV2 | tfClearAccountCreateAmount);
constexpr std::uint32_t tfBridgeModifyMask = ~(tfUniversal | tfClearAccountCreateAmount);

// Batch Flags:
constexpr std::uint32_t tfAllOrNothing = 0x00010000;
constexpr std::uint32_t tfOnlyOne = 0x00020000;
constexpr std::uint32_t tfUntilFailure = 0x00040000;
constexpr std::uint32_t tfIndependent = 0x00080000;
constexpr std::uint32_t const tfBatchMask =
~(tfUniversalV2 | tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent);
~(tfUniversal | tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent);
constexpr std::uint32_t const tfBatchSubTx =
tfAllOrNothing | tfOnlyOne | tfUntilFailure | tfIndependent;

Expand Down
6 changes: 3 additions & 3 deletions src/test/app/AccountDelete_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ class AccountDelete_test : public beast::unit_test::suite
NetClock::time_point const& cancelAfter) {
Json::Value jv;
jv[jss::TransactionType] = jss::EscrowCreate;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[jss::Account] = account.human();
jv[jss::Destination] = to.human();
jv[jss::Amount] = amount.getJson(JsonOptions::none);
Expand Down Expand Up @@ -397,7 +397,7 @@ class AccountDelete_test : public beast::unit_test::suite
[](Account const& account, Account const& from, std::uint32_t seq) {
Json::Value jv;
jv[jss::TransactionType] = jss::EscrowCancel;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[jss::Account] = account.human();
jv[sfOwner.jsonName] = from.human();
jv[sfOfferSequence.jsonName] = seq;
Expand Down Expand Up @@ -535,7 +535,7 @@ class AccountDelete_test : public beast::unit_test::suite
auto payChanClaim = [&]() {
Json::Value jv;
jv[jss::TransactionType] = jss::PaymentChannelClaim;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[jss::Account] = alice.human();
jv[sfChannel.jsonName] = to_string(payChanKey.key);
jv[sfBalance.jsonName] =
Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/TestHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ create(A const& account, A const& dest, STAmount const& sendMax)
jv[sfSendMax.jsonName] = sendMax.getJson(JsonOptions::none);
jv[sfDestination.jsonName] = to_string(dest);
jv[sfTransactionType.jsonName] = jss::CheckCreate;
jv[sfFlags.jsonName] = tfUniversal;
jv[sfFlags.jsonName] = tfFullyCanonicalSig;
return jv;
}
// clang-format on
Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/impl/AMM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ pay(Account const& account, AccountID const& to, STAmount const& amount)
jv[jss::Amount] = amount.getJson(JsonOptions::none);
jv[jss::Destination] = to_string(to);
jv[jss::TransactionType] = jss::Payment;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
return jv;
}

Expand Down
12 changes: 6 additions & 6 deletions src/test/jtx/impl/TestHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ escrow(AccountID const& account, AccountID const& to, STAmount const& amount)
{
Json::Value jv;
jv[jss::TransactionType] = jss::EscrowCreate;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[jss::Account] = to_string(account);
jv[jss::Destination] = to_string(to);
jv[jss::Amount] = amount.getJson(JsonOptions::none);
Expand All @@ -234,7 +234,7 @@ finish(AccountID const& account, AccountID const& from, std::uint32_t seq)
{
Json::Value jv;
jv[jss::TransactionType] = jss::EscrowFinish;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[jss::Account] = to_string(account);
jv[sfOwner.jsonName] = to_string(from);
jv[sfOfferSequence.jsonName] = seq;
Expand All @@ -246,7 +246,7 @@ cancel(AccountID const& account, Account const& from, std::uint32_t seq)
{
Json::Value jv;
jv[jss::TransactionType] = jss::EscrowCancel;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[jss::Account] = to_string(account);
jv[sfOwner.jsonName] = from.human();
jv[sfOfferSequence.jsonName] = seq;
Expand All @@ -267,7 +267,7 @@ create(
{
Json::Value jv;
jv[jss::TransactionType] = jss::PaymentChannelCreate;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[jss::Account] = to_string(account);
jv[jss::Destination] = to_string(to);
jv[jss::Amount] = amount.getJson(JsonOptions::none);
Expand All @@ -289,7 +289,7 @@ fund(
{
Json::Value jv;
jv[jss::TransactionType] = jss::PaymentChannelFund;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[jss::Account] = to_string(account);
jv[sfChannel.fieldName] = to_string(channel);
jv[jss::Amount] = amount.getJson(JsonOptions::none);
Expand All @@ -309,7 +309,7 @@ claim(
{
Json::Value jv;
jv[jss::TransactionType] = jss::PaymentChannelClaim;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[jss::Account] = to_string(account);
jv["Channel"] = to_string(channel);
if (amount)
Expand Down
6 changes: 3 additions & 3 deletions src/test/jtx/impl/check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ cash(jtx::Account const& dest, uint256 const& checkId, STAmount const& amount)
jv[sfAmount.jsonName] = amount.getJson(JsonOptions::none);
jv[sfCheckID.jsonName] = to_string(checkId);
jv[sfTransactionType.jsonName] = jss::CheckCash;
jv[sfFlags.jsonName] = tfUniversal;
jv[sfFlags.jsonName] = tfFullyCanonicalSig;
return jv;
}

Expand All @@ -52,7 +52,7 @@ cash(
jv[sfDeliverMin.jsonName] = atLeast.value.getJson(JsonOptions::none);
jv[sfCheckID.jsonName] = to_string(checkId);
jv[sfTransactionType.jsonName] = jss::CheckCash;
jv[sfFlags.jsonName] = tfUniversal;
jv[sfFlags.jsonName] = tfFullyCanonicalSig;
return jv;
}

Expand All @@ -64,7 +64,7 @@ cancel(jtx::Account const& dest, uint256 const& checkId)
jv[sfAccount.jsonName] = dest.human();
jv[sfCheckID.jsonName] = to_string(checkId);
jv[sfTransactionType.jsonName] = jss::CheckCancel;
jv[sfFlags.jsonName] = tfUniversal;
jv[sfFlags.jsonName] = tfFullyCanonicalSig;
return jv;
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/jtx/impl/credentials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ create(
jv[jss::Account] = issuer.human();
jv[jss::Subject] = subject.human();

jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[sfCredentialType.jsonName] = strHex(credType);

return jv;
Expand All @@ -56,7 +56,7 @@ accept(
jv[jss::Account] = subject.human();
jv[jss::Issuer] = issuer.human();
jv[sfCredentialType.jsonName] = strHex(credType);
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;

return jv;
}
Expand All @@ -74,7 +74,7 @@ deleteCred(
jv[jss::Subject] = subject.human();
jv[jss::Issuer] = issuer.human();
jv[sfCredentialType.jsonName] = strHex(credType);
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
return jv;
}

Expand Down
6 changes: 3 additions & 3 deletions src/test/jtx/impl/did.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ set(jtx::Account const& account)
Json::Value jv;
jv[jss::TransactionType] = jss::DIDSet;
jv[jss::Account] = to_string(account.id());
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
return jv;
}

Expand All @@ -44,7 +44,7 @@ setValid(jtx::Account const& account)
Json::Value jv;
jv[jss::TransactionType] = jss::DIDSet;
jv[jss::Account] = to_string(account.id());
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
jv[sfURI.jsonName] = strHex(std::string{"uri"});
return jv;
}
Expand All @@ -55,7 +55,7 @@ del(jtx::Account const& account)
Json::Value jv;
jv[jss::TransactionType] = jss::DIDDelete;
jv[jss::Account] = to_string(account.id());
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
return jv;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/impl/ledgerStateFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ nftPageLinks(jtx::Account const& acct, jtx::Account const& owner)
jv[sfLedgerFixType.jsonName] = LedgerStateFix::nfTokenPageLink;
jv[sfOwner.jsonName] = owner.human();
jv[sfTransactionType.jsonName] = jss::LedgerStateFix;
jv[sfFlags.jsonName] = tfUniversal;
jv[sfFlags.jsonName] = tfFullyCanonicalSig;
return jv;
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/impl/pay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pay(AccountID const& account, AccountID const& to, AnyAmount amount)
jv[jss::Amount] = amount.value.getJson(JsonOptions::none);
jv[jss::Destination] = to_string(to);
jv[jss::TransactionType] = jss::Payment;
jv[jss::Flags] = tfUniversal;
jv[jss::Flags] = tfFullyCanonicalSig;
return jv;
}
Json::Value
Expand Down
2 changes: 1 addition & 1 deletion src/test/jtx/impl/txflags.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace jtx {
void
txflags::operator()(Env&, JTx& jt) const
{
jt[jss::Flags] = v_ /*| tfUniversal*/;
jt[jss::Flags] = v_ /*| tfFullyCanonicalSig*/;
}

} // namespace jtx
Expand Down
Loading

0 comments on commit 98b83e8

Please sign in to comment.