-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
feat: broadcastRawTransaction cheatcode #4931
feat: broadcastRawTransaction cheatcode #4931
Conversation
Hey, I just tried it and got the following error:
the tx I am sending is a create tx so the to is the zero address, I guess the current PR do not support that ? |
By the way I am also wondering how it behave in a script with --broadcast I am assuming it will be broadcasted and show up in the broadcast files as this is my use case. But maybe there are other use-case that want the broadcast to happen only if vm.broadcast was called. If so it will have to ignore the broadcast sender address obviously Interested to know what is the plan here |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a full review as still waiting for tests—but just a few nits upfront :)
Thanks for the review @Evalir ! You can see it here: https://github.com/foundry-rs/foundry/pull/4931/files#diff-adc09d8ab1c41936c5b0de46796293527cd70c1a67dc170b44030830658b2053R107 Maybe I'm not applying the state correctly here: https://github.com/foundry-rs/foundry/pull/4931/files#diff-eeb83a97daa4af74bebc0c8b78fc406a8697412e50f5e203a116f67fb3239f23R1195 Otherwise, most tests seem to work. |
22f10fb
to
72a159f
Compare
the branch was getting a bit old, so i just rebased on master |
thank you! ack. Will review this week |
I just tried the PR and when the sendRawTransaction is executed I get
This is executed with
And before that call I make sure 0x3fAB184622Dc19b6109349B94811493BF2a45362 have enough balance to execute the tx (10000000 gwei) |
That's weird @wighawag it doesnt crash for me, and I cant reproduce a crash. $ ./myforge script ./script/RawTx.s.sol -f http://127.0.0.1:8545 -vvvvv --broadcast can you give me more details? |
I was using a complex setup so I recreated my use case in this repo :https://github.com/bug-reproduction/hello_foundry_4931 The README explains the issue that my complex setup was probably hitting Basicaly it seems sendRawTransaction is indeed working but it does not affect the current execution environment and everything act like it was never executed, until you execute a new script |
72a159f
to
76a8a98
Compare
I would definitely find this cheatcode useful |
Same! |
Hey @teddav I'd like to contribute to this PR, bc it would be super useful for me. Would you be kind and provide a status update of the current code? What's in need of a fix, or any challenge that you are facing? Thanks in advance |
Hey @LeoPapais ! I'm glad you're interested in it. I am too ahah 😁 In the meantime, if you need it you can just pull the PR and build Foundry from there if you need this cheatcode. That's what I did. It's not that convenient though... 😉 |
Hey hey! So adding a bit more context on this:
appreciate the patience 🙏 |
As mentioned above by @Evalir, we recently refactored how cheatcodes are implemented in #6131. You can read more about it in the dev docs. |
Hi @DaniPopes, for my clarification, this cheatcode would need to be refactored based on #6131 in order to be merged? |
Just wondering if there is any update on this feature ? |
i forgot about that! you come at the right time @wighawag , i might have time next week to finish that. It will be a good way for me to look at the new Foundry file structure (i havent looked into it in months). |
If you end up picking this up again, I'd recommend just starting over in a new PR rather than trying to rebase this one. Quite literally every file touched here has been completely re-written. |
76a8a98
to
c2e7007
Compare
c2e7007
to
96ad847
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, pending @klkvr
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
last nits
…ast section + document its behavior
Motivation
Add a cheatcode to apply a raw signed transaction to the current state.
Closes #4816
I'm going to add some unit tests. In the meantime, @wighawag let me know if your tests run correctly.
Thanks @mattsse for the help 😊