Skip to content

refactor: pull libbitcoin_server code out of wallet code 5/5#5767

Merged
PastaPastaPasta merged 22 commits into
dashpay:developfrom
knst:bitcoinserver-15639-p3
Jan 10, 2024
Merged

refactor: pull libbitcoin_server code out of wallet code 5/5#5767
PastaPastaPasta merged 22 commits into
dashpay:developfrom
knst:bitcoinserver-15639-p3

Conversation

@knst
Copy link
Copy Markdown
Collaborator

@knst knst commented Dec 15, 2023

Issue being fixed or feature implemented

Wallet library should not depends on server code (libbitcoin_server).

This is final PR that includes relevant backport bitcoin#15639 and will unblock multiprocess: bitcoin#18677

With changes in this PR wallet would not use any server (node) code anymore; which includes llmq implementation, mempool, server-side CoinJoin and many other heavy things.

Eventually it may help to integrate dash wallet easier to 3rd party applications as a standalone library, for example in mobile wallet, hardware devices, etc.

Prior work:

What was done?

Refactored Coin Join related code:

  • general Coin Join code that doesn't depends from implementation moved to a new module coinjoin/common.
  • wallet uses client-only code
  • qt code doesn't include more any coinjoin header as before, coinjoin is available through interfaces/node
  • bunch of static methods +mutex +map from coinjoin.h become a new object CDSTXManager
  • deglobalized and completely removed ::coinJoinClientManagers in favor to cj_ctx->clientman

Backported related PRs from bitcoin:

After adding missing changes from bitcoin#15638 and some extra improvements it was possible to finally backport bitcoin#15639

As a side effect one more circular dependency disappeared: coinjoin/client -> coinjoin/util -> wallet/wallet -> coinjoin/client

How Has This Been Tested?

Built 2 version: with and without these PRs: #5743, #5762 + this PR

-rwxr-xr-x  . . .   2372096  dash-cli
-rwxr-xr-x  . . .  19478944  dashd
-rwxr-xr-x  . . .  45950104  dash-qt
-rwxr-xr-x  . . .   4962688  dash-tx
-rwxr-xr-x  . . .  16049704  dash-wallet <------
-rwxr-xr-x  . . .  28106664  test_dash

and:

-rwxr-xr-x  . . .   2372096  dash-cli
-rwxr-xr-x  . . .  19503520  dashd
-rwxr-xr-x  . . .  45974680  dash-qt
-rwxr-xr-x  . . .   4962688  dash-tx
-rwxr-xr-x  . . .   9946088  dash-wallet <------
-rwxr-xr-x  . . .  28118952  test_dash

The binary dash-wallet lost ~40% of weight on this diet.

Breaking Changes

N/A

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

@knst knst added this to the 20.1 milestone Dec 15, 2023
@knst knst changed the title refactor: pull wallet code out of libbitcoin_server 5/5 refactor: pull libbitcoin_server code out of wallet code 5/5 Dec 15, 2023
@knst knst changed the title refactor: pull libbitcoin_server code out of wallet code 5/5 re\factor: pull libbitcoin_server code out of wallet code 5/5 Dec 15, 2023
@knst knst changed the title re\factor: pull libbitcoin_server code out of wallet code 5/5 refactor: pull libbitcoin_server code out of wallet code 5/5 Dec 15, 2023
@knst knst force-pushed the bitcoinserver-15639-p3 branch 2 times, most recently from 9309fd7 to 6444c8c Compare December 16, 2023 20:29
@knst knst removed the guix-build label Dec 16, 2023
@knst knst force-pushed the bitcoinserver-15639-p3 branch 3 times, most recently from ae246f9 to 12636a3 Compare December 17, 2023 06:54
@github-actions
Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@knst knst force-pushed the bitcoinserver-15639-p3 branch from 12636a3 to 82a953b Compare December 17, 2023 18:55
@knst knst force-pushed the bitcoinserver-15639-p3 branch from 82a953b to d8f4e72 Compare December 18, 2023 09:24
@github-actions
Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@knst knst force-pushed the bitcoinserver-15639-p3 branch from d8f4e72 to 0a5912c Compare December 22, 2023 08:19
@knst knst force-pushed the bitcoinserver-15639-p3 branch from 0a5912c to fce73c9 Compare December 22, 2023 09:11
@knst knst added the guix-build label Jan 4, 2024
@PastaPastaPasta
Copy link
Copy Markdown
Member

