Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .github/workflows/runtime-interaction-graph.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: Runtime interaction graph

on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
graph-diff:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: current
persist-credentials: false
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.base.sha }}
path: base
persist-credentials: false
- name: Select coverage policy
id: coverage-policy
run: |
policy=base/scripts/runtime-interaction-graph/coverage-thresholds-deployment.json
if [ ! -f "$policy" ]; then
policy=current/scripts/runtime-interaction-graph/coverage-thresholds-deployment.json
fi
echo "path=$policy" >> "$GITHUB_OUTPUT"
- name: Select contract fixtures
id: contract-fixtures
run: |
before=base/scripts/runtime-interaction-graph/fixtures/ci-contracts.json
if [ ! -f "$before" ]; then
before=current/scripts/runtime-interaction-graph/fixtures/ci-contracts.json
fi
echo "before=$before" >> "$GITHUB_OUTPUT"
echo "after=current/scripts/runtime-interaction-graph/fixtures/ci-contracts.json" >> "$GITHUB_OUTPUT"
- name: Test graph tooling
run: |
python3 -m unittest discover -s current/scripts/runtime-interaction-graph -p 'test_*.py'
node --test current/scripts/runtime-interaction-graph/collect_runtime_contracts.test.mjs
- name: Generate graphs
run: |
python3 current/scripts/runtime-interaction-graph/runtime_interaction_graph.py \
--root base --output output/before \
--contracts-manifest "${{ steps.contract-fixtures.outputs.before }}"
python3 current/scripts/runtime-interaction-graph/runtime_interaction_graph.py \
--root current --output output/after \
--contracts-manifest "${{ steps.contract-fixtures.outputs.after }}"
- name: Compare graphs and coverage
run: |
python3 current/scripts/runtime-interaction-graph/diff_graphs.py \
output/before/interaction-graph.json output/after/interaction-graph.json \
--before-coverage output/before/coverage.json \
--after-coverage output/after/coverage.json \
--coverage-thresholds "${{ steps.coverage-policy.outputs.path }}" \
--output output/graph-diff.json --markdown output/graph-diff.md
- name: Add graph summary
if: always()
run: |
if [ -f output/graph-diff.md ]; then
cat output/graph-diff.md >> "$GITHUB_STEP_SUMMARY"
fi
- uses: actions/upload-artifact@v4
if: always()
with:
name: runtime-interaction-graph
path: output

full-semantic-graph:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 360
env:
CARGO_INCREMENTAL: "0"
CARGO_NET_GIT_FETCH_WITH_CLI: "true"
CARGO_PROFILE_DEV_DEBUG: "0"
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Install pinned nightly
run: rustup toolchain install nightly-2025-12-06 --profile minimal
- name: Test graph tooling
run: |
python3 -m unittest discover -s scripts/runtime-interaction-graph -p 'test_*.py'
node --test scripts/runtime-interaction-graph/collect_runtime_contracts.test.mjs
- name: Collect workspace MIR
run: |
python3 scripts/runtime-interaction-graph/collect_mir.py \
--all --output output/full/mir
- name: Generate compiler-enriched graph
run: |
python3 scripts/runtime-interaction-graph/runtime_interaction_graph.py \
--rustc-mir-manifest output/full/mir/manifest.json \
--contracts-manifest scripts/runtime-interaction-graph/fixtures/ci-contracts.json \
--output output/full/graph \
--coverage-thresholds scripts/runtime-interaction-graph/coverage-thresholds-full.json
- uses: actions/upload-artifact@v4
if: always()
with:
name: runtime-interaction-graph-full
path: output/full
35 changes: 35 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,38 @@ available Codex equivalent:
Available shared skills:
- `hydration_cl0wdit` - security audit workflow for Substrate runtime and pallet
code.

## runtime interaction graph

For runtime dependency and interaction questions, use the bounded AI-facing
query interface documented in `scripts/runtime-interaction-graph/README.md`.
Prefer `query_graph.py` over loading `interaction-graph.json` or the interactive
HTML into model context. Use the generated `graph-scale.svg` for a compact visual
overview of graph size, activity, domains, edge kinds, and evidence provenance.

## User working preferences

- Do not run `git commit` or stage changes unless the user explicitly authorizes
that specific commit. Leave completed changes unstaged by default.
- When authorized to commit, stay on the current branch unless the user asks for
a new branch.
- Use a single short commit subject with no body or trailers. Do not add AI
attribution. Follow wording supplied by the user; otherwise use the repository
convention where applicable.
- Prefer lowercase prose in responses, summaries, headings, and proposed commit
messages. Preserve the canonical capitalization of code identifiers and names.
- Default to no new explanatory comments. Add comments only for non-obvious
runtime invariants or constraints, never to narrate a diff.
- Run `cargo fmt` after Rust changes.
- Prefer Makefile targets for builds and tests. For direct cargo commands, export
the Makefile's required `RUSTFLAGS` and `CXXFLAGS` separately before running
cargo; do not use inline environment prefixes.
- After version changes, run an appropriate cargo check so `Cargo.lock` remains
synchronized. Version every changed crate: use a minor bump for source changes
and a patch bump for test-only changes, and keep the runtime crate version and
`spec_version` aligned.
- For comparison tests, use the reference implementation in its original
language and toolchain instead of translating it.
- When the user needs to copy generated data such as an encoded call or a long
hex value, write it to a suitable untracked project file so it is available in
the IDE changes view.
24 changes: 24 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,32 @@ Available shared skills:
- `scripts/mint-limit/README.md` — generate TC proposals to set XCM mint limits and lift circuit breaker lockdowns
- `scripts/dca-monitor/README.md` — verify DCA fixes on a Chopsticks fork before deploying a runtime upgrade
- `scripts/onchain-routes/README.md` — generate TC proposals to register/update on-chain router routes
- `scripts/runtime-interaction-graph/README.md` — generate, query, and visualize the runtime interaction graph
- `integration-tests/README.md` — debug prod issues via scraper snapshots + integration tests

