Skip to content
Merged
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
65 changes: 65 additions & 0 deletions .agents/skills/guidelines/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: guidelines
description: Behavioral guidelines to reduce common LLM coding mistakes. Use when writing, reviewing, or refactoring code to avoid overcomplication, make surgical changes, surface assumptions, and define verifiable success criteria.
license: MIT
---

# Guidelines

**Tradeoff:** These guidelines bias toward caution over speed. For trivial tasks, use judgment.

## 1. Think Before Coding

**Don't assume. Don't hide confusion. Surface tradeoffs.**

Before implementing:
- State your assumptions explicitly. If uncertain, ask.
- If multiple interpretations exist, present them - don't pick silently.
- If a simpler approach exists, say so. Push back when warranted.
- If something is unclear, stop. Name what's confusing. Ask.

## 2. Simplicity First

**Minimum code that solves the problem. Nothing speculative.**

- No features beyond what was asked.
- No abstractions for single-use code.
- No "flexibility" or "configurability" that wasn't requested.
- No error handling for impossible scenarios.
- If you write 200 lines and it could be 50, rewrite it.

Ask yourself: "Would a senior engineer say this is overcomplicated?" If yes, simplify.

## 3. Surgical Changes

**Touch only what you must. Clean up only your own mess.**

When editing existing code:
- Don't "improve" adjacent code, comments, or formatting.
- Don't refactor things that aren't broken.
- Match existing style, even if you'd do it differently.
- If you notice unrelated dead code, mention it - don't delete it.

When your changes create orphans:
- Remove imports/variables/functions that YOUR changes made unused.
- Don't remove pre-existing dead code unless asked.

The test: Every changed line should trace directly to the user's request.

## 4. Goal-Driven Execution

**Define success criteria. Loop until verified.**

Transform tasks into verifiable goals:
- "Add validation" → "Write tests for invalid inputs, then make them pass"
- "Fix the bug" → "Write a test that reproduces it, then make it pass"
- "Refactor X" → "Ensure tests pass before and after"

For multi-step tasks, state a brief plan:
```
1. [Step] → verify: [check]
2. [Step] → verify: [check]
3. [Step] → verify: [check]
```
Comment on lines +59 to +63
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add a language tag to the fenced code block (markdownlint MD040).

Line 59 opens a fenced block without a language identifier, which will fail common markdown linting rules.

Suggested fix
-```
+```text
 1. [Step] → verify: [check]
 2. [Step] → verify: [check]
 3. [Step] → verify: [check]
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>

[warning] 59-59: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @.agents/skills/guidelines/SKILL.md around lines 59 - 63, The fenced code
block that currently starts with (the three-backtick block showing the numbered verification steps) lacks a language tag and triggers markdownlint MD040; fix it by adding a language identifier (e.g., "text") immediately after the opening backticks so the block becomestext, ensuring the code fence is
tagged without changing the block contents.


</details>

<!-- fingerprinting:phantom:triton:hawk:753d3d17-a651-49d5-85d3-9cb9da9cac21 -->

<!-- d98c2f50 -->

<!-- This is an auto-generated comment by CodeRabbit -->


Strong success criteria let you loop independently. Weak criteria ("make it work") require constant clarification.
81 changes: 81 additions & 0 deletions .agents/skills/upgrade-changelog/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: upgrade-changelog
description: "Generates CHANGELOG.md entries for upgrade versions found in upgrades/software/ by parsing init.go and upgrade.go"
---
# Instructions

Generate changelog entries in `upgrades/CHANGELOG.md` for any upgrade version under `upgrades/software/` that doesn't already have an entry.

## Steps

1. **Find semver directories** — list all directories under `upgrades/software/` whose names match `v<major>.<minor>.<patch>` (e.g., `v2.0.0`, `v1.0.0`).

2. **Read `upgrades/CHANGELOG.md`** — identify which versions already have entries by scanning for `##### vX.Y.Z` headings. If a version already has a heading, skip it entirely.

3. **For each new version** (no existing heading), gather data from two files:

### 3a. Parse `upgrades/software/<version>/init.go`

Find all `utypes.RegisterMigration(...)` calls. Each call has the form:
```go
utypes.RegisterMigration(moduleName, version, handlerFn)
```
- `moduleName` is a Go constant (e.g., `dv1.ModuleName`). Resolve it:
1. Find the import alias (e.g., `dv1 "pkg.akt.dev/go/node/deployment/v1"`)
2. Search the imported package for `ModuleName` constant definition to get the actual string value
- `version` is a `uint64` — this is the **from** version. The **to** version is `version + 1`.
- Record each migration as: `moduleName version -> version+1`

