book
book copied to clipboard
Update transact cheatcode example
ref https://github.com/foundry-rs/foundry/issues/5985
TODO
- add additional working example
- make existing example work in the same block by manually setting the nonce
- make existing example work on the parent block by manually decreasing the block's basefee
Will take this one.
wb!
TODO
- add additional working example
- make existing example work in the same block by manually setting the nonce
- make existing example work on the parent block by manually decreasing the block's basefee
Hey @mattsse! I noticed something interesting in this. If we see the transaction specified in the example. We can see the state changes here.
We can see the nonce of the sender changes from 1 to 2. Now if I set the nonce manually in the example like this vm.setNonce(sender, 1);
but I get an error like this [FAIL. Reason: new nonce (1) must be strictly equal to or higher than the account's current nonce (2)]
and if I set the nonce greater than or equal to 2 it says [FAIL. Reason: backend: failed committing transaction]
so there's no way to pass this test? Or am I doing something wrong?