Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into action
Browse files Browse the repository at this point in the history
* upstream/develop:
  Rename `allowClawback` flag to `allowTrustLineClawback` (4617)
  Update dependencies (4595)
  • Loading branch information
ximinez committed Jul 14, 2023
2 parents 106596b + 5ba1f98 commit b42edc1
Show file tree
Hide file tree
Showing 26 changed files with 237 additions and 147 deletions.
5 changes: 4 additions & 1 deletion .github/actions/dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ inputs:
runs:
using: composite
steps:
- name: unlock Conan
shell: bash
run: conan remove --locks
- name: export custom recipes
shell: bash
run: |
conan export external/snappy snappy/1.1.9@
conan export external/snappy snappy/1.1.10@
conan export external/soci soci/4.0.3@
- name: install dependencies
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ jobs:
conan --version
cmake --version
env | sort
- name: configure Conan
run : |
conan profile get env.CXXFLAGS default || true
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default
- name: build
uses: ./.github/actions/build
with:
Expand Down
20 changes: 17 additions & 3 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ can't build earlier Boost versions.
which allows you to statically link it with GCC, if you want.

```
conan export external/snappy snappy/1.1.9@
conan export external/snappy snappy/1.1.10@
```

5. Export our [Conan recipe for SOCI](./external/soci).
Expand Down Expand Up @@ -180,7 +180,7 @@ can't build earlier Boost versions.
`$OUTPUT_FOLDER/build/generators/conan_toolchain.cmake`.

Single-config generators:

