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

feat(forge): allow --verifier custom option (#9311) #6

Merged
merged 68 commits into from
Nov 29, 2024

Conversation

Dargon789
Copy link
Owner

@Dargon789 Dargon789 commented Nov 14, 2024

  • feat(forge): allow --verifier custom option

  • Changes after review: add description of custom verifier, reorg err message, add custom verifier api key

  • Fix descriptions

  • Update crates/verify/src/provider.rs


Motivation

Solution

Summary by Sourcery

Add support for a custom verification provider by introducing the --verifier custom option, along with the ability to specify a custom verifier API key and URL.

New Features:

  • Introduce a --verifier custom option to allow users to specify a custom verification provider.

Enhancements:

  • Add support for a custom verifier API key and URL, enabling integration with custom verification providers.

* feat(forge): allow `--verifier custom` option

* Changes after review: add description of custom verifier, reorg err message, add custom verifier api key

* Fix descriptions

* Update crates/verify/src/provider.rs

Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com>

---------

Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
Copy link

sourcery-ai bot commented Nov 14, 2024

Reviewer's Guide by Sourcery

This PR adds support for custom verification providers by introducing a new --verifier custom option. The implementation extends the existing verification infrastructure to handle custom providers that are compatible with the Etherscan API. It also adds a new --verifier-api-key parameter and improves error handling in the retry mechanism.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Added support for custom verification provider type
  • Added new Custom variant to VerificationProviderType enum
  • Implemented FromStr and Display traits for the Custom provider type
  • Set up Custom provider to use EtherscanVerificationProvider as its backend
crates/verify/src/provider.rs
Enhanced verifier configuration with API key support
  • Added new verifier_api_key field to VerifierArgs struct
  • Updated Default implementation for VerifierArgs
  • Added API key handling in figment Provider implementations
crates/verify/src/verify.rs
crates/verify/src/bytecode.rs
Improved error handling in retry mechanism
  • Updated error message formatting in handle_err method
  • Switched to sh_warn! macro for error logging
crates/common/src/retry.rs

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

sourcery-ai[bot]
sourcery-ai bot previously approved these changes Nov 14, 2024
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Dargon789 - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Please add tests for the custom verifier functionality to ensure it works as expected
  • The PR description is empty - please fill out the motivation and solution sections to help reviewers understand the context and purpose of these changes
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

crates/verify/src/verify.rs Show resolved Hide resolved
@Dargon789 Dargon789 enabled auto-merge (squash) November 14, 2024 21:44
* begin api and rough comments

* impl cheatcode

* add check for eoa

* fix eoa check on each prank call

* add to assets

* prank compiling

* delegate call working, storage not upating

* delegate call working, some tidy up

* add prank2 calls

* impl remaining tests

* formatting

* forge fmt

* add pranks to cheatcodes.json

* run cargo cheats

* If verbosity level is 1 or higher, it shows dirty files.

* Fix, add EOA prank test

* Revert "If verbosity level is 1 or higher, it shows dirty files."

This reverts commit d03ac1d.

* Fix test

* apply on extdelegatecall

---------

Co-authored-by: mgiagante <251503-mgiagante@users.noreply.gitlab.com>
Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
auto-merge was automatically disabled November 15, 2024 14:02

Head branch was pushed to by a user without write access

grandizzy and others added 3 commits November 15, 2024 16:29
…9321)

* add --sizes and --names JSON compatibility + generalize report kind

* add additional json output tests

* fix feedback nit
Copy link
Owner Author

@Dargon789 Dargon789 left a comment

Choose a reason for hiding this comment

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

