-
Notifications
You must be signed in to change notification settings - Fork 82
Open
Labels
breakingbreaking changebreaking changecashc-compilerRelates to the cashc compilerRelates to the cashc compiler
Milestone
Description
Created a standalone issue for typed bytesX
function arguments
previously part of #178 (previously titled 'Consider changes to bytes
types)
Mathieu and I were talking about this and we think it could make sense to disallow bytesX as function parameters, since these types are not runtime enforced. We could alternatively also add an option to enforce these types by injecting require(x.length === y) statements. This is something we should consider in more detail later.
For
bytesX
types in function parameters:
- We disallow
bytesX
as function argument.- If a user adds e.g. a
require(x.length == 20)
check, then the compiler will infer thatx
's type isbytes20
for the rest of the contract.- (Optionally) apply the same for
if
statements.- If people want to forgo these checks, they can always manually cast to
bytesX(x)
. We should add a warning to the docs about the security implications of doing that.
this issue also came up when thinking about how to integrate structs (#27)
Metadata
Metadata
Assignees
Labels
breakingbreaking changebreaking changecashc-compilerRelates to the cashc compilerRelates to the cashc compiler