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

feat: Superblock creation (Sentinel elimination) #5525

Merged
merged 23 commits into from
Aug 29, 2023

Conversation

ogabrielides
Copy link
Collaborator

@ogabrielides ogabrielides commented Aug 3, 2023

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
src/chain.h Outdated Show resolved Hide resolved
src/governance/governance.cpp Outdated Show resolved Hide resolved
src/governance/governance.cpp Show resolved Hide resolved
src/governance/governance.cpp Show resolved Hide resolved
@ogabrielides ogabrielides marked this pull request as ready for review August 9, 2023 15:21
src/governance/classes.cpp Outdated Show resolved Hide resolved
@UdjinM6
Copy link

UdjinM6 commented Aug 9, 2023

Note:

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

needs rebase

@UdjinM6 UdjinM6 added this to the 20 milestone Aug 17, 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.

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.

@github-actions
Copy link

This pull request has conflicts, please rebase.

@ogabrielides
Copy link
Collaborator 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
Copy link

UdjinM6 commented Aug 18, 2023

LGTM but c5f6915 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
Collaborator Author

@UdjinM6 Done

@UdjinM6
Copy link

UdjinM6 commented Aug 22, 2023

pls see b25de6d

@ogabrielides
Copy link
Collaborator 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
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.

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

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.

a few small comments

src/governance/governance.cpp Outdated Show resolved Hide resolved
src/governance/governance.cpp Outdated Show resolved Hide resolved
Co-Authored-By: PastaPastaPasta <[email protected]>
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

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

@PastaPastaPasta PastaPastaPasta merged commit ceb84d5 into dashpay:develop Aug 29, 2023
9 checks passed
@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