Is the idea to give users the choice about what kind of information they choose to provide about the compilation?
@gh1dra The compiler
field is for information about the compiler and its settings that were used to generate the outputs (abi, bytecodes, userdoc, devdoc) rather than containing the outputs of the compilation. As you said, this gives the user more flexibility in choosing what fields they want or are able to include in a manifest.
I’m fine with breaking Solidity metadata with regards to “version” if it is a dealbreaker for EthPM
It’s not a dealbreaker for me, but I do prefer the scheme ("manifest"
, "name"
, "version"
) that @rumkin proposed the best. It’s the cleanest / easiest to understand.
as long as it is still possible to easily determine whether the given json is a v1 Solidity metadata json.
If we adopt this scheme, I’m not so sure this will be easily achieved. As @fubuloubu pointed out, there will be ethpm v1 & v2 manifests that have a "version"
field of "1"
(referring to the version of that specific package release, rather than the specification it conforms to). These will be impossible to simply distinguish from v1 Solidity metadata json (which also have a "version"
field of "1"
). Unless the tooling has the knowledge to search for a "manifest"
field (required in all ethpm v3 manifests), validate that it is "3"
- and then it will be able to distinguish b/w the two specifications. So it is possible reliably determine which specification a json object is, but it won’t be trivial. If this is an acceptable amount of complexity for @chriseth, I’ll update the spec to reflect this change.
I would also prefer camelCase.
I’m also ok with this change. Unless any of the python/vyper ppl have strong objections, I’ll update the spec.
sources: " Paths must resolve to a path within the current virtual directory." - do we really need this requirement? What does it mean for a path to resolve to such a path?
For ethpm, we need the ability to faithfully recreate the original source tree. Otherwise, when users “install” a package to disk - if the paths are not the same paths of the original source tree, then they might not be able to re-compile the sources.
In ethpm v1/v2 we required all paths to be relative paths that begin with ./
(the root of the virtual directory), which has worked well. Though, I understand the solidity compiler might not want to enforce such a requirement. If we relax this requirement, we’ll need to define an additional mechanism (like a filesystem
key) that maps the paths used to valid filesystem paths - which will be required for packages to have the capability to be written to disk (“installed”).
How do you determine if it resolves to a directory or to a file?
If the path points to a content-addressed uri, the uri must be resolved to determine whether it’s a directory or a file. The only other option is for the path to point to an inlined string of the source contract which would always be a single file.
If there are multiple contract types specified - is there a way to provide the “main” contract in some way? For Solidity metadata, there is exactly one contract type that is the one currently being compiled. Is the expectation that in this case, there is only one item in this object?
Yup, that’s how I’d see it working out.
contract alias: In the Solidity compiler, we identify names by prefixing the file name (including path) followed by a “:”. How do contract aliases identify the actual contract in the source?
In ethpm a contract alias is defined as <contract-name>[<identifier>]
. In ethpm v1/v2 there was no mechanism to map a contract type to a source - however in v3 it seems to me as though the compilationTarget
field in the compiler settings would serve this function.
Why is the compiler a sub-field of the contract type? I see that different compilers could be used for different contract, but in that case, shouldn’t the sources also be a sub-field of the contract type?
I’m not sure I understand this concern exactly. There are packages that would be useful with just "sources"
and no "contract_types"
. Also, different compilers could be used to generate different "contract_types"
for the same source. This would introduce a lot of redundancy if sources were located in "contract_types"
.
I’m really not sure if this forum-style discussion is the best way to do this
Agreed, I’m starting to think that it’s time to move this to github, where we can have more nuanced threads around specific concerns. I’ll work on migrating the changes discussed here to the ethpm-spec
repository - and link it here once it’s updated.