v0.6.0
Subgraph versions & metadata
Subgraphs are now deployed in two steps: first, the subgraph name is created with e.g. graph create
(using the Graph CLI), then a subgraph version is deployed to this name with graph deploy
.
Subgraph versions
Subgraphs are now versioned. When a new version is deployed, it replaces the previous version. Accessing a subgraph by name (e.g. via /subgraphs/name/my/subgraph
) always queries the current version. Previous versions can still be queried by ID (/subgraphs/id/Qm....
).
The built-in subgraph of subgraphs (see below) allows to query meta data about the current as well as previous versions.
Subgraph metadata
This adds endpoints for querying subgraph meta data (/subgraphs
and /subgraphs/graphql
) over HTTP and WebSockets. For any subgraph created, the versions that have been deployed can be queried along with their manifest information, deployment status, entity count and more.
Ethereum improvements
- Overloaded events are now supported in
graph-node
. - Indexed event parameters are now properly represented as
Bytes
with a length of 32. - Event parameters that are encoded as a byte array with a length that is not a multiple of 32 are now supported properly.
Big decimal support
Large decimal numbers are now supported via the BigDecimal
type in the subgraph schema and in AssemblyScript mappings. Conversions from BigInt
and string
to BigDecimal
are implemented as well as basic BigDecimal
arithmetics and a new bigInt.divDecimal(...)
devision method for BigInt
s to obtain decimal numbers.
IPFS file streaming
A new ipfs.map(hash: string, callback: string, userData: Value, params: string[]): void
host export has been added, allowing to stream files from IPFS and having a callback in the mapping called for every value, along with the provided user data). This is particularly useful for streaming JSONLines files.
GraphQL API changes
Interfaces
Support for interfaces has been added to the GraphQL API. Subgraphs can now define interfaces in their schema and instantiate entities that implement these interfaces. The only restriction currently is that entities that implement the same interface must have distinct IDs.
Arguments for relationship fields
One-to-many and many-to-many relationship fields can now be queried with arguments. The same filtering and ordering API is used as for top-level query fields.
Limit results to 100 entities per collection
The results returned for any collection in a GraphQL result are now limited to 100 entities per collection. This number can be further reduced by providing a first
argument to the collection query field.
Subscription throttling
- Subscriptions will fire at most every 500ms while a subgraph version is still syncing.
- The built-in "subgraph of subgraphs" is always throttled like that.
Other GraphQL changes
@derivedFrom
is now supported for one-to-one relationships.- GraphQL queries can optionally be limited with a timeout. This can be set via the
GRAPH_GRAPHQL_QUERY_TIMEOUT
environment variable. - Return a 200 even if there were GraphQL errors. Required for GraphQL clients.
- Handle
@include
directive in queries correctly. - Parse query variables correctly.
- Add GraphQL filter fields for list values.
Mapping changes
- The
GRAPH_EVENT_HANDLER_TIMEOUT
environment variable now allows to set a timeout after which event handlers will be terminated and considered failed. - Add a
typeConversion.bytesToBase58
host export for mappings. - Fix passing
BigInt
values starting with0x80
to mappings. - Add
input: Bytes
member to Ethereum transactions (only if the mapping'sapiVersion
is >0.0.1
.
Store changes
- Use Postgres indexes for entities and their attributes to speed up queries.
- Use a Postgres connection pool for the store.
- Don't record entity history that we don't need, reducing the size of the database significantly.
Other changes
- Switch to Rust 2018.
- Log query execution with timing data.
- Handle panics in
graph-node
better and shutdown the node when it makes sense. - Add health-check endpoint by making
GET /
return a 200 status. - All environment variables supported are now documented.
- The fast Ethereum block scan that was previously hard-coded to the first 4,000,000 blocks can now be adjusted with the
ETHEREUM_FAST_SCAN_END
environment variable. - Block ingestion can now be disabled with the
DISABLE_BLOCK_INGESTOR
environment variable. - The IPFS file size for
ipfs.cat
can be limited with theGRAPH_MAX_IPFS_FILE_BYTES
environment variable. - The timeout for IPFS file resolution now defaults to 30s and can be controlled with the
GRAPH_IPFS_TIMEOUT
environment variable. - Log IPFS file resolution errors.