Repository: ethereum/solidity
Pull request #15895: Update metadata docs for "libraries" and "compilationSettings" fields
Author: login: kuzdogan
Labels: name: documentation :book:
name: external contribution :star:
Created: 2025-02-26T23:15:35Z | Merged: 2025-03-21T17:46:29Z



Diff:
diff --git a/docs/metadata.rst b/docs/metadata.rst
index 063936a9dcde..90513ee326de 100644
--- a/docs/metadata.rst
+++ b/docs/metadata.rst
@@ -124,56 +124,29 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except:
+      // - Different format: "libraries" field
+      // - Added field in metadata.settings: "compilationTarget"
+      // - Not in metadata.settings: "stopAfter", "debug.debugInfo", "outputSelection"
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
+        // ...
+        // ...
+        // ...
+        // The rest of the fields and their defaults same as in std JSON input.
       },
       // Required: Compilation source files/source units, keys are file paths
       "sources": {
diff --git a/docs/using-the-compiler.rst b/docs/using-the-compiler.rst
index 4984d999df27..23e83baec4e6 100644
--- a/docs/using-the-compiler.rst
+++ b/docs/using-the-compiler.rst
@@ -279,7 +279,7 @@ Input Description
       {
         // Optional: Stop compilation after the given stage. Currently only "parsing" is valid here
         "stopAfter": "parsing",
-        // Optional: Sorted list of remappings
+        // Optional: List of remappings
         "remappings": [ ":g=/dir" ],
         // Optional: Optimizer settings
         "optimizer": {


Reviews:
user: login: cameel
body: Thanks! Looks good, but there's actually even more we could add. See my suggestions below.
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-07T13:05:51Z
user: login: kuzdogan
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-10T07:23:24Z
user: login: cameel
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-10T15:29:03Z
user: login: cameel
body: Still needs some corrections.
state: CHANGES_REQUESTED
author_association: COLLABORATOR
submitted_at: 2025-03-13T21:05:16Z
user: login: kuzdogan
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-14T07:28:36Z
user: login: cameel
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-14T18:10:10Z
user: login: cameel
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-19T13:44:18Z
user: login: kuzdogan
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-03-20T09:29:51Z
user: login: cameel
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-03-20T18:05:39Z
user: login: cameel
body: The PR looks good now. Thanks for taking the time to improve this part of the docs :)
state: APPROVED
author_association: COLLABORATOR
submitted_at: 2025-03-20T18:06:15Z

Review comments:
diff_hunk: @@ -124,19 +124,24 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" docs for the rest.
path: docs/metadata.rst
user: login: cameel
body: ```suggestion
      // See the standard JSON input's "settings" field docs for the rest.
```
created_at: 2025-03-07T12:33:59Z
author_association: COLLABORATOR
diff_hunk: @@ -124,19 +124,24 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. Not a valid field in the standard JSON input settings.
path: docs/metadata.rst
user: login: cameel
body: We can add even more info here:

```suggestion
        // metadata is created for. This field is not present in the standard JSON input settings.
        // The closest equivalent is settings.outputSelection, used to select compilation targets.
```
created_at: 2025-03-07T12:44:59Z
author_association: COLLABORATOR
path: docs/metadata.rst
user: login: cameel
body: Comparing this with the Standard JSON input docs, I see we're missing a few settings fields here:
- `optimizer.simpleCounterForLoopUncheckedIncrement`
- `viaIR`
- `debug.revertStrings`

Maybe you could add them?

Also `eofVersion`, but this is actually undocumented for input. IMO we should add it to the input and just mark it as experimental.
created_at: 2025-03-07T12:50:20Z
author_association: COLLABORATOR
path: docs/metadata.rst
user: login: cameel
body: I was surprised to see the comment saying that `runs` and `enabled` are deprecated. It seems to be coming from here: https://github.com/ethereum/solidity/pull/5959#issuecomment-465240252

Just FYI, I doubt we'll actually do that. We should probably remove the comment. I'll add that to call agenda to discuss.
created_at: 2025-03-07T12:57:57Z
author_association: COLLABORATOR
path: docs/metadata.rst
user: login: kuzdogan
body: How about I remove the std json settings contents except the differences like `compilationTarget` and `libraries`. It would otherwise be difficult to keep the metadata's settings docs up to date. I'll refer people to the compiler docs.
created_at: 2025-03-10T07:23:24Z
author_association: MEMBER
path: docs/metadata.rst
user: login: cameel
body: Yeah, that sounds reasonable. Please just double check I did not miss anything.

TBH we should really also have a sanity check in the implementation that the structure is the same.
created_at: 2025-03-10T15:29:02Z
author_association: COLLABORATOR
diff_hunk: @@ -124,56 +124,27 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
+        // ...
+        // ...
+        // ...
+        // The rest of the fields are the same as in the compiler's standard JSON input.
path: docs/metadata.rst
user: login: cameel
body: This is still missing some differences. Looking at input docs, there seem to be a few fields that are present in `settings`, but not included in metadata:
- `stopAfter`
- `debug.debugInfo`
- `outputSelection` (it gets replaced by `compilationTarget`)
created_at: 2025-03-13T20:52:12Z
author_association: COLLABORATOR
diff_hunk: @@ -124,56 +124,27 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
+        // ...
+        // ...
+        // ...
+        // The rest of the fields are the same as in the compiler's standard JSON input.
path: docs/metadata.rst
user: login: cameel
body: This means that the `Reflects the settings in the JSON input ...` comment over the whole `settings` dict above is inaccurate as well.
created_at: 2025-03-13T20:53:26Z
author_association: COLLABORATOR
diff_hunk: @@ -124,56 +124,27 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
path: docs/metadata.rst
user: login: cameel
body: Just noticed this. The compiler does not sort remappings before putting them in metadata. In the input they are not expected to be sorted either. The order can matter in corner cases. For example if prefixes are identical, the one specified last wins (see [Import Remapping](https://docs.soliditylang.org/en/develop/path-resolution.html#import-remapping)).

It is being removed here but looks like we have the same comment in input docs so should fix it there.
created_at: 2025-03-13T21:01:19Z
author_association: COLLABORATOR
diff_hunk: @@ -124,56 +124,27 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
+        // ...
+        // ...
+        // ...
+        // The rest of the fields are the same as in the compiler's standard JSON input.
path: docs/metadata.rst
user: login: cameel
body: I'd also mention explicitly that the defaults are the same for those fields.
created_at: 2025-03-13T21:03:16Z
author_association: COLLABORATOR
diff_hunk: @@ -124,56 +124,27 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
+        // ...
+        // ...
+        // ...
+        // The rest of the fields are the same as in the compiler's standard JSON input.
path: docs/metadata.rst
user: login: kuzdogan
body: >  Looking at input docs, there seem to be a few fields that are present in settings, but not included in metadata:

Do you mean these fields can be passed in the std-json input but not in the metadata.settings field? I wasn't able to see this info in the input docs, I guess you are saying this not by looking at the docs but by knowing the implementation?

This means, these fields passed to a contract's std-json input will not be present in its metadata output.
created_at: 2025-03-14T07:28:36Z
author_association: MEMBER
diff_hunk: @@ -124,56 +124,27 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
+        // ...
+        // ...
+        // ...
+        // The rest of the fields are the same as in the compiler's standard JSON input.
path: docs/metadata.rst
user: login: cameel
body: Yes, they're allowed in the input but not included in metadata.

I found them by comparing the input docs with the metadata docs - you can see that they're in one but not in the other. I of course then confirmed this by checking the implementation ([`CompilerStack::createMetadata()`](https://github.com/ethereum/solidity/blob/v0.8.29/libsolidity/interface/CompilerStack.cpp#L1711-L1837)). I guess the fact that some fields were missing from metadata docs (especially `debug.revertStrings`) may make it seem that it's the case for everything else, but that was just those from https://github.com/ethereum/solidity/pull/15895#discussion_r1985012039.

> This means, these fields passed to a contract's std-json input will not be present in its metadata output.

My point is that now the docs claim that settings in metadata are the same as in input except for a few fields. The ones I listed are different as well (they're missing) so they should be mentioned among those fields.
created_at: 2025-03-14T18:10:10Z
author_association: COLLABORATOR
diff_hunk: @@ -124,56 +124,27 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
path: docs/metadata.rst
user: login: cameel
body: Can you do this in this PR?
created_at: 2025-03-19T13:44:18Z
author_association: COLLABORATOR
diff_hunk: @@ -124,56 +124,27 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
path: docs/metadata.rst
user: login: kuzdogan
body: Updated from 

```
// Optional: Sorted list of remappings
```

to
```
// Optional: List of remappings
```

Hope I got it right :)



created_at: 2025-03-20T09:29:51Z
author_association: MEMBER
diff_hunk: @@ -124,56 +124,27 @@ explanatory purposes.
           "version": 1 // NatSpec version
         }
       },
-      // Required: Compiler settings. Reflects the settings in the JSON input during compilation.
-      // Check the documentation of standard JSON input's "settings" field
+      // Required: Compiler settings.
+      // Reflects the settings in the JSON input during compilation, except the
+      // "compilationTarget" and the "libraries" fields. Check each field for details.
+      // See the standard JSON input's "settings" field docs for the rest.
       "settings": {
         // Required for Solidity: File path and the name of the contract or library this
-        // metadata is created for.
+        // metadata is created for. This field is not present in the standard JSON input settings.
         "compilationTarget": {
           "myDirectory/myFile.sol": "MyContract"
         },
-        // Required for Solidity.
-        "evmVersion": "london",
-        // Optional: Only present if not null.
-        "eofVersion": 1,
         // Required for Solidity: Addresses for libraries used.
+        // Note that metadata has a different format for "libraries" field than the standard JSON input.
+        // metadata format = { "MyLib.sol:MyLib": "0x123123..." }
+        // standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
         "libraries": {
-          "MyLib": "0x123123..."
+          "MyLib.sol:MyLib": "0x123123..."
         },
-        "metadata": {
-          // Reflects the setting used in the input json, defaults to "true"
-          "appendCBOR": true,
-          // Reflects the setting used in the input json, defaults to "ipfs"
-          "bytecodeHash": "ipfs",
-          // Reflects the setting used in the input json, defaults to "false"
-          "useLiteralContent": true
-        },
-        // Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
-        // and are only given for backward-compatibility.
-        "optimizer": {
-          "details": {
-            "constantOptimizer": false,
-            "cse": false,
-            "deduplicate": false,
-            // inliner defaults to "false"
-            "inliner": false,
-            // jumpdestRemover defaults to "true"
-            "jumpdestRemover": true,
-            "orderLiterals": false,
-            // peephole defaults to "true"
-            "peephole": true,
-            "yul": true,
-            // Optional: Only present if "yul" is "true"
-            "yulDetails": {
-              "optimizerSteps": "dhfoDgvulfnTUtnIf...",
-              "stackAllocation": false
-            }
-          },
-          "enabled": true,
-          "runs": 500
-        },
-        // Required for Solidity: Sorted list of import remappings.
-        "remappings": [ ":g=/dir" ]
path: docs/metadata.rst
user: login: cameel
body: Yeah, looks good. Thanks!
created_at: 2025-03-20T18:05:39Z
author_association: COLLABORATOR

PR comments:
user: login: github-actions[bot]
created_at: 2025-02-26T23:15:46Z
body: Thank you for your contribution to the Solidity compiler! A team member will follow up shortly.

If you haven't read our [contributing guidelines](https://docs.soliditylang.org/en/latest/contributing.html) and our [review checklist](https://github.com/ethereum/solidity/blob/develop/ReviewChecklist.md) before, please do it now, this makes the reviewing process and accepting your contribution smoother.

If you have any questions or need our help, feel free to post them in the PR or talk to us directly on the [#solidity-dev](https://matrix.to/#/#ethereum_solidity-dev:gitter.im) channel on Matrix.
author_association: NONE
user: login: kuzdogan
created_at: 2025-03-13T07:48:22Z
body: Rebased and updated. Now the settings only has "compilationTarget" and "libraries", and refers the rest to the std-json docs.
author_association: MEMBER
user: login: cameel
created_at: 2025-03-20T18:08:41Z
body: Oh, one more thing before we merge. Can you squash the commits a bit? Does not have to be one, but we generally at least squash the fixes from review into the original commits to keep history easier to understand.
author_association: COLLABORATOR
user: login: kuzdogan
created_at: 2025-03-21T10:42:22Z
body: Rebased
author_association: MEMBER