Skip to content

Commit

Permalink
comment
Browse files Browse the repository at this point in the history
  • Loading branch information
daejunpark committed Sep 14, 2024
1 parent 45050ff commit 86cf4bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/halmos/calldata.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ class FunctionInfo:


class Calldata:
# For dynamic parameters not explicitly listed in --array-lengths, default sizes are used:
# - For dynamic arrays: the size ranges from 0 to the value of --loop (inclusive).
# - For bytes or strings: the size candidates are given by --default-bytes-lengths.
args: HalmosConfig

# `dyn_params` will be updated to include the fully resolved size information for all dynamic parameters.
Expand Down
12 changes: 6 additions & 6 deletions src/halmos/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,19 @@ def arg(
)


class ParseCSVAction(argparse.Action):
class ParseCSV(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
values = ParseCSVAction.parse(values)
values = ParseCSV.parse(values)
setattr(namespace, self.dest, values)

@staticmethod
def parse(values: str) -> list[int]:
return [int(x.strip()) for x in values.split(",")]


class ParseArrayLengthsAction(argparse.Action):
class ParseArrayLengths(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
values = ParseArrayLengthsAction.parse(values)
values = ParseArrayLengths.parse(values)
setattr(namespace, self.dest, values)

@staticmethod
Expand Down Expand Up @@ -183,14 +183,14 @@ class Config:
help="set the length of dynamic-sized arrays including bytes and string (default: loop unrolling bound)",
global_default=None,
metavar="NAME1=LENGTH1,NAME2=LENGTH2,...",
action=ParseArrayLengthsAction,
action=ParseArrayLengths,
)

default_bytes_lengths: str = arg(
help="set the default length candidates for bytes and string not specified in --array-lengths",
global_default="0,32,1024,65", # 65 is ECDSA signature size
metavar="LENGTH1,LENGTH2,...",
action=ParseCSVAction,
action=ParseCSV,
)

storage_layout: str = arg(
Expand Down

0 comments on commit 86cf4bb

Please sign in to comment.