[PATCH 0/3] gnu: fulcrum: Update to 1.9.1.

  • Done
  • quality assurance status badge
Details
2 participants
  • Jean-Pierre De Jesus DIAZ
  • Ludovic Courtès
Owner
unassigned
Submitted by
Jean-Pierre De Jesus DIAZ
Severity
normal
J
J
Jean-Pierre De Jesus DIAZ wrote on 20 Sep 2023 14:37
(address . guix-patches@gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230920123738.1241364-1-jean@foundationdevices.com
This patch series unbundle the code present in Fulcrum while updating it
to 1.9.1. Adds a patch file for this as using the system libraries is
non-trivial to do.

It also changes the origin to use the upstream one instead of the
Flowee's fork of it.

Jean-Pierre De Jesus DIAZ (3):
gnu: Add robin-hood-hashing.
gnu: Add simdjson 0.6.
gnu: fulcrum: Update to 1.9.1.

gnu/packages/cpp.scm | 43 ++++
gnu/packages/finance.scm | 88 +++++---
.../fulcrum-1.9.1-unbundled-libraries.patch | 210 ++++++++++++++++++
3 files changed, 315 insertions(+), 26 deletions(-)
create mode 100644 gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch

--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 20 Sep 2023 14:39
[PATCH 1/3] gnu: Add robin-hood-hashing.
(address . 66120@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230920123933.1241422-1-jean@foundationdevices.com
* gnu/packages/cpp.scm (robin-hood-hashing): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com>
---
gnu/packages/cpp.scm | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)

Toggle diff (49 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 4ee7f375d7..7117ada000 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -37,6 +37,7 @@
;;; Copyright © 2023 Artyom V. Poptsov <poptsov.artyom@gmail.com>
;;; Copyright © 2023 Liliana Marie Prikler <liliana.prikler@gmail.com>
;;; Copyright © 2023 Denis 'GNUtoo' Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -223,6 +224,34 @@ (define-public range-v3
;; Others
license:boost1.0))))
+(define-public robin-hood-hashing
+ (package
+ (name "robin-hood-hashing")
+ (version "3.11.5")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/martinus/robin-hood-hashing")
+ (commit version)))
+ (modules '((guix build utils)))
+ (snippet #~(delete-file-recursively "src/test/thirdparty"))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1qx6i09sp8c3l89mhyaql144nzh2h26ky9ms3n5l85qplx1vv2r7"))))
+ (build-system cmake-build-system)
+ (arguments
+ (list #:tests? #f ;; Needs bundled libraries for tests.
+ ;; By default this option is set to ON and removes the ability to
+ ;; install the library.
+ #:configure-flags
+ #~(list "-DRH_STANDALONE_PROJECT=OFF")))
+ (home-page "https://github.com/martinus/robin-hood-hashing")
+ (synopsis "Unordered set and map data structures library")
+ (description "This library provides a header-only unordered set and map
+data structures for C++.")
+ (license license:expat)))
+
(define-public c++-gsl
(package
(name "c++-gsl")
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 20 Sep 2023 14:39
[PATCH 2/3] gnu: Add simdjson 0.6.
(address . 66120@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230920123933.1241422-2-jean@foundationdevices.com
* gnu/packages/cpp.scm (simdjson-0.6): New variable.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com>
---
gnu/packages/cpp.scm | 14 ++++++++++++++
1 file changed, 14 insertions(+)

Toggle diff (27 lines)
diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 7117ada000..7d9eb2a264 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -2048,6 +2048,20 @@ (define-public simdjson
(home-page "https://github.com/simdjson/simdjson")
(license license:asl2.0)))
+(define-public simdjson-0.6
+ (package
+ (inherit simdjson)
+ (version "0.6.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/simdjson/simdjson")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name (package-name simdjson) version))
+ (sha256
+ (base32
+ "038i9nmk85vpxvs546w6cyci0ppdrrp5wnlv1kffxw29x71a3g5l"))))))
+
(define-public bloomberg-bde-tools
(let ((commit "f63dfe9114cd7df29623bd01f644b9f654253972"))
(package
--
2.34.1
J
J
Jean-Pierre De Jesus DIAZ wrote on 20 Sep 2023 14:39
[PATCH 3/3] gnu: fulcrum: Update to 1.9.1.
(address . 66120@debbugs.gnu.org)(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)
20230920123933.1241422-3-jean@foundationdevices.com
* gnu/packages/finance.scm (fulcrum): Use the upstream origin instead of
the Flowee's fork of it, updates and expands the synopsis and
description. Updates the package to 1.9.1 and build without any
bundled libraries with the help of a patch.

* gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch: New
patch.

Signed-off-by: Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com>
---
gnu/packages/finance.scm | 88 +++++---
.../fulcrum-1.9.1-unbundled-libraries.patch | 210 ++++++++++++++++++
2 files changed, 272 insertions(+), 26 deletions(-)
create mode 100644 gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch

Toggle diff (335 lines)
diff --git a/gnu/packages/finance.scm b/gnu/packages/finance.scm
index a1e2216ae0..63de983472 100644
--- a/gnu/packages/finance.scm
+++ b/gnu/packages/finance.scm
@@ -34,6 +34,7 @@
;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2023 Frank Pursel <frank.pursel@gmail.com>
;;; Copyright © 2023 Skylar Hill <stellarskylark@posteo.net>
+;;; Copyright © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -76,6 +77,7 @@ (define-module (gnu packages finance)
#:use-module (gnu packages boost)
#:use-module (gnu packages check)
#:use-module (gnu packages compression)
+ #:use-module (gnu packages cpp)
#:use-module (gnu packages crypto)
#:use-module (gnu packages curl)
#:use-module (gnu packages databases)
@@ -1795,36 +1797,70 @@ (define-public bitcoin-unlimited
(define-public fulcrum
(package
(name "fulcrum")
- (version "1.1.1")
- (source
- (origin
- (method url-fetch)
- (uri (string-append "https://gitlab.com/FloweeTheHub/fulcrum/-/archive/v"
- version "/fulcrum-v" version ".tar.gz"))
- (sha256
- (base32 "04w5gw02d39caa8a0l6wkn87kc43zzad2prqsyrcq97vlbkdx6x6"))))
+ (version "1.9.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/cculianu/Fulcrum")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (modules '((guix build utils)))
+ (snippet
+ #~(for-each delete-file-recursively
+ '("src/Json/simdjson"
+ "src/bitcoin/secp256k1"
+ "src/robin_hood"
+ "src/zmq"
+ "staticlibs")))
+ (sha256
+ (base32
+ "1110vanl6aczlq25i4ck9j4vr81in5icw4z383wyhjpcy6rwxsw2"))
+ (patches
+ (search-patches "fulcrum-1.9.1-unbundled-libraries.patch"))))
(build-system gnu-build-system)
(arguments
- `(#:phases
- (modify-phases %standard-phases
- ;; Call qmake instead of configure to create a Makefile.
- (replace 'configure
- (lambda _
- (invoke
- "qmake"
- (string-append "PREFIX=" %output)
- "features="))))))
- (native-inputs
- (list qttools-5))
+ (list #:configure-flags
+ #~(list "CONFIG+=config_without_bundled_cppzmq"
+ "CONFIG+=config_without_bundled_robin_hood"
+ "CONFIG+=config_without_bundled_secp256k1"
+ "LIBS+=-lrocksdb"
+ #$@(if (target-64bit?) '("LIBS+=-lsimdjson") '())
+ (format #f "DEFINES+=GIT_COMMIT=\"\\\\\\~s\\\\\\\""
+ #$version)
+ (string-append "PREFIX=" #$output))
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'configure
+ (lambda* (#:key configure-flags #:allow-other-keys)
+ (apply invoke "qmake" configure-flags))))))
+ (native-inputs (list pkg-config qttools-5))
(inputs
- (list python qtbase-5 rocksdb zlib))
- (home-page "https://gitlab.com/FloweeTheHub/fulcrum/")
- (synopsis "Fast and nimble SPV server for Bitcoin Cash")
+ (append (list cppzmq
+ jemalloc
+ python
+ qtbase-5
+ robin-hood-hashing
+ rocksdb
+ zeromq
+ zlib)
+ (if (target-64bit?)
+ (list simdjson-0.6)
+ '())))
+ (home-page "https://github.com/cculianu/Fulcrum")
+ (synopsis "Payment verification server for Bitcoin-like crypto-currencies")
(description
- "Flowee Fulcrum is a server that is the back-end for @acronym{SPV,
-Simplified Payment Verification} wallets, it provides the full API for those
-walets in a fast and small server. The full data is stored in a full node,
-like Flowee the Hub, which Fulcrum connects to over RPC.")
+ "Fulcrum is a @acronym{SPV, Simplified Payment Verification} server for
+Bitcoin-like crypto-currencies. The server indexes the blockchain of the
+crypto-currency used, and the resulting index can be used by wallets to
+perform queries to keep real-time track of balances.
+
+Supported crypto-currencies:
+
+@itemize
+@item Bitcoin Core.
+@item Bitcoin Cash-like.
+@item Litecoin.
+@end itemize")
(license license:gpl3+)))
(define-public flowee
diff --git a/gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch b/gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch
new file mode 100644
index 0000000000..327846b7aa
--- /dev/null
+++ b/gnu/packages/patches/fulcrum-1.9.1-unbundled-libraries.patch
@@ -0,0 +1,210 @@
+SPDX-FileCopyrightText: © 2023 Foundation Devices, Inc. <hello@foundationdevices.com>
+SPDX-License-Identifier: GPL-3.0-or-later
+
+These patch series allow to compile Fulcrum without using any bundled
+libraries.
+
+From 141d590b4189908a88ca07ad8e3880e4933e6427 Mon Sep 17 00:00:00 2001
+From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
+Date: Thu, 6 Jul 2023 14:56:53 +0200
+Subject: [PATCH 1/4] Add config to build without secp256k1
+
+Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
+---
+ Fulcrum.pro | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Fulcrum.pro b/Fulcrum.pro
+index e7fdfde..2dad355 100644
+--- a/Fulcrum.pro
++++ b/Fulcrum.pro
+@@ -480,7 +480,7 @@ HEADERS += \
+ # Enable secp256k1 compilation on x86_64 only -- we don't actually use this lib
+ # yet in Fulcrum, so on platforms that aren't x86_64 it's ok to exclude it; it
+ # was included in case we wish to someday verify signatures in Fulcrum, etc.
+-contains(QT_ARCH, x86_64):!win32-msvc {
++contains(QT_ARCH, x86_64):!contains(CONFIG, config_without_bundled_secp256k1):!win32-msvc {
+ message("Including embedded secp256k1")
+
+ SOURCES += bitcoin/secp256k1/secp256k1.c
+--
+2.34.1
+
+
+From 093a43d02dd14039ae8aed992223e5167f3fb866 Mon Sep 17 00:00:00 2001
+From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
+Date: Thu, 6 Jul 2023 15:49:01 +0200
+Subject: [PATCH 2/4] Allow using system simdjson
+
+Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
+---
+ Fulcrum.pro | 7 +++++++
+ src/Json/Json_Parser.cpp | 5 ++++-
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/Fulcrum.pro b/Fulcrum.pro
+index 2dad355..c478af6 100644
+--- a/Fulcrum.pro
++++ b/Fulcrum.pro
+@@ -149,6 +149,13 @@ contains(CONFIG, config_endian_big) {
+ }
+ # /GIT_COMMIT=
+
++# simdjson
++contains(LIBS, -lsimdjson) {
++ message("simdjson: Using CLI override")
++ DEFINES += SYSTEM_SIMDJSON
++}
++# /simdjson
++
+ # ZMQ
+ !contains(LIBS, -lzmq) {
+ # Test for ZMQ, and if found, add pkg-config which we will rely upon to find libs
+diff --git a/src/Json/Json_Parser.cpp b/src/Json/Json_Parser.cpp
+index c24fe94..eb42eec 100644
+--- a/src/Json/Json_Parser.cpp
++++ b/src/Json/Json_Parser.cpp
+@@ -56,7 +56,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+ // embed simdjson here, if we are on a known 64-bit platform and the header & sources are available
+ #if defined(__x86_64__) || defined(_M_AMD64) || defined(__aarch64__) || defined(_M_ARM64)
+-#if __has_include("simdjson/simdjson.h") && __has_include("simdjson/simdjson.cpp")
++#if defined(SYSTEM_SIMDJSON)
++#include <simdjson.h>
++#define HAVE_SIMDJSON 1
++#elif __has_include("simdjson/simdjson.h") && __has_include("simdjson/simdjson.cpp")
+ #include "simdjson/simdjson.h"
+ #include "simdjson/simdjson.cpp"
+ #define HAVE_SIMDJSON 1
+--
+2.34.1
+
+
+From 4c609cb1467478cb669b5ca2290606128543a48c Mon Sep 17 00:00:00 2001
+From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
+Date: Thu, 6 Jul 2023 15:56:01 +0200
+Subject: [PATCH 3/4] Allow using system robin-hood-hashing
+
+Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
+---
+ Fulcrum.pro | 13 ++++++++++---
+ src/Controller.cpp | 2 +-
+ src/Storage.cpp | 4 ++--
+ 3 files changed, 13 insertions(+), 6 deletions(-)
+
+diff --git a/Fulcrum.pro b/Fulcrum.pro
+index c478af6..99c7659 100644
+--- a/Fulcrum.pro
++++ b/Fulcrum.pro
+@@ -149,6 +149,16 @@ contains(CONFIG, config_endian_big) {
+ }
+ # /GIT_COMMIT=
+
++# robin-hood-hashing
++!contains(CONFIG, config_without_bundled_robin_hood) {
++ # Robin Hood unordered_flat_map implememntation (single header and MUCH more efficient than unordered_map!)
++ HEADERS += robin_hood/robin_hood.h
++ INCLUDEPATH += src/robin_hood/
++} else {
++ message("robin-hood-hashing: Using CLI override")
++}
++# /robin-hood-hashing
++
+ # simdjson
+ contains(LIBS, -lsimdjson) {
+ message("simdjson: Using CLI override")
+@@ -402,9 +412,6 @@ HEADERS += \
+ WebSocket.h \
+ ZmqSubNotifier.h
+
+-# Robin Hood unordered_flat_map implememntation (single header and MUCH more efficient than unordered_map!)
+-HEADERS += robin_hood/robin_hood.h
+-
+ RESOURCES += \
+ resources.qrc
+
+diff --git a/src/Controller.cpp b/src/Controller.cpp
+index 918c1f2..d0cab56 100644
+--- a/src/Controller.cpp
++++ b/src/Controller.cpp
+@@ -33,7 +33,7 @@
+ #include "bitcoin/crypto/common.h" // ReadLE32
+ #include "bitcoin/rpc/protocol.h" // for RPC_INVALID_ADDRESS_OR_KEY
+ #include "bitcoin/transaction.h"
+-#include "robin_hood/robin_hood.h"
++#include <robin_hood.h>
+
+ #include <algorithm>
+ #include <cassert>
+diff --git a/src/Storage.cpp b/src/Storage.cpp
+index e74278c..0f0b91e 100644
+--- a/src/Storage.cpp
++++ b/src/Storage.cpp
+@@ -31,7 +31,7 @@
+
+ #include "bitcoin/hash.h"
+
+-#include "robin_hood/robin_hood.h"
++#include <robin_hood.h>
+
+ #if __has_include(<rocksdb/advanced_cache.h>)
+ // Newer rocksdb 8.1 defines the `Cache` class in this header. :/
+@@ -4537,7 +4537,7 @@ namespace {
+ } // end anon namespace
+
+ #ifdef ENABLE_TESTS
+-#include "robin_hood/robin_hood.h"
++#include <robin_hood.h>
+ namespace {
+
+ template<size_t NB>
+--
+2.34.1
+
+
+From 0e3888b12f62553b032a56b71d2c1545add080b6 Mon Sep 17 00:00:00 2001
+From: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
+Date: Thu, 6 Jul 2023 16:04:57 +0200
+Subject: [PATCH 4/4] Allow using system cppzmq
+
+Signed-off-by: Jean-Pierre De Jesus DIAZ <me@jeandudey.tech>
+---
+ Fulcrum.pro | 8 ++++++++
+ src/ZmqSubNotifier.cpp | 2 +-
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/Fulcrum.pro b/Fulcrum.pro
+index 99c7659..0948834 100644
+--- a/Fulcrum.pro
++++ b/Fulcrum.pro
+@@ -186,6 +186,14 @@ contains(LIBS, -lsimdjson) {
+ }
+ # /ZMQ
+
++# cppzmq
++!contains(CONFIG, config_without_bundled_cppzmq) {
++ INCLUDEPATH += src/zmq
++} else {
++ message("cppzmq: Using CLI override")
++}
++# /cppzmq
++
+ # - Try and detect rocksdb and if not, fall back to the staticlib.
+ # - User can suppress this behavior by specifying a "LIBS+=-lrocksdb..." on the
+ # CLI when they invoked qmake. In that case, they must set-up the LIBS+= and
+diff --git a/src/ZmqSubNotifier.cpp b/src/ZmqSubNotifier.cpp
+index 6b03784..48a41be 100644
+--- a/src/ZmqSubNotifier.cpp
++++ b/src/ZmqSubNotifier.cpp
+@@ -23,7 +23,7 @@
+ #if defined(ENABLE_ZMQ)
+ // real implementation
+ #define ZMQ_CPP11
+-#include "zmq/zmq.hpp"
++#include <zmq.hpp>
+
+ #include <QRandomGenerator>
+
+--
+2.34.1
+
--
2.34.1
L
L
Ludovic Courtès wrote on 28 Sep 2023 11:43
Re: bug#66120: [PATCH 0/3] gnu: fulcrum: Update to 1.9.1.
(name . Jean-Pierre De Jesus DIAZ)(address . jean@foundationdevices.com)(address . 66120-done@debbugs.gnu.org)
8734yyy6ns.fsf@gnu.org
Hi,

Jean-Pierre De Jesus DIAZ <jean@foundationdevices.com> skribis:

Toggle quote (4 lines)
> gnu: Add robin-hood-hashing.
> gnu: Add simdjson 0.6.
> gnu: fulcrum: Update to 1.9.1.

I added the patch to ‘gnu/local.mk’ and committed.

Thanks!

Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 66120@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 66120
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch