Skip to content

feat: Superblock creation (Sentinel elimination) - #5525

Merged
PastaPastaPasta merged 23 commits into
dashpay:developfrom
ogabrielides:superblock_creation
Aug 29, 2023
Merged

PastaPastaPasta merged 23 commits into
dashpay:developfrom
ogabrielides:superblock_creation

Conversation

@ogabrielides

@ogabrielides ogabrielides commented Aug 3, 2023 •

Copy link
Copy Markdown

Issue being fixed or feature implemented

Implementation of issue https://github.com/dashpay/dash-issues/issues/43

What was done?

Masternode will try to create, sign and submit a Superblock (GovTrigger) during the nSuperblockMaturityWindow.

How Has This Been Tested?

Breaking Changes

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 (for repository code-owners and collaborators only)

@ogabrielides
ogabrielides marked this pull request as draft August 3, 2023 14:00
@ogabrielides
ogabrielides marked this pull request as ready for review August 4, 2023 15:58
@ogabrielides
ogabrielides marked this pull request as draft August 4, 2023 18:00
Comment thread src/chain.h Resolved
Comment thread src/governance/governance.cpp Resolved
Comment thread src/governance/governance.cpp Resolved
Comment thread src/governance/governance.cpp Resolved
@ogabrielides
ogabrielides marked this pull request as ready for review August 9, 2023 15:21
Comment thread src/governance/classes.cpp Resolved
@UdjinM6

UdjinM6 commented Aug 9, 2023

Copy link
Copy Markdown

Note:

Check Merge Fast-Forward Only / check_merge (pull_request) Failing after 23s

needs rebase

@ogabrielides
ogabrielides requested a review from UdjinM6 August 16, 2023 12:11
@UdjinM6 UdjinM6 added this to the 20 milestone Aug 17, 2023

@UdjinM6 UdjinM6 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

pls see 97ec634628

NOTE: I'm not 100% sure about 97ec634628#diff-6787065e28efe13420b2f5e85125894595bec4c84b0b917d952dc86abd879033R534-R538 but we need a way to prevent mns from creating triggers all at the same time. Sentinel does this by introducing random delays. I don't think we can use delays in Core so limiting it to the current payee only is one possible solution that might work I think. This means it's only nSuperblockMaturityWindow MNs that could participate (1662 on mainnet). The chance all of them are broken/malicious and won't create any trigger is pretty low I think. But maybe there is a better idea.

@github-actions

Copy link
Copy Markdown

This pull request has conflicts, please rebase.

@ogabrielides

Copy link
Copy Markdown
Author

pls see 97ec634

NOTE: I'm not 100% sure about 97ec634628#diff-6787065e28efe13420b2f5e85125894595bec4c84b0b917d952dc86abd879033R534-R538 but we need a way to prevent mns from creating triggers all at the same time. Sentinel does this by introducing random delays. I don't think we can use delays in Core so limiting it to the current payee only is one possible solution that might work I think. This means it's only nSuperblockMaturityWindow MNs that could participate (1662 on mainnet). The chance all of them are broken/malicious and won't create any trigger is pretty low I think. But maybe there is a better idea.

@UdjinM6 Well technically this means that most of the time, always the first payee during the nSuperblockMaturityWindow will manage to create the trigger. Since others MNs will vote for it.

@UdjinM6

UdjinM6 commented Aug 18, 2023

Copy link
Copy Markdown

LGTM but c5f6915aeef06f1eda517d2adb0ef8c2ecdd2cca should be dropped and instead this PR should be rebased after #5538 is merged.

UdjinM6 added a commit that referenced this pull request Aug 21, 2023
…l snapshot (#5538)

## Issue being fixed or feature implemented

`-1` will only mean `not initialized` from now

Should fix crashes like
https://gitlab.com/dashpay/dash/-/jobs/4893359925
This fix applied on top of #5525
https://gitlab.com/UdjinM6/dash/-/pipelines/972154075

## What was done?
Introduce and use `m_initial_snapshot_index` instead of re-using
`nHeight`. Added a couple of asserts to make sure:
1. we never create mn lists with `nHeight` set to `-1` _explicitly_ (but
it's ok for ctor with no params to do so)
2. we never set `nHeight` to `-1` for an existing mn list
3. we never try to get a height for a non-initialized list
4. `GetListForBlockInternal` never returns non-initialized mn lists

## How Has This Been Tested?
Run tests, run regtest/testnet wallets.

## Breaking Changes
We never stored snapshots with `nHeight == -1`, should be no breaking
changes I think.

## Checklist:
- [x] 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
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
@ogabrielides

Copy link
Copy Markdown
Author

@UdjinM6 Done

@UdjinM6

UdjinM6 commented Aug 22, 2023

Copy link
Copy Markdown

pls see b25de6d

@ogabrielides

Copy link
Copy Markdown
Author

pls see b25de6d

@UdjinM6 done

@UdjinM6
UdjinM6 requested a review from knst August 23, 2023 13:12
UdjinM6
UdjinM6 previously approved these changes Aug 23, 2023

@UdjinM6 UdjinM6 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good now I think. Sentinel does have some additional logic for picking "best" triggers and deleting ones with "worse" hashes. But that's only for triggers that had no our vote yet as far as I can tell which never actually happens now that we vote asap, so it should be safe to skip this part imo.

utACK

Comment thread src/governance/classes.cpp Resolved

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a few small comments

Comment thread src/governance/governance.cpp Resolved
Comment thread src/governance/governance.cpp Resolved
Co-Authored-By: PastaPastaPasta <[email protected]>

@PastaPastaPasta PastaPastaPasta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

utACK for squash merge

@UdjinM6 UdjinM6 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

utACK

@PastaPastaPasta
PastaPastaPasta merged commit ceb84d5 into dashpay:develop Aug 29, 2023
@ogabrielides
ogabrielides deleted the superblock_creation branch August 29, 2023 15:37
@PastaPastaPasta PastaPastaPasta added the Needs Release Notes This PR includes breaking changes for which release notes have not yet been merged. label Aug 30, 2023
PastaPastaPasta pushed a commit that referenced this pull request Aug 31, 2023
…5552)

## Issue being fixed or feature implemented
With #5525 , MNs shouldn't use Sentinel anymore. 

## What was done?
In order to force them to remove Sentinel:
-  `gobject submit` RPC won't accept triggers anymore.
-  `gobject vote-conf` RPC isn't available anymore.


## How Has This Been Tested?
`feature_governance.py` and `feature_governance_object.py`

## Breaking Changes
Normally, only Sentinel should be broken.

## Checklist:
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [x] I have added or updated relevant unit/integration/functional/e2e
tests
- [x] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_

---------

Co-authored-by: UdjinM6 <[email protected]>
PastaPastaPasta pushed a commit that referenced this pull request Aug 31, 2023
…et (#5560)

## Issue being fixed or feature implemented
Since #5525, MNs during the maturity window, will propose new triggers. 

In `CGovernanceManager::CreateSuperblockCandidate`, SuperBlock creation
is skipped when the bellow check is true:

`if (nHeight % Params().GetConsensus().nSuperblockCycle <
Params().GetConsensus().nSuperblockCycle -
Params().GetConsensus().nSuperblockMaturityWindow) return std::nullopt;
    `
    
Hence, the value of `nSuperblockMaturityWindow` must be less than
`nSuperblockCycle` and greater than 0.

## What was done?
Changed `nSuperblockMaturityWindow` for devnet and Testnet chain
parameters to the following values:

`nSuperblockCycle` = 24
`nSuperblockMaturityWindow` = 8

## How Has This Been Tested?

## Breaking Changes
 
## Checklist:
- [x] 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
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_
PastaPastaPasta added a commit that referenced this pull request Sep 5, 2023
## Issue being fixed or feature implemented


## What was done?
Added release notes for #5525.

## How Has This Been Tested?


## Breaking Changes


## Checklist:
- [x] 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
- [x] I have made corresponding changes to the documentation
- [x] I have assigned this pull request to a milestone _(for repository
code-owners and collaborators only)_

---------

Co-authored-by: PastaPastaPasta <[email protected]>
Co-authored-by: UdjinM6 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Release Notes This PR includes breaking changes for which release notes have not yet been merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants