Skip to content

feat(forge bind): dedupe generated alloy type bindings by sharing types #10153

Open
@alxiong

Description

@alxiong

Component

Forge

Describe the feature you would like

Currently alloy bindings are all separate in their own submodule, if multiple child contracts uses the same library, e.g. contract B and C uses library A, then types in library A will appear in both the bindings of B and C in the current version of forge bind --aloy

a concrete example is:

https://github.com/EspressoSystems/espresso-network/tree/ace0e437e653187a9cd8e50fd71da6403c18f3ef/contracts/rust/adapter/src/bindings
you will find pub mod BN254 { pub struct G1Point } both in lightclient.rs and iplonkverifier.sol and plonkverifier.sol and they are all mutually incompatible types (or different types)

This create pains because any additional methods written for one of the types won't be translated over to another. (e.g. the From<arkworks::G1Point> for G1Point)

This doesn't used to be a problem in ethers-rs's bindings, because the share_types.rs logic, where shared types are extrapolated out into a separate files and all other modules inherits from that.

This issue requests a similar feature in alloy bindings.

Additional context

No response

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