book icon indicating copy to clipboard operation
book copied to clipboard

Update transact cheatcode example

Open mattsse opened this issue 1 year ago • 3 comments

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

mattsse avatar Oct 04 '23 19:10 mattsse

Will take this one.

Sabnock01 avatar Oct 07 '23 13:10 Sabnock01

wb!

mattsse avatar Oct 07 '23 13:10 mattsse

ref foundry-rs/foundry#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

Hey @mattsse! I noticed something interesting in this. If we see the transaction specified in the example. We can see the state changes here.

image

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?

kamuik16 avatar Mar 18 '24 10:03 kamuik16