Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Abigen produces bindings with dependency issues #2271

Closed
FrankieIsLost opened this issue Mar 16, 2023 · 3 comments · Fixed by #2274
Closed

Abigen produces bindings with dependency issues #2271

FrankieIsLost opened this issue Mar 16, 2023 · 3 comments · Fixed by #2274
Labels
bug Something isn't working

Comments

@FrankieIsLost
Copy link
Contributor

Version
439a0c7

Platform
MacOS

Description
#2222 seems to have affected binding generation. forge bind generates bindings which produce the following errors

error[E0432]: unresolved import `futures_util::try_join`
   |
35 | use futures_util::{lock::Mutex, try_join};
   |                                 ^^^^^^^^ no `try_join` in the root

error: cannot determine resolution for the macro `try_join`
    |
789 |             try_join!(self.resolve_field(ens_name, "avatar"), self.resolve_name(ens_name))?;
    |             ^^^^^^^^
    |
    = note: import resolution is stuck, try simplifying macro imports

    Checking ethers-contract-abigen v2.0.0 (https://github.com/gakonst/ethers-rs#439a0c7d)

Relatedly, should the generated Cargo.toml file pin ethers to a specific version?

@FrankieIsLost FrankieIsLost added the bug Something isn't working label Mar 16, 2023
@DaniPopes
Copy link
Collaborator

How can I reproduce this? And where is the error occurring?

@FrankieIsLost
Copy link
Contributor Author

I believe it should be affecting all bindings generation, but you can use the same toy example from #2261. Adding it here as well:

Consider the following solidity code

pragma solidity ^0.8.13;

contract TestContract {
    event EmptyEvent();
}

Running forge bind --bindings-path ./bindings --crate-name bindings after a fresh foundryup generates rust code that produces the error

@DaniPopes
Copy link
Collaborator

DaniPopes commented Mar 16, 2023

Oh I see, it breaks on building the repo, even if you cd into it and build it there it's fine, I'm not sure what this is.
Can you try again after manually setting [package] ... resolver = "1" in Cargo.toml?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants