Discuss warnings for accidental self-calls after function shadowing
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 57/100
Research direction
Start by reading the warning and name-resolution code that handles imported functions, method scopes, and self-calls; the issue does not name specific source files or tests. Reproduce the two-file example with all warnings enabled and check how the private method call is resolved. Done means the compiler warns about the accidental self-call while preserving the separate scopes allowed by PR #599.
Written by the indexing model from the issue text.
Description
A contract method can shadow an imported function and accidentally call itself without a warning. PR #599 intentionally permits these separate scopes; the silent self-call was reported in solcore-rs #48. This smaller example uses a private method and a runtime argument.
lib.sol:
export {setValue};
function setValue(x: word) {
assembly { sstore(0, x) }
}
main.sol:
import {setValue} from lib;
contract C {
function setValue(x: word) { setValue(x); }
function main() {
let x: word;
assembly { x := calldataload(0) }
setValue(x);
}
}
Actual: compilation succeeds without a warning even with all warnings enabled. The runtime Hull contains the following method; the imported storage write is never reached:
function setValue (x : word) -> unit {
setValue(x)
}
- Dominant language
- Haskell
- Stars
- 115
- Forks
- 11
- Avg merge
- 20h 29m
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from argotorg/solcore
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
user feedback: Rename `lam` to `lambda` and give the unit type a namePossibly taken @rodrigogribeiro claimed this 50 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 4/5 3-5 days Newbie friendliness 57/100
All issues in argotorg/solcore
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
IntersectMBO/cardano-ledger#6276 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
OpenZeppelin/canton-contracts#92 ·
Maintainers usually reply within 1 day