Skip to content

Conversation

@ogabrielides
Copy link

@ogabrielides ogabrielides added this to the 19 milestone Sep 20, 2022
@ogabrielides ogabrielides marked this pull request as draft September 20, 2022 08:37
@github-actions
Copy link

This pull request has conflicts, please rebase.

@github-actions
Copy link

This pull request has conflicts, please rebase.

@ogabrielides ogabrielides marked this pull request as ready for review September 27, 2022 12:18

// 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
Copy link
Collaborator

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?

Suggested change
consensus.vDeployments[Consensus::DEPLOYMENT_BASIC_BLS_SCHEME].nStartTime = 1625097600; // July 1st, 2021
consensus.vDeployments[Consensus::DEPLOYMENT_BASIC_BLS_SCHEME].nStartTime = 1661990400; // Sep 1st, 2022

Copy link
Author

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

@ogabrielides ogabrielides requested a review from knst October 10, 2022 08:40
@ogabrielides ogabrielides marked this pull request as draft October 10, 2022 12:10
@ogabrielides ogabrielides marked this pull request as ready for review October 12, 2022 15:48
Copy link
Collaborator

@knst knst left a 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) {
Copy link
Collaborator

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.

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());
Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like missing nVersion == ....

Copy link
Collaborator

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)
Copy link
Collaborator

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.

Copy link
Collaborator

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

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.

@github-actions
Copy link

This pull request has conflicts, please rebase.

Copy link

@HashEngineering HashEngineering left a 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.

@ogabrielides
Copy link
Author

@HashEngineering I agree with you. The problem is tha CSimplifiedMNListEntry doesn't include a nVersion field.
(Nor CSimplifiedMNListDiff which holds CSimplifiedMNListEntry entries).
By taking into consideration the fact that SPV clients are not able to see status of BIP9 forks, I can not think of a backward compatible way to support this.
cc @QuantumExplorer @PastaPastaPasta @UdjinM6 any ideas?

@HashEngineering
Copy link

@HashEngineering I agree with you. The problem is tha CSimplifiedMNListEntry doesn't include a nVersion field. (Nor CSimplifiedMNListDiff which holds CSimplifiedMNListEntry entries). By taking into consideration the fact that SPV clients are not able to see status of BIP9 forks, I can not think of a backward compatible way to support this. cc @QuantumExplorer @PastaPastaPasta @UdjinM6 any ideas?

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.

@thephez
Copy link
Collaborator

thephez commented Nov 2, 2022

@ogabrielides title should be in conventional commit format feat!: ...

@ogabrielides ogabrielides changed the title Bls scheme upgrade feat!: BLS scheme upgrade Nov 2, 2022
Copy link

@HashEngineering HashEngineering left a 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>
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.

LGTM now, let's see if it works on devnets/testnet :)

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.

Time to test on devnet/testnet

utACK for squash merge

@PastaPastaPasta PastaPastaPasta merged commit 78d057d into dashpay:develop Dec 30, 2022
@PastaPastaPasta
Copy link
Member

@ogabrielides can you write release notes for this in the near future?

@PastaPastaPasta PastaPastaPasta added the Needs Release Notes This PR includes breaking changes for which release notes have not yet been merged. label Dec 30, 2022
@ogabrielides ogabrielides deleted the bls_scheme_upgrade branch December 30, 2022 09:16
PastaPastaPasta pushed a commit that referenced this pull request Jan 10, 2023
…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
PastaPastaPasta pushed a commit that referenced this pull request Jan 10, 2023
## 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
@thephez
Copy link
Collaborator

thephez commented Jan 31, 2023

Release notes are in #5137

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.

7 participants