Releases: graphprotocol/graph-node
v0.10.0
Data source templates / dynamic data sources
Also referred to as dynamic contract subscriptions, as this is currently the main use case.
This feature supports creating new data sources from templates while indexing the subgraph. The motivation behind this is to provide a natural way of indexing registry/factory contracts that reference many other (sub)contracts.
See Define a Subgraph: Dynamic Data Sources in the docs for more details.
Details about the implementation are described in the pull request that introduced the feature:
When starting a subgraph, the node now not only loads the manifest, it also loads the dynamic data sources from the store and fetches their files from IPFS. It then injects the data source instances into the subgraph instance before starting the indexing.
Whenever we we process a block and mappings request new data sources, these data sources are collected and, after having processed the block, are instantiated from templates. We then process the current block again but only with those new data sources. The entity operations from this are merged into the ones we already have for the block. After that, the dynamic data sources are persisted by adding the data sources to the subgraph instance and by adding entity operations to store them in the db (for 1.).
If new data sources have been added in a block, the block stream is restarted to incorporate events that are relevant for the new data sources going forward. We figured this would be easier to do (and it is) than modifying the block stream while it is already running.
Anonymous events
Anonymous Solidity events are used by projects like Maker. Supporting them requires filtering events not by their usual signature (e.g. Transfer(address,address)
) but by their topic 0 value.
This version adds support for that by allowing event handlers to specify the topic0
value to filter by. For more information see Define a Subgraph: Anonymous Events in the docs.
Full support for GraphQL fragments
This releases finishes the support for GraphQL fragments both inline and spread in.
Query complexity limiting
Graph Node now supports limiting complexity of queries both in terms of potential number of entities returned and query depth, similar to how GitHub do it in their GraphQL API.
The following environment variables can be used for this:
GRAPH_GRAPHQL_MAX_COMPLEXITY
— limits the complexity of queries (default: unlimited).GRAPH_GRAPHQL_MAX_DEPTH
— limits the depth of queries (default and maximum: 255).
Entity table splitting
Starting with this release, Graph Node stores entities and their history in a Postgres schema dedicated to the subgraph deployment. Every subgraph deployment now gets their own entities table, which speeds up queries significantly. Existing entity data in the global entities table can still be queried as before.
Other changes
- Fix list equality filters.
- Log smart contract call times.
- Reduce subgraph logging overall to reduce noise around event processing.
- Switch to the latest IPFS client version for HTTPS support.
- Add environment variables to control the block range size used while scanning the history of the chain (
ETHEREUM_PARALLEL_BLOCK_RANGES
) as well as the number of parallel block ranges to scan (ETHEREUM_BLOCK_RANGE_SIZE
).
v0.9.0
Ethereum tuples / Solidity structs
This release adds support for Ethereum tuples (structs in Solidity). Events with tuple parameters are now decoded correctly and passed to mappings as EthereumTuple
objects. Passing tuples as arguments to smart contract calls is support as well.
Other changes
- The GraphQL execution has been simplified in preparation of performance improvements.
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.
v0.5.0
Changes
- Deployed subgraphs can now be queried using GraphQL, using the new
/subgraphs
route. - Query and subscription URLs have changed:
/by-id/<id>
is now/subgraphs/id/<id>
,/by-name/<name>
is now/subgraphs/name/<name>
.
- Support for new subgraph manifest fields has been added:
description
andrepository
at the top level,network
(one ofmainnet
,ropsten
,rinkeby
,kovan
, to be extended) at the data source level.
- A new
entityCount
field has been added to the subgraphs schema at/subgraphs
. - HTTP and WebSocket ports are now configurable via
--http-port
/HTTP_PORT
and--ws-port
/WS_PORT
. - The Rust version to
1.31
. - The AssemblyScript version to the latest master.
Fixes
orderBy
now works again, for all attribute types.Address.from()
in mappings now accepts0x
-prefixed addresses.- A frequent deadlock at
graph-node
startup has been fixed. - Our
__typename
support has been changed to avoid warnings in clients. - GraphiQL now uses the
wss
protocol for subscriptions if served using HTTPS. - Missing CORS headers have been added.
v0.4.1
Changes
- Batch requests for transaction receipts.
- Make
bigInt.toHex()
format numbers as big-endian, with leading zeros trimmed. - Implement
env.abort
to improve logging of AssemblyScript exceptions. - Add GraphQL
__typename
support. - Optionally, write subgraph logs to Elasticsearch.
- Add
--ethereum-polling-interval
/ETHEREUM_POLLING_INTERVAL
option. - Bring the full test suite back (it had been partially disabled due to massive code changes).
- Documentation improvements (getting started).
- Fix casting bug when querying boolean entity fields.
- Add
BigInt
math (+
,-
,*
,/
and%
). - Add more data to Ethereum events, blocks and transactions passed to mappings.
v0.4.0
This release corresponds to the following graph-cli and graph-ts releases:
ETHSanFrancisco v1
ethsf-v1 Cut first version for ETHSanFrancisco
Developer Preview
This developer preview includes:
- GraphQL Server — A custom spec-compliant GraphQL implementation. We automatically generate the server from the SDL schema including support for filters w/ boolean expressions, sorting, and pagination.
- Ethereum Adapter — Subscribes to Ethereum events using IPC or RPC and accesses smart contract storage.
- WASM Runtime Host — Executes developer-provided Mappings on WASM using Parity’s excellent Wasmi library.
- Postgres Store — Stores and indexes the transformed data in an entity table in Postgres, which is queried by the GraphQL server.