Skip to content

Conversation

@knst
Copy link
Collaborator

@knst knst commented Jan 10, 2023

LLMQContext uses RAII to initialize all members. Ensured that all members always initialized correctly in proper order if LLMQContext exists.

BlockAssembler, CChainState use too many agruments and they are making wrong assumption that members of LLMQContext can be constructed and used independently, but that's not true. Instead, let's pass LLMQContext whenever possible.

Issue being fixed or feature implemented

https://github.com/dashpay/dash-issues/issues/52

How Has This Been Tested?

Run unit/functional test and introduce no breaking changes.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone

@knst

This comment was marked as resolved.

@knst knst changed the title backports, refactoring: deglobalisation of mempool and simplifying interface of BlockAssembler backport, refactoring: deglobalisation of mempool and simplifying interface of BlockAssembler Jan 10, 2023
@knst knst changed the title backport, refactoring: deglobalisation of mempool and simplifying interface of BlockAssembler backport, refactor: deglobalisation of mempool and simplifying interface of BlockAssembler Jan 10, 2023
@knst knst force-pushed the block-assembler branch 4 times, most recently from 4d2cb7f to ad8f79e Compare January 10, 2023 17:16
@github-actions
Copy link

This pull request has conflicts, please rebase.

@kwvg
Copy link
Collaborator

kwvg commented Jan 19, 2023

I attempted to get around the mempool problem by passing them by reference, not sure if this is the best way to do it. kwvg@6396c89 and kwvg@f201072

@knst knst changed the title backport, refactor: deglobalisation of mempool and simplifying interface of BlockAssembler refactor: simplifying interface of BlockAssembler Jan 22, 2023
@knst
Copy link
Collaborator Author

knst commented Jan 22, 2023

Mempool refactorings moved here: #5169
@kittywhiskers thanks for a comment, I used similar approach.

@github-actions
Copy link

This pull request has conflicts, please rebase.

@knst knst marked this pull request as ready for review February 15, 2023 07:33
@knst knst requested a review from kwvg February 15, 2023 07:34
Copy link
Collaborator

@kwvg kwvg left a comment

Choose a reason for hiding this comment

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

NACK

NodeContext is a container for references that constitute a node, not a self-contained object that initializes its members or cleans up after itself. There is no NodeContext "unit" to initialize, so to speak, only the container, because that's what NodeContext is.

The burden of initialization of its members falls on each entity's initialization logic (that be setup_common.cpp for tests or init.cpp for daemons), which means when passing a NodeContext, we have to be very sure that everything within it is initialized and valid before passing any instance of it. An assurance that as of now, we cannot make.

This PR at least seems to be less interested in NodeContext's members but rather LLMQContext's and LLMQContext, unlike NodeContext mostly sets itself up and cleans up after, the key word being mostly.

Members of LLMQContext (CQuorumBlockProcessor, CQuorumManager, CChainLocksHandler and CInstantSendManager) are very much globals with its corresponding LLMQContext members being an alias to them, meant to migrate code to using NodeContext (and hence, LLMQContext) when possible and document the dependencies of each subsystem.

That is ultimately why we went with having long argument lists, documentation. During the initial deglobalization effort, it was a painstaking process to document all the uses of a global and then passing them by reference as an argument leading to a common initialization point, I had also attempted to use LLMQContext to cleanup the argument list, but found debugging to be painful as it obscured the order of initialization.

Perhaps if LLMQContext is entirely self-contained and we can guarantee that all its members are initialized before passing it, I would be open to it replacing our (admittedly quite long) arguments but as it stands, I feel it'll cause more problems than it'll solve.

@knst knst marked this pull request as draft February 16, 2023 09:08
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

This pull request has conflicts, please rebase.

@knst knst force-pushed the block-assembler branch from e36f5b2 to 91d861c Compare June 8, 2023 11:31
@knst knst force-pushed the block-assembler branch from 91d861c to d76729b Compare June 8, 2023 11:48
@knst
Copy link
Collaborator Author

knst commented Jul 17, 2023

@PastaPastaPasta I removed commit with new circular dependencies. Please, help to get merged this PR.

UdjinM6
UdjinM6 previously approved these changes Jul 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.

re-utACK

vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 24, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 24, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 25, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 25, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 25, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 25, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 25, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 25, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 25, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
knst added a commit to knst/dash that referenced this pull request Jul 25, 2023
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 25, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
@github-actions
Copy link

This pull request has conflicts, please rebase.

knst added 2 commits July 28, 2023 13:16
New constructors uses LLMQContext instead of direct usage llmq's component.
Refactoring some internal methods accordingly in rpc/mining.cpp

It helps to avoid passing too many arguments and make code cleaner.
Beside that it can add more components or refactor llmq/ module without
chaging interface of BlockAssembler that is widely used in unit tests
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.

re-utACK

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 squash merge

@PastaPastaPasta PastaPastaPasta merged commit 9bb1b10 into dashpay:develop Jul 30, 2023
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Jul 30, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Aug 1, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
vijaydasmp pushed a commit to vijaydasmp/dash that referenced this pull request Aug 1, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
UdjinM6 pushed a commit to vijaydasmp/dash that referenced this pull request Aug 1, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
PastaPastaPasta pushed a commit to vijaydasmp/dash that referenced this pull request Aug 8, 2023
…not using default ports

010eed3 doc: warn that incoming conns are unlikely when not using default ports (Adam Jonas)

Pull request description:

  Closes dashpay#5150.

  This was mostly copied from dashpay#5285 by sulks, who has since quit GitHub.

  The issue has remained open for 6 years, but the extra explanation still seems useful.

ACKs for top commit:
  laanwj:
    re-ACK 010eed3

Tree-SHA512: d240fb06bba41ad8898ced59356c10adefc09f3abb33e277f8e2c5980b40678f2d237f286b476451bb29d2b94032a7dee2ada3b2efe004ed1c2509e70b48e40f
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