Skip to content

solc does not accept forge emitted JSON with verify-contract --show-standard-json-input  #9421

Closed as not planned
@hernandp

Description

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (4817280 2024-11-12T00:20:12.440102314Z)

What command(s) is the bug in?

forge verify-contract --show-standard-json-input 0x0000000000000000000000000000000000000000 input.sol > solc.input.json

Operating System

Windows

Describe the bug

I am feeding solc 0.8.25 with the output of forge verify-contract --show-standard-json-input. I expect the emitted JSON to be valid for compiler input in standard JSON mode but it does not. There is a workaround, so this must be a minor bug in the specified forge version. For example, :

forge verify-contract --show-standard-json-input 0x0000000000000000000000000000000000000000 input.sol > solc.input.json

 ./solc --standard-json solc.input.json
 
{
   "errors":[
      {
         "component":"general",
         "formattedMessage":"* Line 1, Column 196011\n  Duplicate key: '../lib/evm/PriceOracle.sol'\n* Line 1, Column 204189\n  Extra non-whitespace after JSON value.\n",
         "message":"* Line 1, Column 196011\n  Duplicate key: '../lib/evm/IPriceOracle.sol'\n* Line 1, Column 204189\n  Extra non-whitespace after JSON value.\n",
         "severity":"error",
         "type":"JSONError"
      }
   ]
}

After applying some cleanup with:

cat solc.input.json | jq > solc.input.clean.json

solc 0.8.25 accepts this JSON as input without problem.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    • Status

      Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions