Skip to content

EthDebug source range offsets must be non-negative #15998

Open
@RaoulSchaffranek

Description

@RaoulSchaffranek

Description

According to the EthDebug JSON schema, source range offsets must be non-negative integers, see: https://ethdebug.github.io/format/spec/materials/source-range

However, solc sets it to -1 in some cases.

Environment

  • Compiler version: Version: 0.8.29+commit.ab55807c.Linux.g++
  • Compilation pipeline (legacy, IR, EOF): IR
  • Target EVM version (as per compiler settings): osaka
  • Framework/IDE (e.g. Foundry, Hardhat, Remix): no
  • EVM execution environment / backend / blockchain client: not applicable
  • Operating system: WSL

Steps to Reproduce

solc --standard-json test/cmdlineTests/standard_output_debuginfo_ethdebug_compatible/input.json > output.json

See, https://github.com/ethereum/solidity/blob/4f23c18e7c7668abffabaaa5095107015e500714/test/cmdlineTests/standard_output_debuginfo_ethdebug_compatible/input.json

The output.json file contains four JUMPDEST instructions containing a negative offset, here is one such example:

                                {
                                    "context": {
                                        "code": {
                                            "range": {
                                                "length": 0,
                                                "offset": -1
                                            },
                                            "source": {
                                                "id": 0
                                            }
                                        }
                                    },
                                    "offset": 13,
                                    "operation": {
                                        "mnemonic": "JUMPDEST"
                                    }
                                },

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