argotorg / argotorg/solidity

Different Bytecode produced from Identical Source when Using @notice vs @inheritdoc

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

Description

**Description**

Two contracts with the same source code but different NatSpec tags (@notice vs @inheritdoc) compile to different bytecode, making the output non-deterministic.

Expected: NatSpec comments should not impact bytecode.

**Environment**
Compiler version: 0.8.30
Compilation pipeline: legacy
Target EVM version: any
Framework/IDE: solc standard-json
OS: Windows

**Steps to Reproduce**
Attached with two files:
Two variants of the same json files that differ only in NatSpec comments: one uses @notice, the other uses @inheritdoc.
uni.json - using @notice
arbi.json - using @inheritdoc

[arbi.json](https://github.com/user-attachments/files/22532173/arbi.json)
[uni.json](https://github.com/user-attachments/files/22532174/uni.json)

The image below showing the different.
Image

Image

**Command used to compile:**
solc-windows-amd64-v0.8.30.exe --standard-json < uni.json > outuni.json
solc-windows-amd64-v0.8.30.exe --standard-json < arbi.json > outarbi.json

From the output, we can see that the bytecode for contract src/TheCompact.sol:TheCompact is different.
Here are the difff: https://difff.jp/en/xi9vx.html

Image

Contributor guide

Open the contributing guide

Research direction

Compile the attached arbi.json and uni.json inputs with solc 0.8.30 using the standard-json entry point, then compare the bytecode for src/TheCompact.sol:TheCompact. Trace the compiler path responsible for the differing NatSpec variants; done means identical source produces identical bytecode regardless of @notice versus @inheritdoc.

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
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.