### 3b. Parse `upgrades/software/<version>/upgrade.go`

Find the `StoreLoader()` method. It returns a `*storetypes.StoreUpgrades` struct with optional fields:
- `Added: []string{...}` — new stores
- `Renamed: []storetypes.StoreRename{...}` — renamed stores
- `Deleted: []string{...}` — removed stores

If `StoreLoader()` returns `nil`, there are no store changes.

For each store key constant (e.g., `epochstypes.StoreKey`, `ttypes.ModuleName`):
1. Find the import alias in the file
2. Search the imported package for the constant definition to get the actual string value

4. **Insert the new entry** in `upgrades/CHANGELOG.md` immediately after the line:
```
Add new upgrades after this line based on the template above
```
Comment thread
troian marked this conversation as resolved.
followed by `-----`.

Use this format (newest entries go first, right after the delimiter):

```markdown

##### vX.Y.Z

###### Description

- Stores
- added
- `storeName`: brief description if available
- renamed
- `oldName` -> `newName`
- deleted
- `storeName`: brief description if available

- Migrations
- moduleName `from -> to`
```

**Omission rules** (match existing CHANGELOG style):
- Omit the entire `Stores` section if there are no added, renamed, or deleted stores
- Omit `added`/`renamed`/`deleted` subsections individually if empty
- Omit the entire `Migrations` section if there are no migrations
- Always include the `###### Description` heading (leave it for the user to fill in)

5. **Report results** — list each version processed and what was added. For skipped versions (already in CHANGELOG), mention they were skipped.

## Important notes

