Compare commits

..

6 Commits

Author SHA1 Message Date
Denis Angell
b5581bafc9 Update Memory_test.cpp 2024-10-08 00:30:50 +02:00
Denis Angell
b128c75c0c Update Memory_test.cpp 2024-10-07 23:32:39 +02:00
Denis Angell
04fb4b20f1 Update Memory_test.cpp 2024-10-07 23:13:25 +02:00
Denis Angell
8acf291a76 Update json_value.cpp 2024-10-07 22:10:37 +02:00
Denis Angell
e40d644113 Update Door.h 2024-10-07 21:39:34 +02:00
Denis Angell
08b3a199a4 misc 2024-10-07 19:54:20 +02:00
31 changed files with 141 additions and 84 deletions

View File

@@ -433,17 +433,13 @@ target_sources (rippled PRIVATE
src/ripple/app/tx/impl/CancelOffer.cpp
src/ripple/app/tx/impl/CashCheck.cpp
src/ripple/app/tx/impl/Change.cpp
src/ripple/app/tx/impl/ClaimReward.cpp
src/ripple/app/tx/impl/CreateCheck.cpp
src/ripple/app/tx/impl/CreateOffer.cpp
src/ripple/app/tx/impl/CreateTicket.cpp
src/ripple/app/tx/impl/DeleteAccount.cpp
src/ripple/app/tx/impl/DepositPreauth.cpp
src/ripple/app/tx/impl/Escrow.cpp
src/ripple/app/tx/impl/GenesisMint.cpp
src/ripple/app/tx/impl/Import.cpp
src/ripple/app/tx/impl/InvariantCheck.cpp
src/ripple/app/tx/impl/Invoke.cpp
src/ripple/app/tx/impl/NFTokenAcceptOffer.cpp
src/ripple/app/tx/impl/NFTokenBurn.cpp
src/ripple/app/tx/impl/NFTokenCancelOffer.cpp
@@ -452,10 +448,14 @@ target_sources (rippled PRIVATE
src/ripple/app/tx/impl/OfferStream.cpp
src/ripple/app/tx/impl/PayChan.cpp
src/ripple/app/tx/impl/Payment.cpp
src/ripple/app/tx/impl/Remit.cpp
src/ripple/app/tx/impl/SetAccount.cpp
src/ripple/app/tx/impl/SetHook.cpp
src/ripple/app/tx/impl/SetRegularKey.cpp
src/ripple/app/tx/impl/SetHook.cpp
src/ripple/app/tx/impl/ClaimReward.cpp
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
@@ -726,6 +726,7 @@ if (tests)
src/test/app/LedgerReplay_test.cpp
src/test/app/LoadFeeTrack_test.cpp
src/test/app/Manifest_test.cpp
src/test/app/Memory_test.cpp
src/test/app/MultiSign_test.cpp
src/test/app/NetworkID_test.cpp
src/test/app/NFToken_test.cpp

View File

@@ -53,7 +53,7 @@ Loop: test.app test.jtx
test.app > test.jtx
Loop: test.app test.rpc
test.rpc ~= test.app
test.rpc == test.app
Loop: test.jtx test.toplevel
test.toplevel > test.jtx

View File

@@ -1,17 +1,12 @@
#include <ripple/app/hook/applyHook.h>
#include <ripple/app/ledger/OpenLedger.h>
#include <ripple/app/ledger/TransactionMaster.h>
#include <ripple/app/misc/HashRouter.h>
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/misc/Transaction.h>
#include <ripple/app/misc/TxQ.h>
#include <ripple/app/tx/impl/Import.h>
#include <ripple/app/tx/impl/details/NFTokenUtils.h>
#include <ripple/basics/Log.h>
#include <ripple/basics/Slice.h>
#include <ripple/protocol/ErrorCodes.h>
#include <ripple/protocol/TxFlags.h>
#include <ripple/protocol/st.h>
#include <ripple/protocol/tokens.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <any>

View File

@@ -19,9 +19,7 @@
#include <ripple/app/consensus/RCLValidations.h>
#include <ripple/app/ledger/Ledger.h>
#include <ripple/app/main/Application.h>
#include <ripple/app/misc/NegativeUNLVote.h>
#include <ripple/json/to_string.h>
namespace ripple {

View File

@@ -733,7 +733,7 @@ private:
RCLConsensus mConsensus;
ConsensusPhase mLastConsensusPhase;
ConsensusPhase mLastConsensusPhase = ConsensusPhase::unknown;
LedgerMaster& m_ledgerMaster;

View File

@@ -23,7 +23,6 @@
#include <ripple/ledger/View.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/Indexes.h>
#include <ripple/protocol/st.h>
namespace ripple {

View File

@@ -24,15 +24,12 @@
#include <ripple/basics/base64.h>
#include <ripple/json/json_reader.h>
#include <ripple/json/json_value.h>
#include <ripple/json/to_string.h>
#include <ripple/ledger/View.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/Import.h>
#include <ripple/protocol/Indexes.h>
#include <ripple/protocol/PublicKey.h>
#include <ripple/protocol/STTx.h>
#include <ripple/protocol/STValidation.h>
#include <ripple/protocol/st.h>
#include <algorithm>
#include <charconv>
#include <iostream>

View File

@@ -22,7 +22,6 @@
#include <ripple/ledger/View.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/Indexes.h>
#include <ripple/protocol/st.h>
namespace ripple {

View File

@@ -23,9 +23,6 @@
#include <ripple/ledger/View.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/Indexes.h>
#include <ripple/protocol/TxFlags.h>
#include <ripple/protocol/st.h>
namespace ripple {
TxConsequences

View File

@@ -153,10 +153,8 @@ SetSignerList::preCompute()
// NOTE: This way of computing the OwnerCount associated with a SignerList
// is valid until the featureMultiSignReserve amendment passes. Once it
// passes then just 1 OwnerCount is associated with a SignerList.
int
SetSignerList::signerCountBasedOwnerCountDelta(
std::size_t entryCount,
Rules const& rules)
static int
signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules)
{
// We always compute the full change in OwnerCount, taking into account:
// o The fact that we're adding/removing a SignerList and
@@ -178,8 +176,8 @@ SetSignerList::signerCountBasedOwnerCountDelta(
return 2 + static_cast<int>(entryCount);
}
TER
SetSignerList::removeSignersFromLedger(
static TER
removeSignersFromLedger(
Application& app,
ApplyView& view,
Keylet const& accountKeylet,

View File

@@ -71,18 +71,6 @@ public:
AccountID const& account,
beast::Journal j);
static TER
removeSignersFromLedger(
Application& app,
ApplyView& view,
Keylet const& accountKeylet,
Keylet const& ownerDirKeylet,
Keylet const& signerListKeylet,
beast::Journal j);
static int
signerCountBasedOwnerCountDelta(std::size_t entryCount, Rules const& rules);
private:
static void
writeSignersToSLE(

View File

@@ -23,7 +23,6 @@
#include <ripple/app/tx/impl/CancelOffer.h>
#include <ripple/app/tx/impl/CashCheck.h>
#include <ripple/app/tx/impl/Change.h>
#include <ripple/app/tx/impl/ClaimReward.h>
#include <ripple/app/tx/impl/CreateCheck.h>
#include <ripple/app/tx/impl/CreateOffer.h>
#include <ripple/app/tx/impl/CreateTicket.h>
@@ -40,14 +39,12 @@
#include <ripple/app/tx/impl/NFTokenMint.h>
#include <ripple/app/tx/impl/PayChan.h>
#include <ripple/app/tx/impl/Payment.h>
#include <ripple/app/tx/impl/Remit.h>
#include <ripple/app/tx/impl/SetAccount.h>
#include <ripple/app/tx/impl/SetHook.h>
#include <ripple/app/tx/impl/SetRegularKey.h>
#include <ripple/app/tx/impl/SetSignerList.h>
#include <ripple/app/tx/impl/SetTrust.h>
#include <ripple/app/tx/impl/URIToken.h>
#include <ripple/app/tx/impl/XahauGenesis.h>
namespace ripple {

View File

@@ -30,7 +30,7 @@ mulDiv(std::uint64_t value, std::uint64_t mul, std::uint64_t div)
{
using namespace boost::multiprecision;
boost::multiprecision::uint128_t result;
uint128_t result;
result = multiply(result, value, mul);
result /= div;

View File

@@ -101,6 +101,9 @@ to_string(ConsensusMode m)
consensus will internally go back to open (see Consensus::handleWrongLedger).
*/
enum class ConsensusPhase {
//! We dont know the ConsensusPhase
unknown,
//! We haven't closed our ledger yet, but others might have
open,

View File

@@ -182,6 +182,7 @@ Value::Value(ValueType type) : type_(type), allocated_(0)
switch (type)
{
case nullValue:
value_.map_ = nullptr;
break;
case intValue:

View File

@@ -19,7 +19,6 @@
#include <ripple/basics/contract.h>
#include <ripple/ledger/detail/ApplyViewBase.h>
#include <ripple/protocol/STAccount.h>
namespace ripple {
namespace detail {

View File

@@ -19,7 +19,6 @@
#include <ripple/app/main/Application.h>
#include <ripple/app/misc/NetworkOPs.h>
#include <ripple/app/reporting/P2pProxy.h>
#include <ripple/protocol/jss.h>
#include <ripple/rpc/Context.h>
#include <ripple/rpc/Role.h>

View File

@@ -201,24 +201,30 @@ Door<Handler>::Detector::do_detect(boost::asio::yield_context do_yield)
buf.data(),
std::move(stream_)))
sp->run();
return;
}
if (auto sp = ios().template emplace<PlainHTTPPeer<Handler>>(
port_,
handler_,
ioc_,
j_,
remote_address_,
buf.data(),
std::move(stream_)))
sp->run();
return;
else
{
if (auto sp = ios().template emplace<PlainHTTPPeer<Handler>>(
port_,
handler_,
ioc_,
j_,
remote_address_,
buf.data(),
std::move(stream_)))
sp->run();
}
}
if (ec != boost::asio::error::operation_aborted)
else
{
JLOG(j_.trace()) << "Error detecting ssl: " << ec.message() << " from "
<< remote_address_;
if (ec != boost::asio::error::operation_aborted)
{
JLOG(j_.trace()) << "Error detecting ssl: " << ec.message() << " from "
<< remote_address_;
}
}
this->close();
}
//------------------------------------------------------------------------------

View File

@@ -17,9 +17,7 @@
*/
//==============================================================================
#include <ripple/app/ledger/LedgerMaster.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/jss.h>
#include <test/jtx.h>
namespace ripple {

View File

@@ -15,8 +15,8 @@
*/
//==============================================================================
#include <ripple/app/tx/impl/XahauGenesis.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/jss.h>
#include <optional>
#include <test/jtx.h>
@@ -94,7 +94,7 @@ struct GenesisMint_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::literals::chrono_literals;
Env env{*this, envconfig(), features};
Env env{*this, envconfig(), features, nullptr};
auto const alice = Account("alice");
auto const bob = Account("bob");
auto const invoker = Account("invoker");
@@ -133,7 +133,11 @@ struct GenesisMint_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::literals::chrono_literals;
Env env{*this, envconfig(), features};
Env env{*this, envconfig(), features, nullptr};
// Env env{*this, envconfig(), features, nullptr,
// // beast::severities::kWarning
// beast::severities::kTrace
// };
auto const alice = Account("alice");
auto const bob = Account("bob");
auto const invoker = Account("invoker");
@@ -635,7 +639,7 @@ struct GenesisMint_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::literals::chrono_literals;
Env env{*this, envconfig(), features};
Env env{*this, envconfig(), features, nullptr};
auto const alice = Account("alice");
auto const bob = Account("bob");
env.fund(XRP(10000), alice, bob);
@@ -657,7 +661,7 @@ struct GenesisMint_test : public beast::unit_test::suite
using namespace jtx;
using namespace std::literals::chrono_literals;
Env env{*this, envconfig(), features};
Env env{*this, envconfig(), features, nullptr};
auto const alice = Account("alice");
auto const bob = Account("bob");
env.fund(XRP(10000), alice, bob);

View File

@@ -17,7 +17,6 @@
*/
//==============================================================================
#include <ripple/protocol/jss.h>
#include <test/jtx.h>
namespace ripple {

View File

@@ -0,0 +1,93 @@
//------------------------------------------------------------------------------
/*
This file is part of rippled: https://github.com/ripple/rippled
Copyright (c) 2023 XRPL-Labs
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
//==============================================================================
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/TxFlags.h>
#include <ripple/protocol/jss.h>
#include <test/jtx.h>
namespace ripple {
namespace test {
class Memory_test : public beast::unit_test::suite
{
void
testPayment(FeatureBitset features)
{
testcase("payment");
using namespace test::jtx;
using namespace std::literals;
Env env{*this, envconfig(), features};
auto const account = Account("alice");
env.fund(XRP(1000), account);
env.close();
}
void
testHook(FeatureBitset features)
{
testcase("hook");
using namespace test::jtx;
using namespace std::literals;
Env env{*this, envconfig(), features};
auto const account = Account("alice");
auto const dest = Account("bob");
env.fund(XRP(10000), account, dest);
env.close();
env(genesis::setAcceptHook(account), fee(XRP(2)));
env.close();
env(genesis::setAcceptHook(dest), fee(XRP(2)));
env.close();
for (int i = 0; i < 2; ++i)
{
env(pay(account, dest, XRP(2)), fee(XRP(1)));
env.close();
}
}
void
testWithFeats(FeatureBitset features)
{
// testPayment(features);
testHook(features);
}
public:
void
run() override
{
using namespace test::jtx;
auto const sa = supported_amendments();
testWithFeats(sa);
}
};
BEAST_DEFINE_TESTSUITE(Memory, app, ripple);
} // namespace test
} // namespace ripple

View File

@@ -2132,6 +2132,7 @@ struct Remit_test : public beast::unit_test::suite
auto const delta = USD(100);
env(remit::remit(alice, bob), remit::amts({delta}));
env.close();
auto xferRate = transferRate(*env.current(), gw);
auto const postAlice = env.balance(alice, USD.issue());
BEAST_EXPECT(env.balance(bob, USD.issue()) == preBob + delta);
BEAST_EXPECT(to_string(postAlice.value()) == tc.result);

View File

@@ -18,7 +18,6 @@
*/
//==============================================================================
#include <ripple/app/hook/Enum.h>
#include <ripple/app/misc/HashRouter.h>
#include <ripple/app/misc/TxQ.h>
#include <ripple/app/tx/apply.h>
@@ -32,13 +31,6 @@
namespace ripple {
namespace test {
#define BEAST_REQUIRE(x) \
{ \
BEAST_EXPECT(!!(x)); \
if (!(x)) \
return; \
}
struct SetHookTSH_test : public beast::unit_test::suite
{
private:

View File

@@ -17,7 +17,6 @@
*/
//==============================================================================
#include <ripple/protocol/jss.h>
#include <test/jtx/Env.h>
#include <test/jtx/acctdelete.h>

View File

@@ -17,7 +17,6 @@
*/
//==============================================================================
#include <ripple/protocol/TxFlags.h>
#include <ripple/protocol/jss.h>
#include <test/jtx/escrow.h>

View File

@@ -17,7 +17,6 @@
*/
//==============================================================================
#include <ripple/basics/StringUtilities.h>
#include <ripple/json/json_reader.h>
#include <ripple/json/json_writer.h>
#include <ripple/protocol/Feature.h>

View File

@@ -17,7 +17,6 @@
*/
//==============================================================================
#include <ripple/protocol/TxFlags.h>
#include <ripple/protocol/jss.h>
#include <test/jtx/paychan.h>

View File

@@ -23,7 +23,6 @@
#include <ripple/json/json_value.h>
#include <ripple/protocol/STAmount.h>
#include <test/jtx/Account.h>
#include <test/jtx/Env.h>
namespace ripple {
namespace test {

View File

@@ -24,7 +24,6 @@
#include <ripple/beast/unit_test.h>
#include <ripple/protocol/ErrorCodes.h>
#include <ripple/protocol/jss.h>
#include <test/app/Import_json.h>
#include <test/jtx.h>
namespace ripple {

View File

@@ -19,7 +19,6 @@
#include <ripple/app/misc/AmendmentTable.h>
#include <ripple/beast/unit_test.h>
#include <ripple/json/json_reader.h>
#include <ripple/protocol/Feature.h>
#include <ripple/protocol/jss.h>
#include <test/jtx.h>