-
Notifications
You must be signed in to change notification settings - Fork 0
Take the subgraph's deployment record and wire it to the deploy records #4
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
16 commits
Select commit
Hold shift + click to select a range
fbaf412
Move the MetaBoard subgraph here and wire it to the deploy record
86e52a7
Rework: keep only the deployment record; the subgraph source goes back
52c4af2
Trim CLAUDE.md back under the agent-context cap
376d942
Assert the datasource is indexed EVERYWHERE, not just at one address
aa1f60b
Harden `Subgraph manual deploy`: least privilege, one at a time, URLs…
3d85d99
chore: drop mutants.toml; the probe is a one-off, not committed coverage
66c171a
chore: drop the .soldeerignore entry for the deleted mutants.toml
119a312
Make the deploy able to run: codegen, a no-op that is not a failure
0ed2a94
Say what `.gitignore` does to `subgraph/` in a way that parses once
e231f54
Two doc lines that overclaim: `fs_permissions` and "no record of v1"
675f84a
Pin every startBlock to the deploy block, against the chain itself
99ce969
One contract per file: the shared reader moves to its own file
5c70e01
Merge main: the release cut and goldsky reporter landed beside this b…
bc4af7d
Cut CLAUDE.md under the agent-context cap
1690f61
Repair the sentence the cap cut broke
959ffb4
Flip networks.json to the 0.1.0 MetaBoard, on all seven deploy networks
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| name: Subgraph manual deploy | ||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| metadata-ref: | ||
| description: >- | ||
| rain.metadata ref to take the subgraph SOURCE from. The manifest, schema and mappings are not in this repo; only networks.json is. | ||
| required: false | ||
| default: main | ||
| # Read-only, stated rather than left to the repo default. This job fetches and | ||
| # then RUNS another repo's `package.json` install scripts, so the ambient | ||
| # `GITHUB_TOKEN` is reachable from code this repo did not review; nothing here | ||
| # needs to write anything back. | ||
| permissions: | ||
| contents: read | ||
| # One deploy at a time. `GOLDSKY_SUBGRAPH_NAME` is a single name, so two | ||
| # dispatches publish over each other. Never cancelled: a half-finished | ||
| # seven-network loop leaves Goldsky holding some networks from one run and some | ||
| # from the other, which is worse than waiting. | ||
| concurrency: | ||
| group: subgraph-manual-deploy | ||
| cancel-in-progress: false | ||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
| env: | ||
| GOLDSKY_TOKEN: ${{ secrets.CI_GOLDSKY_TOKEN }} | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| GOLDSKY_SUBGRAPH_NAME: metaboard | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| steps: | ||
| # `persist-credentials: false` on both checkouts: the fetched subgraph | ||
| # source's install scripts run in this job, and a git config holding the | ||
| # token is one `git config --get` away from them. Nothing here pushes. | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
| # The subgraph is split on whether a file carries a deployment fact | ||
| # (rainlanguage/rain.metadata#149). This repo holds `networks.json` and | ||
| # nothing else under `subgraph/`; the manifest, schema, mappings and | ||
| # package lock are SOURCE and live in the library half. They are fetched | ||
| # rather than duplicated, so there is one copy of each and it is the one | ||
| # matchstick runs against. | ||
| - name: Checkout the subgraph source | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| repository: rainlanguage/rain.metadata | ||
| ref: ${{ inputs.metadata-ref }} | ||
| path: .subgraph-source | ||
| persist-credentials: false | ||
| - uses: nixbuild/nix-quick-install-action@v30 | ||
| with: | ||
| nix_conf: | | ||
| keep-env-derivations = true | ||
| keep-outputs = true | ||
| - name: Restore and save Nix store | ||
| uses: nix-community/cache-nix-action@v7 | ||
| with: | ||
| primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} | ||
| restore-prefixes-first-match: nix-${{ runner.os }}- | ||
| gc-max-store-size-linux: 1G | ||
| # Merged INTO `subgraph/` rather than over it: this repo's own | ||
| # `networks.json` has to survive, and the library must not be shipping one | ||
| # of its own to shadow it. Both are asserted, because a silent shadow | ||
| # would deploy whatever table the library happened to carry. | ||
| - name: Assemble the subgraph | ||
| run: | | ||
| set -euo pipefail | ||
| if [ -e .subgraph-source/subgraph/networks.json ]; then | ||
| echo "::error::rain.metadata ships a networks.json; it would shadow this repo's deploy record" | ||
| exit 1 | ||
| fi | ||
| cp -R .subgraph-source/subgraph/. subgraph/ | ||
| test -f subgraph/networks.json | ||
| test -f subgraph/subgraph.yaml | ||
| source_sha="$(git -C .subgraph-source rev-parse HEAD)" | ||
| echo "subgraph source: rainlanguage/rain.metadata@${source_sha}" | ||
| echo "Subgraph source: [rain.metadata@\`${source_sha}\`](https://github.com/rainlanguage/rain.metadata/commit/${source_sha})" >> "$GITHUB_STEP_SUMMARY" | ||
| # The manifest reads its ABI out of `out/`, which is a forge build of the | ||
| # interface it arrives with as a soldeer dependency, so the dependencies | ||
| # have to be on disk and compiled before `graph build` can read anything. | ||
| - name: Build the ABI the manifest reads | ||
| run: | | ||
| nix develop github:rainlanguage/rainix#sol-shell -c forge soldeer install | ||
| nix develop github:rainlanguage/rainix#sol-shell -c forge build | ||
| # Fail here rather than part way through a seven-network Goldsky loop: the | ||
| # manifest's ABI paths are a cross-repo coupling and this is the first | ||
| # place they can be resolved. Read out of the manifest with `yq` rather | ||
| # than grepped for: `file:` also names the schema and the mapping, and a | ||
| # grep that matched one of those would report success having checked a | ||
| # path that was never in question. | ||
| - name: Check the manifest ABIs resolve | ||
| run: | | ||
| nix develop --command bash -c ' | ||
| set -euo pipefail | ||
| abis="$(yq -r ".dataSources[].mapping.abis[].file" subgraph/subgraph.yaml)" | ||
| test -n "$abis" | ||
| while read -r abi; do | ||
| echo "manifest ABI: $abi" | ||
| test -f "subgraph/$abi" | ||
| done <<< "$abis" | ||
| ' | ||
| # `subgraph-deploy` runs `npm ci` and then `graph build --network`, and | ||
| # `graph build` does NOT codegen. It compiles `src/metaBoard.ts`, which | ||
| # imports `../generated/metaboard0/MetaBoard` and `../generated/schema` — | ||
| # generated files, gitignored in the library half, so they never arrive | ||
| # with the fetched source. Without this step the AssemblyScript compile | ||
| # fails on two unresolved imports for every network in the loop. | ||
| # | ||
| # `npm ci` here is the same install `subgraph-deploy` repeats. It removes | ||
| # `node_modules` and not `generated/`, so the types survive into it. | ||
| - name: Generate the subgraph types | ||
| run: nix develop --command bash -c 'cd subgraph && npm ci && graph codegen' | ||
| - name: Deploy and capture URLs | ||
| id: deploy | ||
| run: | | ||
| set -o pipefail | ||
| nix develop --command subgraph-deploy 2>&1 | tee deploy.log | ||
| echo | ||
| # `subgraph-deploy` skips a network whose version Goldsky already | ||
| # holds, and prints no URL for it. A re-dispatch that skips every | ||
| # network is a SUCCESSFUL no-op matching nothing, and `grep` answers | ||
| # no-match with exit 1 — which `pipefail` plus the runner's `-e` would | ||
| # read as a failed deploy. So exit 1 is folded into an empty list, and | ||
| # only exit 1: anything above it is `grep` failing rather than not | ||
| # matching, and still fails the step. | ||
| matched=0 | ||
| grep -oE 'https://api\.goldsky\.com/api/public/[^[:space:]]+/gn' deploy.log > matched_urls.txt || matched=$? | ||
| if [ "$matched" -gt 1 ]; then | ||
| exit "$matched" | ||
| fi | ||
| sort -u matched_urls.txt > deployed_urls.txt | ||
| echo "::group::Deployed Goldsky URLs" | ||
| cat deployed_urls.txt | ||
| echo "::endgroup::" | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| # Into the run summary as well as the log: `deployed_urls.txt` lives | ||
| # in the runner workspace and is gone with it, and the log is where | ||
| # nobody looks for the one fact a deploy produces. The summary already | ||
| # names the source commit these URLs were built from, so the two sit | ||
| # together and the pair survives the runner. | ||
| # | ||
| # The empty case is spelled rather than left as an empty list: a | ||
| # summary reading "Deployed:" and then nothing looks like a broken | ||
| # step rather than the no-op it is. | ||
| { | ||
| echo | ||
| if [ -s deployed_urls.txt ]; then | ||
| echo "Deployed:" | ||
| echo | ||
| sed 's|^|- |' deployed_urls.txt | ||
| else | ||
| echo "Deployed: nothing. Every network already held this version." | ||
| fi | ||
| } >> "$GITHUB_STEP_SUMMARY" | ||
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 |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ CLAUDE.md | |
| /remappings.txt | ||
| /slither.config.json | ||
| /soldeer.lock | ||
| /subgraph | ||
| /REUSE.toml | ||
| /script | ||
| /test | ||
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
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,44 @@ | ||
| { | ||
| "matic": { | ||
| "metaboard0": { | ||
| "address": "0x8fD50fF9Db9835ba1B61394752A26F53D721D2a1", | ||
| "startBlock": 92426181 | ||
| } | ||
| }, | ||
| "arbitrum-one": { | ||
| "metaboard0": { | ||
| "address": "0x8fD50fF9Db9835ba1B61394752A26F53D721D2a1", | ||
| "startBlock": 496974800 | ||
| } | ||
| }, | ||
| "base": { | ||
| "metaboard0": { | ||
| "address": "0x8fD50fF9Db9835ba1B61394752A26F53D721D2a1", | ||
| "startBlock": 50277465 | ||
| } | ||
| }, | ||
| "base-sepolia": { | ||
| "metaboard0": { | ||
| "address": "0x8fD50fF9Db9835ba1B61394752A26F53D721D2a1", | ||
| "startBlock": 45787995 | ||
| } | ||
| }, | ||
| "flare": { | ||
| "metaboard0": { | ||
| "address": "0x8fD50fF9Db9835ba1B61394752A26F53D721D2a1", | ||
| "startBlock": 67943188 | ||
| } | ||
| }, | ||
| "hyperevm": { | ||
| "metaboard0": { | ||
| "address": "0x8fD50fF9Db9835ba1B61394752A26F53D721D2a1", | ||
| "startBlock": 43806327 | ||
| } | ||
| }, | ||
| "mainnet": { | ||
| "metaboard0": { | ||
| "address": "0x8fD50fF9Db9835ba1B61394752A26F53D721D2a1", | ||
| "startBlock": 25805918 | ||
| } | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.