-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add sourcelist to compilation artifacts #182
Comments
checked https://docs.soliditylang.org/en/v0.8.13/using-the-compiler.html and solc arguments for |
Maybe sourcelist -> sources? |
The terminology changes from tool to tool, apologies I should've used the solc wording. @onbjerg yes! However, not everything about the sources is strictly necessary. I'd particularly like to have the file id's. They will be in |
I see, this is part of the "generatedSources": [{
// Yul AST
"ast": {/* ... */},
// Source file in its text form (may contain comments)
"contents":"{ function abi_decode(start, end) -> data { data := calldataload(start) } }",
// Source file ID, used for source references, same "namespace" as the Solidity source files
"id": 2,
"language": "Yul",
"name": "#utility.yul"
}] if this is set as extra-file, should we emit a list of all ids to sources? |
Not 100% I understand what setting as extra-file means, but yeah that would be perfect! A format that maps id's to files would be best for the purposes of resolving source map elements. I'm not sure however of the other requirements in foundry, so I'll leave this up to you! It would be perfectly fine to retain the existing solidity output structure for my purposes. |
there are currently two arguments that allow you to configure what's included in the artifact and what also should be emitted as separate file --extra-output <EXTRA_OUTPUT>...
Extra output to include in the contract's artifact.
Example keys: evm.assembly, ewasm, ir, irOptimized, metadata
For a full description, see https://docs.soliditylang.org/en/v0.8.13/using-the-compiler.html#input-description
--extra-output-files <EXTRA_OUTPUT_FILES>...
Extra output to write to separate files.
which can also be set in the config file But these are all on a per artifact (contract) basis, so perhaps we'd need some kind of top level lookup table as json file that maps ids to artifact files? |
That would be perfect. Heads up though, incremental compilation (only re-compiling files with changes) and maintaining the integrity of this lookup table is going to be important. |
@robertabbott maybe this |
Is any progress? "metadata": {
"compiler": {
"version": "0.8.19+commit.7dd6d404"
},
...
"sources": {
"node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol": {
"keccak256": "0x4ffc0547c02ad22925310c585c0f166f8759e2648a09e9b489100c42f15dd98d",
"urls": [
"bzz-raw://15f52f51413a9de1ff191e2f6367c62178e1df7806d7880fe857a98b0b66253d",
"dweb:/ipfs/QmaQG1fwfgUt5E9nu2cccFiV47B2V78MM1tCy1qB7n4MsH"
],
"license": "MIT",
"id": 1 // add this
},
}
} If this is accept, I could help here. |
After #140 cache now keeps a mapping |
Component
Forge
Describe the feature you would like
The new compilation artifacts have almost all the necessary information needed for downstream tools to work with forges' compilation artifacts.
The one thing that's missing is the solc sourcelist, this provides a mapping from file indices to file names. This is necessary when you want to map a bytecode location to a source location in a solidity file.
Additional context
No response
The text was updated successfully, but these errors were encountered: