alloy-rs / core

High-performance, well-tested & documented core libraries for Ethereum, in Rust
https://alloy.rs
Apache License 2.0
786 stars 149 forks source link

[Bug] Solidity ABI flattening internalType arrays #585

Closed Yen closed 7 months ago

Yen commented 7 months ago

Component

sol! macro

What version of Alloy are you on?

├── alloy-primitives v0.6.4 │ ├── alloy-rlp v0.3.4 │ │ ├── alloy-rlp-derive v0.3.4 (proc-macro) │ │ ├── alloy-rlp v0.3.4 () ├── alloy-rpc-types v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ ├── alloy-primitives v0.6.4 () │ ├── alloy-rlp v0.3.4 () │ ├── alloy-serde v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ ├── alloy-primitives v0.6.4 () ├── alloy-sol-macro v0.6.4 (proc-macro) │ ├── alloy-json-abi v0.6.4 │ │ ├── alloy-primitives v0.6.4 │ │ ├── alloy-sol-type-parser v0.6.4 ├── alloy-sol-types v0.6.4 │ ├── alloy-primitives v0.6.4 () │ ├── alloy-sol-macro v0.6.4 (proc-macro) () ├── alloy-primitives v0.6.4 () ├── alloy-provider v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ ├── alloy-json-rpc v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ ├── alloy-primitives v0.6.4 () │ ├── alloy-network v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ ├── alloy-consensus v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ │ ├── alloy-eips v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ │ │ ├── alloy-primitives v0.6.4 () │ │ │ │ ├── alloy-rlp v0.3.4 () │ │ │ ├── alloy-primitives v0.6.4 () │ │ │ └── alloy-rlp v0.3.4 () │ │ ├── alloy-eips v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ │ ├── alloy-json-rpc v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ │ ├── alloy-primitives v0.6.4 () │ │ ├── alloy-rpc-types v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ │ ├── alloy-signer v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ │ ├── alloy-primitives v0.6.4 () │ ├── alloy-primitives v0.6.4 () │ ├── alloy-rpc-client v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ ├── alloy-json-rpc v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ │ ├── alloy-transport v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ │ ├── alloy-json-rpc v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ │ ├── alloy-transport-http v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ │ ├── alloy-json-rpc v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ │ │ ├── alloy-transport v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ ├── alloy-rpc-trace-types v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) │ │ ├── alloy-primitives v0.6.4 () │ │ ├── alloy-rpc-types v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ │ ├── alloy-serde v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ ├── alloy-rpc-types v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ ├── alloy-transport v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ ├── alloy-transport-http v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () ├── alloy-rpc-types v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () ├── alloy-sol-macro v0.6.4 (proc-macro) () ├── alloy-sol-types v0.6.4 () ├── alloy-transport-http v0.1.0 (https://github.com/alloy-rs/alloy?rev=410850b#410850b3) () │ │ │ │ ├── alloy-rlp v0.3.4 (*)

Operating System

Linux

Describe the bug

I using the PoolBalanceChanged event from a BalancerV2 derived protocol (equivalent ABI https://etherscan.io/address/0xBA12222222228d8Ba445958a75a0704d566BF2C8#code). The tokens input is of type address[] but internal type contract IERC20[]. If I remove the internal type from the ABI, it correctly becomes a Vec<Address> through the sol! macro, but with the internal type it gets interpreted as Address as if it was ignoring the array. When I view the generated docs on the sol! output for the ABI, it shows it parsed event signature as event PoolBalanceChanged(bytes32 indexed poolId, address indexed liquidityProvider, address tokens, int256[] deltas, uint256[] protocolFeeAmounts), which is incorrect.