Note Alex The Entrepenerd's response in Discord stating startPrank() would eliminate the need for this testing pattern: link to discord conversation
Testing
Tested locally with
cabal test --test-options='-p /Cheat-Codes-Pass/'
Look for tests prove_startPrank(address) and prove_startPrank_val()
Checklist
[x] tested locally
[x] added automated tests
[x] updated the docs
[x] updated the changelog
Additional Notes
Edge cases such as stacks of startPrank() were not tested/considered.
For example, this code will not work - although I am unsure how this operates in Foundry anyway.
While untested, I would expect:
code 1 to have msg.sender = defaultcode 2 to have msg.sender = address1code 3 to have msg.sender = address2code 4 to have msg.sender = defaultcode 5 to have msg.sender = default
I have never written code in Haskell before nor do I have experience with this codebase, please let me know if there are edge cases to consider or any other styling I should do to conform to this repo's standards.
Description
Added
startPrank()
andstopPrank()
cheatcodes to hevm.This should assist in testing smart contracts when using tools that rely on
hevm
such as Echidna or Medusa.Auditors are creating complex proxy patterns to do external testing of contracts using tools such as Echidna / Medusa: How to set up Multi Actor Invariant Testing
Note Alex The Entrepenerd's response in Discord stating
startPrank()
would eliminate the need for this testing pattern: link to discord conversationTesting
Tested locally with
Look for tests
prove_startPrank(address)
andprove_startPrank_val()
Checklist
Additional Notes
Edge cases such as stacks of startPrank() were not tested/considered. For example, this code will not work - although I am unsure how this operates in Foundry anyway.
While untested, I would expect:
code 1
to havemsg.sender = default
code 2
to havemsg.sender = address1
code 3
to havemsg.sender = address2
code 4
to havemsg.sender = default
code 5
to havemsg.sender = default
I have never written code in Haskell before nor do I have experience with this codebase, please let me know if there are edge cases to consider or any other styling I should do to conform to this repo's standards.