diff --git a/proposals/lip-0053.md b/proposals/lip-0053.md index 54d64d26..5c40656f 100644 --- a/proposals/lip-0053.md +++ b/proposals/lip-0053.md @@ -7,7 +7,7 @@ Discussions-To: https://research.lisk.com/t/introduce-cross-chain-update-mechani Status: Draft Type: Standards Track Created: 2021-05-22 -Updated: 2023-08-28 +Updated: 2023-09-26 Requires: 0045, 0049, 0058, 0061 ``` @@ -224,7 +224,25 @@ def verifyValidatorsUpdate(ccu: CCU) -> None: if len(newActiveValidators) < 1 or len(newActiveValidators) > MAX_NUM_VALIDATORS: raise Exception(f"Invalid validators array. It must have at least 1 element and at most {MAX_NUM_VALIDATORS} elements.") + totalWeight = 0 + for validator in newActiveValidators: + # The bftWeight property of each element is a positive integer. + if validator.bftWeight == 0: + raise Exception("Invalid bftWeight property.") + totalWeight += validator.bftWeight + # Total BFT weight has to be less than or equal to MAX_UINT64. + if totalWeight > MAX_UINT64: + raise Exception("Total BFT weight exceeds maximum value.") + certificateThreshold = ccu.params.certificateThreshold + # The range of valid values of the certificate threshold is given by the total sum of the validators weights: + # Minimum value: floor(1/3 * total BFT weight) + 1. + # Maximum value = total BFT weight. + if certificateThreshold < totalWeight//3 + 1: + raise Exception("Certificate threshold is too small.") + if certificateThreshold > totalWeight: + raise Exception("Certificate threshold is too large.") + # computeValidatorsHash is defined in LIP 0058. certificate = decode(certificateSchema, ccu.params.certificate) if certificate.validatorsHash != computeValidatorsHash(newActiveValidators, certificateThreshold):