Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: drop usages of llmq/utils to check if hard-fork is active #5753

Merged
merged 34 commits into from
Dec 22, 2023

Conversation

knst
Copy link
Collaborator

@knst knst commented Dec 5, 2023

Issue being fixed or feature implemented

That's a follow-up changes for #5749 and #5740 (bitcoin#19438)

What was done?

Dropped all usages of llmq/utils to check if any hard-fork is active; as well dropped all direct usages of chainparams in favor of a new interface deploymentstatus

As positive side effect it removes circular dependency validation <-> llmq/utils and it exclude including llmq/utils from many other compilation units.

How Has This Been Tested?

Run unit/functional tests

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 5, 2023
@knst knst force-pushed the refactor-llmq_vbc branch from 8255269 to 689fa42 Compare December 6, 2023 18:53
@knst knst marked this pull request as ready for review December 7, 2023 21:18
src/evo/creditpool.cpp Show resolved Hide resolved
src/evo/specialtxman.cpp Outdated Show resolved Hide resolved
src/evo/specialtxman.cpp Outdated Show resolved Hide resolved
src/evo/creditpool.cpp Show resolved Hide resolved
src/evo/deterministicmns.cpp Show resolved Hide resolved
src/test/util/setup_common.cpp Outdated Show resolved Hide resolved
src/validation.cpp Outdated Show resolved Hide resolved
@knst knst force-pushed the refactor-llmq_vbc branch from 689fa42 to dcae438 Compare December 11, 2023 19:44
@knst knst requested a review from UdjinM6 December 11, 2023 19:45
Copy link

@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.

light ACK, reindexed on mainnet and testnet with no issues

UdjinM6
UdjinM6 previously approved these changes Dec 16, 2023
Copy link

@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.

light ACK, reindexed on mainnet and testnet with no issues

@UdjinM6
Copy link

UdjinM6 commented Dec 16, 2023

not sure why github decided to post this ^^^ twice... 🤷‍♂️

Copy link
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.

I added almost as many comments as you made commits :D (maybe try to do a smaller PR in future :) ); some of these are just comments; others need addressed

src/deploymentstatus.h Outdated Show resolved Hide resolved
src/llmq/utils.cpp Outdated Show resolved Hide resolved
src/evo/creditpool.cpp Show resolved Hide resolved
src/evo/creditpool.cpp Show resolved Hide resolved
src/evo/creditpool.cpp Show resolved Hide resolved
src/llmq/utils.cpp Outdated Show resolved Hide resolved
src/llmq/utils.cpp Outdated Show resolved Hide resolved
src/validation.h Show resolved Hide resolved
src/miner.cpp Show resolved Hide resolved
src/miner.cpp Show resolved Hide resolved
UdjinM6
UdjinM6 previously approved these changes Dec 18, 2023
Copy link

@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.

utACK

@knst knst requested a review from PastaPastaPasta December 18, 2023 16:02
Copy link
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 for merging via merge commit

Copy link
Collaborator

@ogabrielides ogabrielides left a comment

Choose a reason for hiding this comment

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

LGTM.
Good job 👍

Copy link

@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.

utACK

knst added 25 commits December 21, 2023 23:02
…s have no idea why it is not matching with v19 activation
Note: g_versionbitscache is reset in UnloadBlockIndex()
…tation

Impossible to drop it completelly right now because:
 - net doesn't know any details about chain - can't check status of fork
 - the functional test feature_maxuploadtarget.py assume block size 1Mb
 - DIP0001 can't be activated from regtest early block2 because big txes are
 not allowed after DIP0001

refactor: drop global variable fDIP0001ActiveAtTip - attempt 2
@PastaPastaPasta PastaPastaPasta merged commit 78a6904 into dashpay:develop Dec 22, 2023
4 of 5 checks passed
PastaPastaPasta pushed a commit that referenced this pull request Jan 18, 2024
)

## Issue being fixed or feature implemented
`llmq/utils` has simple util code that used all over code base and also
have too heavy code for calculation quorums such as:
`GetAllQuorumMembers`, `EnsureQuorumConnections` and other.

These helpers for calculation quorums are used only by
evo/deterministicmns, evo/simplifiedmns and llmq/* modules, but
llmq/utils is included in many other modules for various trivial
helpers.



## What was done?
Prior work:
 - #5753
 - #5486
 See also #4798

This PR remove all non-quorum calculation code from llmq/utils.
Eventually it happens that easier to take everything out rather than
move Quorum Calculation to new place atm:
- new module llmq/options have a code related to various params, command
line options, spork-related etc
- llmq/utils is not included in various files which do not use any
llmq/utils code
 - helper `BuildCommitmentHash` goes to llmq/commitment
 - helper `BuildSignHash` goes to llmq/signing
- helper `GetLLMQParam` inlined since it's trivial (it has not been
trivial when introduced ages ago)
- removed dependency of `IsQuorumEnabled` on CQuorumManager which means
`quorumManager` deglobalization is done for 90%


## How Has This Been Tested?
 - Run unit functional tests
- updated circular dependencies
`test/lint/lint-circular-dependencies.sh`
- check that llmq/utils is not included without needs to calculate
Quorums Members
```
$ grep -r include src/ 2> /dev/null | grep -v .Po: | grep -vE 'llmq/utils.(h|cpp)': | grep llmq/utils  
src/evo/mnauth.cpp:#include <llmq/utils.h>
src/evo/deterministicmns.cpp:#include <llmq/utils.h>
src/llmq/quorums.cpp:#include <llmq/utils.h>
src/llmq/blockprocessor.cpp:#include <llmq/utils.h>
src/llmq/commitment.cpp:#include <llmq/utils.h>
src/llmq/debug.cpp:#include <llmq/utils.h>
src/llmq/dkgsessionhandler.cpp:#include <llmq/utils.h>
src/llmq/dkgsession.cpp:#include <llmq/utils.h>
src/llmq/dkgsessionmgr.cpp:#include <llmq/utils.h>
src/rpc/quorums.cpp:#include <llmq/utils.h>
```


## Breaking Changes
N/A

## Checklist:
- [x] I have performed a self-review of my own code
- [x] 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
- [x] I have assigned this pull request to a milestone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants