Skip to content

Update dip-0006.md#109

Merged
thephez merged 3 commits into
masterfrom
VirgileBa-patch-1
Apr 8, 2022
Merged

Update dip-0006.md#109
thephez merged 3 commits into
masterfrom
VirgileBa-patch-1

Conversation

@VirgileBa
Copy link
Copy Markdown
Collaborator

a llmqType was forgotten in the hash, now it reflects the codebase

Comment thread dip-0006.md Outdated

1. Retrieve the deterministic masternode list which is valid at quorumHeight
2. Calculate `SHA256(proTxHash, quorumHash)` for each entry in the list
2. Calculate `SHA256(proTxHash, quorumHash, llmqType)` for each entry in the list
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmmm.... I think it's a bit more complicated actually...

First, you calculate confirmedHashWithProRegTxHash = SHA256(proTxHash, confirmedHash) where

confirmedHash | uint256 | 32 | The hash of the block at which the masternode got confirmed

https://github.com/dashpay/dips/blob/master/dip-0004.md#sml-simplified-masternode-list-entry
https://github.com/dashpay/dash/blob/master/src/evo/deterministicmns.h#L122-L129
dashpay/dash#2440
(note: we do this beforehand for each MN)

When you need to determine quorums you calculate so called modifier = SHA256(llmqType, quorumHash)
https://github.com/dashpay/dash/blob/master/src/llmq/quorums_utils.cpp#L42.

You then use it to calculate "scores" (hashes that are used to sort masternodes) like that
SHA256(confirmedHashWithProRegTxHash, modifier)
https://github.com/dashpay/dash/blob/master/src/evo/deterministicmns.cpp#L274-L298
dashpay/dash#2477

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

how do the documentation even end up being that far from what's actually implemented?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🤷‍♂️

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

(thanks for pointing it out btw)

@VirgileBa VirgileBa closed this Apr 7, 2022
@VirgileBa VirgileBa deleted the VirgileBa-patch-1 branch April 7, 2022 13:28
@thephez thephez restored the VirgileBa-patch-1 branch April 7, 2022 14:22
@thephez thephez reopened this Apr 7, 2022
@thephez thephez requested review from UdjinM6 and ogabrielides April 7, 2022 17:11
Copy link
Copy Markdown
Contributor

@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.

LGTM 👍

@thephez thephez merged commit 5117b9a into master Apr 8, 2022
@thephez thephez deleted the VirgileBa-patch-1 branch April 8, 2022 16:22
@ogabrielides
Copy link
Copy Markdown
Contributor

@UdjinM6 Looks like modifier = SHA256(SHA256(llmqType, quorumHash)) (double SHA256 instead of single).
Check implementation of ::SerializeHash used to build modified.

thephez added a commit that referenced this pull request May 11, 2022
thephez added a commit that referenced this pull request May 16, 2022
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