-
Notifications
You must be signed in to change notification settings - Fork 9
docs: address #469 subgraph PR feedback #542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8bb234f
test: assert contract addresses are up-to-date
dennis-tra 91a0252
docs: add motivation for custom dealbot subgraph
dennis-tra 7bc1f08
docs: describe subgraph release & deploy process
dennis-tra d657aad
docs(subgraph): link #573, generalize version, deploy calib first
dennis-tra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // Asserts apps/subgraph/networks.json stays in sync with the contract | ||
| // addresses shipped by @filoz/synapse-core (which is generated from | ||
| // FilOzone/filecoin-services). Bumping synapse-core is the trigger for any | ||
| // address change; this test fails fast if networks.json drifts. | ||
|
|
||
| import { readFile } from "node:fs/promises"; | ||
| import { dirname, join } from "node:path"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { test } from "node:test"; | ||
| import assert from "node:assert/strict"; | ||
| import { generated } from "@filoz/synapse-core/abis"; | ||
|
|
||
| const { filecoinWarmStorageServiceAddress, pdpVerifierAddress } = generated; | ||
|
|
||
| const here = dirname(fileURLToPath(import.meta.url)); | ||
| const networksPath = join(here, "..", "networks.json"); | ||
| const networks = JSON.parse(await readFile(networksPath, "utf8")); | ||
|
|
||
| const cases = { | ||
| "filecoin": 314, | ||
| "filecoin-testnet": 314159, | ||
| }; | ||
|
|
||
| for (const [network, chainId] of Object.entries(cases)) { | ||
| test(`${network} PDPVerifier address matches synapse-core[${chainId}]`, () => { | ||
| const actual = networks[network]?.PDPVerifier?.address; | ||
| const expected = pdpVerifierAddress[chainId]; | ||
| assert.equal(actual, expected, `expected ${expected}, got ${actual} for ${network}.PDPVerifier.address`) | ||
| }); | ||
|
|
||
| test(`${network} FilecoinWarmStorageService address matches synapse-core[${chainId}]`, () => { | ||
| const actual = networks[network]?.FilecoinWarmStorageService?.address; | ||
| const expected = filecoinWarmStorageServiceAddress[chainId]; | ||
| assert.equal(actual, expected, `expected ${expected}, got ${actual} for ${network}.FilecoinWarmStorageService.address`); | ||
| }); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # Subgraph Release Checklist | ||
|
|
||
| Source of truth for releasing and deploying [`apps/subgraph/`](../apps/subgraph/). | ||
|
|
||
| The dealbot subgraph is versioned independently from `apps/backend` and `apps/web`. Those two go through a release process as described in [release-process.md](release-process.md). The subgraph is published to [Goldsky](https://goldsky.com/) on its own cadence following the steps below. | ||
|
|
||
| When cutting a release, you may copy the checklist into a new GitHub issue titled `Release subgraph vX.Y.Z` and tick the boxes as you go. The structure mirrors [filecoin-pay-explorer's release template](https://github.com/FilOzone/filecoin-pay-explorer/blob/main/.github/ISSUE_TEMPLATE/release.md). | ||
|
|
||
| ## Notes | ||
|
|
||
| - Dealbot's backend consumes the subgraph at a `prod`-tagged URL (e.g. `.../dealbot-mainnet/prod/gn`). Re-tagging is what actually promotes a new version to production (no backend redeploy required). | ||
| - This checklist assumes a **backward-compatible** change. For a breaking change see [Breaking changes](#breaking-changes) at the bottom. | ||
|
|
||
| ## 1. Define the new version | ||
|
|
||
| ```bash | ||
| NEW_RELEASE_VERSION="X.Y.Z" # no v prefix — used as the Goldsky version segment | ||
| CURRENT_VERSION="X.Y.Z" # version currently tagged as `prod` (will be replaced) | ||
| ``` | ||
|
|
||
| - [ ] Version strings agreed and set | ||
| - [ ] Bump follows semver: additive → minor, fix → patch, breaking → major | ||
|
|
||
| ## 2. Create a GitHub release | ||
|
|
||
| ```bash | ||
| gh release create "subgraph-v$NEW_RELEASE_VERSION" \ | ||
| --title "subgraph v$NEW_RELEASE_VERSION" \ | ||
| --generate-notes | ||
| ``` | ||
|
|
||
| - [ ] GitHub release created with tag `subgraph-vX.Y.Z` | ||
|
|
||
| The `subgraph-` prefix disambiguates from backend / web releases, which are tagged on the same repo by release-please. | ||
|
|
||
| ## 3. Build and publish the subgraph | ||
|
|
||
| > **Note:** Tag-triggered CI for subgraph deploys is not wired up yet — for now every release uses the manual fallback. Tracked as follow-up in [#573](https://github.com/FilOzone/dealbot/issues/573); target is to match [filecoin-pay-explorer's `deploy.yml`](https://github.com/FilOzone/filecoin-pay-explorer/blob/main/.github/workflows/deploy.yml). | ||
|
|
||
| The following commands need to be run in the `apps/subgraph` directory and require the `goldsky` CLI authenticated via a `GOLDSKY_API_KEY`. | ||
|
|
||
| ```bash | ||
| export VERSION=X.Y.Z # no v prefix; used as the Goldsky version segment | ||
|
|
||
| pnpm build:calibration | ||
| pnpm deploy:calibration | ||
|
|
||
| pnpm build:mainnet | ||
| pnpm deploy:mainnet | ||
| ``` | ||
|
|
||
| - [ ] `dealbot-calibration/$NEW_RELEASE_VERSION` deployed | ||
| - [ ] `dealbot-mainnet/$NEW_RELEASE_VERSION` deployed | ||
|
|
||
| ## 4. Await subgraph indexing | ||
|
|
||
| - [ ] Received confirmation email that `dealbot-calibration` finished indexing | ||
| - [ ] Received confirmation email that `dealbot-mainnet` finished indexing | ||
|
|
||
| ## 5. Smoke-test the candidate in staging | ||
|
|
||
| Point dealbot staging at the new versioned URL. The cleanest way is via a `staging` tag so the staging backend's config can stay stable: | ||
|
|
||
| ```bash | ||
| for network in calibration mainnet; do | ||
| goldsky subgraph tag delete dealbot-$network/$CURRENT_VERSION --tag staging 2>/dev/null || true | ||
| goldsky subgraph tag create dealbot-$network/$NEW_RELEASE_VERSION --tag staging | ||
| done | ||
| ``` | ||
|
|
||
| - [ ] `dealbot-mainnet/$NEW_RELEASE_VERSION` tagged as `staging` | ||
| - [ ] `dealbot-calibration/$NEW_RELEASE_VERSION` tagged as `staging` | ||
| - [ ] Dealbot staging backend's subgraph-dependent checks succeed against the new subgraph | ||
| - [ ] No new errors in dealbot staging logs | ||
|
|
||
| ## 6. Promote subgraphs to `prod` | ||
|
|
||
| > [!NOTE] | ||
| > Re-tagging as `prod` below switches the **production** dealbot backend over to the new subgraph version. Do this only when you're ready to take it live. | ||
|
|
||
| ```bash | ||
| for network in calibration mainnet; do | ||
| # `tag create` errors if `prod` already points at another version, so we | ||
| # delete first. The window between the two calls is sub-second; consumers | ||
| # querying the `prod` URL in that window will get an error. | ||
| goldsky subgraph tag delete dealbot-$network/$CURRENT_VERSION --tag prod 2>/dev/null || true | ||
| goldsky subgraph tag create dealbot-$network/$NEW_RELEASE_VERSION --tag prod | ||
| done | ||
| ``` | ||
|
|
||
| - [ ] `dealbot-mainnet` tagged as `prod` | ||
| - [ ] `dealbot-calibration` tagged as `prod` | ||
|
|
||
| ## 7. Verify production | ||
|
|
||
| - [ ] Dealbot production backend's subgraph-dependent checks are healthy | ||
| - [ ] No regressions in production metrics or dashboards | ||
|
|
||
| ## 8. Wrap-up | ||
|
|
||
| - [ ] Announce the release in `#fil-foc` | ||
| - [ ] Capture any improvements needed for next time | ||
| - [ ] Close this issue | ||
|
|
||
| --- | ||
|
|
||
| ## Breaking changes | ||
|
|
||
| When the schema or entity shape changes in a way the current backend can't read, the order changes — re-tagging `prod` first would take the backend down: | ||
|
|
||
| 1. Steps 1–4 as above (cut & deploy the new version, wait for indexing). | ||
| 2. Land the backend changes that consume the new shape, configured to read from the new **versioned** URL (not `prod`). Deploy to dealbot staging and validate end-to-end against `vX.Y.Z`. | ||
| 3. Once dealbot production is on a backend release that understands the new shape (either both shapes during a migration, or new-only), proceed to step 6 to re-tag `prod`. | ||
| 4. Rollback: re-tag the previous subgraph version back to `prod`. The `prod` tag is the rollback lever — a single Goldsky API call, no backend redeploy required. |
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.
Uh oh!
There was an error while loading. Please reload this page.