Skip to content
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

chore: upstream f5aa05e commits #686

Merged
merged 101 commits into from
Nov 1, 2024
Merged

chore: upstream f5aa05e commits #686

merged 101 commits into from
Nov 1, 2024

Conversation

elfedy
Copy link
Contributor

@elfedy elfedy commented Nov 1, 2024

What 💻

Add all upstream commits for f5aa05e update

Why ✋

They get lost when squashing the update PR commits

Evidence 📷

Commits are added and conflicts resolved taking all our changes but no changes happen

DaniPopes and others added 30 commits September 20, 2024 11:58
* feat(cheatcode): disaply message for cheatcodes marked as deprecated

* Deprecated cheatcodes as hashset, displayed once per test suite

* Add deprecated cheatcode replacement attr

* Add support for fuzz and invariant tests

* Changes after review: add Deprecated(replacement)

* Update crates/cheatcodes/src/inspector.rs

Co-authored-by: DaniPopes <[email protected]>

* chore: touchups

* Fix CI

---------

Co-authored-by: DaniPopes <[email protected]>
* refactor: rewrite the console.log format string parser

* chore: clippy
* feat: implement `parseTomlType` cheats

* chore: `forge fmt`

* revert: use json naming to indicate to users that they are operating on json data

* chore: nit

* chore: nit
improve description of --flamechart and --flamegraph, explaining the difference
chore(evm): use dyn DatabaseExt in inspect
chore: use serde_json::from_str when possible
* chore: deprecate --debug regex argument

