Skip to content

Commit c4d93b9

Browse files
committed
feat!: cosmwasm
Signed-off-by: Artur Troian <troian@users.noreply.github.com>
1 parent 6f5a606 commit c4d93b9

307 files changed

Lines changed: 26118 additions & 3221 deletions

File tree

Some content is hidden

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

.claude/skills/setup-env/SKILL.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
name: setup-env
3+
description: "Set up development environment by loading direnv. Must be run before any make targets (tests, builds, linting)."
4+
---
5+
# Instructions
6+
7+
Before running any make target (`make test`, `make bins`, `make lint-go`, etc.), the direnv environment **must** be loaded.
8+
Without it, make will fail with errors about `AKASH_DIRENV_SET` or `AKASH_ROOT` not being set.
9+
10+
## Steps
11+
12+
1. **Allow and load direnv** for the project root. This sets all required variables (`AKASH_ROOT`, `AKASH_DIRENV_SET`, `GOTOOLCHAIN`, `GOPATH`, `GOWORK`, cache paths) adds tool directories to `PATH`, and runs `make cache` to download build tools and wasmvm libraries:
13+
```bash
14+
direnv allow
15+
```
16+
17+
2. **Load environment into current shell**:
18+
```bash
19+
eval "$(direnv export bash 2>&1 | grep -v '^direnv:')"
20+
```
21+
22+
3. **Validate**:
23+
```bash
24+
[[ "$AKASH_DIRENV_SET" == "1" ]] && echo "direnv loaded" || echo "ERROR: direnv not loaded"
25+
```
26+
27+
## Notes
28+
29+
- If direnv fails, check that required system tools are installed: `make`, `unzip`, `wget`, `curl`, `npm`, `jq`, `readlink`, `pv`, `lz4`.
30+
- On macOS, Homebrew `make` (v4+) must be on PATH: `export PATH="$(brew --prefix)/opt/make/libexec/gnubin:$PATH"`.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
name: build-contracts
3+
description: "Builds all cosmwasm contracts"
4+
---
5+
# Instructions
6+
When requested, execute [make build-contracts] from the project root directory.

.claude/skills/vanity/SKILL.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
name: vanity
3+
description: "Registers node major version vanity URL in the sibling vanity repo"
4+
---
5+
# Instructions
6+
7+
Register the current node major version as a vanity URL in the `github.com/com/akash-network/vanity` repo.
8+
9+
## Steps
10+
11+
1. **Read the major version** from `go.mod` in this repo. Extract the version suffix from the module path (e.g. `pkg.akt.dev/node/v2``v2`). If the module path has no version suffix (v0/v1), abort — no vanity entry is needed.
12+
13+
2. **Get the current git branch name** using `git rev-parse --abbrev-ref HEAD`.
14+
15+
3. **Open `vanity/vangen.json`** and check if a repository entry with `"prefix": "node/vN"` already exists (where `vN` is the version from step 1). If it exists, inform the user and abort.
16+
17+
4. **Add a new entry** to the `repositories` array in `vanity/vangen.json`:
18+
```json
19+
{
20+
"prefix": "node/vN",
21+
"type": "git",
22+
"main": true,
23+
"url": "https://github.com/akash-network/node",
24+
"source": {
25+
"home": "https://github.com/akash-network/node",
26+
"dir": "https://github.com/akash-network/node/tree/BRANCH{/dir}",
27+
"file": "https://github.com/akash-network/node/blob/BRANCH{/dir}/{file}#L{line}"
28+
},
29+
"website": {
30+
"url": "https://github.com/akash-network/node"
31+
}
32+
}
33+
```
34+
Replace `vN` with the detected version and `BRANCH` with the detected branch name. Place the entry after the last existing `node` entry.
35+
36+
5. **Run `make vangen`** in `vanity` to regenerate HTML files.
37+
38+
6. **Verify** that `vanity/node/vN/index.html` was created and contains the correct `go-import` and `go-source` meta tags pointing to the detected branch. Also verify that existing `vanity/node/index.html` and any `vanity/node/vN/index.html` is unchanged.

.env

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
GO111MODULE=on
2+
CGO_ENABLED=1
23

34
KIND_VERSION=0.11.1
45
ROOT_DIR=${AKASH_ROOT}
56

