-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat!: BLS scheme upgrade #5021
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!: BLS scheme upgrade #5021
Conversation
|
This pull request has conflicts, please rebase. |
|
This pull request has conflicts, please rebase. |
src/chainparams.cpp
Outdated
|
|
||
| // Deployment of basic BLS scheme | ||
| consensus.vDeployments[Consensus::DEPLOYMENT_BASIC_BLS_SCHEME].bit = 8; | ||
| consensus.vDeployments[Consensus::DEPLOYMENT_BASIC_BLS_SCHEME].nStartTime = 1625097600; // July 1st, 2021 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably doesn't matter if the same date is re-used from a previous fork, but just in case?
| consensus.vDeployments[Consensus::DEPLOYMENT_BASIC_BLS_SCHEME].nStartTime = 1625097600; // July 1st, 2021 | |
| consensus.vDeployments[Consensus::DEPLOYMENT_BASIC_BLS_SCHEME].nStartTime = 1661990400; // Sep 1st, 2022 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I will include this change in the next version
knst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please, check these 2 comments like blockers and potentially bugs:
- ToString() for CBLSSignature
- checkMalleable usage
Other my comments are hints and more about code style rather that potentially issues.
| obj.Serialize(s, legacy); | ||
| } | ||
| template <typename Stream> | ||
| inline void Unserialize(Stream& s, bool checkMalleable = true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like a bug for me due to shadowing class's member checkMalleable by this argument.
Either it should be removed from constructor, nor this argument to be removed.
src/llmq/commitment.h
Outdated
| obj.pushKV("quorumPublicKey", quorumPublicKey.ToString(nVersion == LEGACY_BLS_NON_INDEXED_QUORUM_VERSION || nVersion == LEGACY_BLS_INDEXED_QUORUM_VERSION)); | ||
| obj.pushKV("quorumVvecHash", quorumVvecHash.ToString()); | ||
| obj.pushKV("quorumSig", quorumSig.ToString()); | ||
| obj.pushKV("membersSig", membersSig.ToString()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like missing nVersion == ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think better to remove whole function ToString() without arguments from CBLSWrapper to prevent misunderstandings like that:
diff --git a/src/bls/bls.h b/src/bls/bls.h
index 2cbe356d38..493d953b72 100644
--- a/src/bls/bls.h
+++ b/src/bls/bls.h
@@ -228,11 +228,6 @@ public:
std::vector<uint8_t> buf = ToByteVector(specificLegacyScheme);
return HexStr(buf);
}
-
- inline std::string ToString() const
- {
- return ToString(bls::bls_legacy_scheme.load());
- }
};
(in assumption that it is misusage)
|
|
||
| //TODO: Add version with argument (bool specificLegacyScheme) | ||
| bool SetHexStr(const std::string& str) | ||
| bool SetHexStr(const std::string& str, const bool specificLegacyScheme) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is better to use enum class instead bool for better code reability.
Otherwise it is more difficult to read code such as "SetHexStr(str, true)" without using IDE's hints.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this bool can be extra pain in case if it would be once 3rd version of BLS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, there are two other schemes in the BLS library.
|
This pull request has conflicts, please rebase. |
HashEngineering
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the changes to CFinalCommitment that will allow an SPV node to determine which BLS scheme to use for the public key and signatures. Additionally the various Provider Special transactions are using version 2.
I would suggest something similar for SimplifiedMNListEntry - The reason being that an SPV node will not be able to tell what scheme is being used since it doesn't know about BIP9 or other hard fork mechanisms. Of course, there may be other ways to deal with this problem.
|
@HashEngineering I agree with you. The problem is tha |
What about a new protocol version that supports a version field in the necessary structures? This is what is happening with 70224, changing the format of a message that is backward compatible with previous releases. |
|
@ogabrielides title should be in conventional commit format |
HashEngineering
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have found a bug that breaks SPV clients that rely on "mnlistdiff" or "qrinfo" to know the BLS scheme that should be used.
Co-authored-by: UdjinM6 <UdjinM6@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM now, let's see if it works on devnets/testnet :)
utACK
PastaPastaPasta
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Time to test on devnet/testnet
utACK for squash merge
|
@ogabrielides can you write release notes for this in the near future? |
…ff (#5139) ## Issue being fixed or feature implemented We shouldn't have changed it in the first place if we want to avoid additional migration/reindexing. I did not think about it when I proposed this patch in #5021, sorry 🙈 Thanks @ogabrielides for noticing 👍 #5021 follow-up ## What was done? <!--- Describe your changes in detail --> ## How Has This Been Tested? <!--- Please describe in detail how you tested your changes. --> <!--- Include details of your testing environment, and the tests you ran to --> <!--- see how your change affects other areas of the code, etc. --> ## Breaking Changes <!--- Please describe any breaking changes your code introduces --> ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> - [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 **For repository code-owners and collaborators only** - [x] I have assigned this pull request to a milestone
## Issue being fixed or feature implemented ``` POTENTIAL DEADLOCK DETECTED Previous lock order was: (2) 'cs_main' in governance/governance.cpp:1096 (in thread 'init') (1) 'cs' in governance/governance.cpp:1096 (in thread 'init') Current lock order is: (1) 'cs' in governance/governance.cpp:778 (in thread 'msghand') 'cs' in governance/object.cpp:104 (in thread 'msghand') (2) '::cs_main' in validation.cpp:117 (in thread 'msghand') ``` #5021 follow-up ## What was done? Lock `cs_main` earlier ## How Has This Been Tested? run dashd on testnet ## Breaking Changes none ## Checklist: <!--- Go over all the following points, and put an `x` in all the boxes that apply. --> - [x] I have performed a self-review of my own code - [x] 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 **For repository code-owners and collaborators only** - [x] I have assigned this pull request to a milestone
|
Release notes are in #5137 |
Tracking issue is: (https://github.com/dashpay/dash/issues/5001)