Compare commits

..

5 Commits

Author SHA1 Message Date
Richard Holland
f4ff7bd4de Merge branch 'dev' into fixImportIssuer 2026-04-29 10:43:25 +10:00
tequ
b79fde27f1 Merge branch 'dev' into fixImportIssuer 2026-04-29 08:53:20 +09:00
tequ
46fb152b12 Merge branch 'dev' into fixImportIssuer 2026-04-28 20:52:54 +09:00
tequ
ce0ae8294e Merge branch 'dev' into fixImportIssuer 2026-04-24 14:09:48 +09:00
tequ
9f33cad6db Disallow setting a AMM account as Issuer/Destination/Inform 2026-03-10 15:35:18 +09:00
16 changed files with 20 additions and 91 deletions

View File

@@ -464,16 +464,3 @@ jobs:
verbose: true
plugins: noop
use_oidc: true
- name: Export server definitions
if: matrix.job_type == 'build' && matrix.compiler_id == 'gcc-13-libstdcxx'
run: |
${{ env.build_dir }}/rippled --definitions | python3 -m json.tool > server_definitions.json
- name: Upload server definitions
if: matrix.job_type == 'build' && matrix.compiler_id == 'gcc-13-libstdcxx'
uses: actions/upload-artifact@v7
with:
name: server-definitions
path: server_definitions.json
archive: false

View File

