argotorg / argotorg/solidity

encodeCall fails to reference public member

Open
#13,931 3 comments 1 reaction 0 assignees View on GitHub
bug :bug: low effort low impact must have eventually
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

Solidity generates an accessor method for every public member.
However, `abi.encodeCall` doesn't recognize this variable.

```solidity
// SPDX-License-Identifier: GPL-3.0
// import 'hardhat/console.sol';

pragma solidity ^0.8.12;

contract Test {

uint public val;
constructor(uint x) {
val = x;
}
function fun() public view returns(uint) { return val; }
}

contract Test1 {

function test(Test a) internal view {
a.val(); //successfully reference the variable as method
a.fun();
abi.encodeCall(Test.fun, ());
abi.encodeCall(Test.val, ()); // <== fails to compile
}
}
```

Contributor guide

Open the contributing guide

Research direction

Start by compiling the minimal Test and Test1 example, comparing abi.encodeCall(Test.fun, ()) with abi.encodeCall(Test.val, ()). Trace the compiler handling of public-member accessors and abi.encodeCall; the issue is done when the generated accessor is accepted without breaking the existing function case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, solidity
Domain
blockchain, compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.