Skip to content

Commit

Permalink
chore: increase reason string limit to 1024 bytes
Browse files Browse the repository at this point in the history
and document it
  • Loading branch information
charles-cooper committed Oct 25, 2021
1 parent 2a4972f commit f47906d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/statements.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ The ``raise`` statement triggers an exception and reverts the current call.
raise "something went wrong"
The error string is not required.
The error string is not required. If it is provided, it is limited to 1024 bytes.

assert
------
Expand All @@ -104,7 +104,7 @@ The ``assert`` statement makes an assertion about a given condition. If the cond
assert x > 5, "value too low"
The error string is not required.
The error string is not required. If it is provided, it is limited to 1024 bytes.

This method's behavior is equivalent to:

Expand Down
4 changes: 2 additions & 2 deletions vyper/semantics/validation/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ def _validate_revert_reason(msg_node: vy_ast.VyperNode) -> None:
raise StructureException("Reason string cannot be empty", msg_node)
elif not (isinstance(msg_node, vy_ast.Name) and msg_node.id == "UNREACHABLE"):
try:
validate_expected_type(msg_node, StringDefinition(64))
validate_expected_type(msg_node, StringDefinition(1024))
except TypeMismatch as e:
raise InvalidType("revert reason must be String[64]") from e
raise InvalidType("revert reason must fit within String[1024]") from e


class FunctionNodeVisitor(VyperNodeVisitorBase):
Expand Down

0 comments on commit f47906d

Please sign in to comment.