mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-16 09:05:50 +00:00
Compare commits
7 Commits
smart-escr
...
revert-551
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd39392225 | ||
|
|
b113190563 | ||
|
|
358b7f50a7 | ||
|
|
f47e2f4e82 | ||
|
|
a7eea9546f | ||
|
|
9874d47d7f | ||
|
|
c2f3e2e263 |
@@ -18,7 +18,7 @@ if(tests)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(unity "Creates a build using UNITY support in cmake. This is the default" ON)
|
option(unity "Creates a build using UNITY support in cmake." OFF)
|
||||||
if(unity)
|
if(unity)
|
||||||
if(NOT is_ci)
|
if(NOT is_ci)
|
||||||
set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "")
|
set(CMAKE_UNITY_BUILD_BATCH_SIZE 15 CACHE STRING "")
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ find_package(Boost 1.82 REQUIRED
|
|||||||
COMPONENTS
|
COMPONENTS
|
||||||
chrono
|
chrono
|
||||||
container
|
container
|
||||||
context
|
|
||||||
coroutine
|
coroutine
|
||||||
date_time
|
date_time
|
||||||
filesystem
|
filesystem
|
||||||
@@ -24,7 +23,7 @@ endif()
|
|||||||
|
|
||||||
target_link_libraries(ripple_boost
|
target_link_libraries(ripple_boost
|
||||||
INTERFACE
|
INTERFACE
|
||||||
Boost::boost
|
Boost::headers
|
||||||
Boost::chrono
|
Boost::chrono
|
||||||
Boost::container
|
Boost::container
|
||||||
Boost::coroutine
|
Boost::coroutine
|
||||||
|
|||||||
12
conanfile.py
12
conanfile.py
@@ -164,7 +164,17 @@ class Xrpl(ConanFile):
|
|||||||
# `include/`, not `include/ripple/proto/`.
|
# `include/`, not `include/ripple/proto/`.
|
||||||
libxrpl.includedirs = ['include', 'include/ripple/proto']
|
libxrpl.includedirs = ['include', 'include/ripple/proto']
|
||||||
libxrpl.requires = [
|
libxrpl.requires = [
|
||||||
'boost::boost',
|
'boost::headers',
|
||||||
|
'boost::chrono',
|
||||||
|
'boost::container',
|
||||||
|
'boost::coroutine',
|
||||||
|
'boost::date_time',
|
||||||
|
'boost::filesystem',
|
||||||
|
'boost::json',
|
||||||
|
'boost::program_options',
|
||||||
|
'boost::regex',
|
||||||
|
'boost::system',
|
||||||
|
'boost::thread',
|
||||||
'date::date',
|
'date::date',
|
||||||
'grpc::grpc++',
|
'grpc::grpc++',
|
||||||
'libarchive::libarchive',
|
'libarchive::libarchive',
|
||||||
|
|||||||
2
external/antithesis-sdk/CMakeLists.txt
vendored
2
external/antithesis-sdk/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.25)
|
cmake_minimum_required(VERSION 3.18)
|
||||||
|
|
||||||
# Note, version set explicitly by rippled project
|
# Note, version set explicitly by rippled project
|
||||||
project(antithesis-sdk-cpp VERSION 0.4.4 LANGUAGES CXX)
|
project(antithesis-sdk-cpp VERSION 0.4.4 LANGUAGES CXX)
|
||||||
|
|||||||
@@ -22,8 +22,18 @@
|
|||||||
|
|
||||||
#include <xrpl/basics/contract.h>
|
#include <xrpl/basics/contract.h>
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated"
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/outcome.hpp>
|
#include <boost/outcome.hpp>
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -24,13 +24,38 @@
|
|||||||
#include <boost/container/flat_set.hpp>
|
#include <boost/container/flat_set.hpp>
|
||||||
#include <boost/endian/conversion.hpp>
|
#include <boost/endian/conversion.hpp>
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
Workaround for overzealous clang warning, which trips on libstdc++ headers
|
||||||
|
|
||||||
|
In file included from
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_algo.h:61:
|
||||||
|
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tempbuf.h:263:8:
|
||||||
|
error: 'get_temporary_buffer<std::pair<ripple::Quality, const
|
||||||
|
std::vector<std::unique_ptr<ripple::Step>> *>>' is deprecated
|
||||||
|
[-Werror,-Wdeprecated-declarations] 263 |
|
||||||
|
std::get_temporary_buffer<value_type>(_M_original_len));
|
||||||
|
^
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated"
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <functional>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <system_error>
|
#include <system_error>
|
||||||
|
|||||||
@@ -61,13 +61,6 @@
|
|||||||
* 2) The feature is not in the ledger (has always been marked as
|
* 2) The feature is not in the ledger (has always been marked as
|
||||||
* Supported::no) and the code to support it has been removed
|
* Supported::no) and the code to support it has been removed
|
||||||
*
|
*
|
||||||
* If we want to discontinue a feature that we've never fully supported and
|
|
||||||
* the feature has never been enabled, we should remove all the related
|
|
||||||
* code, and mark the feature as "abandoned". To do this:
|
|
||||||
*
|
|
||||||
* 1) Open features.macro, move the feature to the abandoned section and
|
|
||||||
* change the macro to XRPL_ABANDON
|
|
||||||
*
|
|
||||||
* When a feature has been enabled for several years, the conditional code
|
* When a feature has been enabled for several years, the conditional code
|
||||||
* may be removed, and the feature "retired". To retire a feature:
|
* may be removed, and the feature "retired". To retire a feature:
|
||||||
*
|
*
|
||||||
@@ -100,13 +93,10 @@ namespace detail {
|
|||||||
#undef XRPL_FIX
|
#undef XRPL_FIX
|
||||||
#pragma push_macro("XRPL_RETIRE")
|
#pragma push_macro("XRPL_RETIRE")
|
||||||
#undef XRPL_RETIRE
|
#undef XRPL_RETIRE
|
||||||
#pragma push_macro("XRPL_ABANDON")
|
|
||||||
#undef XRPL_ABANDON
|
|
||||||
|
|
||||||
#define XRPL_FEATURE(name, supported, vote) +1
|
#define XRPL_FEATURE(name, supported, vote) +1
|
||||||
#define XRPL_FIX(name, supported, vote) +1
|
#define XRPL_FIX(name, supported, vote) +1
|
||||||
#define XRPL_RETIRE(name) +1
|
#define XRPL_RETIRE(name) +1
|
||||||
#define XRPL_ABANDON(name) +1
|
|
||||||
|
|
||||||
// This value SHOULD be equal to the number of amendments registered in
|
// This value SHOULD be equal to the number of amendments registered in
|
||||||
// Feature.cpp. Because it's only used to reserve storage, and determine how
|
// Feature.cpp. Because it's only used to reserve storage, and determine how
|
||||||
@@ -123,8 +113,6 @@ static constexpr std::size_t numFeatures =
|
|||||||
#pragma pop_macro("XRPL_FIX")
|
#pragma pop_macro("XRPL_FIX")
|
||||||
#undef XRPL_FEATURE
|
#undef XRPL_FEATURE
|
||||||
#pragma pop_macro("XRPL_FEATURE")
|
#pragma pop_macro("XRPL_FEATURE")
|
||||||
#undef XRPL_ABANDON
|
|
||||||
#pragma pop_macro("XRPL_ABANDON")
|
|
||||||
|
|
||||||
/** Amendments that this server supports and the default voting behavior.
|
/** Amendments that this server supports and the default voting behavior.
|
||||||
Whether they are enabled depends on the Rules defined in the validated
|
Whether they are enabled depends on the Rules defined in the validated
|
||||||
@@ -366,13 +354,10 @@ foreachFeature(FeatureBitset bs, F&& f)
|
|||||||
#undef XRPL_FIX
|
#undef XRPL_FIX
|
||||||
#pragma push_macro("XRPL_RETIRE")
|
#pragma push_macro("XRPL_RETIRE")
|
||||||
#undef XRPL_RETIRE
|
#undef XRPL_RETIRE
|
||||||
#pragma push_macro("XRPL_ABANDON")
|
|
||||||
#undef XRPL_ABANDON
|
|
||||||
|
|
||||||
#define XRPL_FEATURE(name, supported, vote) extern uint256 const feature##name;
|
#define XRPL_FEATURE(name, supported, vote) extern uint256 const feature##name;
|
||||||
#define XRPL_FIX(name, supported, vote) extern uint256 const fix##name;
|
#define XRPL_FIX(name, supported, vote) extern uint256 const fix##name;
|
||||||
#define XRPL_RETIRE(name)
|
#define XRPL_RETIRE(name)
|
||||||
#define XRPL_ABANDON(name)
|
|
||||||
|
|
||||||
#include <xrpl/protocol/detail/features.macro>
|
#include <xrpl/protocol/detail/features.macro>
|
||||||
|
|
||||||
@@ -382,8 +367,6 @@ foreachFeature(FeatureBitset bs, F&& f)
|
|||||||
#pragma pop_macro("XRPL_FIX")
|
#pragma pop_macro("XRPL_FIX")
|
||||||
#undef XRPL_FEATURE
|
#undef XRPL_FEATURE
|
||||||
#pragma pop_macro("XRPL_FEATURE")
|
#pragma pop_macro("XRPL_FEATURE")
|
||||||
#undef XRPL_ABANDON
|
|
||||||
#pragma pop_macro("XRPL_ABANDON")
|
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,6 @@
|
|||||||
#if !defined(XRPL_RETIRE)
|
#if !defined(XRPL_RETIRE)
|
||||||
#error "undefined macro: XRPL_RETIRE"
|
#error "undefined macro: XRPL_RETIRE"
|
||||||
#endif
|
#endif
|
||||||
#if !defined(XRPL_ABANDON)
|
|
||||||
#error "undefined macro: XRPL_ABANDON"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Add new amendments to the top of this list.
|
// Add new amendments to the top of this list.
|
||||||
// Keep it sorted in reverse chronological order.
|
// Keep it sorted in reverse chronological order.
|
||||||
@@ -133,11 +130,8 @@ XRPL_FIX (NFTokenNegOffer, Supported::yes, VoteBehavior::Obsolete)
|
|||||||
XRPL_FIX (NFTokenDirV1, Supported::yes, VoteBehavior::Obsolete)
|
XRPL_FIX (NFTokenDirV1, Supported::yes, VoteBehavior::Obsolete)
|
||||||
XRPL_FEATURE(NonFungibleTokensV1, Supported::yes, VoteBehavior::Obsolete)
|
XRPL_FEATURE(NonFungibleTokensV1, Supported::yes, VoteBehavior::Obsolete)
|
||||||
XRPL_FEATURE(CryptoConditionsSuite, Supported::yes, VoteBehavior::Obsolete)
|
XRPL_FEATURE(CryptoConditionsSuite, Supported::yes, VoteBehavior::Obsolete)
|
||||||
|
// This sits here temporarily and will be moved to another section soon
|
||||||
// The following amendments were never supported, never enabled, and
|
XRPL_FEATURE(OwnerPaysFee, Supported::no, VoteBehavior::Obsolete)
|
||||||
// we've abanded them. These features should never be in the ledger,
|
|
||||||
// and we've removed all the related code.
|
|
||||||
XRPL_ABANDON(OwnerPaysFee)
|
|
||||||
|
|
||||||
// The following amendments have been active for at least two years. Their
|
// The following amendments have been active for at least two years. Their
|
||||||
// pre-amendment code has been removed and the identifiers are deprecated.
|
// pre-amendment code has been removed and the identifiers are deprecated.
|
||||||
|
|||||||
@@ -398,14 +398,6 @@ retireFeature(std::string const& name)
|
|||||||
return registerFeature(name, Supported::yes, VoteBehavior::Obsolete);
|
return registerFeature(name, Supported::yes, VoteBehavior::Obsolete);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Abandoned features are not in the ledger and have no code controlled by the
|
|
||||||
// feature. They were never supported, and cannot be voted on.
|
|
||||||
uint256
|
|
||||||
abandonFeature(std::string const& name)
|
|
||||||
{
|
|
||||||
return registerFeature(name, Supported::no, VoteBehavior::Obsolete);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Tell FeatureCollections when registration is complete. */
|
/** Tell FeatureCollections when registration is complete. */
|
||||||
bool
|
bool
|
||||||
registrationIsDone()
|
registrationIsDone()
|
||||||
@@ -440,8 +432,6 @@ featureToName(uint256 const& f)
|
|||||||
#undef XRPL_FIX
|
#undef XRPL_FIX
|
||||||
#pragma push_macro("XRPL_RETIRE")
|
#pragma push_macro("XRPL_RETIRE")
|
||||||
#undef XRPL_RETIRE
|
#undef XRPL_RETIRE
|
||||||
#pragma push_macro("XRPL_ABANDON")
|
|
||||||
#undef XRPL_ABANDON
|
|
||||||
|
|
||||||
#define XRPL_FEATURE(name, supported, vote) \
|
#define XRPL_FEATURE(name, supported, vote) \
|
||||||
uint256 const feature##name = registerFeature(#name, supported, vote);
|
uint256 const feature##name = registerFeature(#name, supported, vote);
|
||||||
@@ -453,11 +443,6 @@ featureToName(uint256 const& f)
|
|||||||
[[deprecated("The referenced amendment has been retired")]] \
|
[[deprecated("The referenced amendment has been retired")]] \
|
||||||
[[maybe_unused]] \
|
[[maybe_unused]] \
|
||||||
uint256 const retired##name = retireFeature(#name);
|
uint256 const retired##name = retireFeature(#name);
|
||||||
|
|
||||||
#define XRPL_ABANDON(name) \
|
|
||||||
[[deprecated("The referenced amendment has been abandoned")]] \
|
|
||||||
[[maybe_unused]] \
|
|
||||||
uint256 const abandoned##name = abandonFeature(#name);
|
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#include <xrpl/protocol/detail/features.macro>
|
#include <xrpl/protocol/detail/features.macro>
|
||||||
@@ -468,8 +453,6 @@ featureToName(uint256 const& f)
|
|||||||
#pragma pop_macro("XRPL_FIX")
|
#pragma pop_macro("XRPL_FIX")
|
||||||
#undef XRPL_FEATURE
|
#undef XRPL_FEATURE
|
||||||
#pragma pop_macro("XRPL_FEATURE")
|
#pragma pop_macro("XRPL_FEATURE")
|
||||||
#undef XRPL_ABANDON
|
|
||||||
#pragma pop_macro("XRPL_ABANDON")
|
|
||||||
|
|
||||||
// All of the features should now be registered, since variables in a cpp file
|
// All of the features should now be registered, since variables in a cpp file
|
||||||
// are initialized from top to bottom.
|
// are initialized from top to bottom.
|
||||||
|
|||||||
@@ -17,18 +17,8 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <test/jtx/AMM.h>
|
#include <test/jtx.h>
|
||||||
#include <test/jtx/AMMTest.h>
|
#include <test/jtx/AMMTest.h>
|
||||||
#include <test/jtx/Account.h>
|
|
||||||
#include <test/jtx/Env.h>
|
|
||||||
#include <test/jtx/amount.h>
|
|
||||||
#include <test/jtx/credentials.h>
|
|
||||||
#include <test/jtx/fee.h>
|
|
||||||
#include <test/jtx/flags.h>
|
|
||||||
#include <test/jtx/mpt.h>
|
|
||||||
#include <test/jtx/permissioned_domains.h>
|
|
||||||
#include <test/jtx/utility.h>
|
|
||||||
#include <test/jtx/vault.h>
|
|
||||||
|
|
||||||
#include <xrpld/ledger/View.h>
|
#include <xrpld/ledger/View.h>
|
||||||
|
|
||||||
|
|||||||
@@ -98,8 +98,7 @@ struct Buffer_test : beast::unit_test::suite
|
|||||||
x = b0;
|
x = b0;
|
||||||
BEAST_EXPECT(x == b0);
|
BEAST_EXPECT(x == b0);
|
||||||
BEAST_EXPECT(sane(x));
|
BEAST_EXPECT(sane(x));
|
||||||
#if defined(__clang__) && (!defined(__APPLE__) && (__clang_major__ >= 7)) || \
|
#if defined(__clang__)
|
||||||
(defined(__APPLE__) && (__apple_build_version__ >= 10010043))
|
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
|
#pragma clang diagnostic ignored "-Wself-assign-overloaded"
|
||||||
#endif
|
#endif
|
||||||
@@ -111,8 +110,7 @@ struct Buffer_test : beast::unit_test::suite
|
|||||||
BEAST_EXPECT(y == b3);
|
BEAST_EXPECT(y == b3);
|
||||||
BEAST_EXPECT(sane(y));
|
BEAST_EXPECT(sane(y));
|
||||||
|
|
||||||
#if defined(__clang__) && (!defined(__APPLE__) && (__clang_major__ >= 7)) || \
|
#if defined(__clang__)
|
||||||
(defined(__APPLE__) && (__apple_build_version__ >= 10010043))
|
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
// Convenience header that includes everything
|
// Convenience header that includes everything
|
||||||
|
|
||||||
|
#include <test/jtx/AMM.h>
|
||||||
#include <test/jtx/Account.h>
|
#include <test/jtx/Account.h>
|
||||||
#include <test/jtx/Env.h>
|
#include <test/jtx/Env.h>
|
||||||
#include <test/jtx/Env_ss.h>
|
#include <test/jtx/Env_ss.h>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <test/jtx/mpt.h>
|
#include <test/jtx.h>
|
||||||
|
|
||||||
#include <xrpl/protocol/jss.h>
|
#include <xrpl/protocol/jss.h>
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <test/jtx/permissioned_dex.h>
|
#include <test/jtx.h>
|
||||||
|
|
||||||
#include <xrpl/beast/unit_test/suite.h>
|
#include <xrpl/beast/unit_test/suite.h>
|
||||||
#include <xrpl/protocol/jss.h>
|
#include <xrpl/protocol/jss.h>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
#include <test/jtx/permissioned_domains.h>
|
#include <test/jtx.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace test {
|
namespace test {
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
#ifndef RIPPLE_TEST_JTX_MPT_H_INCLUDED
|
#ifndef RIPPLE_TEST_JTX_MPT_H_INCLUDED
|
||||||
#define RIPPLE_TEST_JTX_MPT_H_INCLUDED
|
#define RIPPLE_TEST_JTX_MPT_H_INCLUDED
|
||||||
|
|
||||||
#include <test/jtx.h>
|
#include <test/jtx/Account.h>
|
||||||
|
#include <test/jtx/Env.h>
|
||||||
#include <test/jtx/ter.h>
|
#include <test/jtx/ter.h>
|
||||||
#include <test/jtx/txflags.h>
|
#include <test/jtx/txflags.h>
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <test/jtx.h>
|
#include <test/jtx/Account.h>
|
||||||
|
#include <test/jtx/Env.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace test {
|
namespace test {
|
||||||
namespace jtx {
|
namespace jtx {
|
||||||
|
|||||||
@@ -20,7 +20,8 @@
|
|||||||
#ifndef RIPPLE_TEST_JTX_PERMISSIONED_DOMAINS_H_INCLUDED
|
#ifndef RIPPLE_TEST_JTX_PERMISSIONED_DOMAINS_H_INCLUDED
|
||||||
#define RIPPLE_TEST_JTX_PERMISSIONED_DOMAINS_H_INCLUDED
|
#define RIPPLE_TEST_JTX_PERMISSIONED_DOMAINS_H_INCLUDED
|
||||||
|
|
||||||
#include <test/jtx.h>
|
#include <test/jtx/Account.h>
|
||||||
|
#include <test/jtx/Env.h>
|
||||||
#include <test/jtx/deposit.h>
|
#include <test/jtx/deposit.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
|
|||||||
@@ -94,6 +94,8 @@ SuiteJournalSink::writeAlways(
|
|||||||
return "FTL:";
|
return "FTL:";
|
||||||
}();
|
}();
|
||||||
|
|
||||||
|
static std::mutex log_mutex;
|
||||||
|
std::lock_guard lock(log_mutex);
|
||||||
suite_.log << s << partition_ << text << std::endl;
|
suite_.log << s << partition_ << text << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -120,15 +120,15 @@ deleteSLE(
|
|||||||
}
|
}
|
||||||
|
|
||||||
NotTEC
|
NotTEC
|
||||||
checkFields(PreflightContext const& ctx)
|
checkFields(STTx const& tx, beast::Journal j)
|
||||||
{
|
{
|
||||||
if (!ctx.tx.isFieldPresent(sfCredentialIDs))
|
if (!tx.isFieldPresent(sfCredentialIDs))
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
|
|
||||||
auto const& credentials = ctx.tx.getFieldV256(sfCredentialIDs);
|
auto const& credentials = tx.getFieldV256(sfCredentialIDs);
|
||||||
if (credentials.empty() || (credentials.size() > maxCredentialsArraySize))
|
if (credentials.empty() || (credentials.size() > maxCredentialsArraySize))
|
||||||
{
|
{
|
||||||
JLOG(ctx.j.trace())
|
JLOG(j.trace())
|
||||||
<< "Malformed transaction: Credentials array size is invalid: "
|
<< "Malformed transaction: Credentials array size is invalid: "
|
||||||
<< credentials.size();
|
<< credentials.size();
|
||||||
return temMALFORMED;
|
return temMALFORMED;
|
||||||
@@ -140,7 +140,7 @@ checkFields(PreflightContext const& ctx)
|
|||||||
auto [it, ins] = duplicates.insert(cred);
|
auto [it, ins] = duplicates.insert(cred);
|
||||||
if (!ins)
|
if (!ins)
|
||||||
{
|
{
|
||||||
JLOG(ctx.j.trace())
|
JLOG(j.trace())
|
||||||
<< "Malformed transaction: duplicates in credentials.";
|
<< "Malformed transaction: duplicates in credentials.";
|
||||||
return temMALFORMED;
|
return temMALFORMED;
|
||||||
}
|
}
|
||||||
@@ -150,24 +150,28 @@ checkFields(PreflightContext const& ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
TER
|
TER
|
||||||
valid(PreclaimContext const& ctx, AccountID const& src)
|
valid(
|
||||||
|
STTx const& tx,
|
||||||
|
ReadView const& view,
|
||||||
|
AccountID const& src,
|
||||||
|
beast::Journal j)
|
||||||
{
|
{
|
||||||
if (!ctx.tx.isFieldPresent(sfCredentialIDs))
|
if (!tx.isFieldPresent(sfCredentialIDs))
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
|
|
||||||
auto const& credIDs(ctx.tx.getFieldV256(sfCredentialIDs));
|
auto const& credIDs(tx.getFieldV256(sfCredentialIDs));
|
||||||
for (auto const& h : credIDs)
|
for (auto const& h : credIDs)
|
||||||
{
|
{
|
||||||
auto const sleCred = ctx.view.read(keylet::credential(h));
|
auto const sleCred = view.read(keylet::credential(h));
|
||||||
if (!sleCred)
|
if (!sleCred)
|
||||||
{
|
{
|
||||||
JLOG(ctx.j.trace()) << "Credential doesn't exist. Cred: " << h;
|
JLOG(j.trace()) << "Credential doesn't exist. Cred: " << h;
|
||||||
return tecBAD_CREDENTIALS;
|
return tecBAD_CREDENTIALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sleCred->getAccountID(sfSubject) != src)
|
if (sleCred->getAccountID(sfSubject) != src)
|
||||||
{
|
{
|
||||||
JLOG(ctx.j.trace())
|
JLOG(j.trace())
|
||||||
<< "Credential doesn't belong to the source account. Cred: "
|
<< "Credential doesn't belong to the source account. Cred: "
|
||||||
<< h;
|
<< h;
|
||||||
return tecBAD_CREDENTIALS;
|
return tecBAD_CREDENTIALS;
|
||||||
@@ -175,7 +179,7 @@ valid(PreclaimContext const& ctx, AccountID const& src)
|
|||||||
|
|
||||||
if (!(sleCred->getFlags() & lsfAccepted))
|
if (!(sleCred->getFlags() & lsfAccepted))
|
||||||
{
|
{
|
||||||
JLOG(ctx.j.trace()) << "Credential isn't accepted. Cred: " << h;
|
JLOG(j.trace()) << "Credential isn't accepted. Cred: " << h;
|
||||||
return tecBAD_CREDENTIALS;
|
return tecBAD_CREDENTIALS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,10 +356,12 @@ verifyValidDomain(
|
|||||||
|
|
||||||
TER
|
TER
|
||||||
verifyDepositPreauth(
|
verifyDepositPreauth(
|
||||||
ApplyContext& ctx,
|
STTx const& tx,
|
||||||
|
ApplyView& view,
|
||||||
AccountID const& src,
|
AccountID const& src,
|
||||||
AccountID const& dst,
|
AccountID const& dst,
|
||||||
std::shared_ptr<SLE> const& sleDst)
|
std::shared_ptr<SLE> const& sleDst,
|
||||||
|
beast::Journal j)
|
||||||
{
|
{
|
||||||
// If depositPreauth is enabled, then an account that requires
|
// If depositPreauth is enabled, then an account that requires
|
||||||
// authorization has at least two ways to get a payment in:
|
// authorization has at least two ways to get a payment in:
|
||||||
@@ -363,24 +369,21 @@ verifyDepositPreauth(
|
|||||||
// 2. If src is deposit preauthorized by dst (either by account or by
|
// 2. If src is deposit preauthorized by dst (either by account or by
|
||||||
// credentials).
|
// credentials).
|
||||||
|
|
||||||
bool const credentialsPresent = ctx.tx.isFieldPresent(sfCredentialIDs);
|
bool const credentialsPresent = tx.isFieldPresent(sfCredentialIDs);
|
||||||
|
|
||||||
if (credentialsPresent &&
|
if (credentialsPresent &&
|
||||||
credentials::removeExpired(
|
credentials::removeExpired(view, tx.getFieldV256(sfCredentialIDs), j))
|
||||||
ctx.view(), ctx.tx.getFieldV256(sfCredentialIDs), ctx.journal))
|
|
||||||
return tecEXPIRED;
|
return tecEXPIRED;
|
||||||
|
|
||||||
if (sleDst && (sleDst->getFlags() & lsfDepositAuth))
|
if (sleDst && (sleDst->getFlags() & lsfDepositAuth))
|
||||||
{
|
{
|
||||||
if (src != dst)
|
if (src != dst)
|
||||||
{
|
{
|
||||||
if (!ctx.view().exists(keylet::depositPreauth(dst, src)))
|
if (!view.exists(keylet::depositPreauth(dst, src)))
|
||||||
return !credentialsPresent
|
return !credentialsPresent
|
||||||
? tecNO_PERMISSION
|
? tecNO_PERMISSION
|
||||||
: credentials::authorizedDepositPreauth(
|
: credentials::authorizedDepositPreauth(
|
||||||
ctx.view(),
|
view, tx.getFieldV256(sfCredentialIDs), dst);
|
||||||
ctx.tx.getFieldV256(sfCredentialIDs),
|
|
||||||
dst);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,16 @@
|
|||||||
#ifndef RIPPLE_APP_MISC_CREDENTIALHELPERS_H_INCLUDED
|
#ifndef RIPPLE_APP_MISC_CREDENTIALHELPERS_H_INCLUDED
|
||||||
#define RIPPLE_APP_MISC_CREDENTIALHELPERS_H_INCLUDED
|
#define RIPPLE_APP_MISC_CREDENTIALHELPERS_H_INCLUDED
|
||||||
|
|
||||||
#include <xrpld/app/tx/detail/Transactor.h>
|
#include <xrpld/ledger/ApplyView.h>
|
||||||
|
#include <xrpld/ledger/ReadView.h>
|
||||||
|
|
||||||
|
#include <xrpl/basics/Log.h>
|
||||||
|
#include <xrpl/basics/base_uint.h>
|
||||||
|
#include <xrpl/beast/utility/Journal.h>
|
||||||
|
#include <xrpl/protocol/AccountID.h>
|
||||||
|
#include <xrpl/protocol/STArray.h>
|
||||||
|
#include <xrpl/protocol/STTx.h>
|
||||||
|
#include <xrpl/protocol/TER.h>
|
||||||
|
|
||||||
namespace ripple {
|
namespace ripple {
|
||||||
namespace credentials {
|
namespace credentials {
|
||||||
@@ -48,13 +57,17 @@ deleteSLE(
|
|||||||
|
|
||||||
// Amendment and parameters checks for sfCredentialIDs field
|
// Amendment and parameters checks for sfCredentialIDs field
|
||||||
NotTEC
|
NotTEC
|
||||||
checkFields(PreflightContext const& ctx);
|
checkFields(STTx const& tx, beast::Journal j);
|
||||||
|
|
||||||
// Accessing the ledger to check if provided credentials are valid. Do not use
|
// Accessing the ledger to check if provided credentials are valid. Do not use
|
||||||
// in doApply (only in preclaim) since it does not remove expired credentials.
|
// in doApply (only in preclaim) since it does not remove expired credentials.
|
||||||
// If you call it in prelaim, you also must call verifyDepositPreauth in doApply
|
// If you call it in prelaim, you also must call verifyDepositPreauth in doApply
|
||||||
TER
|
TER
|
||||||
valid(PreclaimContext const& ctx, AccountID const& src);
|
valid(
|
||||||
|
STTx const& tx,
|
||||||
|
ReadView const& view,
|
||||||
|
AccountID const& src,
|
||||||
|
beast::Journal j);
|
||||||
|
|
||||||
// Check if subject has any credential maching the given domain. If you call it
|
// Check if subject has any credential maching the given domain. If you call it
|
||||||
// in preclaim and it returns tecEXPIRED, you should call verifyValidDomain in
|
// in preclaim and it returns tecEXPIRED, you should call verifyValidDomain in
|
||||||
@@ -93,10 +106,12 @@ verifyValidDomain(
|
|||||||
// Check expired credentials and for existing DepositPreauth ledger object
|
// Check expired credentials and for existing DepositPreauth ledger object
|
||||||
TER
|
TER
|
||||||
verifyDepositPreauth(
|
verifyDepositPreauth(
|
||||||
ApplyContext& ctx,
|
STTx const& tx,
|
||||||
|
ApplyView& view,
|
||||||
AccountID const& src,
|
AccountID const& src,
|
||||||
AccountID const& dst,
|
AccountID const& dst,
|
||||||
std::shared_ptr<SLE> const& sleDst);
|
std::shared_ptr<SLE> const& sleDst,
|
||||||
|
beast::Journal j);
|
||||||
|
|
||||||
} // namespace ripple
|
} // namespace ripple
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,8 @@ DeleteAccount::preflight(PreflightContext const& ctx)
|
|||||||
// An account cannot be deleted and give itself the resulting XRP.
|
// An account cannot be deleted and give itself the resulting XRP.
|
||||||
return temDST_IS_SRC;
|
return temDST_IS_SRC;
|
||||||
|
|
||||||
if (auto const err = credentials::checkFields(ctx); !isTesSuccess(err))
|
if (auto const err = credentials::checkFields(ctx.tx, ctx.j);
|
||||||
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return preflight2(ctx);
|
return preflight2(ctx);
|
||||||
@@ -241,7 +242,8 @@ DeleteAccount::preclaim(PreclaimContext const& ctx)
|
|||||||
return tecDST_TAG_NEEDED;
|
return tecDST_TAG_NEEDED;
|
||||||
|
|
||||||
// If credentials are provided - check them anyway
|
// If credentials are provided - check them anyway
|
||||||
if (auto const err = credentials::valid(ctx, account); !isTesSuccess(err))
|
if (auto const err = credentials::valid(ctx.tx, ctx.view, account, ctx.j);
|
||||||
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
// if credentials then postpone auth check to doApply, to check for expired
|
// if credentials then postpone auth check to doApply, to check for expired
|
||||||
@@ -376,7 +378,8 @@ DeleteAccount::doApply()
|
|||||||
if (ctx_.view().rules().enabled(featureDepositAuth) &&
|
if (ctx_.view().rules().enabled(featureDepositAuth) &&
|
||||||
ctx_.tx.isFieldPresent(sfCredentialIDs))
|
ctx_.tx.isFieldPresent(sfCredentialIDs))
|
||||||
{
|
{
|
||||||
if (auto err = verifyDepositPreauth(ctx_, account_, dstID, dst);
|
if (auto err = verifyDepositPreauth(
|
||||||
|
ctx_.tx, ctx_.view(), account_, dstID, dst, ctx_.journal);
|
||||||
!isTesSuccess(err))
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -672,7 +672,8 @@ EscrowFinish::preflight(PreflightContext const& ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto const err = credentials::checkFields(ctx); !isTesSuccess(err))
|
if (auto const err = credentials::checkFields(ctx.tx, ctx.j);
|
||||||
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return tesSUCCESS;
|
return tesSUCCESS;
|
||||||
@@ -761,7 +762,8 @@ EscrowFinish::preclaim(PreclaimContext const& ctx)
|
|||||||
{
|
{
|
||||||
if (ctx.view.rules().enabled(featureCredentials))
|
if (ctx.view.rules().enabled(featureCredentials))
|
||||||
{
|
{
|
||||||
if (auto const err = credentials::valid(ctx, ctx.tx[sfAccount]);
|
if (auto const err =
|
||||||
|
credentials::valid(ctx.tx, ctx.view, ctx.tx[sfAccount], ctx.j);
|
||||||
!isTesSuccess(err))
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -1107,7 +1109,8 @@ EscrowFinish::doApply()
|
|||||||
|
|
||||||
if (ctx_.view().rules().enabled(featureDepositAuth))
|
if (ctx_.view().rules().enabled(featureDepositAuth))
|
||||||
{
|
{
|
||||||
if (auto err = verifyDepositPreauth(ctx_, account_, destID, sled);
|
if (auto err = verifyDepositPreauth(
|
||||||
|
ctx_.tx, ctx_.view(), account_, destID, sled, ctx_.journal);
|
||||||
!isTesSuccess(err))
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -473,7 +473,8 @@ PayChanClaim::preflight(PreflightContext const& ctx)
|
|||||||
return temBAD_SIGNATURE;
|
return temBAD_SIGNATURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto const err = credentials::checkFields(ctx); !isTesSuccess(err))
|
if (auto const err = credentials::checkFields(ctx.tx, ctx.j);
|
||||||
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return preflight2(ctx);
|
return preflight2(ctx);
|
||||||
@@ -485,7 +486,8 @@ PayChanClaim::preclaim(PreclaimContext const& ctx)
|
|||||||
if (!ctx.view.rules().enabled(featureCredentials))
|
if (!ctx.view.rules().enabled(featureCredentials))
|
||||||
return Transactor::preclaim(ctx);
|
return Transactor::preclaim(ctx);
|
||||||
|
|
||||||
if (auto const err = credentials::valid(ctx, ctx.tx[sfAccount]);
|
if (auto const err =
|
||||||
|
credentials::valid(ctx.tx, ctx.view, ctx.tx[sfAccount], ctx.j);
|
||||||
!isTesSuccess(err))
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -554,7 +556,8 @@ PayChanClaim::doApply()
|
|||||||
|
|
||||||
if (depositAuth)
|
if (depositAuth)
|
||||||
{
|
{
|
||||||
if (auto err = verifyDepositPreauth(ctx_, txAccount, dst, sled);
|
if (auto err = verifyDepositPreauth(
|
||||||
|
ctx_.tx, ctx_.view(), txAccount, dst, sled, ctx_.journal);
|
||||||
!isTesSuccess(err))
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -238,7 +238,8 @@ Payment::preflight(PreflightContext const& ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto const err = credentials::checkFields(ctx); !isTesSuccess(err))
|
if (auto const err = credentials::checkFields(ctx.tx, ctx.j);
|
||||||
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
return preflight2(ctx);
|
return preflight2(ctx);
|
||||||
@@ -358,7 +359,8 @@ Payment::preclaim(PreclaimContext const& ctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto const err = credentials::valid(ctx, ctx.tx[sfAccount]);
|
if (auto const err =
|
||||||
|
credentials::valid(ctx.tx, ctx.view, ctx.tx[sfAccount], ctx.j);
|
||||||
!isTesSuccess(err))
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -450,8 +452,13 @@ Payment::doApply()
|
|||||||
// 1. If Account == Destination, or
|
// 1. If Account == Destination, or
|
||||||
// 2. If Account is deposit preauthorized by destination.
|
// 2. If Account is deposit preauthorized by destination.
|
||||||
|
|
||||||
if (auto err =
|
if (auto err = verifyDepositPreauth(
|
||||||
verifyDepositPreauth(ctx_, account_, dstAccountID, sleDst);
|
ctx_.tx,
|
||||||
|
ctx_.view(),
|
||||||
|
account_,
|
||||||
|
dstAccountID,
|
||||||
|
sleDst,
|
||||||
|
ctx_.journal);
|
||||||
!isTesSuccess(err))
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -521,8 +528,13 @@ Payment::doApply()
|
|||||||
ter != tesSUCCESS)
|
ter != tesSUCCESS)
|
||||||
return ter;
|
return ter;
|
||||||
|
|
||||||
if (auto err =
|
if (auto err = verifyDepositPreauth(
|
||||||
verifyDepositPreauth(ctx_, account_, dstAccountID, sleDst);
|
ctx_.tx,
|
||||||
|
ctx_.view(),
|
||||||
|
account_,
|
||||||
|
dstAccountID,
|
||||||
|
sleDst,
|
||||||
|
ctx_.journal);
|
||||||
!isTesSuccess(err))
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
@@ -644,8 +656,13 @@ Payment::doApply()
|
|||||||
if (dstAmount > dstReserve ||
|
if (dstAmount > dstReserve ||
|
||||||
sleDst->getFieldAmount(sfBalance) > dstReserve)
|
sleDst->getFieldAmount(sfBalance) > dstReserve)
|
||||||
{
|
{
|
||||||
if (auto err =
|
if (auto err = verifyDepositPreauth(
|
||||||
verifyDepositPreauth(ctx_, account_, dstAccountID, sleDst);
|
ctx_.tx,
|
||||||
|
ctx_.view(),
|
||||||
|
account_,
|
||||||
|
dstAccountID,
|
||||||
|
sleDst,
|
||||||
|
ctx_.journal);
|
||||||
!isTesSuccess(err))
|
!isTesSuccess(err))
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user