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

Dynamic block forging for the P2P mode #4024

Closed
wants to merge 4 commits into from
Closed

Conversation

coot
Copy link
Contributor

@coot coot commented Jun 9, 2022

Description:

This PR introduces dynamic updates to the block forging configuration, enabling and disabling block forging through the SIGHUP signal. It addresses issue input-output-hk/ouroboros-network#3159 and relies on changes in ouroboros-consensus#140 and cardano-api#45.

Main changes:

  • Dependencies Update: The ouroboros-consensus and cardano-api dependencies have been updated to accommodate the changes needed for this feature.

  • Improved Import Structure: The UseLedger type was moved to prevent cyclic imports, improving the overall import structure.

  • Adding of SomeBlockType and ReflBlockType

How it works:

Block forging can now be dynamically enabled/disabled through SIGHUP signal. This is done by triggering the node to read the block forging credential files upon receiving the signal. To disable block forging, one must move/rename/delete the file at the specified path (for the credential flags) and then send the SIGHUP signal. The code will then disable block forging and trace the appropriate log messages.

Copy link
Contributor

@nfrisby nfrisby left a comment

Choose a reason for hiding this comment

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

All the data flow looks reasonable to me. 👍

I'm not Approving, because I'm not Node and also I didn't review the handler logic -- I only double-checked that the new handler calls the function I was expecting it would. So I Approve those parts, but I didn't review everything.

cardano-node/src/Cardano/Node/Run.hs Show resolved Hide resolved
cardano-api/src/Cardano/Api/Protocol/Types.hs Outdated Show resolved Hide resolved
cardano-api/src/Cardano/Api/Protocol/Types.hs Outdated Show resolved Hide resolved
cardano-node/src/Cardano/Node/Run.hs Show resolved Hide resolved
cardano-node/src/Cardano/Node/Run.hs Outdated Show resolved Hide resolved
@newhoggy
Copy link
Contributor

newhoggy commented Apr 3, 2023

This work is ongoing.

@bolt12 bolt12 force-pushed the coot/dynamic-block-forging branch from ff0dce6 to ed2a73d Compare June 19, 2023 08:19
@bolt12 bolt12 requested a review from a team as a code owner June 19, 2023 08:19
@bolt12 bolt12 force-pushed the coot/dynamic-block-forging branch 3 times, most recently from 63ba255 to 20d8f19 Compare June 21, 2023 16:22
@bolt12 bolt12 force-pushed the coot/dynamic-block-forging branch from 20d8f19 to a1d0c3a Compare June 23, 2023 16:08
@bolt12 bolt12 requested a review from a team as a code owner June 23, 2023 16:08
@coot coot linked an issue Jun 27, 2023 that may be closed by this pull request
@bolt12 bolt12 force-pushed the coot/dynamic-block-forging branch from 9cc9107 to 1594803 Compare June 28, 2023 15:21
bolt12 and others added 4 commits June 30, 2023 17:19
- The moving of UseLedger was needed in order to import `Cardano.Node.Protocol (ProtocolInstantiationError)`
- Added new constructors to Startup Tracer
Block Forging can be enabled/disabled through SIGHUP signal. Sending
such a signal will trigger the node to read the block forging credential
files. Since the credential files are passed via CLI flags one can not
remove them without restarting the node. For this effect, in order for
one to be able to disable block forging, moving/renaming/deleting the
file at the specified path (for the credential flags) and then sending
the SIGHUP signal is what needs to be done. The code will detect that
the specified files do not exist and it will disable block forging,
while tracing the appropriate log messages.

In case one wants to start a block producing node (i.e. passing the
credentials in the respective flags) but doesn't want it to actually
behave as a BP, there's a new `--start-as-non-producing-node` flag that
will run the node with credentials as a normal node. However on SIGHUP
it will read the credential files and start forging.

Refactor code to accomodate the changes

Added EnabledBlockForging type

Co-authored-by: Marcin Szamotulski <coot@coot.me>
@bolt12
Copy link
Contributor

bolt12 commented Jul 14, 2023

Closed in favor of #5383 (comment)

@bolt12 bolt12 closed this Jul 14, 2023
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.

Enable block production dynamically
4 participants