dashpay / dash

Dash - Reinventing Cryptocurrency
https://www.dash.org
MIT License
1.49k stars 1.19k forks source link

refactor: return enum in CL verifying code, apply for submitchainlock #6096

Open knst opened 4 days ago

knst commented 4 days ago

Issue being fixed or feature implemented

Currently by result of submitchainlock impossible to distinct a situation when a signature is invalid and when a core is far behind and just doesn't know about signing quorum yet.

This PR aims to fix this issue, as requested by shumkov for needs of platform:

mailformed signature and can’t verify signature due to unknown quorum is the same error? possible to distingush ?

What was done?

Return enum in CL verifying code chainlock_handler.VerifyChainLock. The RPC submitchainlock now returns error with code=-1 and message no quorum found. Current tip height: {N} hash: {HASH}

How Has This Been Tested?

Functional test feature_llmq_chainlocks.py is updated

Breaking Changes

submitchainlock return one more error code - not really a breaking change though, because v21 hasn't released yet.

Checklist:

DashCoreAutoGuix commented 4 days ago

Guix Automation has began to build this PR tagged as v21.0.0-devpr6096.c36c8c71. A new comment will be made when the image is pushed.

DashCoreAutoGuix commented 4 days ago

Guix Automation has completed; a release should be present here: https://github.com/dashpay/dash-dev-branches/releases/tag/v21.0.0-devpr6096.c36c8c71. The image should be on dockerhub soon.

PastaPastaPasta commented 2 days ago

Please object if there is a reason for this to be back ported to v21.0

shumkov commented 1 day ago

@PastaPastaPasta Currently, we have a bug in Drive when we submit chainlock we get the same error in case if Core is not synced up to the height when this CL quorum is created or if a malicious proposer sends a malformed signature. In the first case, we would like to wait a bit and try again. In the second case, we want to reject a proposal immediately. It opens an attack vector if we wait in both cases or often leads to multiple rounds per height if we reject blocks for both.