Skip to content

Commit 0c5a69e

Browse files
committed
Merge branch 'release/1.0.4'
2 parents d2c870d + ec5d1eb commit 0c5a69e

File tree

105 files changed

+7996
-6335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+7996
-6335
lines changed

.githooks/pre-commit

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
exec 1>&2
4+
5+
# paths to check and re-format
6+
sources="src unittests"
7+
formatter="clang-format -i"
8+
9+
first=$(git diff $sources)
10+
find $sources -type f \( -name '*.cpp' -o -name '*.h' -o -name '*.ipp' \) -print0 | xargs -0 $formatter
11+
second=$(git diff $sources)
12+
changes=$(diff <(echo "$first") <(echo "$second") | wc -l | sed -e 's/^[[:space:]]*//')
13+
14+
if [ "$changes" != "0" ]; then
15+
cat <<\EOF
16+
17+
WARNING
18+
-----------------------------------------------------------------------------
19+
Automatically re-formatted code with `clang-format` - commit was aborted.
20+
Please manually add any updated files and commit again.
21+
-----------------------------------------------------------------------------
22+
23+
EOF
24+
exit 1
25+
fi

.github/workflows/build.yml

Lines changed: 56 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Build Clio
22
on:
33
push:
4-
branches: [master, release, develop, develop-next]
4+
branches: [master, release/*, develop, develop-next]
55
pull_request:
6-
branches: [master, release, develop, develop-next]
6+
branches: [master, release/*, develop, develop-next]
77
workflow_dispatch:
88

99
jobs:
@@ -29,6 +29,7 @@ jobs:
2929
- suffix: rpm
3030
image: rippleci/clio-rpm-builder:2022-09-17
3131
script: rpm
32+
3233
container:
3334
image: ${{ matrix.type.image }}
3435

@@ -67,59 +68,63 @@ jobs:
6768
name: clio_tests-${{ matrix.type.suffix }}
6869
path: ${{ github.workspace }}/clio_tests
6970

70-
sign:
71-
name: Sign packages
72-
needs: build_clio
73-
runs-on: ubuntu-20.04
74-
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/release' || github.ref == 'refs/heads/develop'
75-
env:
76-
GPG_KEY_B64: ${{ secrets.GPG_KEY_B64 }}
77-
GPG_KEY_PASS_B64: ${{ secrets.GPG_KEY_PASS_B64 }}
71+
build_dev:
72+
name: ${{ matrix.os.name }} test
73+
needs: lint
74+
continue-on-error: ${{ matrix.os.experimental }}
7875
strategy:
7976
fail-fast: false
8077
matrix:
81-
type:
82-
- suffix: deb
83-
image: ubuntu:20.04
84-
script: dpkg
85-
# - suffix: rpm
86-
# image: centos:7
87-
# script: rpm
88-
container:
89-
image: ${{ matrix.type.image }}
90-
steps:
91-
- uses: actions/checkout@v3
92-
- name: Install dpkg-sig
93-
run: |
94-
apt-get update && apt-get install -y dpkg-sig gnupg
95-
- name: Get package artifact
96-
uses: actions/download-artifact@v3
97-
with:
98-
name: clio_${{ matrix.type.suffix }}_packages
99-
100-
- name: find packages
101-
run: find . -name "*.${{ matrix.type.suffix }}"
102-
103-
- name: Sign packages
104-
uses: ./.github/actions/sign
105-
78+
os:
79+
- name: ubuntu-22.04
80+
experimental: true
81+
- name: macos-11
82+
experimental: true
83+
- name: macos-12
84+
experimental: false
85+
runs-on: ${{ matrix.os.name }}
10686

107-
- name: Verify the signature
108-
run: |
109-
set -e
110-
for PKG in $(ls *.deb); do
111-
gpg --verify "${PKG}"
112-
done
113-
114-
- name: Get short SHA
115-
id: shortsha
116-
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
117-
118-
- name: Artifact signed packages
119-
uses: actions/upload-artifact@v2
120-
with:
121-
name: signed-clio-deb-packages-${{ steps.shortsha.outputs.sha8 }}
122-
path: ${{ github.workspace }}/*.deb
87+
steps:
88+
- uses: actions/checkout@v3
89+
with:
90+
path: clio
91+
92+
- name: Check Boost cache
93+
id: boost
94+
uses: actions/cache@v3
95+
with:
96+
path: boost
97+
key: ${{ runner.os }}-boost
98+
99+
- name: Build boost
100+
if: steps.boost.outputs.cache-hit != 'true'
101+
run: |
102+
curl -s -OJL "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.gz"
103+
tar zxf boost_1_77_0.tar.gz
104+
mv boost_1_77_0 boost
105+
cd boost
106+
./bootstrap.sh
107+
if [[ ${{ matrix.os.name }} =~ mac ]];then
108+
mac_flags='cxxflags="-std=c++14"'
109+
fi
110+
./b2 ${mac_flags}
111+
112+
- name: install deps
113+
run: |
114+
if [[ ${{ matrix.os.name }} =~ mac ]];then
115+
brew install pkg-config protobuf openssl ninja cassandra-cpp-driver bison
116+
elif [[ ${{matrix.os.name }} =~ ubuntu ]];then
117+
sudo apt-get -y install git pkg-config protobuf-compiler libprotobuf-dev libssl-dev wget build-essential doxygen bison flex autoconf clang-format
118+
fi
119+
120+
- name: Build clio
121+
run: |
122+
export BOOST_ROOT=$(pwd)/boost
123+
cd clio
124+
cmake -B build
125+
if ! cmake --build build -j$(nproc); then
126+
echo '# 🔥${{ matrix.os.name }}🔥 failed!💥' >> $GITHUB_STEP_SUMMARY
127+
fi
123128
124129
test_clio:
125130
name: Test Clio

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
build/
33
.vscode
44
.python-version
5+
config.json

CMake/deps/Postgres.cmake

Lines changed: 0 additions & 31 deletions
This file was deleted.

CMake/deps/SourceLocation.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
include(CheckIncludeFileCXX)
2+
3+
check_include_file_cxx("source_location" SOURCE_LOCATION_AVAILABLE)
4+
if(SOURCE_LOCATION_AVAILABLE)
5+
target_compile_definitions(clio PUBLIC "HAS_SOURCE_LOCATION")
6+
endif()
7+
8+
check_include_file_cxx("experimental/source_location" EXPERIMENTAL_SOURCE_LOCATION_AVAILABLE)
9+
if(EXPERIMENTAL_SOURCE_LOCATION_AVAILABLE)
10+
target_compile_definitions(clio PUBLIC "HAS_EXPERIMENTAL_SOURCE_LOCATION")
11+
endif()

CMake/deps/gtest.cmake

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ if(NOT googletest_POPULATED)
1010
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
1111
endif()
1212

13-
target_link_libraries(clio_tests PUBLIC clio gtest_main)
13+
target_link_libraries(clio_tests PUBLIC clio gmock_main)
14+
target_include_directories(clio_tests PRIVATE unittests)
1415

1516
enable_testing()
1617

CMake/install/clio.service.in

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ExecStart=@CLIO_INSTALL_DIR@/bin/clio_server @CLIO_INSTALL_DIR@/etc/config.json
1111
Restart=on-failure
1212
User=clio
1313
Group=clio
14+
LimitNOFILE=65536
1415

1516
[Install]
16-
WantedBy=multi-user.target
17+
WantedBy=multi-user.target

CMake/settings.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-narrowing -Wall -Werror -Wno-dangling-else")
1+
target_compile_options(clio
2+
PUBLIC -Wall
3+
-Werror
4+
-Wno-narrowing
5+
-Wno-deprecated-declarations
6+
-Wno-dangling-else)

CMakeLists.txt

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ if(NOT GIT_COMMIT_HASH)
2020
endif()
2121
find_package(Git)
2222
if(Git_FOUND)
23-
execute_process(COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8
24-
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE gch)
25-
if(gch)
26-
set(GIT_COMMIT_HASH "${gch}")
27-
message(STATUS "Git commit: ${GIT_COMMIT_HASH}")
28-
add_definitions(-DCLIO_GIT_COMMIT_HASH="${GIT_COMMIT_HASH}")
23+
execute_process(COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
24+
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE git-ref)
25+
if(git-ref)
26+
set(BUILD "${git-ref}")
27+
message(STATUS "Build version: ${BUILD}")
28+
add_definitions(-DCLIO_BUILD="${BUILD}")
2929
endif()
3030
endif()
3131
endif() #git
32+
if(PACKAGING)
33+
add_definitions(-DPKG=1)
34+
endif()
3235

3336
add_library(clio)
3437
target_compile_features(clio PUBLIC cxx_std_20)
@@ -41,16 +44,14 @@ include(CMake/ClioVersion.cmake)
4144
include(CMake/deps/rippled.cmake)
4245
include(CMake/deps/Boost.cmake)
4346
include(CMake/deps/cassandra.cmake)
44-
include(CMake/deps/Postgres.cmake)
47+
include(CMake/deps/SourceLocation.cmake)
4548

4649
target_sources(clio PRIVATE
4750
## Main
4851
src/main/impl/Build.cpp
4952
## Backend
5053
src/backend/BackendInterface.cpp
5154
src/backend/CassandraBackend.cpp
52-
src/backend/Pg.cpp
53-
src/backend/PostgresBackend.cpp
5455
src/backend/SimpleCache.cpp
5556
## ETL
5657
src/etl/ETLSource.cpp
@@ -60,6 +61,7 @@ target_sources(clio PRIVATE
6061
## Subscriptions
6162
src/subscriptions/SubscriptionManager.cpp
6263
## RPC
64+
src/rpc/Errors.cpp
6365
src/rpc/RPC.cpp
6466
src/rpc/RPCHelpers.cpp
6567
src/rpc/Counters.cpp
@@ -75,7 +77,9 @@ target_sources(clio PRIVATE
7577
src/rpc/handlers/GatewayBalances.cpp
7678
src/rpc/handlers/NoRippleCheck.cpp
7779
# NFT
80+
src/rpc/handlers/NFTHistory.cpp
7881
src/rpc/handlers/NFTInfo.cpp
82+
src/rpc/handlers/NFTOffers.cpp
7983
# Ledger
8084
src/rpc/handlers/Ledger.cpp
8185
src/rpc/handlers/LedgerData.cpp
@@ -88,23 +92,30 @@ target_sources(clio PRIVATE
8892
# Dex
8993
src/rpc/handlers/BookChanges.cpp
9094
src/rpc/handlers/BookOffers.cpp
91-
# NFT
92-
src/rpc/handlers/NFTOffers.cpp
9395
# Payment Channel
9496
src/rpc/handlers/ChannelAuthorize.cpp
9597
src/rpc/handlers/ChannelVerify.cpp
9698
# Subscribe
9799
src/rpc/handlers/Subscribe.cpp
98100
# Server
99101
src/rpc/handlers/ServerInfo.cpp
100-
# Utility
101-
src/rpc/handlers/Random.cpp)
102+
# Utilities
103+
src/rpc/handlers/Random.cpp
104+
src/config/Config.cpp
105+
src/log/Logger.cpp
106+
src/util/Taggable.cpp)
102107

103108
add_executable(clio_server src/main/main.cpp)
104109
target_link_libraries(clio_server PUBLIC clio)
105110

106111
if(BUILD_TESTS)
107-
add_executable(clio_tests unittests/main.cpp)
112+
add_executable(clio_tests
113+
unittests/RPCErrors.cpp
114+
unittests/Backend.cpp
115+
unittests/Logger.cpp
116+
unittests/Config.cpp
117+
unittests/ProfilerTest.cpp
118+
unittests/DOSGuard.cpp)
108119
include(CMake/deps/gtest.cmake)
109120
endif()
110121

CONTRIBUTING.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ To contribute, please:
1313

1414
> **Note:** Please make sure you read the [Style guide](#style-guide).
1515
16+
## Install git hooks
17+
Please make sure to run the following command in order to use git hooks that are helpful for `clio` development.
18+
19+
``` bash
20+
git config --local core.hooksPath .githooks
21+
```
22+
1623
## Git commands
1724
This sections offers a detailed look at the git commands you will need to use to get your PR submitted.
1825
Please note that there are more than one way to do this and these commands are only provided for your convenience.
@@ -117,7 +124,11 @@ Existing maintainers can resign, or be subject to a vote for removal at the behe
117124
## Existing Maintainers
118125

119126
* [cjcobb23](https://github.com/cjcobb23) (Ripple)
120-
* [natenichols](https://github.com/natenichols) (Ripple)
121127
* [legleux](https://github.com/legleux) (Ripple)
122128
* [undertome](https://github.com/undertome) (Ripple)
123129
* [godexsoft](https://github.com/godexsoft) (Ripple)
130+
* [officialfrancismendoza](https://github.com/officialfrancismendoza) (Ripple)
131+
132+
## Honorable ex-Maintainers
133+
134+
* [natenichols](https://github.com/natenichols) (ex-Ripple)

0 commit comments

Comments
 (0)