feat(forge): allow --verifier custom option (foundry-rs#9311) #6

* test: enhance tests

* update ws url

* Assert json unordered

* Update crates/test-utils/src/util.rs

Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>

* Changes after review

* Fix rpc url test

---------

Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
Co-authored-by: grandizzy <38490174+grandizzy@users.noreply.github.com>
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
@Dargon789 Dargon789 enabled auto-merge (squash) November 16, 2024 12:53
Locking 40 packages to latest compatible versions
    Updating allocator-api2 v0.2.19 -> v0.2.20
    Updating alloy-dyn-abi v0.8.11 -> v0.8.12
    Updating alloy-json-abi v0.8.11 -> v0.8.12
    Updating alloy-primitives v0.8.11 -> v0.8.12
    Updating alloy-sol-macro v0.8.11 -> v0.8.12
    Updating alloy-sol-macro-expander v0.8.11 -> v0.8.12
    Updating alloy-sol-macro-input v0.8.11 -> v0.8.12
    Updating alloy-sol-type-parser v0.8.11 -> v0.8.12
    Updating alloy-sol-types v0.8.11 -> v0.8.12
    Updating aws-sdk-sts v1.49.0 -> v1.50.0
    Updating axum v0.7.7 -> v0.7.9
    Updating bstr v1.10.0 -> v1.11.0
    Updating cc v1.1.37 -> v1.2.1
    Updating clap v4.5.20 -> v4.5.21
    Updating clap_builder v4.5.20 -> v4.5.21
    Updating clap_complete v4.5.37 -> v4.5.38
    Updating clap_lex v0.7.2 -> v0.7.3
    Updating comfy-table v7.1.1 -> v7.1.3
    Updating cpufeatures v0.2.14 -> v0.2.15
    Removing crossterm v0.27.0
      Adding diff v0.1.13
    Updating flate2 v1.0.34 -> v1.0.35
    Updating indicatif v0.17.8 -> v0.17.9
      Adding indoc v2.0.5
    Updating instability v0.3.2 -> v0.3.3
    Removing instant v0.1.13
    Updating libc v0.2.162 -> v0.2.164
      Adding pretty_assertions v1.4.1
    Updating quinn v0.11.5 -> v0.11.6
    Updating quinn-proto v0.11.8 -> v0.11.9
    Updating regex-automata v0.4.8 -> v0.4.9
    Updating rustix v0.38.39 -> v0.38.40
    Updating rustls v0.23.16 -> v0.23.17
    Updating scc v2.2.4 -> v2.2.5
    Updating serde v1.0.214 -> v1.0.215
    Updating serde_derive v1.0.214 -> v1.0.215
    Updating syn-solidity v0.8.11 -> v0.8.12
    Removing thiserror v1.0.68
      Adding thiserror v1.0.69 (available: v2.0.3)
      Adding thiserror v2.0.3
    Removing thiserror-impl v1.0.68
      Adding thiserror-impl v1.0.69
      Adding thiserror-impl v2.0.3
      Adding web-time v1.1.0
note: pass `--verbose` to see 44 unchanged dependencies behind latest

Co-authored-by: mattsse <19890894+mattsse@users.noreply.github.com>
auto-merge was automatically disabled November 17, 2024 09:06

Head branch was pushed to by a user without write access

Copy link
Owner Author

@Dargon789 Dargon789 left a comment

Choose a reason for hiding this comment

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

update cargo.lock

@Dargon789 Dargon789 enabled auto-merge (squash) November 17, 2024 15:45
@Dargon789 Dargon789 linked an issue Nov 17, 2024 that may be closed by this pull request
auto-merge was automatically disabled November 18, 2024 06:56

Head branch was pushed to by a user without write access

Copy link
Owner Author

@Dargon789 Dargon789 left a comment

Choose a reason for hiding this comment

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

feat(forge): allow --verifier custom option (foundry-rs#9311) #6
test

Copy link
Owner Author

@Dargon789 Dargon789 left a comment

Choose a reason for hiding this comment

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

test again

@Dargon789 Dargon789 enabled auto-merge (rebase) November 18, 2024 08:08
* feat(cast storage): allow ugly printing of layout

Prior to this change, `cast storage $ADDRESS --rpc-url $RPC_URL
--etherscan-api-key $ETHERSCAN_API_KEY` always provided a prettified
output.

This change adds a `--pretty` flag to `cast storage` which defaults to
`true` thus retaining backwards compatibility. Passing `--pretty=false`
to `cast storage` results in the json output of the storage layout being
produced instead.

* fix: remove default value from help text

The default value is accessible via `cast storage --help`

* fix(cast storage): provide output json path

* test(cast): add storage_layout_simple_json test

* fix(cast storage): use `--json` flag to ugly print

* fix(cast storage): include values in json mode

* fix(cast-storage): quiet compilation in all cases

* chore: cargo clippy

* use fixtures, assert JSON

* only quiet if JSON mode, avoid unnecessary warning (if you pass an API key you already expect to fetch remote, very likely default)

---------

Co-authored-by: zerosnacks <95942363+zerosnacks@users.noreply.github.com>
Co-authored-by: zerosnacks <zerosnacks@protonmail.com>
auto-merge was automatically disabled November 18, 2024 14:48

Head branch was pushed to by a user without write access

* chore: Update to Cancun

* cancun to TEST_DATA_DEFAULT, add TEST_DATA_PARIS

* Shanghai compat test

* Redact gaswaster address
Copy link
Owner Author

@Dargon789 Dargon789 left a comment

Choose a reason for hiding this comment

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

crates file test

@Dargon789 Dargon789 enabled auto-merge (squash) November 18, 2024 17:44
…les to compile (#9325)

* If verbosity level is 1 or higher, it shows dirty files.

* Adds verbose message variant for compilation.

* Removing `if..else` statement to always display `self.send_msg`.

* Changes order of messages.

* Removes semicolons and adds comment on message order.

* Removes verbose variant in favor of the already existing variant.

* nits, sort the dirty files list and prefix with -

* Raises verbosity level to 5+

* Update crates/common/src/term.rs

Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>

---------

Co-authored-by: mgiagante <251503-mgiagante@users.noreply.gitlab.com>
Co-authored-by: zerosnacks <zerosnacks@protonmail.com>
Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
Copy link
Owner Author

@Dargon789 Dargon789 left a comment

Choose a reason for hiding this comment

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

review cargo.lock new update forge test

@Dargon789 Dargon789 enabled auto-merge (squash) November 23, 2024 03:01
auto-merge was automatically disabled November 23, 2024 14:15

Head branch was pushed to by a user without write access

DaniPopes and others added 25 commits November 23, 2024 16:10
Locking 36 packages to latest compatible versions
    Updating async-compression v0.4.17 -> v0.4.18
    Updating bytemuck v1.19.0 -> v1.20.0
    Updating const-hex v1.13.1 -> v1.13.2
      Adding core-foundation v0.10.0
    Updating cpufeatures v0.2.15 -> v0.2.16
    Updating h2 v0.4.6 -> v0.4.7
    Updating hyper v1.5.0 -> v1.5.1
    Updating impl-trait-for-tuples v0.2.2 -> v0.2.3
    Updating interprocess v2.2.1 -> v2.2.2
    Updating itoa v1.0.11 -> v1.0.13
    Updating litemap v0.7.3 -> v0.7.4
    Updating op-alloy-consensus v0.6.5 -> v0.6.8
    Updating op-alloy-rpc-types v0.6.5 -> v0.6.8
    Updating portable-atomic v1.9.0 -> v1.10.0
    Updating proc-macro2 v1.0.89 -> v1.0.92
    Updating quick-junit v0.5.0 -> v0.5.1
    Updating quick-xml v0.36.2 -> v0.37.1
    Updating rustix v0.38.40 -> v0.38.41
    Updating rustls v0.23.17 -> v0.23.18
    Updating rustls-native-certs v0.8.0 -> v0.8.1
    Updating scale-info v2.11.5 -> v2.11.6
    Updating scale-info-derive v2.11.5 -> v2.11.6
    Updating schannel v0.1.26 -> v0.1.27
      Adding security-framework v3.0.1
    Updating semver-parser v0.10.2 -> v0.10.3
    Updating syn v2.0.87 -> v2.0.89
    Updating sync_wrapper v1.0.1 -> v1.0.2
    Updating unicode-ident v1.0.13 -> v1.0.14
    Updating url v2.5.3 -> v2.5.4
    Updating wasmtimer v0.4.0 -> v0.4.1
    Updating webpki-roots v0.26.6 -> v0.26.7
    Updating yoke v0.7.4 -> v0.7.5
    Updating yoke-derive v0.7.4 -> v0.7.5
    Updating zerofrom v0.1.4 -> v0.1.5
    Updating zerofrom-derive v0.1.4 -> v0.1.5
    Updating zip v2.2.0 -> v2.2.1
note: pass `--verbose` to see 18 unchanged dependencies behind latest

Co-authored-by: mattsse <19890894+mattsse@users.noreply.github.com>
…as alias (#9406)

remove duplicate gas_limit field, declare as alias
Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
Revert "feat: remove ethers (#8826)"

This reverts commit d739704.
* adhere to --quiet flag

* revert case-specific handling of writing to progress, redundant

* handle writing to multiprogress, previously panic

* make verification process compatible with --json flag

* revert verifaction --json flow, too messy

* clean up

* revert

* handle json correctly for script deployment logs, incl. receipts

* avoid incompatible lines with json output

* revert unnecessary change

* add json and quiet test

* address feedback

* fix incorrect ordering
Signed-off-by: wangjingcun <wangjingcun@aliyun.com>
…#9420)

* add --broadcast flag to forge create, default to dry run

* nits

* fix tests

* add dry run tests incl --json

* minor fixes, failing test due to minor bytecode difference
…`-vvvvv` (#9013)

* Add options for state changes output and json output in cast run command

* fix test

* add back serde_json in Cargo.lock

* format using nightly

* rename parameter

* update revm-inspectors

* supress clippy warning and merge master

* add serde_json

* disable some stdout print when --json option is used

* remove unnecessary check

* replace with sh_println

* replace with shell::is_json

* Show storage for verbosity > 1, add test

* Change verbosity to > 4 for both cast and forge test, add test, fix ci

---------

Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
* feat: rewrite inline config using figment

* wip

* wip

* fix: use same GasLimit type

* wip

* fixes

* tests

* test fixes

* fmt

* test update
* script: evm_opts -> evm_args

Signed-off-by: jsvisa <delweng@gmail.com>

* forge: evm_opts -> evm_args

Signed-off-by: jsvisa <delweng@gmail.com>

* chisel: evm_opts -> evm_args

Signed-off-by: jsvisa <delweng@gmail.com>

* forge: evm_opts -> evm_args

Signed-off-by: jsvisa <delweng@gmail.com>

---------

Signed-off-by: jsvisa <delweng@gmail.com>
This pull request addresses a minor but important syntax issue in the conditional statement used to check for the presence of libusb on macOS.
* feat: add timeouts to fuzz testing

Adds --fuzz-timeout-secs to fuzz tests which will cause a property
test to timeout after a certain number of seconds. Also adds
--fuzz-allow-timeouts so that timeouts are optionally not
considered to be failures.

* simplify timeout implementation

* use u32 for timeout

* switch back to failing for timeouts

* clippy

* Nits:
- move logic to interrupt invariant test in depth loop
- add and reuse start_timer fn and TEST_TIMEOUT constant
- add fuzz and invariant tests
- fix failing test

* Fix fmt

* Changes after review: introduce FuzzTestTimer

---------

Co-authored-by: grandizzy <grandizzy.the.egg@gmail.com>
…9428)

* feat(cast): Add custom error decoding support

* Review changes

* Changes after review: decode with Openchain too, add test

* Review changes: nit, handle incomplete selectors
* use alloy-chains' is_arbitrum

* clean up
* feat: specify `rpc_headers` in cast and config

* test
@Dargon789 Dargon789 merged commit 443d4b4 into Dargon789:master Nov 29, 2024
21 checks passed
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.

bug: release workflow failed