argotorg / argotorg/solidity

Parameter Evaluation Order Not Documented

Open
#16,116 0 comments 0 reactions 0 assignees View on GitHub
bug :bug:
Dominant language
C++
Stars
25.7k
Forks
6.2k
Avg merge
2d 19h
Merged PRs (30d)
29

Description

In the legacy codegen, the log arguments are evaluated from **right to left**, whereas in the IR-based codegen, they are evaluated from **left to right**. However, this difference is not reflected in the [documentation](https://docs.soliditylang.org/en/latest/ir-breaking-changes.html).

```solidity
contract EventEvalOrder {
uint public a;

event Log(uint indexed first, uint indexed second, uint indexed third);

function call1() public returns (uint) {
a = 1;
return 10;
}

function call2() public returns (uint) {
a = 2;
return 20;
}

function call3() public returns (uint) {
a = 3;
return 30;
}

function triggerEvent() public returns (uint) {
emit Log(call1(), call2(), call3());
return a;
}
}
```
legacy codegen: a=1
ir-based codegen: a=3

Contributor guide

Open the contributing guide

Research direction

Start with the linked ir-breaking-changes documentation and review the parameter-evaluation-order section against the provided EventEvalOrder example. Done means the documentation explicitly states the legacy codegen evaluates log arguments right to left while IR-based codegen evaluates them left to right, including the observable result.

Written by the indexing model from the issue text.

Assessment

Tech stack
solidity
Domain
compilers, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.