From 0f6d74c6c97c3a92d62c0d55154d8792fc8c7096 Mon Sep 17 00:00:00 2001 From: Rhys Bartels-Waller Date: Mon, 27 Jul 2020 01:43:50 +1000 Subject: [PATCH 1/2] chore: minor config update Add missing ENsV from config, and allow port override of Hasura --- docker-compose.yml | 3 ++- package.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 350595c8..80200b57 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -61,7 +61,7 @@ services: context: ./packages/api-cardano-db-hasura/hasura image: inputoutput/cardano-graphql-hasura:${CARDANO_GRAPHQL_VERSION:-1.0.0} ports: - - "8090:8080" + - ${HASURA_PORT:-8090}:8080 depends_on: - "postgres" restart: on-failure @@ -90,6 +90,7 @@ services: image: inputoutput/cardano-graphql:${CARDANO_GRAPHQL_VERSION:-1.0.0} environment: - CACHE_ENABLED=true + - GENESIS_FILE_BYRON=/configuration/genesis_byron.json - GENESIS_FILE_SHELLEY=/configuration/genesis_shelley.json - HASURA_URI=http://hasura:8080 - POSTGRES_HOST=postgres diff --git a/package.json b/package.json index b5992d05..976e47cb 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "service-dependencies": "docker-compose config --services | grep -v \"cardano-graphql\" | xargs docker-compose", "start:mainnet": "GENESIS_FILE_BYRON=${PWD}/config/network/mainnet/genesis_byron.json GENESIS_FILE_SHELLEY=${PWD}/config/network/mainnet/genesis_shelley.json HASURA_URI=http://localhost:8090 yarn workspace @cardano-graphql/server start", "start:shelley_testnet": "GENESIS_FILE_SHELLEY=${PWD}/config/network/shelley_testnet/genesis_shelley.json yarn workspace @cardano-graphql/server start", - "start:mainnet_candidate_3": "GENESIS_FILE_BYRON=${PWD}/config/network/mainnet_candidate_3/genesis_byron.json GENESIS_FILE_SHELLEY=${PWD}/config/network/mainnet_candidate_3/genesis_shelley.json yarn workspace @cardano-graphql/server start", + "start:mainnet_candidate_3": "GENESIS_FILE_BYRON=${PWD}/config/network/mainnet_candidate_3/genesis_byron.json GENESIS_FILE_SHELLEY=${PWD}/config/network/mainnet_candidate_3/genesis_shelley.json HASURA_URI=http://localhost:8090 yarn workspace @cardano-graphql/server start", "test": "yarn workspaces run test" }, "contributors": [ From be1ec6adb230148d59b644b316387790d6969bd7 Mon Sep 17 00:00:00 2001 From: Rhys Bartels-Waller Date: Mon, 27 Jul 2020 02:49:03 +1000 Subject: [PATCH 2/2] Bump version, update changelog --- CHANGELOG.md | 47 +++++++++++++++++++++ docker-compose.yml | 4 +- package.json | 2 +- packages/api-cardano-db-hasura/package.json | 6 +-- packages/api-genesis/README.md | 2 +- packages/api-genesis/package.json | 4 +- packages/cli/package.json | 2 +- packages/client-ts/package.json | 2 +- packages/server/package.json | 8 ++-- packages/util-dev/package.json | 4 +- packages/util/package.json | 2 +- 11 files changed, 65 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 957ccc3d..e2cd652e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,53 @@ Changelog ========= +## 2.0.0-beta.0 +This new major version brings the first round of Shelley-era features to the API, +introduces a new genesis file API package, and hardens the migrations and metadata handling. +This version is required for transitioning through the upcoming Shelley hard fork. + +### Compatible with: + +- [`cardano-node`: `1.18.0`](https://github.com/input-output-hk/cardano-node/releases/tag/1.18.0) +- [`cardano-db-sync`: `3.0.0`](https://github.com/input-output-hk/cardano-db-sync/releases/tag/3.0.0) - Note: The database must be recreated using the new version. + +## Features +### New Queries +- `stakePools`, `stakePools_aggregate` +- `delegations`, `delegations_aggregate` +- `stakeRegistrations`, `stakeRegistrations_aggregate` +- `stakeDeregistrations`, `stakeDeregistrations_aggregate` +- `withdrawals`, `withdrawals_aggregate` +- `genesis` +- Metadata and SQL migrations are now performed within the application layer, and make the service immune to schema +being removed should `cardano-db-sync` restart. using the +[Hasura CLI](https://hasura.io/docs/1.0/graphql/manual/hasura-cli/install-hasura-cli.html), which +is included in the [Dockerfile](./Dockerfile) and [NixOS](./nix/nixos/cardano-graphql-service.nix) +service, however outside of this you must install and place `hasura` on PATH. +- A new API package [`@cardano-graphql/api-genesis`](./packages/api-genesis/README.md) allows +access to the network genesis files. It's integrated into the server, with the config exposed +as environment variables. As usual, the docker-compose.yaml serves as a good reference. + +## Breaking Changes :warning: +### Removed fields +- `cardanoDbSync.slotDiffFromNetworkTip` **removed** in reponse to a change in strategy for determining +sync status with `cardano-db-sync` determining sync status relies on a chain +that has produce +- `Block.slotWithinEpoch` **removed** due to complexity with variation across eras. The Genesis API has information +for calculations based on context. + +### Changed fields +Dates we're previously formatted to ISO 3339, however ISO 8601 is being adopted with this release for +alignment with the Shelley genesis file format and simplification when the precision is not required. +- `2017-10-03T21:43:51.000Z` -> `2017-10-03T21:43:51Z` +- `Block.createdAt` -> `Block.forgedAt` +- `Block.createdBy` -> `Block.slotLeader` links to an object, with a nullable `stakePool` field. For +previous behaviour, `Block.slotLeader.description` can be used, however the description prefixes have +changed upstream from `SlotLeader` to `ByronGenesis` + +## Chores +- Migrations have been squashed into a single step. + ## 1.0.0 ## Features - Optimised versions of some key aggregated queries: diff --git a/docker-compose.yml b/docker-compose.yml index 80200b57..03e2f527 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,7 +59,7 @@ services: hasura: build: context: ./packages/api-cardano-db-hasura/hasura - image: inputoutput/cardano-graphql-hasura:${CARDANO_GRAPHQL_VERSION:-1.0.0} + image: inputoutput/cardano-graphql-hasura:${CARDANO_GRAPHQL_VERSION:-2.0.0-beta.0} ports: - ${HASURA_PORT:-8090}:8080 depends_on: @@ -87,7 +87,7 @@ services: build: context: . target: server - image: inputoutput/cardano-graphql:${CARDANO_GRAPHQL_VERSION:-1.0.0} + image: inputoutput/cardano-graphql:${CARDANO_GRAPHQL_VERSION:-2.0.0-beta.0} environment: - CACHE_ENABLED=true - GENESIS_FILE_BYRON=/configuration/genesis_byron.json diff --git a/package.json b/package.json index 976e47cb..3eb9c0f2 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "cardano-graphql", "description": "A TypeScript monorepo. Includes a server package and API modules for flexible implementation", - "version": "1.0.0", + "version": "2.0.0-beta.0", "private": true, "workspaces": [ "packages/*" diff --git a/packages/api-cardano-db-hasura/package.json b/packages/api-cardano-db-hasura/package.json index a9d645f2..8d96ccf4 100644 --- a/packages/api-cardano-db-hasura/package.json +++ b/packages/api-cardano-db-hasura/package.json @@ -1,6 +1,6 @@ { "name": "@cardano-graphql/api-cardano-db-hasura", - "version": "1.0.0", + "version": "2.0.0-beta.0", "description": "Module for interfacing with the Cardano DB, populated by cardano-db-sync-extended that utilises Hasura for a powerful query interface", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -32,7 +32,7 @@ "schema.graphql" ], "dependencies": { - "@cardano-graphql/util": "1.0.0", + "@cardano-graphql/util": "2.0.0-beta.0", "@graphql-tools/delegate": "^6.0.10", "@graphql-tools/schema": "^6.0.9", "@graphql-tools/wrap": "^6.0.9", @@ -50,7 +50,7 @@ "set-interval-async": "^1.0.33" }, "devDependencies": { - "@cardano-graphql/util-dev": "1.0.0", + "@cardano-graphql/util-dev": "2.0.0-beta.0", "@graphql-codegen/cli": "^1.15.2", "@graphql-codegen/typescript": "^1.15.2", "@graphql-codegen/typescript-graphql-files-modules": "^1.15.2", diff --git a/packages/api-genesis/README.md b/packages/api-genesis/README.md index da8afd9a..0b9b5efe 100644 --- a/packages/api-genesis/README.md +++ b/packages/api-genesis/README.md @@ -1,3 +1,3 @@ # Cardano GraphQL - API Genesis -This API module provides access to the network's genesis file. +This API module provides access to the network's genesis files, keyed by era. diff --git a/packages/api-genesis/package.json b/packages/api-genesis/package.json index 24fe7ed1..8f316e59 100644 --- a/packages/api-genesis/package.json +++ b/packages/api-genesis/package.json @@ -1,6 +1,6 @@ { "name": "@cardano-graphql/api-genesis", - "version": "1.0.0", + "version": "2.0.0-beta.0", "description": "Query the network genesis", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -38,7 +38,7 @@ "graphql-scalars": "^1.2.2" }, "devDependencies": { - "@cardano-graphql/util-dev": "1.0.0", + "@cardano-graphql/util-dev": "2.0.0-beta.0", "@graphql-codegen/cli": "^1.15.2", "@graphql-codegen/typescript": "^1.15.2", "@graphql-codegen/typescript-graphql-files-modules": "^1.15.2", diff --git a/packages/cli/package.json b/packages/cli/package.json index d89a37d7..23aa69df 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@cardano-graphql/cli", - "version": "1.0.0", + "version": "2.0.0-beta.0", "description": "Management tool for managing a Cardano GraphQL deployment", "main": "./dist/index.js", "bin": { diff --git a/packages/client-ts/package.json b/packages/client-ts/package.json index 4c17cf77..c2551660 100644 --- a/packages/client-ts/package.json +++ b/packages/client-ts/package.json @@ -1,6 +1,6 @@ { "name": "@cardano-graphql/client-ts", - "version": "1.0.0", + "version": "2.0.0-beta.0", "description": "A client package for Cardano GraphQL, including the GraphQL schema and TypeScript definitions generated from it", "repository": { "type": "git", diff --git a/packages/server/package.json b/packages/server/package.json index 7fb53a1d..d77c1c56 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,6 +1,6 @@ { "name": "@cardano-graphql/server", - "version": "1.0.0", + "version": "2.0.0-beta.0", "description": "Serve the Cardano GraphQL API over HTTP", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -24,8 +24,8 @@ }, "homepage": "https://github.com/input-output-hk/cardano-graphql/blob/master/packages/server/README.md", "dependencies": { - "@cardano-graphql/api-cardano-db-hasura": "1.0.0", - "@cardano-graphql/api-genesis": "1.0.0", + "@cardano-graphql/api-cardano-db-hasura": "2.0.0-beta.0", + "@cardano-graphql/api-genesis": "2.0.0-beta.0", "@graphql-tools/merge": "^6.0.10", "apollo-metrics": "^1.0.1", "apollo-server-core": "^2.14.3", @@ -39,7 +39,7 @@ "ts-custom-error": "^3.1.1" }, "devDependencies": { - "@cardano-graphql/util-dev": "1.0.0", + "@cardano-graphql/util-dev": "2.0.0-beta.0", "@types/graphql-depth-limit": "^1.1.2", "@types/node": "^14.0.13", "shx": "^0.3.2", diff --git a/packages/util-dev/package.json b/packages/util-dev/package.json index a04b88f2..1454a0cd 100644 --- a/packages/util-dev/package.json +++ b/packages/util-dev/package.json @@ -1,6 +1,6 @@ { "name": "@cardano-graphql/util-dev", - "version": "1.0.0", + "version": "2.0.0-beta.0", "description": "Common development utilities", "main": "dist/index.js", "typings": "dist/index.d.ts", @@ -22,7 +22,7 @@ }, "homepage": "https://github.com/input-output-hk/cardano-graphql/blob/master/packages/util-dev/README.md", "devDependencies": { - "@cardano-graphql/util": "1.0.0", + "@cardano-graphql/util": "2.0.0-beta.0", "shx": "^0.3.2" }, "directories": { diff --git a/packages/util/package.json b/packages/util/package.json index 16c9d700..8227dde4 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -1,6 +1,6 @@ { "name": "@cardano-graphql/util", - "version": "1.0.0", + "version": "2.0.0-beta.0", "description": "Common utilities", "main": "dist/index.js", "typings": "dist/index.d.ts",