Skip to content

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

Open
@QYuQianchen

Description

@QYuQianchen

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions