Solidity: Sourcemaps have less information after 0.6.3

Created on 23 May 2020  路  5Comments  路  Source: ethereum/solidity

Description

Starting from 0.6.3, sourcemaps seem to have less information, at least around reverts statements.

Environment

  • Compiler version: 0.6.2, 0.6.3 and 0.6.8
  • Target EVM version (as per compiler settings): Default
  • Framework/IDE (e.g. Truffle or Remix): Plain solc
  • EVM execution environment / backend / blockchain client: Not relevant
  • Operating system: Ubuntu

Steps to Reproduce

Given this input.json:

{
  "language": "Solidity",
  "sources": {
    "c.sol": {
      "content": "pragma solidity ^0.6.0;\n\ncontract C {\n  function test() public {\n    revert();\n  }\n}\n"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "debug": {},
    "outputSelection": {
      "*": {
        "*": [
          "abi",
          "evm.bytecode",
          "evm.deployedBytecode",
          "evm.methodIdentifiers"
        ],
        "": [
          "id",
          "ast"
        ]
      }
    }
  }
}

Compiling it with 0.6.2 and getting deployedBytecode.sourceMap for c.sol gives this:

25:59:0:-:0;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;25:59:0;;;;;;;;;;;;;;;;;;;40:42;;;:::i;:::-;;;69:8;;

While compiling with 0.6.3 (or 0.6.8; the result is the same) results in this:

25:59:0:-:0;;;;5:9:-1;2:2;;;27:1;24;17:12;2:2;25:59:0;;;;;;;;;;;;;;;;12:1:-1;9;2:12;40:42:0;;;:::i;:::-;;;12:1:-1;9;2:12

Notice that there's no mapping for the revert() statement: in the first sourcemap that's given by 69:8, but there's nothing like that in the second one.

Most helpful comment

After #9029, it should be similar to how it was before 0.6.3.

All 5 comments

This is due to the revert having become an internal routine. I will create a fix that reduces the source references for these internal routines altogether.

So to clarify, this is information that won't come back, right?

After #9029, it should be similar to how it was before 0.6.3.

Oh, got it, thanks :+1:

cc @alcuadrado

Will the fix be released in 0.6.9?

Do you have an intuition of what's going on here? Can we, for example, assume that the unmapped chunk is the translation of the expression that follows the latest mapped one?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bshastry picture bshastry  路  3Comments

walter-weinmann picture walter-weinmann  路  4Comments

Dohtar1337 picture Dohtar1337  路  4Comments

chriseth picture chriseth  路  3Comments

VoR0220 picture VoR0220  路  4Comments