mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
Fix comments
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#include <concepts>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
|
||||
namespace xrpl::test {
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <xrpl/nodestore/Manager.h>
|
||||
#include <xrpl/shamap/Family.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace xrpl {
|
||||
namespace test {
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#include <helpers/TestFamily.h>
|
||||
#include <helpers/TestSink.h>
|
||||
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace xrpl {
|
||||
@@ -101,7 +102,7 @@ public:
|
||||
}
|
||||
|
||||
TimeKeeper&
|
||||
timeKeeper() override
|
||||
getTimeKeeper() override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::timeKeeper() not implemented");
|
||||
}
|
||||
@@ -119,7 +120,7 @@ public:
|
||||
}
|
||||
|
||||
CachedSLEs&
|
||||
cachedSLEs() override
|
||||
getCachedSLEs() override
|
||||
{
|
||||
return cachedSLEs_;
|
||||
}
|
||||
@@ -162,44 +163,44 @@ public:
|
||||
}
|
||||
|
||||
ValidatorList&
|
||||
validators() override
|
||||
getValidators() override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::validators() not implemented");
|
||||
}
|
||||
|
||||
ValidatorSite&
|
||||
validatorSites() override
|
||||
getValidatorSites() override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::validatorSites() not implemented");
|
||||
}
|
||||
|
||||
ManifestCache&
|
||||
validatorManifests() override
|
||||
getValidatorManifests() override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::validatorManifests() not implemented");
|
||||
}
|
||||
|
||||
ManifestCache&
|
||||
publisherManifests() override
|
||||
getPublisherManifests() override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::publisherManifests() not implemented");
|
||||
}
|
||||
|
||||
// Network services
|
||||
Overlay&
|
||||
overlay() override
|
||||
getOverlay() override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::overlay() not implemented");
|
||||
}
|
||||
|
||||
Cluster&
|
||||
cluster() override
|
||||
getCluster() override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::cluster() not implemented");
|
||||
}
|
||||
|
||||
PeerReservationTable&
|
||||
peerReservations() override
|
||||
getPeerReservations() override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::peerReservations() not implemented");
|
||||
}
|
||||
@@ -267,19 +268,19 @@ public:
|
||||
}
|
||||
|
||||
PendingSaves&
|
||||
pendingSaves() override
|
||||
getPendingSaves() override
|
||||
{
|
||||
return pendingSaves_;
|
||||
}
|
||||
|
||||
OpenLedger&
|
||||
openLedger() override
|
||||
getOpenLedger() override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::openLedger() not implemented");
|
||||
}
|
||||
|
||||
OpenLedger const&
|
||||
openLedger() const override
|
||||
getOpenLedger() const override
|
||||
{
|
||||
throw std::logic_error("TestServiceRegistry::openLedger() const not implemented");
|
||||
}
|
||||
@@ -336,7 +337,7 @@ public:
|
||||
}
|
||||
|
||||
beast::Journal
|
||||
journal(std::string const& name) override
|
||||
getJournal(std::string const& name) override
|
||||
{
|
||||
return logs_.journal(name);
|
||||
}
|
||||
@@ -348,13 +349,13 @@ public:
|
||||
}
|
||||
|
||||
Logs&
|
||||
logs() override
|
||||
getLogs() override
|
||||
{
|
||||
return logs_;
|
||||
}
|
||||
|
||||
std::optional<uint256> const&
|
||||
trapTxID() const override
|
||||
getTrapTxID() const override
|
||||
{
|
||||
return trapTxID_;
|
||||
}
|
||||
@@ -367,7 +368,7 @@ public:
|
||||
|
||||
// Temporary: Get the underlying Application
|
||||
Application&
|
||||
app() override
|
||||
getApp() override
|
||||
{
|
||||
throw std::logic_error(
|
||||
"TestServiceRegistry::app() not implemented - no Application available in tests");
|
||||
|
||||
@@ -83,7 +83,8 @@ TxTest::getRules() const
|
||||
[[nodiscard]] TxResult
|
||||
TxTest::submit(std::shared_ptr<STTx const> stx)
|
||||
{
|
||||
auto const result = apply(registry_, *openLedger_, *stx, tapNONE, registry_.journal("apply"));
|
||||
auto const result =
|
||||
apply(registry_, *openLedger_, *stx, tapNONE, registry_.getJournal("apply"));
|
||||
|
||||
// Track successfully applied transactions for canonical reordering on close
|
||||
// We make a copy since the TransactionBase doesn't own the STTx
|
||||
@@ -180,7 +181,7 @@ TxTest::close()
|
||||
OpenView accum(&*newLedger);
|
||||
for (auto const& [key, tx] : txSet)
|
||||
{
|
||||
auto result = apply(registry_, accum, *tx, tapNONE, registry_.journal("apply"));
|
||||
auto result = apply(registry_, accum, *tx, tapNONE, registry_.getJournal("apply"));
|
||||
if (!result.applied)
|
||||
{
|
||||
throw std::runtime_error("TxTest::close: failed to apply transaction");
|
||||
@@ -229,7 +230,7 @@ TxTest::getBalance(AccountID const& account, IOU const& iou) const
|
||||
auto const rippleState = ledger_entries::RippleState{sle};
|
||||
|
||||
auto balance = rippleState.getBalance();
|
||||
balance.setIssuer(iou.issue().account);
|
||||
balance.get<Issue>().account = iou.issue().account;
|
||||
if (account > iou.issue().account)
|
||||
balance.negate();
|
||||
return balance;
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include <xrpl/protocol_autogen/ledger_entries/AccountRoot.h>
|
||||
#include <xrpl/tx/applySteps.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <helpers/Account.h>
|
||||
#include <helpers/IOU.h>
|
||||
#include <helpers/TestServiceRegistry.h>
|
||||
@@ -27,6 +26,9 @@
|
||||
#include <concepts>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <stdexcept>
|
||||
#include <type_traits>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::test {
|
||||
@@ -260,7 +262,7 @@ public:
|
||||
* @param accountFlags Optional account flags to set.
|
||||
*/
|
||||
void
|
||||
createAccount(Account const& account, XRPAmount xrp, uint32_t accountFlags = asfDefaultRipple);
|
||||
createAccount(Account const& account, XRPAmount xrp, uint32_t accountFlags = 0);
|
||||
|
||||
/**
|
||||
* @brief Get the account root object from the current open ledger.
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include <helpers/TxTest.h>
|
||||
|
||||
#include <algorithm>
|
||||
#include <initializer_list>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace xrpl::test {
|
||||
|
||||
TEST(AccountSet, NullAccountSet)
|
||||
@@ -22,7 +29,7 @@ TEST(AccountSet, NullAccountSet)
|
||||
TxTest env;
|
||||
|
||||
Account const alice("alice");
|
||||
env.createAccount(alice, XRP(10), 0);
|
||||
env.createAccount(alice, XRP(10));
|
||||
|
||||
auto& view = env.getOpenLedger();
|
||||
|
||||
@@ -39,13 +46,13 @@ TEST(AccountSet, MostFlags)
|
||||
Account const alice("alice");
|
||||
|
||||
TxTest env;
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
|
||||
// Give alice a regular key so she can legally set and clear
|
||||
// her asfDisableMaster flag.
|
||||
Account const alie{"alie", KeyType::secp256k1};
|
||||
|
||||
env.createAccount(alie, XRP(10000), 0);
|
||||
env.createAccount(alie, XRP(10000));
|
||||
env.close();
|
||||
|
||||
EXPECT_EQ(
|
||||
@@ -145,7 +152,7 @@ TEST(AccountSet, SetAndResetAccountTxnID)
|
||||
TxTest env;
|
||||
Account const alice("alice");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
|
||||
std::uint32_t const orig_flags = env.getAccountRoot(alice).getFlags();
|
||||
|
||||
@@ -177,7 +184,7 @@ TEST(AccountSet, SetNoFreeze)
|
||||
Account const alice("alice");
|
||||
Account const eric("eric");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
// Set eric as alice's regular key (eric doesn't need to be funded)
|
||||
@@ -219,7 +226,7 @@ TEST(AccountSet, Domain)
|
||||
TxTest env;
|
||||
Account const alice("alice");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
// The Domain field is represented as the hex string of the lowercase
|
||||
@@ -285,7 +292,7 @@ TEST(AccountSet, MessageKey)
|
||||
TxTest env;
|
||||
Account const alice("alice");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
// Generate a random ed25519 key pair for the message key
|
||||
@@ -325,7 +332,7 @@ TEST(AccountSet, WalletID)
|
||||
TxTest env;
|
||||
Account const alice("alice");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
std::string_view locator = "9633EC8AF54F16B5286DB1D7B519EF49EEFC050C0C8AC4384F1D88ACD1BFDF05";
|
||||
@@ -355,7 +362,7 @@ TEST(AccountSet, EmailHash)
|
||||
TxTest env;
|
||||
Account const alice("alice");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
std::string_view mh = "5F31A79367DC3137FADA860C05742EE6";
|
||||
@@ -403,7 +410,7 @@ TEST(AccountSet, TransferRate)
|
||||
TxTest env;
|
||||
Account const alice("alice");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
for (auto const& r : testData)
|
||||
@@ -435,7 +442,7 @@ TEST(AccountSet, BadInputs)
|
||||
TxTest env;
|
||||
Account const alice("alice");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
// Setting and clearing the same flag is invalid
|
||||
@@ -516,7 +523,7 @@ TEST(AccountSet, RequireAuthWithDir)
|
||||
Account const alice("alice");
|
||||
Account const bob("bob");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
// alice should have an empty directory
|
||||
@@ -563,7 +570,7 @@ TEST(AccountSet, Ticket)
|
||||
TxTest env;
|
||||
Account const alice("alice");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
// Get alice's current sequence - the ticket will be created at seq + 1
|
||||
@@ -616,7 +623,7 @@ TEST(AccountSet, BadSigningKey)
|
||||
TxTest env;
|
||||
Account const alice("alice");
|
||||
|
||||
env.createAccount(alice, XRP(10000), 0);
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.close();
|
||||
|
||||
// Build a valid transaction first, then corrupt the signing key
|
||||
@@ -647,9 +654,9 @@ TEST(AccountSet, Gateway)
|
||||
{
|
||||
TxTest env;
|
||||
|
||||
env.createAccount(gw, XRP(10000));
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.createAccount(bob, XRP(10000));
|
||||
env.createAccount(gw, XRP(10000), asfDefaultRipple);
|
||||
env.createAccount(alice, XRP(10000), asfDefaultRipple);
|
||||
env.createAccount(bob, XRP(10000), asfDefaultRipple);
|
||||
env.close();
|
||||
|
||||
// Set up trust lines: alice and bob trust gw for USD
|
||||
@@ -700,12 +707,12 @@ TEST(AccountSet, Gateway)
|
||||
|
||||
// Test out-of-bounds legacy transfer rates (4.0 and 4.294967295)
|
||||
// These require direct ledger modification since the transactor blocks them
|
||||
for (double transferRate : {4.0, 4.294967295})
|
||||
for (std::uint32_t transferRate : {4000000000U, 4294967295U})
|
||||
{
|
||||
TxTest env;
|
||||
env.createAccount(gw, XRP(10000));
|
||||
env.createAccount(alice, XRP(10000));
|
||||
env.createAccount(bob, XRP(10000));
|
||||
env.createAccount(gw, XRP(10000), asfDefaultRipple);
|
||||
env.createAccount(alice, XRP(10000), asfDefaultRipple);
|
||||
env.createAccount(bob, XRP(10000), asfDefaultRipple);
|
||||
env.close();
|
||||
|
||||
// Set up trust lines
|
||||
@@ -734,13 +741,12 @@ TEST(AccountSet, Gateway)
|
||||
auto slePtr = view.read(keylet::account(gw.id()));
|
||||
ASSERT_NE(slePtr, nullptr);
|
||||
auto sleCopy = std::make_shared<SLE>(*slePtr);
|
||||
(*sleCopy)[sfTransferRate] = static_cast<std::uint32_t>(transferRate * QUALITY_ONE);
|
||||
(*sleCopy)[sfTransferRate] = transferRate;
|
||||
view.rawReplace(sleCopy);
|
||||
|
||||
// Calculate the amount with the legacy transfer rate
|
||||
auto const amount = USD.amount(1);
|
||||
auto const amountWithRate =
|
||||
multiply(amount, Rate(static_cast<std::uint32_t>(transferRate * QUALITY_ONE)));
|
||||
auto const amountWithRate = multiply(amount, Rate(transferRate));
|
||||
|
||||
// Gateway pays alice 10 USD
|
||||
EXPECT_EQ(
|
||||
|
||||
Reference in New Issue
Block a user