Guix Automation has failed due to the HEAD commit not being signed by an authorized core-team member. Please rebase and sign or push a new empty signed commit to allow Guix build to happen.

@knst knst force-pushed the bitcoinserver-15639-p3 branch from 9b67633 to 29809a1 Compare January 4, 2024 07:58
@PastaPastaPasta
Copy link
Copy Markdown
Member

Guix Automation has failed due to the HEAD commit not being signed by an authorized core-team member. Please rebase and sign or push a new empty signed commit to allow Guix build to happen.

@knst knst force-pushed the bitcoinserver-15639-p3 branch from 29809a1 to ab5a01a Compare January 4, 2024 08:05
@PastaPastaPasta
Copy link
Copy Markdown
Member

Guix Automation has failed due to the HEAD commit not being signed by an authorized core-team member. Please rebase and sign or push a new empty signed commit to allow Guix build to happen.

@knst knst force-pushed the bitcoinserver-15639-p3 branch from ab5a01a to c86999d Compare January 4, 2024 19:12
@knst knst requested a review from PastaPastaPasta January 9, 2024 18:02
@PastaPastaPasta
Copy link
Copy Markdown
Member

Guix Automation has completed; a release should be present here: https://github.com/dashpay/dash-dev-branches/releases/tag/v20.1.0-devpr5767.8698bae1. The image should be on dockerhub soon.

Copy link
Copy Markdown
Member

@PastaPastaPasta PastaPastaPasta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK; please state preference for squash / merge commit

I really don't like "Loader" but 🤷 all other comments were addressed or not relevant

@knst
Copy link
Copy Markdown
Collaborator Author

knst commented Jan 10, 2024

please state preference for squash / merge commit

There are 2 backports, should be Merge commit, not squash

Copy link
Copy Markdown

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re-utACK

knst and others added 22 commits January 10, 2024 12:05
This code can be used in both server side code and in wallet code
Its class CDSTXManager has a lot of ex-static functions and data that
are actually meant to be an object
faca730 ci: Install fixed version of clang-format for linters (MarcoFalke)
fa4695d build: Sort Makefile.am after renaming file (MarcoFalke)
cccc278 scripted-diff: Move ui_interface to the node lib (MarcoFalke)
fa72ca6 qt: Remove unused includes (MarcoFalke)
fac96e6 wallet: Do not include server symbols (MarcoFalke)
fa0f6c5 Revert "Fix link error with --enable-debug" (MarcoFalke)

Pull request description:

  This reverts a hacky workaround from commit b83cc0f, which only happens to work due to compiler optimizations. Then, it actually fixes the linker error.

  The underlying problem is that the wallet includes symbols from the server (ui_interface), which usually results in linker failures. Though, in this specific case the linker failures have not been observed (unless `-O0`) because our compilers were smart enough to strip unused symbols.

  Fix the underlying problem by creating a new header-only with the needed symbol and move ui_interface to node to clarify that this is part of libbitcoin_server.

ACKs for top commit:
  Sjors:
    ACK faca730
  laanwj:
    ACK faca730
  hebasto:
    re-ACK faca730, since the [previous](bitcoin#19331 (review)) review:

Tree-SHA512: e9731f249425aaea50b6db5fc7622e10078cf006721bb87989cac190a2ff224412f6f8a7dd83efd018835302337611f5839e29e15bef366047ed591cef58dfb4
@PastaPastaPasta PastaPastaPasta merged commit 09b5833 into dashpay:develop Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants