foundry-rs / foundry-rs/foundry

Using ABI decoding tools for debugging is harder than it should be

Open
#11,068 2 comments 2 reactions 0 assignees View on GitHub
T-feature T-to-investigate
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
18h 20m
Merged PRs (30d)
510

Description

### Component

Cast

### Describe the feature you would like

The current tooling for ABI decoding in Foundry is lacking a bit once your contracts become more complex. Some features I'd like to see:

- Decoding calldata from a pre-built Foundry project (that is any ABI decoding command in Cast should be able to use the signatures in the local directory)
- Utilities for decoding `bytes` and `bytes[]` into other types, especially structs. In the smart contracts I work with, a lot of our parameters are just `bytes` or `bytes[]` and they are manually decoded into structs. There is currently no easy way (as far as I know) to decode a blob into some other type, especially a struct defined in a Foundry project. Current workarounds include using a combination of `cast abi-decode` and `forge eip712`.

### Additional context

I challenge you to decode the following calldata blob into an `Intent`, and then `encodedPrecalls` in the intent into `SignedCall`s for this repo: https://github.com/ithacaxyz/account/

The call is for this function https://github.com/ithacaxyz/account/blob/fa369c9675cca63df83e44a78ef626b972da3b49/src/Simulator.sol#L213


0x622ad0de000000000000000000000000ee3ee2e1bd6ea49fbbab4582a7e3f45d07376362000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000090000000000000000000000000000000000000000000000000006c6d821990b8d0000000000000000000000000000000000000000000000000000000000002af8000000000000000000000000000000000000000000000000000000000000271000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000044cb40f0176ebf9daba987b0a6de90b99d8161f100000000000000000000000000000000000000000000000000000000000002c0ee8a4e23721e9f710656e99ad0adb14ace1961f1d716114200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000af3b0a5b4becc4fa1dfafe74580efa19a2ea49fa0000000000000000000000000000000000000000000000000000001aebb89f850000000000000000000000000000000000000000000000000000001aebb89f850000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000007c00000000000000000000000001486b5677f2628cebe89b45265ca274fb2c3bacd00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000b7c7e959d4395c8d3081365ae37133d7792e559d000000000000000000000000000000000000000000000000000000000000086000000000000000000000000000000000000000000000000000000000000008800000000000000000000000000000000000000000000000000000001aebb89f850000000000000000000000000000000000000000000000000000001aebb89f85000000000000000000000000409213829cbbca9bc84ecc79dc606b6929aec46300000000000000000000000000000000000000000000000000000000000008e00000000000000000000000000000000000000000000000000000000000000bc0000000000000000000000000b303da76a51dc069b64c9f874ae0a0c9cdfc31640000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000af3b0a5b4becc4fa1dfafe74580efa19a2ea49fa000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000044a9059cbb00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000340000000000000000000000000000000000000000000000000000000000000002000000000000000000000000044cb40f0176ebf9daba987b0a6de90b99d8161f10000000000000000000000000000000000000000000000000000000000000080c1d0e8b2caeb0f2612540149c36fdbae805a4728d0fbfa4c000000000000000000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000104cebfe33600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000004076170a6ccb37f2ab8ddd8da4ba6e5e15eb9d7ea3722c3cafc938d705822c3f472b5e91561ee81f4780e81d2b22986a5d6398ab0fcadb147f7469d595e8aa613b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000411d75b42d567e1841b74f2e651bdf8ba0a51583e97a256e0e2ab5d69bce0a5ca2083c53c65a1a5e3ca10ee4db2d4641b9f8a52dc529b3c0591cb7d027a11334811b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000af3b0a5b4becc4fa1dfafe74580efa19a2ea49fa0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002c00000000000000000000000000000000000000000000000000000000000000060286cd601572018a2bb3fb60cdfa29e821d84234c0e99c5f28e4d13cf0cc91f4500000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000013a30d5ac7215f7fde30947825758a0a413df75d43c589471307f0565300b3e3b0000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000006c0ca8304acab165530464145abb9bc9c241bfaff947c6e9383a9addf20e3a510a3f07950ba1cb82995dbde61eefb5ce50280261d49196cd9977b0e7978e06e5b100000000000000000000000000000000000000000000000000000000000000244242424242424242424242424242424242424242424242424242424242424242010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000827b226368616c6c656e6765223a224b477a5741566367474b4b375037594d33364b65676832454930774f6d6358796a6b30547a777a4a483055222c2263726f73734f726967696e223a66616c73652c226f726967696e223a2268747470732f2f6974686163612e78797a222c2274797065223a22776562617574686e2e676574227d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.