@@ -31,8 +31,6 @@
namespace ripple {
#define LEDGER_NAMESPACE2(value1, value2) (uint16_t(value1) << 8) | value2
/** Type-specific prefix for calculating ledger indices.
The identifier for a given object within the ledger is calculated based
@@ -82,14 +80,14 @@ enum class LedgerNameSpace : std::uint16_t {
UNL_REPORT = 'R',
CRON = 'L',
AMM = 'A',
BRIDGE = LEDGER_NAMESPACE2(0x01, 'H'),
BRIDGE = 'H',
XCHAIN_CLAIM_ID = 'Q',
XCHAIN_CREATE_ACCOUNT_CLAIM_ID = 'K',
DID = LEDGER_NAMESPACE2(0x01, 'I'),
ORACLE = LEDGER_NAMESPACE2(0x01, 'R'),
DID = 'I',
ORACLE = 'R',
MPTOKEN_ISSUANCE = '~',
MPTOKEN = 't',
CREDENTIAL = LEDGER_NAMESPACE2(0x01, 'D'),
CREDENTIAL = 'D',
PERMISSIONED_DOMAIN = 'm',
// No longer used or supported. Left here to reserve the space

View File

@@ -2891,39 +2891,6 @@ struct Remit_test : public beast::unit_test::suite
}
}
void
testDestAMM(FeatureBitset features)
{
testcase("remit to AMM Account");
using namespace test::jtx;
using namespace std::literals;
auto const alice = Account("alice");
auto const gw = Account("gw");
auto const USD = gw["USD"];
Env env{*this, features};
env.fund(XRP(10'000'000), alice, gw);
env.close();
env.trust(USD(100'000), alice);
env.close();
env(pay(gw, alice, USD(100'000)));
env.close();
AMM ammAlice(env, alice, XRP(10'000), USD(10'000));
env(remit::remit(alice, ammAlice.ammAccount()),
remit::amts({USD(10'000)}),
ter(tecNO_PERMISSION));
env(remit::remit(alice, ammAlice.ammAccount()),
remit::amts({XRP(10'000)}),
ter(tecNO_PERMISSION));
env(remit::remit(gw, ammAlice.ammAccount()),
remit::amts({gw["EUR"](10'000)}),
ter(tecNO_PERMISSION));
}
void
testWithFeats(FeatureBitset features)
{
@@ -2945,7 +2912,6 @@ struct Remit_test : public beast::unit_test::suite
testRippling(features);
testURIToken(features);
testOptionals(features);
testDestAMM(features);
}
public:

View File

@@ -63,7 +63,7 @@ countTx(std::shared_ptr<SHAMap> const& txSet)
auto tx = std::make_shared<STTx
const>(SerialIter{sit.getSlice(sit.getVLDataLength())});
if (tx->getTxnType() == ttUNL_MODIFY)
if (tx->getFieldU16(sfTransactionType) == ttUNL_MODIFY)
counter++;
}
*/

View File

@@ -2655,7 +2655,7 @@ HookAPI::meta_slot(uint32_t slot_into) const
Expected<std::pair<uint32_t, uint32_t>, HookReturnCode>
HookAPI::xpop_slot(uint32_t slot_into_tx, uint32_t slot_into_meta) const
{
if (hookCtx.applyCtx.tx.getTxnType() != ttIMPORT)
if (hookCtx.applyCtx.tx.getFieldU16(sfTransactionType) != ttIMPORT)
return Unexpected(PREREQUISITE_NOT_MET);
if (slot_into_tx > hook_api::max_slots ||

View File

@@ -41,7 +41,7 @@ getTransactionalStakeHolders(STTx const& tx, ReadView const& rv)
if (!otxnAcc)
return {};
TxType const& tt = tx.getTxnType();
uint16_t tt = tx.getFieldU16(sfTransactionType);
std::map<AccountID, std::pair<int, bool>> tshEntries;

View File

@@ -24,7 +24,6 @@
#include <xrpld/core/TimeKeeper.h>
#include <xrpld/net/RPCCall.h>
#include <xrpld/rpc/RPCHandler.h>
#include <xrpld/rpc/handlers/Handlers.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/StringUtilities.h>
#include <xrpl/basics/contract.h>
@@ -388,8 +387,7 @@ run(int argc, char** argv)
po::value<std::string>(),
"Specify the range of present ledgers for testing purposes. Min and "
"max values are comma separated.")(
"version", "Display the build version.")(
"definitions", "Output server definitions as JSON and exit.");
"version", "Display the build version.");
po::options_description data("Ledger/Data Options");
data.add_options()("import", importText.c_str())(
@@ -531,13 +529,6 @@ run(int argc, char** argv)
return 0;
}
if (vm.count("definitions"))
{
auto defs = getStaticServerDefinitions();
std::cout << Json::FastWriter().write(defs);
return 0;
}
#ifndef ENABLE_TESTS
if (vm.count("unittest") || vm.count("unittest-child"))
{

View File

@@ -1132,7 +1132,7 @@ Import::doRegularKey(std::shared_ptr<SLE>& sle, STTx const& stpTrans)
JLOG(ctx_.journal.trace()) << "Import: doRegularKey acc: " << id;
if (stpTrans.getTxnType() != ttREGULAR_KEY_SET)
if (stpTrans.getFieldU16(sfTransactionType) != ttREGULAR_KEY_SET)
{
JLOG(ctx_.journal.warn())
<< "Import: doRegularKey called on non-regular key transaction.";

View File

@@ -402,7 +402,7 @@ NoZeroEscrow::finalize(
if (bad_ && rv.rules().enabled(featurePaychanAndEscrowForTokens) &&
txn.isFieldPresent(sfTransactionType))
{
TxType const& tt = txn.getTxnType();
uint16_t const tt = txn.getFieldU16(sfTransactionType);
if (tt == ttESCROW_CANCEL || tt == ttESCROW_FINISH)
return true;

View File

@@ -573,7 +573,7 @@ Payment::doApply()
return tecUNFUNDED_PAYMENT;
}
// AMMs can never receive an XAH payment.
// AMMs can never receive an XRP payment.
// Must use AMMDeposit transaction instead.
if (sleDst->isFieldPresent(sfAMMID))
return tecNO_PERMISSION;

View File

@@ -295,11 +295,6 @@ Remit::doApply()
(flags & lsfDisallowIncomingRemit))
return tecNO_PERMISSION;
// AMMs can never receive an XAH payment.
// Must use AMMDeposit transaction instead.
if (sleDstAcc && sleDstAcc->isFieldPresent(sfAMMID))
return tecNO_PERMISSION;
// Check if the destination account requires deposit authorization.
bool const depositAuth{sb.rules().enabled(featureDepositAuth)};
if (depositAuth && sleDstAcc && (flags & lsfDepositAuth))

View File

@@ -308,7 +308,7 @@ Transactor::calculateBaseFee(ReadView const& view, STTx const& tx)
// * The additional cost of each multisignature on the transaction.
XRPAmount baseFee = view.fees().base;
if (tx.getTxnType() == ttIMPORT)
if (tx.getFieldU16(sfTransactionType) == ttIMPORT)
{
XRPAmount const importFee = baseFee * 10;
if (importFee > baseFee)
@@ -325,7 +325,7 @@ Transactor::calculateBaseFee(ReadView const& view, STTx const& tx)
if (view.rules().enabled(featureHooks))
{
// if this is a "cleanup" txn we regard it as already paid up
if (tx.getTxnType() == ttEMIT_FAILURE)
if (tx.getFieldU16(sfTransactionType) == ttEMIT_FAILURE)
return XRPAmount{0};
// if the txn is an emitted txn then we add the callback fee
@@ -1536,7 +1536,10 @@ Transactor::doHookCallback(
true,
true,
false,
ctx_.tx.getTxnType() == ttEMIT_FAILURE ? 1UL : 0UL,
safe_cast<TxType>(ctx_.tx.getFieldU16(sfTransactionType)) ==
ttEMIT_FAILURE
? 1UL
: 0UL,
hook_no - 1,
provisionalMeta);

View File

@@ -180,7 +180,7 @@ URIToken::preclaim(PreclaimContext const& ctx)
}
AccountID const acc = ctx.tx.getAccountID(sfAccount);
TxType const& tt = ctx.tx.getTxnType();
uint16_t tt = ctx.tx.getFieldU16(sfTransactionType);
auto const sle =
ctx.view.read(keylet::account(ctx.tx.getAccountID(sfAccount)));
@@ -349,7 +349,7 @@ URIToken::doApply()
if (!sle)
return tefINTERNAL;
TxType const& tt = ctx_.tx.getTxnType();
uint16_t tt = ctx_.tx.getFieldU16(sfTransactionType);
if (tt == ttURITOKEN_MINT || tt == ttURITOKEN_BUY)
{

View File

@@ -65,7 +65,7 @@ computeBookChanges(std::shared_ptr<L const> const& lpAccepted)
continue;
std::optional<uint32_t> offerCancel;
TxType const& tt = tx.first->getTxnType();
uint16_t tt = tx.first->getFieldU16(sfTransactionType);
switch (tt)
{
case ttOFFER_CANCEL:

View File

@@ -129,8 +129,6 @@ doRipplePathFind(RPC::JsonContext&);
Json::Value
doServerDefinitions(RPC::JsonContext&);
Json::Value
getStaticServerDefinitions();
Json::Value
doServerInfo(RPC::JsonContext&); // for humans
Json::Value
doServerState(RPC::JsonContext&); // for machines

View File

@@ -523,15 +523,6 @@ public:
}
};
Json::Value
getStaticServerDefinitions()
{
static const Definitions defs{};
Json::Value ret = defs();
ret[jss::hash] = to_string(defs.getHash());
return ret;
}
Json::Value
doServerDefinitions(RPC::JsonContext& context)
{