argotorg / argotorg/solidity

`via-ir` causes abicoder v1 results mismatch

Open
#15,562 1 comment 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

## Description

I have a use case where I need to be able to handle both abicoder v1 and abicoder v2 inputs. Preferably I'm also able to have `via-ir` enabled, but that seems to cause issues.

Created a minimal reproducible and seems just enabling `via-ir` with abicoder is enough for it to fail. When running the attached code without `via-ir` it works, but once it's enabled the code reverts. See sections on how to reproduce.

[standard_json_builds.zip](https://github.com/user-attachments/files/17606285/builds.zip)

## Environment
- Compiler version: `Version: 0.8.28+commit.7893614a.Darwin.appleclang`
- Target EVM version (as per compiler settings): default
- Framework/IDE (e.g. Truffle or Remix): none
- EVM execution environment / backend / blockchain client: mainnet
- Operating system: osx

## Steps to Reproduce
Source code used in steps below, [standard_json_builds.zip](https://github.com/user-attachments/files/17606285/builds.zip).

First verify that it works without `via-ir`

1. Compile the attached `standard_json_no_via_ir.json`.
```
6080604052348015600e575f5ffd5b50600436106026575f3560e01c8063c0f8940c14602a575b5f5ffd5b60408051808201825260208082525f199181019190915281516fffffffffffffffffffffffffffffffff81529151918290030190f3fea26469706673582212201116ca6874acbe2a3c87b31bf1d75b23ceede323e55407692d8d977c1c75861364736f6c634300081c0033
```
2. Run it an call the code method (link to [playground](https://www.evm.codes/playground?fork=cancun&unit=Wei&callData=0xc0f8940c&codeType=Bytecode&code='z80z4052348015z0e57y50z043610z26575f35ze01c8063c0f8940c14z2a575byz4080518082018252z208082525f199181019190915281516xxxxf81529151918290030190f3fea26469706673582212201116ca6874acbe2a3c87b31bf1d75b23ceede323e55407692d8d977c1c75861364736f6c634300081c0033'~ffffz60y5f5ffd5bx~~%01xyz~_) ) and you see `00000000000000000000000000000000ffffffffffffffffffffffffffffffff` will be returned

3. Now we compile it with `via-ir` (`standard_json_with_via_ir.json`)
```
60806004361015600d575f80fd5b5f3560e01c63c0f8940c14601f575f80fd5b346068575f3660031901126068576040810181811067ffffffffffffffff82111760545760405260208082525f199101525f80fd5b634e487b7160e01b5f52604160045260245ffd5b5f80fdfea2646970667358221220256379ce8332b74ed80d9770e158c2012529aa222388614085f1572b384b2e5f64736f6c634300081c0033
```

2. Run it ([playground](https://www.evm.codes/playground?fork=cancun&unit=Wei&callData=0xc0f8940c&codeType=Bytecode&code='~ts4361w5sd57ux35~ewc63c0f8940c14~1f57u34~6857x36s319w12~6857~4081w81811067yyyy821117~5457~40v20t8252x1991w52u634e487b71~ewbxv41s4v24xfd5bzfea2646970667358221220256379ce8332b74edtd9770e158c2w2529aa22238861408x1572b384b2ex64736f6c634300081c0033'~60zxtfdyffffx5fw01v52~uz5bt80s~0%01stuvwxyz~_)) Then it reverts :'(

Contributor guide

Open the contributing guide

Research direction

Start by compiling the attached standard_json_no_via_ir.json and standard_json_with_via_ir.json, then run each bytecode in the linked playground with the same call data. Compare the abicoder results and revert behavior; done means enabling via-ir no longer changes the successful result into a revert.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.