Skip to content

bug(forge bind): generated contract bindings are incompatible with alloy-rs 0.14.0 #10321

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

Open
2 tasks done
Tracked by #10183
QYuQianchen opened this issue Apr 16, 2025 · 1 comment
Open
2 tasks done
Tracked by #10183
Labels
Cmd-forge-bind Command: forge bind T-blocked Type: blocked T-bug Type: bug

Comments

@QYuQianchen
Copy link

QYuQianchen commented Apr 16, 2025

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge Version: 1.1.0-nightly Commit SHA: f0e24fb Build Timestamp: 2025-04-15T06:04:06.457241000Z (1744697046)

What version of Foundryup are you on?

foundryup: 1.0.1

What command(s) is the bug in?

forge bind

Operating System

macOS (Apple Silicon)

Describe the bug

When running forge bind against alloy v0.14.0, the generated Rust code no longer compiles because the forge bind template still assumes pre‑0.14 interfaces in alloy-contract and alloy-sol-types.

The following errors pop up when using alloy crate of v0.14.0 with "transports" feature enabled:

  1. Missing Transport
error[E0405]: cannot find trait Transport in module alloy_contract::private
     |
2925 |         T: alloy_contract::private::Transport + ::core::clone::Clone,
     |                                     ^^^^^^^^^ not found in alloy_contract::private
  1. abi_decode_returns lost its validate: bool parameter
error[E0050]: method abi_decode_returns has 2 parameters but the declaration in trait abi_decode_returns has 1
     |
1119 |                   data: &[u8],
     |  _______________________^
1120 | |                 validate: bool,
     | |______________________________^ expected 1 parameter, found 2
     |
     = note: abi_decode_returns from trait: fn(&[u8]) -> std::result::Result<<Self as SolCall>::Return, alloy::alloy_sol_types::Error>
  1. decode_raw_log dropped its validate: bool parameter as well
error[E0050]: method decode_raw_log has 3 parameters but the declaration in trait alloy::alloy_sol_types::SolEventInterface::decode_raw_log has 2
     |
2843 |               topics: &[alloy_sol_types::Word],
     |  _____________________^
2844 | |             data: &[u8],
2845 | |             validate: bool,
     | |__________________________^ expected 2 parameters, found 3
     |
     = note: decode_raw_log from trait: fn(&[alloy::alloy_primitives::FixedBytes<32>], &[u8]) -> std::result::Result<Self, alloy::alloy_sol_types::Error>
  1. SolCallBuilder type alias lost a generic parameter
error[E0107]: type alias takes at most 3 generic arguments but 4 generic arguments were supplied
     |
3124 |         ) -> alloy_contract::SolCallBuilder<T, &P, bindKeysCall, N> {
     |                              ^^^^^^^^^^^^^^                    --- help: remove the unnecessary generic argument
     |                              |
     |                              expected at most 3 generic arguments
     |
note: type alias defined here, with at most 3 generic parameters: P, C, N

For the validate param, the change log of alloy-sol-macro-expander (part of alloy-core) indicates that it has been removed in version "1.0.0" (released after version "0.8.24"), while the version used in foundry stays at "0.8.22"

@QYuQianchen QYuQianchen added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Apr 16, 2025
@github-project-automation github-project-automation bot moved this to Todo in Foundry Apr 16, 2025
@QYuQianchen QYuQianchen changed the title Generated binding incompatible with alloy-rs Generated contract bindings are incompatible with alloy-rs Apr 17, 2025
@yash-atreya
Copy link
Member

@QYuQianchen, thanks for notifying. This is because alloy hasn't been bumped to 0.14 in foundry.

For more context,
alloy 0.14 depends on alloy-core 1.0 which consists of several breaking changes including the ones you're facing compilation issues.

To bump alloy, we need couple of things across the toolchain to be bumped first such as revm, and revm-inspectors.

@zerosnacks zerosnacks changed the title Generated contract bindings are incompatible with alloy-rs bug(forge bind): generated contract bindings are incompatible with alloy-rs 0.14.0 Apr 17, 2025
@zerosnacks zerosnacks added Cmd-forge-bind Command: forge bind T-blocked Type: blocked and removed T-needs-triage Type: this issue needs to be labelled labels Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cmd-forge-bind Command: forge bind T-blocked Type: blocked T-bug Type: bug
Projects
Status: Todo
Development

No branches or pull requests

3 participants