- Store key constants may be named `StoreKey` or `ModuleName` — both are used as store identifiers. Resolve whichever constant appears in the code.
- When resolving Go constants from external packages, search under the Go module cache or use `go doc` if needed. The packages typically follow the pattern `pkg.akt.dev/go/node/<module>/<version>`.
- If a constant cannot be resolved, use the raw Go expression as a placeholder (e.g., `` `epochstypes.StoreKey` ``) and warn the user.
- Multiple versions may need entries — process them all in one run, inserting newest first after the delimiter.
20 changes: 20 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ import (
transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
ibchost "github.com/cosmos/ibc-go/v10/modules/core/exported"

gogogrpc "github.com/cosmos/gogoproto/grpc"

cflags "pkg.akt.dev/go/cli/flags"
aclient "pkg.akt.dev/go/node/client"
epochstypes "pkg.akt.dev/go/node/epochs/v1beta1"
"pkg.akt.dev/go/sdkutil"

Expand Down Expand Up @@ -532,6 +535,11 @@ func (app *AkashApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIC
// Register node gRPC service for grpc-gateway.
nodeservice.RegisterGRPCGatewayRoutes(cctx, apiSvr.GRPCGatewayRouter)

// Register Akash Discovery gRPC-Gateway route for REST access at GET /akash/discovery/v1/info.
if err := aclient.RegisterDiscoveryHandlerServer(cctx.CmdContext, apiSvr.GRPCGatewayRouter, aclient.NewDiscoveryServer(aclient.GetRegistry())); err != nil {
panic(fmt.Errorf("failed to register discovery gRPC-Gateway routes: %w", err))
}

// register swagger API from root so that other applications can override easily
if apiConfig.Swagger {
RegisterSwaggerAPI(cctx, apiSvr.Router)
Expand All @@ -557,6 +565,18 @@ func (app *AkashApp) RegisterNodeService(cctx client.Context, cfg config.Config)
nodeservice.RegisterNodeService(cctx, app.GRPCQueryRouter(), cfg)
}

// RegisterGRPCServerWithSkipCheckHeader registers all gRPC services including
// the Akash Discovery service for version negotiation.
func (app *AkashApp) RegisterGRPCServerWithSkipCheckHeader(server gogogrpc.Server, skipCheckHeader bool) {
// Register all standard Cosmos SDK module query services.
app.BaseApp.RegisterGRPCServerWithSkipCheckHeader(server, skipCheckHeader)

// Register Akash Discovery service directly on the gRPC server.
// This enables version discovery for clients via gRPC at akash.discovery.v1.Discovery/GetInfo
// and via REST through gRPC-Gateway at GET /akash/discovery/v1/info.
aclient.RegisterDiscoveryService(server, aclient.GetRegistry())
}

// RegisterSwaggerAPI registers swagger route with API Server
func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) {
statikFS, err := fs.New()
Expand Down
11 changes: 11 additions & 0 deletions cmd/akash/cmd/app_creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import (
sdkserver "github.com/cosmos/cosmos-sdk/server"
servertypes "github.com/cosmos/cosmos-sdk/server/types"

"github.com/cosmos/cosmos-sdk/version"

cflags "pkg.akt.dev/go/cli/flags"
aclient "pkg.akt.dev/go/node/client"
"pkg.akt.dev/go/sdkutil"

akash "pkg.akt.dev/node/v2/app"
Expand Down Expand Up @@ -81,6 +84,14 @@ func (a appCreator) newApp(
cast.ToUint32(appOpts.Get(cflags.FlagStateSyncSnapshotKeepRecent)),
)

// Configure version discovery registry with chain metadata.
// This is used by the CometBFT JSON-RPC "akash" route (automatic via init())
// and the gRPC Discovery service (registered in AkashApp.RegisterGRPCServerWithSkipCheckHeader).
aclient.SetRegistry(aclient.DefaultRegistry(
aclient.WithChainID(chainID),
aclient.WithNodeVersion(version.Version),
))

baseAppOptions := []func(*baseapp.BaseApp){
baseapp.SetChainID(chainID),
baseapp.SetPruning(pruningOpts),
Expand Down
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module pkg.akt.dev/node/v2

go 1.25.9
go 1.26.2

require (
cosmossdk.io/api v0.9.2
Expand Down Expand Up @@ -35,7 +35,7 @@ require (
github.com/prometheus/client_golang v1.23.2
github.com/rakyll/statik v0.1.7
github.com/regen-network/cosmos-proto v0.3.1
github.com/rs/zerolog v1.34.0
github.com/rs/zerolog v1.35.0
github.com/spf13/cast v1.10.0
github.com/spf13/cobra v1.10.2
github.com/spf13/pflag v1.0.10
Expand All @@ -48,7 +48,7 @@ require (
google.golang.org/grpc v1.76.0
gopkg.in/yaml.v3 v3.0.1
gotest.tools/v3 v3.5.2
pkg.akt.dev/go v0.2.9
pkg.akt.dev/go v0.2.10
pkg.akt.dev/go/cli v0.2.2
pkg.akt.dev/go/sdl v0.2.0
)
Expand All @@ -59,12 +59,12 @@ replace (
// use cosmos fork of keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0

github.com/bytedance/sonic => github.com/bytedance/sonic v1.14.2
github.com/bytedance/sonic => github.com/bytedance/sonic v1.15.0

// use akash fork of cometbft
github.com/cometbft/cometbft => github.com/akash-network/cometbft v0.38.21-akash.1
// use akash fork of cosmos sdk
github.com/cosmos/cosmos-sdk => github.com/akash-network/cosmos-sdk v0.53.6-akash.1
github.com/cosmos/cosmos-sdk => github.com/akash-network/cosmos-sdk v0.53.7-akash.1

github.com/cosmos/gogoproto => github.com/akash-network/gogoproto v1.7.0-akash.2

Expand Down Expand Up @@ -118,8 +118,8 @@ require (
github.com/bits-and-blooms/bitset v1.24.3 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/bytedance/gopkg v0.1.3 // indirect
github.com/bytedance/sonic v1.14.2 // indirect
github.com/bytedance/sonic/loader v0.4.0 // indirect
github.com/bytedance/sonic v1.15.0 // indirect
github.com/bytedance/sonic/loader v0.5.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
Expand Down Expand Up @@ -210,7 +210,7 @@ require (
github.com/jmhodges/levigo v1.0.1-0.20191019112844-b572e7f4cdac // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.9 // indirect
Expand Down Expand Up @@ -262,25 +262,25 @@ require (
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v1.0.1 // indirect
go.etcd.io/bbolt v1.4.0 // indirect
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/detectors/gcp v1.36.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.62.0 // indirect
go.opentelemetry.io/otel v1.37.0 // indirect
go.opentelemetry.io/otel/metric v1.37.0 // indirect
go.opentelemetry.io/otel v1.41.0 // indirect
go.opentelemetry.io/otel/metric v1.41.0 // indirect
go.opentelemetry.io/otel/sdk v1.37.0 // indirect
Comment thread
troian marked this conversation as resolved.
go.opentelemetry.io/otel/sdk/metric v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.37.0 // indirect
go.opentelemetry.io/otel/trace v1.41.0 // indirect
go.uber.org/mock v0.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
go.yaml.in/yaml/v2 v2.4.2 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/arch v0.17.0 // indirect
golang.org/x/arch v0.24.0 // indirect
golang.org/x/crypto v0.45.0 // indirect
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sys v0.38.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/term v0.37.0 // indirect
golang.org/x/text v0.31.0 // indirect
golang.org/x/time v0.12.0 // indirect
Expand Down
Loading
Loading