Skip to content

Commit

Permalink
remove unneeded fields
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnxie999 committed Oct 3, 2024
1 parent 86bcebd commit b0691c2
Show file tree
Hide file tree
Showing 11 changed files with 10 additions and 20 deletions.
2 changes: 0 additions & 2 deletions include/xrpl/protocol/SField.h
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,6 @@ extern SF_UINT64 const sfXChainAccountClaimCount;
extern SF_UINT64 const sfAssetPrice;
extern SF_UINT64 const sfMaximumAmount;
extern SF_UINT64 const sfOutstandingAmount;
extern SF_UINT64 const sfLockedAmount;
extern SF_UINT64 const sfMPTAmount;

// 128-bit
Expand Down Expand Up @@ -661,7 +660,6 @@ extern SField const sfXChainClaimProofSig;
extern SField const sfXChainCreateAccountProofSig;
extern SField const sfXChainClaimAttestationCollectionElement;
extern SField const sfXChainCreateAccountAttestationCollectionElement;
extern SField const MPToken;

// array of objects (common)
// ARRAY/1 is reserved for end of array
Expand Down
5 changes: 3 additions & 2 deletions include/xrpl/protocol/TER.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ enum TEMcodes : TERUnderlyingType {

temSEQ_AND_TICKET,
temBAD_NFTOKEN_TRANSFER_FEE,
temBAD_MPTOKEN_TRANSFER_FEE,

temBAD_AMM_TOKENS,

Expand All @@ -139,7 +138,9 @@ enum TEMcodes : TERUnderlyingType {
temEMPTY_DID,

temARRAY_EMPTY,
temARRAY_TOO_LARGE
temARRAY_TOO_LARGE,

temBAD_TRANSFER_FEE
};

//------------------------------------------------------------------------------
Expand Down
1 change: 0 additions & 1 deletion include/xrpl/protocol/jss.h
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ JSS(load_fee); // out: LoadFeeTrackImp, NetworkOPs
JSS(local); // out: resource/Logic.h
JSS(local_txs); // out: GetCounts
JSS(local_static_keys); // out: ValidatorList
JSS(locked_amount); // out: MPTHolders
JSS(low); // out: BookChanges
JSS(lowest_sequence); // out: AccountInfo
JSS(lowest_ticket); // out: AccountInfo
Expand Down
2 changes: 0 additions & 2 deletions src/libxrpl/protocol/LedgerFormats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,6 @@ LedgerFormats::LedgerFormats()
{sfAssetScale, soeDEFAULT},
{sfMaximumAmount, soeOPTIONAL},
{sfOutstandingAmount, soeREQUIRED},
{sfLockedAmount, soeDEFAULT},
{sfMPTokenMetadata, soeOPTIONAL},
{sfPreviousTxnID, soeREQUIRED},
{sfPreviousTxnLgrSeq, soeREQUIRED}
Expand All @@ -388,7 +387,6 @@ LedgerFormats::LedgerFormats()
{sfAccount, soeREQUIRED},
{sfMPTokenIssuanceID, soeREQUIRED},
{sfMPTAmount, soeDEFAULT},
{sfLockedAmount, soeDEFAULT},
{sfOwnerNode, soeREQUIRED},
{sfPreviousTxnID, soeREQUIRED},
{sfPreviousTxnLgrSeq, soeREQUIRED}
Expand Down
3 changes: 1 addition & 2 deletions src/libxrpl/protocol/SField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ CONSTRUCT_TYPED_SFIELD(sfXChainAccountClaimCount, "XChainAccountClaimCount", U
CONSTRUCT_TYPED_SFIELD(sfAssetPrice, "AssetPrice", UINT64, 23);
CONSTRUCT_TYPED_SFIELD(sfMaximumAmount, "MaximumAmount", UINT64, 24);
CONSTRUCT_TYPED_SFIELD(sfOutstandingAmount, "OutstandingAmount", UINT64, 25);
CONSTRUCT_TYPED_SFIELD(sfLockedAmount, "LockedAmount", UINT64, 26);
CONSTRUCT_TYPED_SFIELD(sfMPTAmount, "MPTAmount", UINT64, 27);
CONSTRUCT_TYPED_SFIELD(sfMPTAmount, "MPTAmount", UINT64, 26);

// 128-bit
CONSTRUCT_TYPED_SFIELD(sfEmailHash, "EmailHash", UINT128, 1);
Expand Down
3 changes: 1 addition & 2 deletions src/libxrpl/protocol/STInteger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,7 @@ Json::Value STUInt64::getJson(JsonOptions) const
};

if (auto const& fName = getFName(); fName == sfMaximumAmount ||
fName == sfOutstandingAmount || fName == sfLockedAmount ||
fName == sfMPTAmount)
fName == sfOutstandingAmount || fName == sfMPTAmount)
{
return convertToString(value_, 10); // Convert to base 10
}
Expand Down
3 changes: 1 addition & 2 deletions src/libxrpl/protocol/STParsedJSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,7 @@ parseLeaf(
std::uint64_t val;

bool const useBase10 = field == sfMaximumAmount ||
field == sfOutstandingAmount ||
field == sfLockedAmount || field == sfMPTAmount;
field == sfOutstandingAmount || field == sfMPTAmount;

// if the field is amount, serialize as base 10
auto [p, ec] = std::from_chars(
Expand Down
2 changes: 1 addition & 1 deletion src/libxrpl/protocol/TER.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,6 @@ transResults()
MAKE_ERROR(temINVALID_COUNT, "Malformed: Count field outside valid range."),
MAKE_ERROR(temSEQ_AND_TICKET, "Transaction contains a TicketSequence and a non-zero Sequence."),
MAKE_ERROR(temBAD_NFTOKEN_TRANSFER_FEE, "Malformed: The NFToken transfer fee must be between 1 and 5000, inclusive."),
MAKE_ERROR(temBAD_MPTOKEN_TRANSFER_FEE, "Malformed: The MPToken transfer fee must be between 1 and 5000, inclusive."),
MAKE_ERROR(temXCHAIN_EQUAL_DOOR_ACCOUNTS, "Malformed: Bridge must have unique door accounts."),
MAKE_ERROR(temXCHAIN_BAD_PROOF, "Malformed: Bad cross-chain claim proof."),
MAKE_ERROR(temXCHAIN_BRIDGE_BAD_ISSUES, "Malformed: Bad bridge issues."),
Expand All @@ -211,6 +210,7 @@ transResults()
MAKE_ERROR(temXCHAIN_BRIDGE_BAD_REWARD_AMOUNT, "Malformed: Bad reward amount."),
MAKE_ERROR(temARRAY_EMPTY, "Malformed: Array is empty."),
MAKE_ERROR(temARRAY_TOO_LARGE, "Malformed: Array is too large."),
MAKE_ERROR(temBAD_TRANSFER_FEE, "Malformed: Transfer fee is outside valid range."),

MAKE_ERROR(terRETRY, "Retry transaction."),
MAKE_ERROR(terFUNDS_SPENT, "DEPRECATED."),
Expand Down
2 changes: 1 addition & 1 deletion src/test/app/MPToken_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MPToken_test : public beast::unit_test::suite
.transferFee = maxTransferFee + 1,
.metadata = "test",
.flags = tfMPTCanTransfer,
.err = temBAD_MPTOKEN_TRANSFER_FEE});
.err = temBAD_TRANSFER_FEE});

// tries to set a txfee while not enabling transfer
mptAlice.create(
Expand Down
2 changes: 1 addition & 1 deletion src/xrpld/app/tx/detail/MPTokenIssuanceCreate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ MPTokenIssuanceCreate::preflight(PreflightContext const& ctx)
if (auto const fee = ctx.tx[~sfTransferFee])
{
if (fee > maxTransferFee)
return temBAD_MPTOKEN_TRANSFER_FEE;
return temBAD_TRANSFER_FEE;

// If a non-zero TransferFee is set then the tfTransferable flag
// must also be set.
Expand Down
5 changes: 1 addition & 4 deletions src/xrpld/ledger/detail/View.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,7 @@ accountHolds(
amount.clear(mptIssue);
else
{
auto const amt = sleMpt->getFieldU64(sfMPTAmount);
auto const locked = sleMpt->getFieldU64(sfLockedAmount);
if (amt > locked)
amount = STAmount{mptIssue, amt - locked};
amount = STAmount{mptIssue, sleMpt->getFieldU64(sfMPTAmount)};

// only if auth check is needed, as it needs to do an additional read
// operation
Expand Down

0 comments on commit b0691c2

Please sign in to comment.