Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Address audit comments for LIP 0047 (#474)
Browse files Browse the repository at this point in the history
* Addressed audit comments
  • Loading branch information
sergeyshemyakov committed Sep 4, 2023
1 parent 4bb7f36 commit 3c82a4d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions proposals/lip-0047.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Discussions-To: https://research.lisk.com/t/introduce-poa-module/288
Status: Draft
Type: Standards Track
Created: 2021-04-29
Updated: 2023-08-17
Updated: 2023-09-04
Requires: 0038, 0040, 0044
```

Expand Down Expand Up @@ -415,6 +415,8 @@ updateAuthorityValidatorParams = {
"properties": {
"newValidators": {
"type": "array",
"minLength": 1,
"maxLength": MAX_NUM_VALIDATORS,
"fieldNumber": 1,
"items": {
"type": "object",
Expand Down Expand Up @@ -461,8 +463,6 @@ def verify(trs: Transaction) -> None:
trsParams = decode(updateAuthorityValidatorParams, trs.params)

newValidators = trsParams.newValidators
if length(newValidators) < 1 or length(newValidators) > MAX_NUM_VALIDATORS:
raise Exception()
# Validator entries are ordered lexicographically with respect to address. Address is unique.
for i in range(length(newValidators) - 1):
if newValidators[i+1].address <= newValidators[i].address: # Lexicographical ordering.
Expand All @@ -471,8 +471,10 @@ def verify(trs: Transaction) -> None:
for validator in newValidators:
if validators(validator.address) is empty:
raise Exception()
if validator.weight == 0:
raise Exception()
totalWeight += validator.weight
if totalWeight > MAX_UINT64:
if totalWeight == 0 or totalWeight > MAX_UINT64:
raise Exception()

if trsParams.threshold < totalWeight // 3 + 1 or trsParams.threshold > totalWeight:
Expand Down

0 comments on commit 3c82a4d

Please sign in to comment.