```
cmake -DCMAKE_TOOLCHAIN_FILE:FILEPATH=build/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
```
Expand Down Expand Up @@ -210,7 +210,7 @@ can't build earlier Boost versions.
```

Multi-config generators:

```
cmake --build . --config Release
cmake --build . --config Debug
Expand Down Expand Up @@ -279,6 +279,18 @@ conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_HAS_STD_INVOKE_R
```


### call to 'async_teardown' is ambiguous

If you are compiling with an early version of Clang 16, then you might hit
a [regression][6] when compiling C++20 that manifests as an [error in a Boost
header][7]. You can workaround it by adding this preprocessor definition:

```
conan profile update 'env.CXXFLAGS="-DBOOST_ASIO_DISABLE_CONCEPTS"' default
conan profile update 'conf.tools.build:cxxflags+=["-DBOOST_ASIO_DISABLE_CONCEPTS"]' default
```


### recompile with -fPIC

If you get a linker error suggesting that you recompile Boost with
Expand Down Expand Up @@ -319,6 +331,8 @@ If you want to experiment with a new package, follow these steps:
[2]: https://en.cppreference.com/w/cpp/compiler_support/20
[3]: https://docs.conan.io/en/latest/getting_started.html
[5]: https://en.wikipedia.org/wiki/Unity_build
[6]: https://github.com/boostorg/beast/issues/2648
[7]: https://github.com/boostorg/beast/issues/2661
[build_type]: https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
[runtime]: https://cmake.org/cmake/help/latest/variable/CMAKE_MSVC_RUNTIME_LIBRARY.html
[toolchain]: https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html
Expand Down
23 changes: 12 additions & 11 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ class Xrpl(ConanFile):
}

requires = [
'boost/1.77.0',
'boost/1.82.0',
'date/3.0.1',
'libarchive/3.6.0',
'lz4/1.9.3',
'grpc/1.50.1',
'libarchive/3.6.2',
'lz4/1.9.3',
'nudb/2.0.8',
'openssl/1.1.1m',
'protobuf/3.21.4',
'snappy/1.1.9',
'openssl/1.1.1u',
'protobuf/3.21.9',
'snappy/1.1.10',
'soci/4.0.3',
'sqlite3/3.38.0',
'zlib/1.2.12',
'sqlite3/3.42.0',
'zlib/1.2.13',
]

default_options = {
Expand All @@ -51,6 +51,7 @@ class Xrpl(ConanFile):
'unity': False,

'cassandra-cpp-driver:shared': False,
'cassandra-cpp-driver:use_atomic': None,
'date:header_only': True,
'grpc:shared': False,
'grpc:secure': True,
Expand Down Expand Up @@ -101,12 +102,12 @@ def configure(self):

def requirements(self):
if self.options.jemalloc:
self.requires('jemalloc/5.2.1')
self.requires('jemalloc/5.3.0')
if self.options.reporting:
self.requires('cassandra-cpp-driver/2.15.3')
self.requires('libpq/13.6')
self.requires('libpq/14.7')
if self.options.rocksdb:
self.requires('rocksdb/6.27.3')
self.requires('rocksdb/6.29.5')

exports_sources = (
'CMakeLists.txt', 'Builds/*', 'bin/getRippledInfo', 'src/*', 'cfg/*'
Expand Down
24 changes: 24 additions & 0 deletions external/snappy/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.1.10":
url: "https://github.com/google/snappy/archive/1.1.10.tar.gz"
sha256: "49d831bffcc5f3d01482340fe5af59852ca2fe76c3e05df0e67203ebbe0f1d90"
"1.1.9":
url: "https://github.com/google/snappy/archive/1.1.9.tar.gz"
sha256: "75c1fbb3d618dd3a0483bff0e26d0a92b495bbe5059c8b4f1c962b478b6e06e7"
Expand All @@ -9,8 +12,29 @@ sources:
url: "https://github.com/google/snappy/archive/1.1.7.tar.gz"
sha256: "3dfa02e873ff51a11ee02b9ca391807f0c8ea0529a4924afa645fbf97163f9d4"
patches:
"1.1.10":
- patch_file: "patches/1.1.10-0001-fix-inlining-failure.patch"
patch_description: "disable inlining for compilation error"
patch_type: "portability"
- patch_file: "patches/1.1.9-0002-no-Werror.patch"
patch_description: "disable 'warning as error' options"
patch_type: "portability"
- patch_file: "patches/1.1.10-0003-fix-clobber-list-older-llvm.patch"
patch_description: "disable inline asm on apple-clang"
patch_type: "portability"
- patch_file: "patches/1.1.9-0004-rtti-by-default.patch"
patch_description: "remove 'disable rtti'"
patch_type: "conan"
"1.1.9":
- patch_file: "patches/1.1.9-0001-fix-inlining-failure.patch"
patch_description: "disable inlining for compilation error"
patch_type: "portability"
- patch_file: "patches/1.1.9-0002-no-Werror.patch"
patch_description: "disable 'warning as error' options"
patch_type: "portability"
- patch_file: "patches/1.1.9-0003-fix-clobber-list-older-llvm.patch"
patch_description: "disable inline asm on apple-clang"
patch_type: "portability"
- patch_file: "patches/1.1.9-0004-rtti-by-default.patch"
patch_description: "remove 'disable rtti'"
patch_type: "conan"
13 changes: 13 additions & 0 deletions external/snappy/patches/1.1.10-0001-fix-inlining-failure.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h
index 1548ed7..3b4a9f3 100644
--- a/snappy-stubs-internal.h
+++ b/snappy-stubs-internal.h
@@ -100,7 +100,7 @@

// Inlining hints.
#if HAVE_ATTRIBUTE_ALWAYS_INLINE
-#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE __attribute__((always_inline))
+#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
#else
#define SNAPPY_ATTRIBUTE_ALWAYS_INLINE
#endif // HAVE_ATTRIBUTE_ALWAYS_INLINE
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/snappy.cc b/snappy.cc
index d414718..e4efb59 100644
--- a/snappy.cc
+++ b/snappy.cc
@@ -1132,7 +1132,7 @@ inline size_t AdvanceToNextTagX86Optimized(const uint8_t** ip_p, size_t* tag) {
size_t literal_len = *tag >> 2;
size_t tag_type = *tag;
bool is_literal;
-#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__)
+#if defined(__GCC_ASM_FLAG_OUTPUTS__) && defined(__x86_64__) && ( (!defined(__clang__) && !defined(__APPLE__)) || (!defined(__APPLE__) && defined(__clang__) && (__clang_major__ >= 9)) || (defined(__APPLE__) && defined(__clang__) && (__clang_major__ > 11)) )
// TODO clang misses the fact that the (c & 3) already correctly
// sets the zero flag.
asm("and $3, %k[tag_type]\n\t"
6 changes: 4 additions & 2 deletions src/ripple/app/tx/impl/Clawback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ Clawback::preclaim(PreclaimContext const& ctx)

std::uint32_t const issuerFlagsIn = sleIssuer->getFieldU32(sfFlags);

// If AllowClawback is not set or NoFreeze is set, return no permission
if (!(issuerFlagsIn & lsfAllowClawback) || (issuerFlagsIn & lsfNoFreeze))
// If AllowTrustLineClawback is not set or NoFreeze is set, return no
// permission
if (!(issuerFlagsIn & lsfAllowTrustLineClawback) ||
(issuerFlagsIn & lsfNoFreeze))
return tecNO_PERMISSION;

auto const sleRippleState =
Expand Down
8 changes: 4 additions & 4 deletions src/ripple/app/tx/impl/SetAccount.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ SetAccount::preclaim(PreclaimContext const& ctx)
//
if (ctx.view.rules().enabled(featureClawback))
{
if (uSetFlag == asfAllowClawback)
if (uSetFlag == asfAllowTrustLineClawback)
{
if (uFlagsIn & lsfNoFreeze)
{
Expand All @@ -240,7 +240,7 @@ SetAccount::preclaim(PreclaimContext const& ctx)
else if (uSetFlag == asfNoFreeze)
{
// Cannot set NoFreeze if clawback is enabled
if (uFlagsIn & lsfAllowClawback)
if (uFlagsIn & lsfAllowTrustLineClawback)
{
JLOG(ctx.j.trace())
<< "Can't set NoFreeze if clawback is enabled";
Expand Down Expand Up @@ -595,10 +595,10 @@ SetAccount::doApply()

// Set flag for clawback
if (ctx_.view().rules().enabled(featureClawback) &&
uSetFlag == asfAllowClawback)
uSetFlag == asfAllowTrustLineClawback)
{
JLOG(j_.trace()) << "set allow clawback";
uFlagsOut |= lsfAllowClawback;
uFlagsOut |= lsfAllowTrustLineClawback;
}

if (uFlagsIn != uFlagsOut)
Expand Down
1 change: 1 addition & 0 deletions src/ripple/basics/RangeSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

#include <optional>
#include <string>
#include <vector>

namespace ripple {

Expand Down
3 changes: 3 additions & 0 deletions src/ripple/consensus/Consensus.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
#include <ripple/consensus/LedgerTiming.h>
#include <ripple/json/json_writer.h>
#include <boost/logic/tribool.hpp>

#include <chrono>
#include <deque>
#include <optional>
#include <sstream>

Expand Down
7 changes: 3 additions & 4 deletions src/ripple/json/impl/json_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ namespace Json {
// Implementation of class Reader
// ////////////////////////////////

constexpr unsigned Reader::nest_limit;

static std::string
codePointToUTF8(unsigned int cp)
{
Expand Down Expand Up @@ -924,8 +922,9 @@ Reader::getLocationLineAndColumn(Location location) const
{
int line, column;
getLocationLineAndColumn(location, line, column);
char buffer[18 + 16 + 16 + 1];
sprintf(buffer, "Line %d, Column %d", line, column);
constexpr std::size_t n = 18 + 16 + 16 + 1;
char buffer[n];
snprintf(buffer, n, "Line %d, Column %d", line, column);
return buffer;
}

Expand Down
4 changes: 4 additions & 0 deletions src/ripple/net/HTTPClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@
#include <ripple/core/Config.h>
#include <boost/asio/io_service.hpp>
#include <boost/asio/streambuf.hpp>

#include <chrono>
#include <deque>
#include <functional>
#include <string>

namespace ripple {

Expand Down
24 changes: 13 additions & 11 deletions src/ripple/overlay/impl/Handshake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <ripple/beast/rfc2616.h>
#include <ripple/overlay/impl/Handshake.h>
#include <ripple/protocol/digest.h>

#include <boost/regex.hpp>

#include <algorithm>
#include <chrono>

Expand All @@ -44,7 +46,7 @@ getFeatureValue(
return {};
boost::smatch match;
boost::regex rx(feature + "=([^;\\s]+)");
auto const value = header->value().to_string();
std::string const value = header->value();
if (boost::regex_search(value, match, rx))
return {match[1]};
return {};
Expand Down Expand Up @@ -233,15 +235,15 @@ verifyHandshake(
{
if (auto const iter = headers.find("Server-Domain"); iter != headers.end())
{
if (!isProperlyFormedTomlDomain(iter->value().to_string()))
if (!isProperlyFormedTomlDomain(iter->value()))
throw std::runtime_error("Invalid server domain");
}

if (auto const iter = headers.find("Network-ID"); iter != headers.end())
{
std::uint32_t nid;

if (!beast::lexicalCastChecked(nid, iter->value().to_string()))
if (!beast::lexicalCastChecked(nid, std::string(iter->value())))
throw std::runtime_error("Invalid peer network identifier");

if (networkID && nid != *networkID)
Expand All @@ -251,7 +253,7 @@ verifyHandshake(
if (auto const iter = headers.find("Network-Time"); iter != headers.end())
{
auto const netTime =
[str = iter->value().to_string()]() -> TimeKeeper::time_point {
[str = std::string(iter->value())]() -> TimeKeeper::time_point {
TimeKeeper::duration::rep val;

if (beast::lexicalCastChecked(val, str))
Expand Down Expand Up @@ -286,8 +288,8 @@ verifyHandshake(
PublicKey const publicKey = [&headers] {
if (auto const iter = headers.find("Public-Key"); iter != headers.end())
{
auto pk = parseBase58<PublicKey>(
TokenType::NodePublic, iter->value().to_string());
auto pk =
parseBase58<PublicKey>(TokenType::NodePublic, iter->value());

if (pk)
{
Expand All @@ -313,7 +315,7 @@ verifyHandshake(
if (iter == headers.end())
throw std::runtime_error("No session signature specified");

auto sig = base64_decode(iter->value().to_string());
auto sig = base64_decode(iter->value());

if (!verifyDigest(publicKey, sharedValue, makeSlice(sig), false))
throw std::runtime_error("Failed to verify session");
Expand All @@ -325,8 +327,8 @@ verifyHandshake(
if (auto const iter = headers.find("Local-IP"); iter != headers.end())
{
boost::system::error_code ec;
auto const local_ip = boost::asio::ip::address::from_string(
iter->value().to_string(), ec);
auto const local_ip =
boost::asio::ip::address::from_string(iter->value(), ec);

if (ec)
throw std::runtime_error("Invalid Local-IP");
Expand All @@ -340,8 +342,8 @@ verifyHandshake(
if (auto const iter = headers.find("Remote-IP"); iter != headers.end())
{
boost::system::error_code ec;
auto const remote_ip = boost::asio::ip::address::from_string(
iter->value().to_string(), ec);
auto const remote_ip =
boost::asio::ip::address::from_string(iter->value(), ec);

if (ec)
throw std::runtime_error("Invalid Remote-IP");
Expand Down
Loading

0 comments on commit b42edc1

Please sign in to comment.