Skip to content

Commit 05439ad

Browse files
Merge branch 'master' into feat/ice-pallet
2 parents a6ad577 + a4522b3 commit 05439ad

47 files changed

Lines changed: 1661 additions & 227 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/skills/hydration_cl0wdit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../ai_skills/hydration_cl0wdit

.codex/skills/hydration_cl0wdit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../ai_skills/hydration_cl0wdit

AGENTS.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# AGENTS.md - hydration-node
2+
3+
This is the Codex entrypoint for the repository.
4+
5+
Follow the project guidance in `CLAUDE.md`; it is the shared repo instruction
6+
file for build, test, style, PR, and domain conventions.
7+
8+
## Shared AI skills
9+
10+
Repo-local AI skills live in `ai_skills/` so they can be used by multiple coding
11+
agents.
12+
13+
When the user invokes a skill by name, or the task clearly matches a skill
14+
description, read the corresponding `ai_skills/<skill-name>/SKILL.md` file and
15+
follow its instructions. Resolve any relative paths in a skill from that skill's
16+
directory.
17+
18+
If a skill references tool names from another agent environment, use the closest
19+
available Codex equivalent:
20+
- `Read` -> file reads such as `sed`, `rg`, or editor context
21+
- `Glob` -> `rg --files` or `find`
22+
- `Grep` -> `rg`
23+
- `Bash` -> shell commands
24+
- `WebFetch` -> web access when available and permitted
25+
- `Agent` -> Codex sub-agents only when the user has explicitly asked for
26+
delegated or parallel agent work
27+
28+
Available shared skills:
29+
- `hydration_cl0wdit` - security audit workflow for Substrate runtime and pallet
30+
code.

