Merge branch 'develop' into ximinez/online-delete-gaps

This commit is contained in:
Ed Hennis
2025-07-18 18:33:10 -04:00
committed by GitHub
15 changed files with 79 additions and 163 deletions

View File

@@ -12,7 +12,6 @@ runs:
conan export --version 1.1.10 external/snappy
conan export --version 9.7.3 external/rocksdb
conan export --version 4.0.3 external/soci
conan export --version 2.0.8 external/nudb
- name: add Ripple Conan remote
if: env.CONAN_URL != ''
shell: bash

View File

@@ -96,7 +96,6 @@ jobs:
conan export --version 1.1.10 external/snappy
conan export --version 9.7.3 external/rocksdb
conan export --version 4.0.3 external/soci
conan export --version 2.0.8 external/nudb
- name: add Ripple Conan remote
if: env.CONAN_URL != ''
shell: bash

View File

@@ -164,6 +164,16 @@ jobs:
generator: Ninja
configuration: ${{ matrix.configuration }}
cmake-args: "-Dassert=TRUE -Dwerr=TRUE ${{ matrix.cmake-args }}"
- name: check linking
run: |
cd ${build_dir}
ldd ./rippled
if [ "$(ldd ./rippled | grep -E '(libstdc\+\+|libgcc)' | wc -l)" -eq 0 ]; then
echo 'The binary is statically linked.'
else
echo 'The binary is dynamically linked.'
exit 1
fi
- name: test
run: |
cd ${build_dir}
@@ -220,6 +230,7 @@ jobs:
cd ${build_dir}
./rippled --unittest --unittest-jobs $(nproc)
ctest -j $(nproc) --output-on-failure
coverage:
strategy:
fail-fast: false
@@ -296,7 +307,6 @@ jobs:
attempt_limit: 5
attempt_delay: 210000 # in milliseconds
conan:
needs: dependencies
runs-on: [self-hosted, heavy]
@@ -313,7 +323,6 @@ jobs:
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093
with:
name: ${{ env.platform }}-${{ env.compiler }}-${{ env.configuration }}
- name: extract cache
run: |
mkdir -p ${CONAN_HOME}

View File

@@ -92,7 +92,6 @@ jobs:
conan export --version 1.1.10 external/snappy
conan export --version 9.7.3 external/rocksdb
conan export --version 4.0.3 external/soci
conan export --version 2.0.8 external/nudb
- name: add Ripple Conan remote
if: env.CONAN_URL != ''
shell: bash

View File

@@ -167,8 +167,6 @@ It does not explicitly link the C++ standard library,
which allows you to statically link it with GCC, if you want.
```
# Conan 1.x
conan export external/snappy snappy/1.1.10@
# Conan 2.x
conan export --version 1.1.10 external/snappy
```
@@ -177,8 +175,6 @@ Export our [Conan recipe for RocksDB](./external/rocksdb).
It does not override paths to dependencies when building with Visual Studio.
```
# Conan 1.x
conan export external/rocksdb rocksdb/9.7.3@
# Conan 2.x
conan export --version 9.7.3 external/rocksdb
```
@@ -187,23 +183,10 @@ Export our [Conan recipe for SOCI](./external/soci).
It patches their CMake to correctly import its dependencies.
```
# Conan 1.x
conan export external/soci soci/4.0.3@
# Conan 2.x
conan export --version 4.0.3 external/soci
```
Export our [Conan recipe for NuDB](./external/nudb).
It fixes some source files to add missing `#include`s.
```
# Conan 1.x
conan export external/nudb nudb/2.0.8@
# Conan 2.x
conan export --version 2.0.8 external/nudb
```
### Build and Test
1. Create a build directory and move into it.

View File