* fix: enable full internal decoding if exactly one test matched
…ansaction` conversion (#8942)

* fix(`anvil`): handle OP deposit tx in TypeTransaction conversion.

* nits

* clippy

* test

Co-authored-by: grandizzy <[email protected]>

* nits

---------

Co-authored-by: grandizzy <[email protected]>
…m gas_limit on forks (#8933)

* fix: #8759, do not set low gas price on block if disabled, use custom gas price in forks

* test(fix): default block gas limit for large mine test

* fix fmt

* fix: optional gas_limit in as_json

* fix: use option not serde_json::Value::Null

* tests: base tests + config tests

* fix: nits

* fix: comment
* add makefile + codespell

* update makefile

* fix typos found by codespell

* add codespell CI task

* fix outdated spec

* ignore testdata

* switch default profile to dev, add strat to ignored words list
* chore: improve fuzz scrape bytecode test

* Remove duped comments, Trigger CI
* chore: add anvil NodeHandle.fire_shutdown_signal

* Remove DAPP remappings from env vars from cli tests.

* Unwrap fire shutdown

* Fix clippy

* track_caller on fire shutdown

* fire shutdown signal on drop
…loyedCode` (#8938)

* feat(`cheatcodes`): vm.getArtifactPath

* cargo cheats

* nit

* nit

* fix

* test: vm.getArtifactPath

* feat: vm.getArtifactPath(creationCode)

* cheats

* nit

* change seed

* rm vm.getArtifactPath(contractName)

* fmt

* nit

* fix

* nit

* rename

* nit

* fix

---------

Co-authored-by: grandizzy <[email protected]>
grandizzy and others added 26 commits October 9, 2024 14:18
redact RPC urls if string is a URL, not an alias
* test: relax pragmas

* test: update rust tests too
…ing` for ERC4337 testing (#8571)

* feat: add record opcode cheat code

feat: capture stack inputs as part of the opcode

feat: record opcode -> record debug trace

fix: memory OOG, need to only use needed stack, mem input

fix: missing op code, instruction results

fix: accessing out-of-bound idx memory

When running on some project, we noticed that it sometimes try to access memory with out of bound
index and panics.

This commit fix it by:
1. Enfore reset to Nonce after stopDebugTraceRecording(), this ensures the `some(..) = ...` part will not be triggered
2. Change how opcode_utils.rs accesses memory. Return empty vector if trying access out-of-bound memory.

* test: add DebugTrace.t.sol for the debug trace cheatcode

* fix: rebase errors

* feat: use tracer for debug trace instead of recording during inspector

This commit also cleans up the previous implementaiton on inspector.
And then change the cheatcode interface to be of three steps:
1. start recording debug trace
2. stop recording
3. get the debug trace by index

The reason is to avoid out-of-memory issue by returning the whole traces at once.

* fix: rebase duplication

* feat: replace instruction result with isOutOfGas

* fix: CI issues

* fix: remove DebugTrace wrapper in inspector

* fix: revert to original tracer config when stops

* chore: reuse existing opcode functions

* chore: refactor, fmt, clippy run

* chore: use ref instead of clone, returning Error when not able to access

* chore: move buffer to evm_core from debugger

* fix: disable dummy tracer by default, return explicit error

Since enabling dummy tracer still come with performance impact, remove the auto dummy tracer
initiation. The cheatcode will return explicit error and require the test to be run in -vvv mode
to have the tracer enabled by default.

* fix: return all traces, turn on necessary tracer config

There was OOM concern but using the get-by-index style, despite improved, does not solve the root cause.
The main issue is that the tracer config did not turn off after the stop recording cheatcode being called.
It seems too much burden for the tracer to record the returned traces inside forge tests as the tests will
also pass around the debug traces, causing memory boost.

This commit also only turns on necessary tracer config instead of using all().

* chore: cleanup comments, typo

* fix: use bytes for memory, remove flattern function, fix get_slice_from_memory

* fix: style fmt

* fix: ensure steps in the order of node when flatten

A node can have steps that calls to another node, so the child node's step might occur before
some steps of its parent node. This introduce the flatten_call_trace function back using
recursive call to ensure the steps are in correct order despite not in the same order of the
node index.

see PR comment: foundry-rs/foundry#8571 (comment)

* doc: remove legacy comment in test

* style: reuse empty initialized var on return val

---------

Co-authored-by: zerosnacks <[email protected]>
* feat(`forge doc`): include @Custom natspec

* chore: make clippy happy

* test: implement test for `is_custom`

* chore: make rustfmt happy

* doc: nit

* chore: format custom tags
* fix(chisel): consider assembly block return as final statement

* Fix 4938

* Start from first assembly block when checking for return statement

* Fix 6618
* add gas report generation in JSON

* skip junit for now

* add json formatted tests, trailing space and invalid formatting

* avoid redundant modifications for calls count

* replace existing tests with snapbox

* clean up snapbox tests

* merge in master

* calls -> frames

* use .is_jsonlines()
* feat: bump alpine to `3.20.3`

* feat: alpine v`3.20`
…ns another string (#9085)

* feat: implement new cheatcode to check if a string contains another string

* chore: make clippy and rustfmt happy

* chore: vm.contains should return a boolean

* Update testdata/cheats/Vm.sol

Co-authored-by: zerosnacks <[email protected]>

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: zerosnacks <[email protected]>

* chore: update `cheatcodes.json`

* chore: update var names

* chore: rename to `vm.contains`

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: Matt Solomon <[email protected]>

* Update crates/cheatcodes/spec/src/vm.rs

Co-authored-by: Matt Solomon <[email protected]>

* chore: address PR comments

---------

Co-authored-by: zerosnacks <[email protected]>
Co-authored-by: Matt Solomon <[email protected]>
Locking 35 packages to latest compatible versions
    Updating alloy-dyn-abi v0.8.6 -> v0.8.7
    Updating alloy-json-abi v0.8.6 -> v0.8.7
    Updating alloy-primitives v0.8.6 -> v0.8.7
    Updating alloy-sol-macro v0.8.6 -> v0.8.7
    Updating alloy-sol-macro-expander v0.8.6 -> v0.8.7
    Updating alloy-sol-macro-input v0.8.6 -> v0.8.7
    Updating alloy-sol-type-parser v0.8.6 -> v0.8.7
    Updating alloy-sol-types v0.8.6 -> v0.8.7
    Updating async-compression v0.4.13 -> v0.4.14
    Updating aws-sdk-kms v1.46.0 -> v1.47.0
    Updating aws-sdk-sso v1.45.0 -> v1.46.0
    Updating aws-sdk-ssooidc v1.46.0 -> v1.47.0
    Updating aws-sdk-sts v1.45.0 -> v1.46.0
    Updating aws-smithy-runtime v1.7.1 -> v1.7.2
    Updating cc v1.1.28 -> v1.1.30
    Updating clap v4.5.19 -> v4.5.20
    Updating clap_builder v4.5.19 -> v4.5.20
    Updating clap_complete v4.5.32 -> v4.5.33
    Updating derive_builder v0.20.1 -> v0.20.2
    Updating derive_builder_core v0.20.1 -> v0.20.2
    Updating derive_builder_macro v0.20.1 -> v0.20.2
    Updating js-sys v0.3.70 -> v0.3.72
    Updating lru v0.12.4 -> v0.12.5
    Updating newtype-uuid v1.1.0 -> v1.1.2
    Updating proc-macro2 v1.0.86 -> v1.0.87
    Updating scc v2.2.0 -> v2.2.1
    Updating sdd v3.0.3 -> v3.0.4
    Updating syn-solidity v0.8.6 -> v0.8.7
    Updating wasm-bindgen v0.2.93 -> v0.2.95
    Updating wasm-bindgen-backend v0.2.93 -> v0.2.95
    Updating wasm-bindgen-futures v0.4.43 -> v0.4.45
    Updating wasm-bindgen-macro v0.2.93 -> v0.2.95
    Updating wasm-bindgen-macro-support v0.2.93 -> v0.2.95
    Updating wasm-bindgen-shared v0.2.93 -> v0.2.95
    Updating web-sys v0.3.70 -> v0.3.72
note: pass `--verbose` to see 10 unchanged dependencies behind latest

Co-authored-by: mattsse <[email protected]>
* feat(`cheatcodes`): vm.rememberKeys

* docs + return addresses + test

* remeberKeys with language

* doc nits

* cargo cheats

* set script wallet in config if unset

* nit

* test
* refactor(`cheatcodes`): mv `ScriptWallets` into `Cheatcode` from `CheatsConfig`

* nit

* rename `ScriptWallets` to `Wallets`

* rename cheatcode

* doc nits
… error out due to nonce desync from rpc latency (#9096)

* fix for issue #9095

* changed 'if' statement into 'match'

* fmt fix

* repeat ask for provider nonce on desync

* loop break and tokio::time use instead of std::thread
… (#9050)

* Identify by creation code

* Compute score for both creation and runtime code

* Fallback to deployed bytecode only if min creation bytecode score is under threshold

* reuse check closure, add basic test
* refac(`script`): extract script sequence and related types to new crate

* replace MultiChainSequence in script crate

* replace TransactionWithMetadata and AdditionalContract

* replace ScriptSequence

* replace all underlying ScriptSequence and related types

* doc nits

* add `ScriptTransactionBuilder`

* remove `TxWithMetadata`

* mv verify fns and use `ScriptSequence` directly

* clippy
…:foundry-rs/foundry into elfedy-f5aa05e-commits
@elfedy elfedy requested a review from a team November 1, 2024 13:05
Copy link
Contributor

@Karrq Karrq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@elfedy elfedy merged commit aa85b6a into main Nov 1, 2024
13 checks passed
@elfedy elfedy deleted the elfedy-f5aa05e-commits branch November 1, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.