CLAUDE.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ For Hydration protocol-level context (architecture, products, tokenomics, Omnipo
77

88
It lists available reference documents and their raw GitHub URLs.
99

10+
## Shared AI skills
11+
12+
Repo-local AI skills live in `ai_skills/` so they can be used by multiple coding
13+
agents, not only Claude.
14+
15+
When the user invokes a skill by name, or the task clearly matches a skill
16+
description, load the corresponding `ai_skills/<skill-name>/SKILL.md` file and
17+
follow its instructions. Resolve any relative paths in a skill from that skill's
18+
directory.
19+
20+
Available shared skills:
21+
- `hydration_cl0wdit` - security audit workflow for Substrate runtime and pallet
22+
code.
23+
1024
## Project overview
1125

1226
Substrate-based parachain (Polkadot ecosystem) implementing DeFi protocols — DEX (Omnipool, Stableswap, XYK, LBP), DCA, OTC, bonds, staking, governance, and EVM compatibility.
@@ -133,6 +147,68 @@ Types: `feat`, `fix`, `refactor`, `perf`, `test`, `docs`, `style`, `ci`, `build`
133147

134148
**Branches:** `fix/description` or `feat/description`
135149

150+
## Code comments and docs
151+
152+
Default to **no comment**. Only write one when the *why* is non-obvious — a hidden
153+
invariant, a surprising decision, a workaround. If removing the comment wouldn't
154+
confuse a future reader who can see the code, don't write it.
155+
156+
**Never restate what the code already says.** Well-named identifiers and types are
157+
the documentation. Comments that paraphrase the next line are noise.
158+
159+
### Module / file headers
160+
One paragraph max. State what lives here; don't enumerate every item or describe
161+
the flow step-by-step.
162+
163+
### Struct / enum field docs
164+
Skip the obvious (`pub unstaking: Balance`, `pub voters_count: u32`). Document a
165+
field only when its semantics are surprising — e.g. it stacks instead of replacing,
166+
must match an external balance, doubles as an idempotency signal.
167+
168+
### Error variants
169+
One line each, or none if the name already tells the story. Don't write a
170+
paragraph explaining the policy that produces the error — that belongs at the
171+
check site.
172+
173+
### Extrinsic docs
174+
Follow the Description / Parameters / Emits structure from the "Extrinsic
175+
documentation" section above, but keep the **Description to 1–2 lines plus at
176+
most one short paragraph** for genuinely load-bearing context. In particular:
177+
178+
- Do not enumerate `Error` variants in the Description — the `#[pallet::error]`
179+
enum is the source of truth.
180+
- Do not list internal implementation steps ("locks X, then mints Y, then calls
181+
Z"). The code shows that.
182+
- Keep the *why* of any non-obvious constraint (e.g. "refuses while stHDX is in
183+
circulation — outstanding aTokens would be stranded").
184+
185+
### Trait method docs
186+
One line. If the trait-level doc already explains the contract, leave method
187+
docs out entirely.
188+
189+
### Inline comments inside function bodies
190+
Reserve for:
191+
- Non-obvious invariants the next line relies on.
192+
- Why a defensive branch exists / why an error is intentionally swallowed.
193+
- Why an unusual construct (`drain_prefix(...).count()` to actually drain,
194+
`set_lock` vs `extend_lock`, pre-decrement before an external call) is correct.
195+
196+
Skip:
197+
- Narrating control flow ("// new record: increment voter count" above
198+
`voters_count += 1`).
199+
- Explaining what a well-named helper does at its call site.
200+
- Restating the assertion in the next `ensure!`.
201+
202+
### What to keep
203+
Comments that warn a future reader about something they would otherwise miss:
204+
- "Must match `LockableAToken.sol`'s `freeBalance` check"
205+
- "Saturating math — hooks must never block voting"
206+
- "Pool presence ⇔ allocation has run" (load-bearing idempotency signal)
207+
- "stHDX invariants — verify on AAVE config change: (1)…(2)…"
208+
209+
If in doubt, delete the comment and see if the code still reads. If it does,
210+
leave it out.
211+
136212
## Versioning
137213

138214
- **SemVer** on all crates — bump `Cargo.toml` version on changes

Cargo.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,19 @@ allowed-tools: Read, Glob, Grep, WebFetch, Bash, Agent
88

99
You are the orchestrator of a parallelized security audit of a Substrate runtime and/or its pallets.
1010

11+
## Codex compatibility
12+
13+
This skill is shared across agent environments. If you are running in Codex, map the Claude-oriented tool names as follows:
14+
15+
- `Read` -> `sed`, `rg`, or other file-read commands.
16+
- `Glob` -> `rg --files` or `find`.
17+
- `Grep` -> `rg`.
18+
- `Bash` -> `exec_command`.
19+
- `WebFetch` -> the web tool, or `curl` only when shell network access is available.
20+
- `Agent` -> Codex sub-agents, following the active Codex environment policy for agent spawning. If sub-agents are unavailable or disallowed in the current environment, run a reduced local review or ask the user how to proceed.
21+
22+
The banner and four-turn orchestration apply only when the user requests an audit run. They do not apply when the user asks to inspect, update, or explain this skill.
23+
1124
## Mode Selection
1225

1326
**Exclude pattern:** skip directories `tests/`, `benchmarking/`, `mock/` and files matching `*test*.rs`, `*mock*.rs`, `*bench*.rs`.
@@ -18,7 +31,7 @@ You are the orchestrator of a parallelized security audit of a Substrate runtime
1831
**Flags:**
1932

2033
- `--pr <ref>`: Audit a specific pull request. `<ref>` can be a PR number or a full GitHub PR URL. Do NOT use `gh` — fetch PR data via `WebFetch` against the GitHub API (`https://api.github.com/repos/{owner}/{repo}/pulls/{number}/files`). Parse the response for changed `.rs` files.
21-
- `--file-output` (off by default): also write the report to a markdown file (path per `{resolved_path}/report-formatting.md`). Never write a report file unless explicitly passed.
34+
- `--file-output` (off by default): also write the report to a markdown file at the path specified by `{resolved_path}/report-formatting.md`. Never write a report file unless explicitly passed.
2235

2336
## Orchestration
2437

@@ -29,7 +42,7 @@ a. Discover in-scope `.rs` files per mode selection:
2942
- **With `--pr`:** Use `WebFetch` to call `https://api.github.com/repos/{owner}/{repo}/pulls/{number}/files` (extract owner/repo from the git remote or the provided URL). Parse the JSON response for changed `.rs` files, then split them into production vs test/bench/mock lists using the same patterns. Do NOT use `gh`.
3043
b. Glob for `**/references/attack-vectors/substrate-attack-vectors.md` — extract the `references/` directory (two levels up) as `{resolved_path}`
3144
c. Read the local `VERSION` file from the same directory as this skill
32-
d. Bash `curl -sf https://raw.githubusercontent.com/galacticcouncil/hydration-node/main/.claude/skills/hydration_cl0wdit/VERSION`
45+
d. Fetch `https://raw.githubusercontent.com/galacticcouncil/hydration-node/main/ai_skills/hydration_cl0wdit/VERSION` (`Bash curl -sf` in Claude; web tool in Codex when shell network is restricted)
3346
e. Bash `mktemp -d /tmp/audit-XXXXXX` → store as `{bundle_dir}`
3447

3548
If the remote VERSION fetch succeeds and differs from local, print `⚠ hydration_cl0wdit v{local} is outdated — a newer version is available in the repo`. If it fails, skip silently.
@@ -59,7 +72,7 @@ Every hacking agent (1–10) receives the full production codebase via `source.m
5972

6073
Print line counts for every bundle and `source.md`. Do NOT inline file content into agent prompts.
6174

62-
**Turn 3 — Spawn.** In one message, spawn all 11 agents as parallel foreground Agent calls. Prompt template (substitute real values):
75+
**Turn 3 — Spawn.** In one message, spawn all 11 agents as parallel audit workers (Claude: foreground Agent calls; Codex: sub-agents). Prompt template (substitute real values):
6376

6477
```
6578
Your bundle file is {bundle_dir}/agent-N-bundle.md (XXXX lines).

.claude/skills/hydration_cl0wdit/references/attack-vectors/hydration-attack-vectors.md renamed to ai_skills/hydration_cl0wdit/references/attack-vectors/hydration-attack-vectors.md

File renamed without changes.

.claude/skills/hydration_cl0wdit/references/attack-vectors/substrate-attack-vectors-1.md renamed to ai_skills/hydration_cl0wdit/references/attack-vectors/substrate-attack-vectors-1.md

File renamed without changes.

.claude/skills/hydration_cl0wdit/references/attack-vectors/substrate-attack-vectors-2.md renamed to ai_skills/hydration_cl0wdit/references/attack-vectors/substrate-attack-vectors-2.md

File renamed without changes.

0 commit comments

Comments
 (0)