-
Notifications
You must be signed in to change notification settings - Fork 2.2k
deal + prank cheat codes #146
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
Conversation
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.
| Token::FixedBytes(s_bytes.to_vec()), | ||
| ])]); | ||
| } | ||
| HEVMCalls::Spoof(inner) => { |
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.
Given these are new cheatcodes, could you please add a short description for them in the CheatcodeHandler struct doctests?
"Spoof executes an arbitrary contract call or transfer from an address. If an ETH transfer is also initiated via {value: ...}, it assumes that the specified caller has enough balance to execute the transfer.
Example:
hevm.spoof{value: 1 ether}(address(1), address(2), abi.encodeWithSelector("transfer(address,uint256)", address(3), 4))
or something like that
"Deal deal(address, uint256) allows you to set an arbitrary account's balance to a specified value"
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.
i dont see existing docs anywhere. i added in the readme - i think in general since its exposed in solidity, it should be documented elsewhere anyways (like a readme)
fixes fixes deal + prank
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.
Looking good.
* deal + spoof cheat codes fixes fixes deal + prank * fixes * no change of origin * fmt * prank is payable * accurate readme * clippy lint fix
* fix(evm-adapters): initialize forked backend cache with local backend state * fix: appease linter * fix(solc): bump version tests for solc release seth: update optimism genesis blockhashes (foundry-rs#134) Optimism performed a regenesis which updated the genesis blockhashes for both mainnet and kovan. For `seth chain` and any other `seth` commands that rely on `seth chain` to work, the hardcoded genesis blockhashes need to be updated. The values were fetched using the following commands: ``` $ seth --rpc-url https://mainnet.optimism.io block 0 hash 0x7ca38a1916c42007829c55e69d3e9a73265554b586a499015373241b8a3fa48b $ seth --rpc-url https://kovan.optimism.io block 0 hash 0x02adc9b449ff5f2467b8c674ece7ff9b21319d76c4ad62a67a70d552655927e5 ``` Tested locally with the commands: ``` $ ./target/debug/seth chain --rpc-url https://mainnet.optimism.io optimism-mainnet $ ./target/debug/seth chain --rpc-url https://kovan.optimism.io optimism-kovan ``` fix provider caching (foundry-rs#135) Use new Solc compilation pipeline (foundry-rs#130) * chore: deprecate dapp_solc * chore: cargo lock * chore(evm-adapters): use sol 0.6.6 for tests without auto solc detection * fix(evm-adapters): adjust breaking changes COMPILED.get -> COMPILED.find bytecode -> bin * refactor(dapp): move sol contracts under testdata/ * chore(dapp): remove dapptools artifacts they will be available via the upstream compilation pipeline * fix(dapp): adjust breaking changes COMPILED.get -> COMPILED.find bytecode -> bin * feat(multi-runner): use new compilation pipeline We now provide a pre-configured Project to the builder, it'll proceed to compile it and use the artifacts accordingly. The addresses map is now part of the contracts map * test(multi-runner): adjust tests to match new compilation pipeline * feat(cli): set Project paths from the BuildOpts * feat(cli): use Project to compile files * chore(cli): remove unused funcs * fix(cli/etherscan): breaking api changes * chore: cargo fmt * tests: avoid race conditions during solc install We do that by using ethers-solc/tests feature which imposes a mutex on the solc downloading step. * test(evm-adapters): make LargeContract test more robust * fix(ethers-solc): update ethers-solc to fixed version bug chore: remove direct svm dep feat: allow specifying ETH_RPC_URL in forking mode fix(rpc): default to Latest block instead of the backend's if none is… (foundry-rs#136) * fix(rpc): default to Latest block instead of the backend's if none is provided * feat(cli): exit -1 if error in tests feat(cli): specify contracts with DAPP_SRC env var ref: foundry-rs#108 feat: expand env vars (foundry-rs#138) * feat(cli): add DAPP_TEST_TIMESTAMP and TEST_NUMBER * feat(dapp): allow specifying sender for all txs * feat(cli): allow specifying the sender for all calls * chore: cargo fmt feat(evm-adapters): make Executor work in already running tokio runtime (foundry-rs#140) * fix deps * feat(evm-adapters): make Executor work in already running tokio runtime fix(cli): wait for git submodule command to finish fix(cli/multi-runner): return errors before checking cache This is a footgun and we should have a helper function for it in ethers-solc chore: actualize seth commands in README.md (foundry-rs#142) * chore: actualize seth commands in README.md * update according to seth from dapptools-rs 0.1.0 feat: Update sputnik (foundry-rs#144) * temp: use patched evm for auto_impl & update lock rust-ethereum/evm#85 * fix sputnik breaking changes * fix(dapp): breaking changes * fix(cli): breaking changes * cli: default to london * chore: fmt fix: enable cheatcodes in the constructor (foundry-rs#145) * feat: override contract creation method Before, transact_create would delegate to the internal handler which does not use cheatcodes. We copy-paste transact_create so that we force it to route to our cheatcode handler. * fix(evm): use the externally exposed apis for create_inner * chore: remove dbg * test: add constructor cheatcode check feat(cli): allow specifying FORK_BLOCK via env var feat(cli): allow skipping automatic solc version detection feat(seth): improve piped input support (foundry-rs#149) Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com> feat(seth): storage (foundry-rs#150) * feat(seth): storage * pad * fmt & clippy Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com> fix(dapptools): explicitly set lib_paths as allowed paths (foundry-rs#139) * fix(dapptools): set lib_paths to libraries on paths config * fix(dapptools): add lib_paths as allowed paths rather than as 'libs' * chore(dapptools): undo unrelated fmt change * chore(dapptools): appease linter deal + prank cheat codes (foundry-rs#146) * deal + spoof cheat codes fixes fixes deal + prank * fixes * no change of origin * fmt * prank is payable * accurate readme * clippy lint fix chore: fmt Adds etch (setCode) cheatcode ref: foundry-rs#151 Rebrand to Foundry (foundry-rs#156) * wip: rebrand * update readme * add demo svg * more readme * benches * cleanup * add more context in readme * docs: some cleanup (foundry-rs#153) * docs: tagline fixes (foundry-rs#154) * docs: add CLI docs * chore typos * docs * modify forge readme * modify forge readme * add cheatcodes readme * cli readme * retab * retab * add minimal utils readme * evm adapters docs * fix: parse block as decimal not hex * chore: fmt Co-authored-by: Matt <matt@mattsolomon.dev> Co-authored-by: t11s <greenfeatherhelp@gmail.com> more docs (foundry-rs#157) * update doc * update doc * update doc * fuzz docs * wrap evm adapters docs perf(evm-adapters): use existing runtime in SharedBackend if available (foundry-rs#158) * perf(evm-adapters): use existing runtime in SharedBackend if available * chore: box runtime to fix enum size lint Co-authored-by: Georgios Konstantopoulos <me@gakonst.com> perf: clippy is a good servant but a bad master (foundry-rs#159) fix(cli): set root to curr dir correctly feat(cli): print counterexample if fuzztest fails feat(cli): forge init (foundry-rs#161) * feat(cli): forge init * chore: address review comments fix(cli): install with Command vs libgit2 (foundry-rs#162) evmodin: update and fix breaking changes (foundry-rs#163)
deal: sets an address's balance
spoof: perform a call to another address from a different address,
i.e. current tx.origin && msg.sender == address(1) -> hevm.spoof(address(2), address(3), bytes([0000]) calls address(3) from address(2) with the bytes data. note this changes tx.origin. some debate could be had as to if thats the correct functionality. I believe it is
this is WIP as there are some issues rn and no tests