RFCS-0006: Manifest Metadata #27
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RFC-0005: Manifest Metadata
Summary
Add optional metadata to the subgraph manifest, containing the source-code for
mapping files and/or a cryptographic signature from the developer.
Goals & Motivation
CryptoStats is currently building tooling to improve the developer experience
for building subgraphs. As part of this initiative, we are aiming to make the
development of subgraphs more “collaborative”, allowing subgraph authors to
be more easily identified, and providing an easy method for subgraphs to be
“forked”. Adding these features necessitates adding additional metadata to the
traditional YAML manifest file. This document aims to standardize these
attributes, allowing other tooling in the Graph ecosystem to take advantage of
them.
Urgency
While this feature is low-priority, CryptoStats will be launching a tool that
uses these features soon.
Terminology
Detailed Design
We propose adding two optional sections to the Manifest file:
sourceCodeandsignature.Source Code
The manifest provides most files needed for a developer to re-build their own
subgraph, such as the schema document, all smart contracts and ABIs. However,
the mapping file is only provided as compiled WASM bytecode, which can not be
modified by other developers.
We would like to propose the addition of an optional sourceCode section to the
manifest, containing a list of entities with the following attributes:
sourcepath is a directory,entryPointshould be provided to define the entry point file for compilationExample
Signature
As subgraphs become a more important piece of the blockchain stack, there may
be value in having a cryptographic signature attached to a subgraph. This
allows any user to verify that a subgraph was created by a specific account.
We propose adding an optional
signaturesection to the manifest with the following attributes:Example
Signature generation
The signature is generated by taking the keccak256 hash of the manifest string,
prefixing it with the string
Subgraph hash:, then taking a ECDSA signatureof this string.
The resulting signature is then included in the new “signature” section and
appended to the manifest.
The following code is an example of how a signature can be generated using
ethers.js:
Signature validation
To validate the signature attached to a subgraph, the signing process must be
reversed, removing the signature section before validating.
The following code is an example of how to validate a manifest signature using
ethers.js:
Compatibility
The proposed design is fully backwards compatable.
Drawbacks and Risks
This proposal only provides additional metadata for subgraphs, therefore there
are no risks nown at this time.
Alternatives
Currently, subgraphs may include a link to a GitHub repo containing source
code. However, this does not allow for programatic managment & compilation
of source code. Furthermore, many GitHub repos may fall out of date compared
to the published subgraphs.
Open Questions