67
AKASH_DEVCACHE_BASE=${AKASH_ROOT}/.cache
78
AKASH_DEVCACHE=${AKASH_DEVCACHE_BASE}
89
AKASH_DEVCACHE_BIN=${AKASH_DEVCACHE}/bin
10+
AKASH_DEVCACHE_LIB=${AKASH_DEVCACHE}/lib
911
AKASH_DEVCACHE_INCLUDE=${AKASH_DEVCACHE}/include
1012
AKASH_DEVCACHE_VERSIONS=${AKASH_DEVCACHE}/versions
1113
AKASH_DEVCACHE_NODE_MODULES=${AKASH_DEVCACHE}
1214
AKASH_DEVCACHE_NODE_BIN=${AKASH_DEVCACHE_NODE_MODULES}/node_modules/.bin
1315
AKASH_RUN=${AKASH_DEVCACHE}/run
1416
AKASH_RUN_BIN=${AKASH_RUN}/bin
17+
18+
CARGO_TARGET_DIR=${AKASH_DEVCACHE_BASE}/cosmwasm

.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ export GOTOOLCHAIN
9999
export GOTOOLCHAIN_SEMVER
100100
export GOWORK
101101

102-
PATH_add "$AKASH_DEVCACHE_NODE_BIN"
103102
PATH_add "$AKASH_DEVCACHE_BIN"
103+
PATH_add "$AKASH_DEVCACHE_NODE_BIN"
104104

105105
AKASH_DIRENV_SET=1
106106
AKASH=$AKASH_DEVCACHE_BIN/akash

.github/actions/setup-ubuntu/action.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ runs:
1616
shell: bash
1717
run: |
1818
sudo apt-get update
19-
sudo apt-get install -y make direnv unzip lz4 wget curl npm jq pv coreutils libudev-dev
19+
sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils musl-tools libudev-dev gcc
2020
- name: Setup npm
2121
uses: actions/setup-node@v4
2222
with:
@@ -38,3 +38,6 @@ runs:
3838
uses: HatsuneMiku3939/direnv-action@v1
3939
with:
4040
masks: ''
41+
- name: Clear stale registry cache
42+
shell: bash
43+
run: docker volume rm registry_cache || true

.github/workflows/dispatch.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,3 @@ jobs:
2020
workflow: akash
2121
ref: refs/heads/main
2222
inputs: '{ "tag" : "${{ env.RELEASE_TAG }}" }'
23-
dispatch-provider:
24-
runs-on: ubuntu-latest
25-
steps:
26-
- name: notify homebrew with new release
27-
uses: benc-uk/workflow-dispatch@v1
28-
with:
29-
token: ${{ secrets.GORELEASER_ACCESS_TOKEN }}
30-
repo: akash-network/homebrew-tap
31-
workflow: provider-services
32-
ref: refs/heads/main
33-
inputs: '{"tag": "${{ env.RELEASE_TAG }}"}'

.github/workflows/tests.yaml

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,6 @@ on:
1515
- v*
1616

1717
jobs:
18-
build-macos:
19-
runs-on: macos-latest
20-
steps:
21-
- name: Install dependencies
22-
run: |
23-
brew install bash direnv pv lz4
24-
sudo chsh -s "$(brew --prefix)/bin/bash"
25-
- name: Hook direnv to bash
26-
run: echo 'eval "$(direnv hook bash)"' >> $HOME/.bashrc
27-
- uses: actions/checkout@v4
28-
- run: git fetch --prune --unshallow
29-
- name: Detect required Go version
30-
run: |
31-
toolchain=$(./script/tools.sh gotoolchain | sed 's/go*//')
32-
echo "GOVERSION=${toolchain}" >> $GITHUB_ENV
33-
- uses: actions/setup-go@v5
34-
with:
35-
go-version: "${{ env.GOVERSION }}"
36-
check-latest: true
37-
- name: Setup direnv
38-
run: |
39-
direnv allow
40-
direnv export gha >> "$GITHUB_ENV"
41-
- run: make bins
42-
4318
build-bins:
4419
runs-on: ubuntu-latest
4520
steps:
@@ -55,9 +30,13 @@ jobs:
5530
dotnet: true # .NET runtime. Saves ~2.7GB. Total CI impact: +10s (not used in build)
5631
haskell: true # Haskell (GHC). Saves ~5GB. Total CI impact: +10s (not used in build)
5732
large-packages: true # large packages (llvm, php, mysql, etc). Saves ~5.3GB. Total CI impact: +60s (not used in build)
33+
- name: Set up QEMU
34+
uses: docker/setup-qemu-action@v3
35+
- name: Set up Docker Buildx
36+
uses: docker/setup-buildx-action@v3
5837
- name: Setup environment
5938
uses: ./.github/actions/setup-ubuntu
60-
- run: make bins
39+
- run: make build-contracts bins
6140
- run: make docker-image
6241

