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

Abigen descriptor for function Call objects has incorrect function selector in comments #2771

Closed
rileyg98 opened this issue Mar 18, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@rileyg98
Copy link

rileyg98 commented Mar 18, 2024

Version
├── ethers v2.0.13
│ ├── ethers-addressbook v2.0.13
│ │ ├── ethers-core v2.0.13
│ ├── ethers-contract v2.0.13
│ │ ├── ethers-contract-abigen v2.0.13
│ │ │ ├── ethers-core v2.0.13 ()
│ │ ├── ethers-contract-derive v2.0.13 (proc-macro)
│ │ │ ├── ethers-contract-abigen v2.0.13
│ │ │ │ ├── ethers-core v2.0.13 (
)
│ │ │ ├── ethers-core v2.0.13 ()
│ │ ├── ethers-core v2.0.13 (
)
│ │ ├── ethers-providers v2.0.13
│ │ │ ├── ethers-core v2.0.13 ()
│ ├── ethers-core v2.0.13 (
)
│ ├── ethers-etherscan v2.0.13
│ │ ├── ethers-core v2.0.13 ()
│ ├── ethers-middleware v2.0.13
│ │ ├── ethers-contract v2.0.13 (
)
│ │ ├── ethers-core v2.0.13 ()
│ │ ├── ethers-etherscan v2.0.13 (
)
│ │ ├── ethers-providers v2.0.13 ()
│ │ ├── ethers-signers v2.0.13
│ │ │ ├── ethers-core v2.0.13 (
)
│ ├── ethers-providers v2.0.13 ()
│ └── ethers-signers v2.0.13 (
)
├── ethers-core v2.0.13 ()
├── ethers-flashbots v0.15.0
│ ├── ethers v2.0.13 (
)
├── ethers-providers v2.0.13 (*)

Platform
5.10.102.1-microsoft-standard-WSL2 #1 SMP Wed Mar 2 00:30:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Description
When generating an abigen file using the macro, I've just discovered the comments on the function Call container types for input parameters has the function selectors mixed up. The actual functions to call these functions have the correct selectors in their comments EDIT: Turns out these are also mixed up, but when cross-referencing these, the selector is referenced in a totally different Call container type. Only discovered when using the selectors as a match case to parse input parameters for validation.

I've attached the rs file containing this incorrect output - had to rename it to a .txt.

ToadRouter04.rs.txt

The correct function selectors for each call are here https://etherscan.io/address/0xb62bdeda5d1e7a03a615b793e949c19d158c6b46#writeProxyContract

in particular check SwapExactTokensForTokensSupportingFeeOnTransferTokens

@rileyg98 rileyg98 added the bug Something isn't working label Mar 18, 2024
@rileyg98
Copy link
Author

It would appear method hash signatures are also impacted.

@rileyg98
Copy link
Author

Err... scratch all this, I had the wrong ABI version.

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

No branches or pull requests

1 participant