This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
Avoid validating keys within block signing authorities in proposed schedule #8021
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Description
The
set_proposed_producers
intrinsic validated that all of the keys in the proposed schedule are valid (according to thevalid()
member function) and aborted if one of them was not valid. This PR still maintains that behavior to avoid introducing an unintended consensus change.The protocol feature introduced in #7404 added a new intrinsic
set_proposed_producers_ex
which allows for a proposed producer schedule to include the newblock_signing_authority
rather than merely single producer keys.The
set_proposed_producers_ex
also provides a mode that unpacks the provided schedule data according to the old format ofset_proposed_producers
(this requires provided apacked_producer_format
value of 0). In the case of using that legacy mode, the system will again validate that the keys in the schedule (just one key per producer) are valid according to thevalid()
member function.The original behavior of
set_proposed_producers_ex
under the new mode that allows forblock_signing_authority
(whenpacked_producer_format
has a value of 1) was to also validate all of the keys. This PR changes that behavior to avoid validating the keys. All the other validation checks on theblock_signing_authority
are still in place.The reason for this change is to allow contracts to call
set_proposed_producers_ex
in a manner that gives the contract confidence that the intrinsic will not abort the transaction. Doing this requires validating the inputs to avoid triggering any of the assertions in the native side implementation ofset_proposed_producers_ex
. The validation of the public keys causes a huge burden on the contract because there is no easy way to pre-validate whether, for example, a given R1 public key is valid without bringing in a lot of cryptography code into the contract. Furthermore, passing in invalid keys does no harm to the system (assuming a supermajority of producers do not all simultaneously make all their block signing keys invalid). It may only harm the producer who chooses the invalid keys because it can prevent them from signing blocks; and, there are already many ways of generating public keys that are considered valid points on the elliptic curve and yet have a corresponding private key that no one knows (short of breaking the cryptography).Consensus Changes
While this is technically a consensus change, it merely modifies the behavior of the currently unreleased consensus changes introduced in #7404.
API Changes
Documentation Additions