crytic / building-secure-contracts

Guidelines and training material to write secure smart contracts
https://secure-contracts.com/
GNU Affero General Public License v3.0
2.18k stars 341 forks source link

double hevm prank does not work #317

Closed xnie0204 closed 1 year ago

xnie0204 commented 1 year ago

Hi I found if I wrote two cheat code prank in one function test, the first one was successful,but the second one could not and gave me a fake positive.

so my code is in one test:

iHevm.prank(address1) function1 (use address1 as msg.sender, set works well) assert(check if function1 works, works nice)

iHevm.prank(address2) function2 (use address2 as msg.sender, ) assert(check if function2 works, it always gives me fake positive)

prank one is good for me. But in my code, I have to prank twice because function2 depends on function1. They can not separate...Any idea or solution for this? Thank you!

xnie0204 commented 1 year ago

Solved, because my second function was wrong... Thank you