Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
0b2a2c2 to
5100649
Compare
|
This is interesting. Generally the protocol would not care about this metadata, I'd suggest that it is all grouped under a |
|
I haven't yet seen this transferred to the Graph GIPS, so I will leave my comment here. I agree with Leo that a metadata field could be adopted where you could include this information. If these fields then get traction by the broader community, and many people are implementing signature and source code for mapping files, then it could get upgraded to an official manifest field. Also, I think the signature could be immediately helpful. It can prevent problems in the explorer, where someone deploys a Uniswap subgraph, and no one can tell if it's from the official team. |
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