Category: Coding Mistakes
Incorrect STATUTES_MAX_IDX
for statutes mutation
High Severity
High Impact
Medium Likelihood
Description
The governance-updated statutes has an associated STATUTES_MAX_IDX
that represents the largest index of the statutes. This value is not correct in the current implementation, since more statutes were added.
Impact
Higher-index statutes cannot be updated by governance as intended. This action would fail in the statute-mutation operation.
(assert
(size_b32 governance_curried_args_hash)
(> mutation_index -2) ; -1 for custom conditions, >= 0 for statutes
(> STATUTES_MAX_IDX mutation_index)
(if (= mutation_index CUSTOM_CONDITIONS_MUTATION_INDEX)
; vote for announcements only, so this should just be a list
(l mutation_value)
; should be a list with 5 elements if mutating statutes
(not (r (r (r (r (r mutation_value))))))
)
Recommendations
Update the STATUTES_MAX_IDX
to the correct value. It may be desirable to find a systematic way to keep this value up-to-date.
Remediation
This issue has been acknowledged by Voltage Technologies Ltd., and a fix was implemented in commit 7b23a5fa↗.