Skip to content

Commit cc58ab1

Browse files
authored
Merge pull request #15895 from kuzdogan/update-metadata-docs
Update metadata docs for "libraries" and "compilationSettings" fields
2 parents d07c219 + 1f044c1 commit cc58ab1

File tree

2 files changed

+16
-43
lines changed

2 files changed

+16
-43
lines changed

docs/metadata.rst

Lines changed: 15 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -124,56 +124,29 @@ explanatory purposes.
124124
"version": 1 // NatSpec version
125125
}
126126
},
127-
// Required: Compiler settings. Reflects the settings in the JSON input during compilation.
128-
// Check the documentation of standard JSON input's "settings" field
127+
// Required: Compiler settings.
128+
// Reflects the settings in the JSON input during compilation, except:
129+
// - Different format: "libraries" field
130+
// - Added field in metadata.settings: "compilationTarget"
131+
// - Not in metadata.settings: "stopAfter", "debug.debugInfo", "outputSelection"
132+
// See the standard JSON input's "settings" field docs for the rest.
129133
"settings": {
130134
// Required for Solidity: File path and the name of the contract or library this
131-
// metadata is created for.
135+
// metadata is created for. This field is not present in the standard JSON input settings.
132136
"compilationTarget": {
133137
"myDirectory/myFile.sol": "MyContract"
134138
},
135-
// Required for Solidity.
136-
"evmVersion": "london",
137-
// Optional: Only present if not null.
138-
"eofVersion": 1,
139139
// Required for Solidity: Addresses for libraries used.
140+
// Note that metadata has a different format for "libraries" field than the standard JSON input.
141+
// metadata format = { "MyLib.sol:MyLib": "0x123123..." }
142+
// standard JSON input format = { "MyLib.sol": { "MyLib": "0x123123..." } }
140143
"libraries": {
141-
"MyLib": "0x123123..."
144+
"MyLib.sol:MyLib": "0x123123..."
142145
},
143-
"metadata": {
144-
// Reflects the setting used in the input json, defaults to "true"
145-
"appendCBOR": true,
146-
// Reflects the setting used in the input json, defaults to "ipfs"
147-
"bytecodeHash": "ipfs",
148-
// Reflects the setting used in the input json, defaults to "false"
149-
"useLiteralContent": true
150-
},
151-
// Optional: Optimizer settings. The fields "enabled" and "runs" are deprecated
152-
// and are only given for backward-compatibility.
153-
"optimizer": {
154-
"details": {
155-
"constantOptimizer": false,
156-
"cse": false,
157-
"deduplicate": false,
158-
// inliner defaults to "false"
159-
"inliner": false,
160-
// jumpdestRemover defaults to "true"
161-
"jumpdestRemover": true,
162-
"orderLiterals": false,
163-
// peephole defaults to "true"
164-
"peephole": true,
165-
"yul": true,
166-
// Optional: Only present if "yul" is "true"
167-
"yulDetails": {
168-
"optimizerSteps": "dhfoDgvulfnTUtnIf...",
169-
"stackAllocation": false
170-
}
171-
},
172-
"enabled": true,
173-
"runs": 500
174-
},
175-
// Required for Solidity: Sorted list of import remappings.
176-
"remappings": [ ":g=/dir" ]
146+
// ...
147+
// ...
148+
// ...
149+
// The rest of the fields and their defaults same as in std JSON input.
177150
},
178151
// Required: Compilation source files/source units, keys are file paths
179152
"sources": {

docs/using-the-compiler.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ Input Description
279279
{
280280
// Optional: Stop compilation after the given stage. Currently only "parsing" is valid here
281281
"stopAfter": "parsing",
282-
// Optional: Sorted list of remappings
282+
// Optional: List of remappings
283283
"remappings": [ ":g=/dir" ],
284284
// Optional: Optimizer settings
285285
"optimizer": {

0 commit comments

Comments
 (0)