@@ -25,9 +25,9 @@ class Xrpl(ConanFile):
requires = [
'grpc/1.50.1',
'libarchive/3.7.6',
'nudb/2.0.8',
'openssl/1.1.1v',
'libarchive/3.8.1',
'nudb/2.0.9',
'openssl/1.1.1w',
'soci/4.0.3',
'zlib/1.3.1',
]
@@ -37,7 +37,7 @@ class Xrpl(ConanFile):
]
tool_requires = [
'protobuf/3.21.9',
'protobuf/3.21.12',
]
default_options = {
@@ -105,15 +105,15 @@ class Xrpl(ConanFile):
# Conan 2 requires transitive headers to be specified
transitive_headers_opt = {'transitive_headers': True} if conan_version.split('.')[0] == '2' else {}
self.requires('boost/1.83.0', force=True, **transitive_headers_opt)
self.requires('date/3.0.3', **transitive_headers_opt)
self.requires('date/3.0.4', **transitive_headers_opt)
self.requires('lz4/1.10.0', force=True)
self.requires('protobuf/3.21.9', force=True)
self.requires('sqlite3/3.47.0', force=True)
self.requires('protobuf/3.21.12', force=True)
self.requires('sqlite3/3.49.1', force=True)
if self.options.jemalloc:
self.requires('jemalloc/5.3.0')
if self.options.rocksdb:
self.requires('rocksdb/9.7.3')
self.requires('xxhash/0.8.2', **transitive_headers_opt)
self.requires('xxhash/0.8.3', **transitive_headers_opt)
exports_sources = (
'CMakeLists.txt',

View File

@@ -1,10 +0,0 @@
sources:
"2.0.8":
url: "https://github.com/CPPAlliance/NuDB/archive/2.0.8.tar.gz"
sha256: "9b71903d8ba111cd893ab064b9a8b6ac4124ed8bd6b4f67250205bc43c7f13a8"
patches:
"2.0.8":
- patch_file: "patches/2.0.8-0001-add-include-stdexcept-for-msvc.patch"
patch_description: "Fix build for MSVC by including stdexcept"
patch_type: "portability"
patch_source: "https://github.com/cppalliance/NuDB/pull/100/files"

View File

@@ -1,72 +0,0 @@
import os
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
from conan.tools.layout import basic_layout
required_conan_version = ">=1.52.0"
class NudbConan(ConanFile):
name = "nudb"
description = "A fast key/value insert-only database for SSD drives in C++11"
license = "BSL-1.0"
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/CPPAlliance/NuDB"
topics = ("header-only", "KVS", "insert-only")
package_type = "header-library"
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True
@property
def _min_cppstd(self):
return 11
def export_sources(self):
export_conandata_patches(self)
def layout(self):
basic_layout(self, src_folder="src")
def requirements(self):
self.requires("boost/1.83.0")
def package_id(self):
self.info.clear()
def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, self._min_cppstd)
def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
def build(self):
apply_conandata_patches(self)
def package(self):
copy(self, "LICENSE*",
dst=os.path.join(self.package_folder, "licenses"),
src=self.source_folder)
copy(self, "*",
dst=os.path.join(self.package_folder, "include"),
src=os.path.join(self.source_folder, "include"))
def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []
self.cpp_info.set_property("cmake_target_name", "NuDB")
self.cpp_info.set_property("cmake_target_aliases", ["NuDB::nudb"])
self.cpp_info.set_property("cmake_find_mode", "both")
self.cpp_info.components["core"].set_property("cmake_target_name", "nudb")
self.cpp_info.components["core"].names["cmake_find_package"] = "nudb"
self.cpp_info.components["core"].names["cmake_find_package_multi"] = "nudb"
self.cpp_info.components["core"].requires = ["boost::thread", "boost::system"]
# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.names["cmake_find_package"] = "NuDB"
self.cpp_info.names["cmake_find_package_multi"] = "NuDB"

View File

@@ -1,24 +0,0 @@
diff --git a/include/nudb/detail/stream.hpp b/include/nudb/detail/stream.hpp
index 6c07bf1..e0ce8ed 100644
--- a/include/nudb/detail/stream.hpp
+++ b/include/nudb/detail/stream.hpp
@@ -14,6 +14,7 @@
#include <cstdint>
#include <cstring>
#include <memory>
+#include <stdexcept>
namespace nudb {
namespace detail {
diff --git a/include/nudb/impl/context.ipp b/include/nudb/impl/context.ipp
index beb7058..ffde0b3 100644
--- a/include/nudb/impl/context.ipp
+++ b/include/nudb/impl/context.ipp
@@ -9,6 +9,7 @@
#define NUDB_IMPL_CONTEXT_IPP
#include <nudb/detail/store_base.hpp>
+#include <stdexcept>
namespace nudb {

View File

@@ -169,6 +169,8 @@ enum warning_code_i {
warnRPC_AMENDMENT_BLOCKED = 1002,
warnRPC_EXPIRED_VALIDATOR_LIST = 1003,
// unused = 1004
warnRPC_FIELDS_DEPRECATED = 2004, // rippled needs to maintain
// compatibility with Clio on this code.
};
//------------------------------------------------------------------------------

View File

@@ -711,6 +711,7 @@ class LedgerRPC_test : public beast::unit_test::suite
env.close();
std::string index;
int hashesLedgerEntryIndex = -1;
{
Json::Value jvParams;
jvParams[jss::ledger_index] = 3u;
@@ -721,11 +722,27 @@ class LedgerRPC_test : public beast::unit_test::suite
env.rpc("json", "ledger", to_string(jvParams))[jss::result];
BEAST_EXPECT(jrr[jss::ledger].isMember(jss::accountState));
BEAST_EXPECT(jrr[jss::ledger][jss::accountState].isArray());
BEAST_EXPECT(jrr[jss::ledger][jss::accountState].size() == 1u);
for (auto i = 0; i < jrr[jss::ledger][jss::accountState].size();
i++)
if (jrr[jss::ledger][jss::accountState][i]["LedgerEntryType"] ==
jss::LedgerHashes)
{
index = jrr[jss::ledger][jss::accountState][i]["index"]
.asString();
hashesLedgerEntryIndex = i;
}
for (auto const& object : jrr[jss::ledger][jss::accountState])
if (object["LedgerEntryType"] == jss::LedgerHashes)
index = object["index"].asString();
// jss::type is a deprecated field
BEAST_EXPECT(
jrr[jss::ledger][jss::accountState][0u]["LedgerEntryType"] ==
jss::LedgerHashes);
index = jrr[jss::ledger][jss::accountState][0u]["index"].asString();
jrr.isMember(jss::warnings) && jrr[jss::warnings].isArray() &&
jrr[jss::warnings].size() == 1 &&
jrr[jss::warnings][0u][jss::id].asInt() ==
warnRPC_FIELDS_DEPRECATED);
}
{
Json::Value jvParams;
@@ -737,8 +754,17 @@ class LedgerRPC_test : public beast::unit_test::suite
env.rpc("json", "ledger", to_string(jvParams))[jss::result];
BEAST_EXPECT(jrr[jss::ledger].isMember(jss::accountState));
BEAST_EXPECT(jrr[jss::ledger][jss::accountState].isArray());
BEAST_EXPECT(jrr[jss::ledger][jss::accountState].size() == 1u);
BEAST_EXPECT(jrr[jss::ledger][jss::accountState][0u] == index);
BEAST_EXPECT(
hashesLedgerEntryIndex > 0 &&
jrr[jss::ledger][jss::accountState][hashesLedgerEntryIndex] ==
index);
// jss::type is a deprecated field
BEAST_EXPECT(
jrr.isMember(jss::warnings) && jrr[jss::warnings].isArray() &&
jrr[jss::warnings].size() == 1 &&
jrr[jss::warnings][0u][jss::id].asInt() ==
warnRPC_FIELDS_DEPRECATED);
}
}

View File

@@ -37,9 +37,8 @@ struct LedgerFill
ReadView const& l,
RPC::Context* ctx,
int o = 0,
std::vector<TxQ::TxDetails> q = {},
LedgerEntryType t = ltANY)
: ledger(l), options(o), txQueue(std::move(q)), type(t), context(ctx)
std::vector<TxQ::TxDetails> q = {})
: ledger(l), options(o), txQueue(std::move(q)), context(ctx)
{
if (context)
closeTime = context->ledgerMaster.getCloseTimeBySeq(ledger.seq());
@@ -58,7 +57,6 @@ struct LedgerFill
ReadView const& ledger;
int options;
std::vector<TxQ::TxDetails> txQueue;
LedgerEntryType type;
RPC::Context* context;
std::optional<NetClock::time_point> closeTime;
};

