Skip to content

Conversation

@random-zebra
Copy link

This PR removes several circular dependencies related to deterministic masternodes code.

The chain of dependencies now is:
validation -> specialtx (containing the specialtx validation/processing code) -> deterministicmns (containing the dmn manager)

Functions defined in specialtx now take a view of the coins cache as parameter, thus no longer depend on validation and only require coins.
Both specialtx and deterministicmns depend on providertx, which now is responsible only for the definition of each payload class and does not depend on any of the previous modules.

Also, add more unit tests for invalid collateral in ProReg txes.

furszy
furszy previously approved these changes Nov 28, 2021
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

Code review ACK f7c2663.

extra nit: would rename the specialtx.h/cpp files to validation_specialtx.h/cpp.

@random-zebra
Copy link
Author

Rebased, file renamed, and dropped unused header imports.
Also removed unneded view-pointer updates, and added "collateral-spent" case in the unit test (squashed in d04cf0f655d6d6422034d63089b596c4b637b110).

furszy
furszy previously approved these changes Nov 29, 2021
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

ACK cbc874e

@random-zebra
Copy link
Author

Rebased, fixing conflict in the circular dependency list.

furszy
furszy previously approved these changes Nov 29, 2021
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

re-ACK 0a67b8f after rebase.

In order to validate the masternode collateral utxo.
Instead encapsulate GetUTXOCoin in CCoinsViewCache, and provide a
pointer/reference to the view from the validation code to
CheckSpecialTx/ProcessSpecialTxsInBlock.

Remove unneeded GetUXOHeight.
thus breaking the circular dependency deterministicmns <-> specialtx
thus making providertx responsible only of the definition of the payload
primitives (therefore not depending on deterministicmns).

this breaks several circular dependencies.
which eliminates 5 circular dependencies
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

rebase utACK 037abb5

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK 037abb5

@furszy furszy merged commit cf41e5d into PIVX-Project:master Dec 5, 2021
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.

3 participants