Skip to content

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

@homeyong

Description

@homeyong

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
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions