mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-29 01:50:43 +00:00
fix build
This commit is contained in:
@@ -256,7 +256,7 @@ escrowUnlockApplyHelper<MPTIssue>(
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static uint32_t
|
||||
static int32_t
|
||||
calculateAdditionalReserve(T const& finishFunction)
|
||||
{
|
||||
if (!finishFunction)
|
||||
|
||||
@@ -1208,11 +1208,14 @@ Transactor::checkMultiSign(
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
static void
|
||||
removeUnfundedOffers(ApplyView& view, std::vector<uint256> const& offers, beast::Journal viewJ)
|
||||
removeUnfundedOffers(
|
||||
ApplyView& view,
|
||||
std::vector<std::pair<uint256, SLE::const_ref>> const& offers,
|
||||
beast::Journal viewJ)
|
||||
{
|
||||
int removed = 0;
|
||||
|
||||
for (auto const& index : offers)
|
||||
for (auto const& [index, _] : offers)
|
||||
{
|
||||
if (auto const sleOffer = view.peek(keylet::offer(index)))
|
||||
{
|
||||
@@ -1227,12 +1230,12 @@ removeUnfundedOffers(ApplyView& view, std::vector<uint256> const& offers, beast:
|
||||
static void
|
||||
removeExpiredNFTokenOffers(
|
||||
ApplyView& view,
|
||||
std::vector<uint256> const& offers,
|
||||
std::vector<std::pair<uint256, SLE::const_ref>> const& offers,
|
||||
beast::Journal viewJ)
|
||||
{
|
||||
std::size_t removed = 0;
|
||||
|
||||
for (auto const& index : offers)
|
||||
for (auto const& [index, _] : offers)
|
||||
{
|
||||
if (auto const offer = view.peek(keylet::nftokenOffer(index)))
|
||||
{
|
||||
@@ -1244,9 +1247,12 @@ removeExpiredNFTokenOffers(
|
||||
}
|
||||
|
||||
static void
|
||||
removeExpiredCredentials(ApplyView& view, std::vector<uint256> const& creds, beast::Journal viewJ)
|
||||
removeExpiredCredentials(
|
||||
ApplyView& view,
|
||||
std::vector<std::pair<uint256, SLE::const_ref>> const& creds,
|
||||
beast::Journal viewJ)
|
||||
{
|
||||
for (auto const& index : creds)
|
||||
for (auto const& [index, _] : creds)
|
||||
{
|
||||
if (auto const sle = view.peek(keylet::credential(index)))
|
||||
{
|
||||
@@ -1263,14 +1269,14 @@ removeExpiredCredentials(ApplyView& view, std::vector<uint256> const& creds, bea
|
||||
static void
|
||||
modifyWasmDataFields(
|
||||
ApplyView& view,
|
||||
std::vector<std::pair<uint256, Blob>> const& wasmObjects,
|
||||
std::vector<std::pair<uint256, SLE::const_ref>> const& wasmObjects,
|
||||
beast::Journal viewJ)
|
||||
{
|
||||
for (auto const& [index, data] : wasmObjects)
|
||||
for (auto const& [index, after] : wasmObjects)
|
||||
{
|
||||
if (auto const sle = view.peek(keylet::escrow(index)))
|
||||
{
|
||||
sle->setFieldVL(sfData, data);
|
||||
sle->setFieldVL(sfData, after->getFieldVL(sfData));
|
||||
view.update(sle);
|
||||
}
|
||||
}
|
||||
@@ -1279,7 +1285,7 @@ modifyWasmDataFields(
|
||||
static void
|
||||
removeDeletedTrustLines(
|
||||
ApplyView& view,
|
||||
std::vector<uint256> const& trustLines,
|
||||
std::vector<std::pair<uint256, SLE::const_ref>> const& trustLines,
|
||||
beast::Journal viewJ)
|
||||
{
|
||||
if (trustLines.size() > kMaxDeletableAmmTrustLines)
|
||||
@@ -1289,7 +1295,7 @@ removeDeletedTrustLines(
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto const& index : trustLines)
|
||||
for (auto const& [index, _] : trustLines)
|
||||
{
|
||||
if (auto const sleState = view.peek({ltRIPPLE_STATE, index});
|
||||
!isTesSuccess(deleteAMMTrustLine(view, sleState, std::nullopt, viewJ)))
|
||||
@@ -1478,7 +1484,7 @@ Transactor::processPersistentChanges(TER result, XRPAmount fee)
|
||||
// re-applied after the context is reset.
|
||||
auto const typesToCollect = typesForResult(result);
|
||||
|
||||
std::map<LedgerEntryType, std::vector<uint256>> deletedObjects;
|
||||
std::map<LedgerEntryType, std::vector<std::pair<uint256, SLE::const_ref>>> deletedObjects;
|
||||
if (!typesToCollect.empty())
|
||||
{
|
||||
ctx_.visit(
|
||||
@@ -1502,7 +1508,7 @@ Transactor::processPersistentChanges(TER result, XRPAmount fee)
|
||||
after->getFieldAmount(sfTakerPays))
|
||||
return;
|
||||
|
||||
deletedObjects[type].push_back(index);
|
||||
deletedObjects[type].push_back({index, after});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,8 +92,11 @@ EscrowCreate::checkExtraFeatures(PreflightContext const& ctx)
|
||||
// Only require featureMPTokensV1 when the escrow amount is an MPT and
|
||||
// fixCleanup3_2_0 is active; XRP/IOU escrows are unaffected by this gate.
|
||||
if (ctx.rules.enabled(fixCleanup3_2_0) && ctx.tx[sfAmount].holds<MPTIssue>())
|
||||
return ctx.rules.enabled(featureMPTokensV1);
|
||||
return true;
|
||||
if (!ctx.rules.enabled(featureMPTokensV1))
|
||||
return false;
|
||||
|
||||
return (!ctx.tx.isFieldPresent(sfBytecode) && !ctx.tx.isFieldPresent(sfData)) ||
|
||||
ctx.rules.enabled(featureSmartEscrow);
|
||||
}
|
||||
|
||||
template <ValidIssueType T>
|
||||
@@ -141,13 +144,6 @@ EscrowCreate::calculateBaseFee(ReadView const& view, STTx const& tx)
|
||||
return txnFees;
|
||||
}
|
||||
|
||||
bool
|
||||
EscrowCreate::checkExtraFeatures(PreflightContext const& ctx)
|
||||
{
|
||||
return (!ctx.tx.isFieldPresent(sfBytecode) && !ctx.tx.isFieldPresent(sfData)) ||
|
||||
ctx.rules.enabled(featureSmartEscrow);
|
||||
}
|
||||
|
||||
NotTEC
|
||||
EscrowCreate::preflight(PreflightContext const& ctx)
|
||||
{
|
||||
@@ -215,7 +211,7 @@ EscrowCreate::preflight(PreflightContext const& ctx)
|
||||
return temMALFORMED;
|
||||
}
|
||||
auto const data = ctx.tx.getFieldVL(sfData);
|
||||
if (data.size() > maxWasmDataLength)
|
||||
if (data.size() > kMaxWasmDataLength)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "EscrowCreate.Data bad size " << data.size();
|
||||
return temMALFORMED;
|
||||
@@ -225,14 +221,14 @@ EscrowCreate::preflight(PreflightContext const& ctx)
|
||||
if (ctx.tx.isFieldPresent(sfBytecode))
|
||||
{
|
||||
auto const fees(ctx.registry.get().getFees());
|
||||
if (fees.extensionSizeLimit == 0 || fees.extensionComputeLimit == 0)
|
||||
if (fees.bytecodeSizeLimit == 0 || fees.gasLimit == 0)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "WASM runtime deactivated by fee voting";
|
||||
return temTEMP_DISABLED;
|
||||
}
|
||||
|
||||
auto const code = ctx.tx.getFieldVL(sfBytecode);
|
||||
if (code.empty() || code.size() > fees.extensionSizeLimit)
|
||||
if (code.empty() || code.size() > fees.bytecodeSizeLimit)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "EscrowCreate.Bytecode bad size " << code.size();
|
||||
return temMALFORMED;
|
||||
|
||||
@@ -78,9 +78,8 @@ EscrowFinish::checkExtraFeatures(PreflightContext const& ctx)
|
||||
return false;
|
||||
|
||||
if (ctx.tx.isFieldPresent(sfGas) && !ctx.rules.enabled(featureSmartEscrow))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -101,7 +100,7 @@ EscrowFinish::preflight(PreflightContext const& ctx)
|
||||
if (auto const allowance = ctx.tx[~sfGas]; allowance)
|
||||
{
|
||||
auto const fees(ctx.registry.get().getFees());
|
||||
if (fees.extensionComputeLimit == 0)
|
||||
if (fees.bytecodeSizeLimit == 0)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "WASM runtime deactivated by fee voting";
|
||||
return temTEMP_DISABLED;
|
||||
@@ -110,7 +109,7 @@ EscrowFinish::preflight(PreflightContext const& ctx)
|
||||
{
|
||||
return temBAD_LIMIT;
|
||||
}
|
||||
if (*allowance > fees.extensionComputeLimit)
|
||||
if (*allowance > fees.bytecodeSizeLimit)
|
||||
{
|
||||
JLOG(ctx.j.debug()) << "Gas too large: " << *allowance;
|
||||
return temBAD_LIMIT;
|
||||
@@ -423,7 +422,7 @@ EscrowFinish::doApply()
|
||||
|
||||
if (auto const& data = ledgerDataProvider.getData(); data.has_value())
|
||||
{
|
||||
if (data->size() > maxWasmDataLength)
|
||||
if (data->size() > kMaxWasmDataLength)
|
||||
{
|
||||
// should already be checked in the updateData host function
|
||||
return tecINTERNAL; // LCOV_EXCL_LINE
|
||||
@@ -451,8 +450,8 @@ EscrowFinish::doApply()
|
||||
}
|
||||
else
|
||||
{
|
||||
JLOG(j_.debug()) << "WASM Failure: " + transHuman(re.error());
|
||||
return re.error();
|
||||
JLOG(j_.debug()) << "WASM Failure: " + transHuman(re.error().ter);
|
||||
return re.error().ter;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ struct EscrowSmart_test : public beast::unit_test::Suite
|
||||
Env env(
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg->FEES.extension_size_limit = 10; // 10 bytes
|
||||
cfg->fees.bytecodeSizeLimit = 10; // 10 bytes
|
||||
return cfg;
|
||||
}),
|
||||
features);
|
||||
@@ -125,7 +125,7 @@ struct EscrowSmart_test : public beast::unit_test::Suite
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
// WASM runtime disabled
|
||||
cfg->FEES.extension_compute_limit = 0;
|
||||
cfg->fees.gasLimit = 0;
|
||||
return cfg;
|
||||
}),
|
||||
features);
|
||||
@@ -149,7 +149,7 @@ struct EscrowSmart_test : public beast::unit_test::Suite
|
||||
Env env(
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg->FEES.extension_size_limit = 0; // WASM upload disabled
|
||||
cfg->fees.bytecodeSizeLimit = 0; // WASM upload disabled
|
||||
return cfg;
|
||||
}),
|
||||
features);
|
||||
@@ -202,8 +202,8 @@ struct EscrowSmart_test : public beast::unit_test::Suite
|
||||
|
||||
auto const escrowCreate = escrow::create(alice, carol, XRP(500));
|
||||
|
||||
// string of length maxWasmDataLength * 2 + 2
|
||||
std::string const longData((maxWasmDataLength + 1) * 2, 'B');
|
||||
// string of length kMaxWasmDataLength * 2 + 2
|
||||
std::string const longData((kMaxWasmDataLength + 1) * 2, 'B');
|
||||
env(escrowCreate,
|
||||
escrow::Data(longData),
|
||||
escrow::Bytecode(kLedgerSqnWasmHex),
|
||||
@@ -216,7 +216,7 @@ struct EscrowSmart_test : public beast::unit_test::Suite
|
||||
Env env(
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg->START_UP = StartUpType::Fresh;
|
||||
cfg->startUp = StartUpType::Fresh;
|
||||
return cfg;
|
||||
}),
|
||||
features);
|
||||
@@ -374,7 +374,7 @@ struct EscrowSmart_test : public beast::unit_test::Suite
|
||||
Env env(
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg->FEES.extension_compute_limit = 1'000; // in gas
|
||||
cfg->fees.gasLimit = 1'000; // in gas
|
||||
return cfg;
|
||||
}),
|
||||
features);
|
||||
@@ -397,7 +397,7 @@ struct EscrowSmart_test : public beast::unit_test::Suite
|
||||
using namespace test::jtx;
|
||||
using namespace std::chrono;
|
||||
Env env{*this, envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg->FEES.extension_compute_limit = 0;
|
||||
cfg->fees.gasLimit = 0;
|
||||
return cfg;
|
||||
})};
|
||||
|
||||
@@ -890,7 +890,7 @@ struct EscrowSmart_test : public beast::unit_test::Suite
|
||||
Env env(
|
||||
*this,
|
||||
envconfig([](std::unique_ptr<Config> cfg) {
|
||||
cfg->FEES.gas_price = 1'000'000; // in gas
|
||||
cfg->fees.gasPrice = 1'000'000; // in gas
|
||||
return cfg;
|
||||
}),
|
||||
features);
|
||||
@@ -1135,7 +1135,7 @@ struct EscrowSmart_test : public beast::unit_test::Suite
|
||||
return Env(
|
||||
*this,
|
||||
envconfig([&sizeLimit](std::unique_ptr<Config> cfg) {
|
||||
cfg->FEES.extension_size_limit = *sizeLimit;
|
||||
cfg->fees.bytecodeSizeLimit = *sizeLimit;
|
||||
return cfg;
|
||||
}),
|
||||
features);
|
||||
|
||||
@@ -21,7 +21,7 @@ setupConfigForUnitTests(Config& cfg)
|
||||
using namespace jtx;
|
||||
// Default fees to old values, so tests don't have to worry about changes in
|
||||
// Config.h
|
||||
// NOTE: For new `FEES` fields, you need to wait for the first flag ledger
|
||||
// NOTE: For new `fees` fields, you need to wait for the first flag ledger
|
||||
// to close for the values to be activated.
|
||||
cfg.fees.referenceFee = UNIT_TEST_REFERENCE_FEE;
|
||||
cfg.fees.accountReserve = XRP(200).value().xrp().drops();
|
||||
|
||||
@@ -75,8 +75,8 @@ class TestServiceRegistry : public ServiceRegistry
|
||||
defaultFees()
|
||||
{
|
||||
Fees fees{XRPAmount{10}, XRPAmount{10 * kDropsPerXrp}, XRPAmount{2 * kDropsPerXrp}};
|
||||
fees.extensionComputeLimit = 1'000'000;
|
||||
fees.extensionSizeLimit = 100'000;
|
||||
fees.gasLimit = 1'000'000;
|
||||
fees.bytecodeSizeLimit = 100'000;
|
||||
fees.gasPrice = 1'000'000;
|
||||
return fees;
|
||||
}
|
||||
|
||||
@@ -824,15 +824,15 @@ public:
|
||||
{
|
||||
XRPL_ASSERT(config_, "xrpl::ApplicationImp::getFees : non-null config");
|
||||
|
||||
auto const& f1(config_->FEES);
|
||||
auto const& f1(config_->fees);
|
||||
|
||||
Fees f2;
|
||||
f2.base = f1.reference_fee;
|
||||
f2.reserve = f1.account_reserve;
|
||||
f2.increment = f1.owner_reserve;
|
||||
f2.extensionComputeLimit = f1.extension_compute_limit;
|
||||
f2.extensionSizeLimit = f1.extension_size_limit;
|
||||
f2.gasPrice = f1.gas_price;
|
||||
f2.base = f1.referenceFee;
|
||||
f2.reserve = f1.accountReserve;
|
||||
f2.increment = f1.ownerReserve;
|
||||
f2.gasLimit = f1.gasLimit;
|
||||
f2.bytecodeSizeLimit = f1.bytecodeSizeLimit;
|
||||
f2.gasPrice = f1.gasPrice;
|
||||
|
||||
return f2;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user