6342
tests:
@@ -67,14 +46,14 @@ jobs:
6746
uses: actions/checkout@v4
6847
- name: Setup environment
6948
uses: ./.github/actions/setup-ubuntu
70-
- run: make test-full
49+
- run: make build-contracts test-full
7150

7251
coverage:
7352
runs-on: ubuntu-latest
7453
steps:
7554
- uses: actions/checkout@v4
7655
- uses: ./.github/actions/setup-ubuntu
77-
- run: make test-coverage
56+
- run: make build-contracts test-coverage
7857
- uses: codecov/codecov-action@v4
7958

8059
lint-go:
@@ -106,6 +85,8 @@ jobs:
10685
uses: actions/checkout@v4
10786
- name: Setup environment
10887
uses: ./.github/actions/setup-ubuntu
88+
- name: build contracts
89+
run: make build-contracts
10990
- name: test-sim-nondeterminism
11091
run: make test-sim-nondeterminism
11192
- name: test-sim-import-export
@@ -136,8 +117,7 @@ jobs:
136117
- name: git tag
137118
run: git tag -a ${{ env.RELEASE_TAG }} -m ${{ env.RELEASE_TAG }}
138119
- name: release dry-run
139-
run: |
140-
make release
120+
run: make release
141121

142122
network-upgrade-names:
143123
runs-on: ubuntu-latest
@@ -211,7 +191,6 @@ jobs:
211191
runs-on: ubuntu-latest
212192
if: startsWith(github.event.ref, 'refs/tags/v')
213193
needs:
214-
- build-macos
215194
- build-bins
216195
- tests
217196
- coverage

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,10 @@ coverage.txt
3434
/.editorconfig
3535

3636
dev.env
37+
38+
*.test
39+
40+
# Added by cargo
41+
42+
/target
43+
/artifacts

.goreleaser-docker.yaml

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ builds:
2424
- "-tags={{ .Env.BUILD_TAGS }}"
2525
- -trimpath
2626
ldflags:
27-
- "{{ .Env.BUILD_VARS }}"
28-
- "{{ .Env.STRIP_FLAGS }}"
29-
- "-linkmode={{ .Env.LINKMODE }}"
30-
- -extldflags "-lc -lrt -lpthread"
27+
- "{{ .Env.BUILD_LDFLAGS }}"
28+
- -s -w
29+
- -linkmode=external
30+
# yamllint disable-line rule:line-length
31+
- -extldflags "-L./.cache/lib -lwasmvm_muslc.x86_64 -Wl,-z,muldefs -lm -lrt -lc"
3132
- id: akash-linux-arm64
3233
binary: akash
3334
main: ./cmd/akash
@@ -43,12 +44,14 @@ builds:
4344
- "-tags={{ .Env.BUILD_TAGS }}"
4445
- -trimpath
4546
ldflags:
46-
- "{{ .Env.BUILD_VARS }}"
47-
- "{{ .Env.STRIP_FLAGS }}"
48-
- "-linkmode={{ .Env.LINKMODE }}"
49-
- -extldflags "-lc -lrt -lpthread"
47+
- "{{ .Env.BUILD_LDFLAGS }}"
48+
- -s -w
49+
- -linkmode=external
50+
# yamllint disable-line rule:line-length
51+
- -extldflags "-L./.cache/lib -lwasmvm_muslc.aarch64 -Wl,-z,muldefs -lm -lrt -lc"
52+
5053
dockers:
51-
- dockerfile: _build/Dockerfile.akash
54+
- dockerfile: _build/akash.Dockerfile
5255
use: buildx
5356
goarch: amd64
5457
goos: linux
@@ -59,11 +62,12 @@ dockers:
5962
- --label=org.opencontainers.image.url={{.GitURL}}
6063
- --label=org.opencontainers.image.source={{.GitURL}}
6164
- --label=org.opencontainers.image.version={{ .Version }}
65+
# yamllint disable-line rule:line-length
6266
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
6367
- --label=org.opencontainers.image.revision={{ .FullCommit }}
6468
image_templates:
6569
- '{{ .Env.DOCKER_IMAGE }}:latest-amd64'
66-
- dockerfile: _build/Dockerfile.akash
70+
- dockerfile: _build/akash.Dockerfile
6771
use: buildx
6872
goarch: arm64
6973
goos: linux
@@ -74,6 +78,7 @@ dockers:
7478
- --label=org.opencontainers.image.url={{.GitURL}}
7579
- --label=org.opencontainers.image.source={{.GitURL}}
7680
- --label=org.opencontainers.image.version={{ .Version }}
81+
# yamllint disable-line rule:line-length
7782
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
7883
- --label=org.opencontainers.image.revision={{ .FullCommit }}
7984
image_templates:

0 commit comments

Comments
 (0)