Closed aodhgan closed 2 years ago
@aodhgan can you place the constant definition inside the struct?
Doesnt seem like you can!
Interesting, although expected 😞
Well then, are the SolHint rule is generally sensible, there's are two clear choices for this specific case:
I'd lean towards using a library, as it splits up contracts into smaller pieces, but wdyt?
Workaround applied. 👍
Bug Description
Solhint is not allowing the definition of constant size arrays within a struct, giving
error Function order is incorrect, struct definition can not go after state variable declaration (line 15) ordering
Consider:
which is valid solidity, but Solhint rejects
While
solc rejects (maybe as it cannot see
_CONST_SIZE
yet). Non magic number fixed size arrays are good for packed gas optimised structs. Is there a workaround such as place in a library or change the solhint rules for constants?@CjHare