View File

@@ -268,19 +268,16 @@ fillJsonState(Object& json, LedgerFill const& fill)
for (auto const& sle : ledger.sles)
{
if (fill.type == ltANY || sle->getType() == fill.type)
if (binary)
{
if (binary)
{
auto&& obj = appendObject(array);
obj[jss::hash] = to_string(sle->key());
obj[jss::tx_blob] = serializeHex(*sle);
}
else if (expanded)
array.append(sle->getJson(JsonOptions::none));
else
array.append(to_string(sle->key()));
auto&& obj = appendObject(array);
obj[jss::hash] = to_string(sle->key());
obj[jss::tx_blob] = serializeHex(*sle);
}
else if (expanded)
array.append(sle->getJson(JsonOptions::none));
else
array.append(to_string(sle->key()));
}
}

View File

@@ -54,10 +54,6 @@ LedgerHandler::check()
bool const binary = params[jss::binary].asBool();
bool const owner_funds = params[jss::owner_funds].asBool();
bool const queue = params[jss::queue].asBool();
auto type = chooseLedgerEntryType(params);
if (type.first)
return type.first;
type_ = type.second;
options_ = (full ? LedgerFill::full : 0) |
(expand ? LedgerFill::expand : 0) |

View File

@@ -76,7 +76,6 @@ private:
std::vector<TxQ::TxDetails> queueTxs_;
Json::Value result_;
int options_ = 0;
LedgerEntryType type_;
};
////////////////////////////////////////////////////////////////////////////////
@@ -91,7 +90,7 @@ LedgerHandler::writeResult(Object& value)
if (ledger_)
{
Json::copyFrom(value, result_);
addJson(value, {*ledger_, &context_, options_, queueTxs_, type_});
addJson(value, {*ledger_, &context_, options_, queueTxs_});
}
else
{
@@ -105,6 +104,21 @@ LedgerHandler::writeResult(Object& value)
addJson(open, {*master.getCurrentLedger(), &context_, 0});
}
}
Json::Value warnings{Json::arrayValue};
if (context_.params.isMember(jss::type))
{
Json::Value& w = warnings.append(Json::objectValue);
w[jss::id] = warnRPC_FIELDS_DEPRECATED;
w[jss::message] =
"Some fields from your request are deprecated. Please check the "
"documentation at "
"https://xrpl.org/docs/references/http-websocket-apis/ "
"and update your request. Field `type` is deprecated.";
}
if (warnings.size())
value[jss::warnings] = std::move(warnings);
}
} // namespace RPC