`abi_decode` requires too many proxy arguments
- Dominant language
- Haskell
- Stars
- 113
- Forks
- 9
- Avg merge
- 4d 9h
- Merged PRs (30d)
- 1
Description
The `abi_decode` definition in `std.solc`: https://github.com/argotorg/solcore/blob/73e0ccd3325de0f7baa10d96bcd3e04d4f892db9/std/std.solc#L594 currently requires a proxy parameter for the type of `reader` (i.e. whether we're decoding from calldata or memory). This is required as monomorphization will otherwise fail due to ambiguity (as `reader` would otherwise appear only in the constraints and not in the function signature).
This means that we are currently unable to implement the `abi.decode` from classic solidity which can generically decode from both memory and calldata:
```
// SPDX-License-Identifier: AGPL-3.0
pragma solidity 0.8.28;
contract SolidityCalldataAccess {
function abi_mem(bytes memory data) external pure returns (uint) {
return abi.decode(data, (uint));
}
function abi_cd(bytes calldata data) external pure returns (uint) {
return abi.decode(data, (uint));
}
}
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at std/std.solc line 594 and inspect how abi_decode exposes the reader type and how monomorphization handles its constraints. Reproduce the issue with the SolidityCalldataAccess example from the report; done means abi.decode can generically handle both memory and calldata without requiring the extra proxy argument.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- solidity
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100