## Runtime interaction graph (live query API)

A deployed instance of the runtime interaction graph (FRAME pallets, runtime config, EVM
subsystem, precompiles, storage, callbacks — evidence-backed nodes/edges) is queryable at:

`https://runtime-graph.lark.hydration.cloud`

Use it to answer "what calls what / what reaches what" questions about the runtime without
grepping or loading the graph into context. `POST /api/v1/query` with JSON:

- `{"operation":"summary"}` — graph totals and identity
- `{"operation":"search","text":"pallet:omnipool"}` — ranked node/edge matches
- `{"operation":"node","id":"pallet:omnipool"}` — one node with evidence
- `{"operation":"neighbors","id":"pallet:omnipool","depth":2}` — bounded ego subgraph
- `{"operation":"paths","source":"pallet:route-executor","target":"boundary:evm-execution","view":"components"}` — bounded reachability
- `{"operation":"packs","section":"component_cycles"}` — precomputed audit queries (cycles, ordering, origin, token flows, entrypoints)

Responses are deterministic, token-budgeted (defaults: 250 records / 16k tokens; lower with
`max_records`/`max_tokens`), and carry the graph SHA-256 fingerprint — check it if build
identity matters. `GET /api/v1` lists operations and limits; `/readyz` shows the loaded graph
identity. The interactive dashboard for humans is at `/`. See
`scripts/runtime-interaction-graph/README.md` for regenerating or querying local graphs.

## Project overview

Substrate-based parachain (Polkadot ecosystem) implementing DeFi protocols — DEX (Omnipool, Stableswap, XYK, LBP), DCA, OTC, bonds, staking, governance, and EVM compatibility.
Expand Down
24 changes: 12 additions & 12 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pallets/broadcast/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-broadcast"
version = "1.7.0"
version = "1.8.0"
authors = ["GalacticCouncil"]
edition = "2021"
license = "Apache 2.0"
Expand Down Expand Up @@ -42,6 +42,7 @@ std = [
"sp-core/std",
"sp-io/std",
"primitives/std",
"hydradx-traits/std",
"frame-support-procedural/std",
]
try-runtime = ["frame-support/try-runtime"]
3 changes: 2 additions & 1 deletion pallets/evm-accounts/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-evm-accounts"
version = "1.6.1"
version = "1.7.0"
authors = ["GalacticCouncil"]
edition = "2021"
license = "Apache-2.0"
Expand Down Expand Up @@ -59,6 +59,7 @@ std = [
"orml-tokens/std",
"orml-traits/std",
"frame-benchmarking/std",
"hydradx-traits/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand Down
3 changes: 2 additions & 1 deletion pallets/nft/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-nft"
version = "7.3.0"
version = "7.4.0"
description = "A generic NFT pallet for managing non-fungible tokens"
authors = ["GalacticCoucil"]
edition = "2021"
Expand Down Expand Up @@ -46,6 +46,7 @@ std = [
"pallet-uniques/std",
"pallet-balances/std",
"scale-info/std",
"hydradx-traits/std",
]
runtime-benchmarks = [
"frame-benchmarking",
Expand Down
4 changes: 3 additions & 1 deletion pallets/parameters/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-parameters"
version = "1.2.0"
version = "1.3.0"
authors = ['GalacticCouncil']
edition = "2021"
license = "Apache-2.0"
Expand Down Expand Up @@ -35,6 +35,8 @@ std = [
'sp-core/std',
'sp-io/std',
'sp-std/std',
'frame-support/std',
'frame-system/std',
]

try-runtime = ["frame-support/try-runtime"]
4 changes: 3 additions & 1 deletion pallets/staking/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pallet-staking"
version = "5.1.0"
version = "5.2.0"
authors = ['GalacticCouncil']
edition = "2021"
license = "Apache-2.0"
Expand Down Expand Up @@ -61,6 +61,8 @@ std = [
"pallet-conviction-voting/std",
"pallet-referenda/std",
"pallet-democracy/std",
"orml-traits/std",
"hydra-dx-math/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
Expand Down
4 changes: 3 additions & 1 deletion runtime/adapters/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hydradx-adapters"
version = "1.13.2"
version = "1.14.0"
description = "Structs and other generic types for building runtimes."
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down Expand Up @@ -125,4 +125,6 @@ std = [
"pallet-bonds/std",
"pallet-timestamp/std",
"pallet-fee-processor/std",
"orml-vesting/std",
"pallet-staking/std",
]
Loading
Loading