Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dapp --replay passes incorrect string to hevm #722

Closed
transmissions11 opened this issue Aug 6, 2021 · 7 comments · Fixed by #786
Closed

dapp --replay passes incorrect string to hevm #722

transmissions11 opened this issue Aug 6, 2021 · 7 comments · Fixed by #786

Comments

@transmissions11
Copy link
Contributor

transmissions11 commented Aug 6, 2021

Running with dapp fails:

 dapp debug --replay '("invariantMetadata()", "0xf893f8919400a329c0648769a73afac7f9381e08fb43dbea7294ce71065d4017f316ec606fe4422e11eb2c47c246b84440c10f1900000000000000000000000000000000000000000000000000000000000ff0dacf45a6e39dc751df612f1d23e577471e184b84a51f02b3c5c641593ab34b8a68a00000000000000000000000000000000000000000000000000000000000000005")'
+ DAPP_LINK_TEST_LIBRARIES=1
+ dapp build
 dapp-build: building with linked libraries
dapp: Predeploying test library src/erc20/SafeERC20.sol:SafeERC20 at 0x0DdeDfFe2789df61F5f76479464F568334414389
dapp: Predeploying test library src/utils/FixedPointMath.sol:FixedPointMath at 0x5Fe5dAc04fe3527Cf7bDba8798F5A8b5edDfE4Af
+ hevm dapp-test --debug --dapp-root=. --state=hevm.libs.if4oJ --json-file=out/dapp.sol.json --replay '("invariantMetadata()",' '"0xf893f8919400a329c0648769a73afac7f9381e08fb43dbea7294ce71065d4017f316ec606fe4422e11eb2c47c246b84440c10f1900000000000000000000000000000000000000000000000000000000000ff0dacf45a6e39dc751df612f1d23e577471e184b84a51f02b3c5c641593ab34b8a68a00000000000000000000000000000000000000000000000000000000000000005")' --verbose 1 --fuzz-runs 200 --smttimeout 60000
Usage: hevm dapp-test [--json-file STRING] [--dapp-root STRING] [--debug]
                      [--jsontrace] [--fuzz-runs INT] [--depth INT]
                      [--replay (TEXT,BYTESTRING)] [--rpc TEXT] [--verbose INT]
                      [--coverage] [--state STRING] [--cache STRING]
                      [--match STRING] [--smttimeout INTEGER]
                      [--max-iterations INTEGER] [--solver TEXT] [--smtdebug]
                      [--ffi]

Available options:
  -h,--help                Show this help text
  --json-file STRING       Filename or path to dapp build output (default:
                           out/*.solc.json)
  --dapp-root STRING       Path to dapp project root directory (default: . )
  --debug                  Run interactively
  --jsontrace              Print json trace output at every step
  --fuzz-runs INT          Number of times to run fuzz tests
  --depth INT              Number of transactions to explore
  --replay (TEXT,BYTESTRING)
                           Custom fuzz case to run/debug
  --rpc TEXT               Fetch state from a remote node
  --verbose INT            Append call trace: {1} failures {2} all
  --coverage               Coverage analysis
  --state STRING           Path to state repository
  --cache STRING           Path to rpc cache repository
  --match STRING           Test case filter - only run methods matching regex
  --smttimeout INTEGER     Timeout given to SMT solver in milliseconds (default:
                           30000)
  --max-iterations INTEGER Number of times we may revisit a particular branching
                           point
  --solver TEXT            Used SMT solver: z3 (default) or cvc4
  --smtdebug               Print smt queries sent to the solver
  --ffi                    Allow the usage of the hevm.ffi() cheatcode (WARNING:
                           this allows test authors to execute arbitrary code on
                           your machine)

Running directly with hevm works:

hevm dapp-test --debug --dapp-root=. --json-file=out/dapp.sol.json --replay '("invariantMetadata()","0xf893f8919400a329c0648769a73afac7f9381e08fb43dbea7294ce71065d4017f316ec606fe4422e11eb2c47c246b84440c10f1900000000000000000000000000000000000000000000000000000000000ff0dacf45a6e39dc751df612f1d23e577471e184b84a51f02b3c5c641593ab34b8a68a00000000000000000000000000000000000000000000000000000000000000005")'
@transmissions11
Copy link
Contributor Author

bumping because seems like a small syntax error somehwere that wouldn't take too long to fix (but i'm a little lost on where that issue is)

@MrChico
Copy link
Member

MrChico commented Aug 16, 2021

how's this #744

@d-xo d-xo closed this as completed Aug 16, 2021
@d-xo d-xo reopened this Sep 9, 2021
@d-xo
Copy link
Contributor

d-xo commented Sep 9, 2021

still broken 😞

@transmissions11
Copy link
Contributor Author

got a fix in mind?

@d-xo
Copy link
Contributor

d-xo commented Sep 12, 2021

Just fighting this now actually, don't really know how to fix it atm :/ afaict it's caused by some very annoying nested bash array expansion nonsense.

@transmissions11
Copy link
Contributor Author

damn. running into it rn trying to debug

affects both test --replay and debug --replay

@d-xo
Copy link
Contributor

d-xo commented Sep 12, 2021

you can always just run hevm dapp-test --replay directly and it should work fine if you need to workaround it for now.

d-xo added a commit that referenced this issue Sep 12, 2021
Fixes #722. For some obscure reason related to bash array expansion, the
whitespace in the invariant replay data ended up being passed to hevm as
`' '` (i.e. two quotes with a space).

I don't know why bash adds these extra quotes, but we can just ignore
this problem by never including whitespace in replay strings...
d-xo added a commit that referenced this issue Sep 12, 2021
Fixes #722. For some obscure reason related to bash array expansion, the
whitespace in the invariant replay data ended up being passed to hevm as
`' '` (i.e. two quotes with a space).

I don't know why bash adds these extra quotes, but we can just ignore
this problem by never including whitespace in replay strings...
d-xo added a commit that referenced this issue Sep 15, 2021
Fixes #722. For some obscure reason related to bash array expansion, the
whitespace in the invariant replay data ended up being passed to hevm as
`' '` (i.e. two quotes with a space).

I don't know why bash adds these extra quotes, but we can just ignore
this problem by never including whitespace in replay strings...
@d-xo d-xo closed this as completed in #786 Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants