Skip to content

Commit c324c47

Browse files
committed
feat: cosmwasm
Signed-off-by: Artur Troian <[email protected]>
1 parent 56645e3 commit c324c47

File tree

182 files changed

+4572
-2075
lines changed

Some content is hidden

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

182 files changed

+4572
-2075
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ ROOT_DIR=${AKASH_ROOT}
66
AKASH_DEVCACHE_BASE=${AKASH_ROOT}/.cache
77
AKASH_DEVCACHE=${AKASH_DEVCACHE_BASE}
88
AKASH_DEVCACHE_BIN=${AKASH_DEVCACHE}/bin
9+
AKASH_DEVCACHE_LIB=${AKASH_DEVCACHE}/lib
910
AKASH_DEVCACHE_INCLUDE=${AKASH_DEVCACHE}/include
1011
AKASH_DEVCACHE_VERSIONS=${AKASH_DEVCACHE}/versions
1112
AKASH_DEVCACHE_NODE_MODULES=${AKASH_DEVCACHE}

.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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ runs:
1414
- name: Install dependencies
1515
# Shell must explicitly specify the shell for each step. https://github.com/orgs/community/discussions/18597
1616
shell: bash
17-
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils libudev-dev
17+
run: sudo apt install -y make direnv unzip lz4 wget curl npm jq pv coreutils musl-tools libudev-dev
1818
- name: Setup npm
1919
uses: actions/setup-node@v4
2020
with:

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
uses: actions/checkout@v4
4848
- name: Setup environment
4949
uses: ./.github/actions/setup-ubuntu
50-
- run: make bins
50+
- run: BUILD_OPTIONS=static-link make bins
5151
- run: make docker-image
5252

5353
tests:

.goreleaser-docker.yaml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ 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+
- -extldflags "-L./.cache/lib -lwasmvm_muslc.x86_64 -Wl,-z,muldefs -lm -lrt -lc"
3131
- id: akash-linux-arm64
3232
binary: akash
3333
main: ./cmd/akash
@@ -43,12 +43,12 @@ builds:
4343
- "-tags={{ .Env.BUILD_TAGS }}"
4444
- -trimpath
4545
ldflags:
46-
- "{{ .Env.BUILD_VARS }}"
47-
- "{{ .Env.STRIP_FLAGS }}"
48-
- "-linkmode={{ .Env.LINKMODE }}"
49-
- -extldflags "-lc -lrt -lpthread"
46+
- "{{ .Env.BUILD_LDFLAGS }}"
47+
- -s -w
48+
- -linkmode=external
49+
- -extldflags "-L./.cache/lib -lwasmvm_muslc.aarch64 -Wl,-z,muldefs -lm -lrt -lc"
5050
dockers:
51-
- dockerfile: _build/Dockerfile.akash
51+
- dockerfile: _build/akash.Dockerfile
5252
use: buildx
5353
goarch: amd64
5454
goos: linux
@@ -63,7 +63,7 @@ dockers:
6363
- --label=org.opencontainers.image.revision={{ .FullCommit }}
6464
image_templates:
6565
- '{{ .Env.DOCKER_IMAGE }}:latest-amd64'
66-
- dockerfile: _build/Dockerfile.akash
66+
- dockerfile: _build/akash.Dockerfile
6767
use: buildx
6868
goarch: arm64
6969
goos: linux

.goreleaser-test-bins.yaml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ builds:
2020
env:
2121
- CC=o64-clang
2222
- CXX=o64-clang++
23+
- CGO_CFLAGS=-mmacosx-version-min=10.12
24+
- CGO_LDFLAGS=-L./.cache/lib -mmacosx-version-min=10.12
2325
flags:
2426
- "-mod={{ .Env.MOD }}"
25-
- "-tags={{ .Env.BUILD_TAGS }}"
27+
- "-tags={{ .Env.BUILD_TAGS }} static_wasm"
2628
- -trimpath
2729
ldflags:
28-
- "{{ .Env.BUILD_VARS }}"
29-
- "{{ .Env.STRIP_FLAGS }}"
30-
- "-linkmode={{ .Env.LINKMODE }}"
30+
- "{{ .Env.BUILD_LDFLAGS }}"
31+
- -s -w
32+
- -linkmode=external
3133
- id: akash-darwin-arm64
3234
binary: akash
3335
main: ./cmd/akash
@@ -38,14 +40,16 @@ builds:
3840
env:
3941
- CC=oa64-clang
4042
- CXX=oa64-clang++
43+
- CGO_CFLAGS=-mmacosx-version-min=10.12
44+
- CGO_LDFLAGS=-L./.cache/lib -mmacosx-version-min=10.12
4145
flags:
4246
- "-mod={{ .Env.MOD }}"
43-
- "-tags={{ .Env.BUILD_TAGS }}"
47+
- "-tags={{ .Env.BUILD_TAGS }} static_wasm"
4448
- -trimpath
4549
ldflags:
46-
- "{{ .Env.BUILD_VARS }}"
47-
- "{{ .Env.STRIP_FLAGS }}"
48-
- "-linkmode={{ .Env.LINKMODE }}"
50+
- "{{ .Env.BUILD_LDFLAGS }}"
51+
- -s -w
52+
- -linkmode=external
4953
- id: akash-linux-amd64
5054
binary: akash
5155
main: ./cmd/akash
@@ -61,10 +65,10 @@ builds:
6165
- "-tags={{ .Env.BUILD_TAGS }}"
6266
- -trimpath
6367
ldflags:
64-
- "{{ .Env.BUILD_VARS }}"
65-
- "{{ .Env.STRIP_FLAGS }}"
66-
- "-linkmode={{ .Env.LINKMODE }}"
67-
- -extldflags "-lc -lrt -lpthread"
68+
- "{{ .Env.BUILD_LDFLAGS }}"
69+
- -s -w
70+
- -linkmode=external
71+
- -extldflags "-L./.cache/lib -lwasmvm_muslc.x86_64 -Wl,-z,muldefs -lm -lrt -lc"
6872
- id: akash-linux-arm64
6973
binary: akash
7074
main: ./cmd/akash
@@ -80,10 +84,10 @@ builds:
8084
- "-tags={{ .Env.BUILD_TAGS }}"
8185
- -trimpath
8286
ldflags:
83-
- "{{ .Env.BUILD_VARS }}"
84-
- "{{ .Env.STRIP_FLAGS }}"
85-
- "-linkmode={{ .Env.LINKMODE }}"
86-
- -extldflags "-lc -lrt -lpthread"
87+
- "{{ .Env.BUILD_LDFLAGS }}"
88+
- -s -w
89+
- -linkmode=external
90+
- -extldflags "-L./.cache/lib -lwasmvm_muslc.aarch64 -Wl,-z,muldefs -lm -lrt -lc"
8791
universal_binaries:
8892
- id: akash-darwin-universal
8993
ids:

.goreleaser.yaml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ builds:
2020
env:
2121
- CC=o64-clang
2222
- CXX=o64-clang++
23+
- CGO_CFLAGS=-mmacosx-version-min=10.12
2324
flags:
2425
- "-mod={{ .Env.MOD }}"
25-
- "-tags={{ .Env.BUILD_TAGS }}"
26+
- "-tags={{ .Env.BUILD_TAGS }} static_wasm"
2627
- -trimpath
2728
ldflags:
28-
- "{{ .Env.BUILD_VARS }}"
29-
- "{{ .Env.STRIP_FLAGS }}"
30-
- "-linkmode={{ .Env.LINKMODE }}"
29+
- "{{ .Env.BUILD_LDFLAGS }}"
30+
- -s -w
31+
- -linkmode=external
32+
- -extldflags "-L./.cache/lib -mmacosx-version-min=10.12"
3133
- id: akash-darwin-arm64
3234
binary: akash
3335
main: ./cmd/akash
@@ -38,14 +40,16 @@ builds:
3840
env:
3941
- CC=oa64-clang
4042
- CXX=oa64-clang++
43+
- CGO_CFLAGS=-mmacosx-version-min=10.12
4144
flags:
4245
- "-mod={{ .Env.MOD }}"
43-
- "-tags={{ .Env.BUILD_TAGS }}"
46+
- "-tags={{ .Env.BUILD_TAGS }} static_wasm"
4447
- -trimpath
4548
ldflags:
46-
- "{{ .Env.BUILD_VARS }}"
47-
- "{{ .Env.STRIP_FLAGS }}"
48-
- "-linkmode={{ .Env.LINKMODE }}"
49+
- "{{ .Env.BUILD_LDFLAGS }}"
50+
- -s -w
51+
- -linkmode=external
52+
- -extldflags "-L./.cache/lib -mmacosx-version-min=10.12"
4953
- id: akash-linux-amd64
5054
binary: akash
5155
main: ./cmd/akash
@@ -61,10 +65,10 @@ builds:
6165
- "-tags={{ .Env.BUILD_TAGS }}"
6266
- -trimpath
6367
ldflags:
64-
- "{{ .Env.BUILD_VARS }}"
65-
- "{{ .Env.STRIP_FLAGS }}"
66-
- "-linkmode={{ .Env.LINKMODE }}"
67-
- -extldflags "-lc -lrt -lpthread"
68+
- "{{ .Env.BUILD_LDFLAGS }}"
69+
- -s -w
70+
- -linkmode=external
71+
- -extldflags "-L./.cache/lib -lwasmvm_muslc.x86_64 -Wl,-z,muldefs -lm -lrt -lc"
6872
- id: akash-linux-arm64
6973
binary: akash
7074
main: ./cmd/akash
@@ -80,10 +84,10 @@ builds:
8084
- "-tags={{ .Env.BUILD_TAGS }}"
8185
- -trimpath
8286
ldflags:
83-
- "{{ .Env.BUILD_VARS }}"
84-
- "{{ .Env.STRIP_FLAGS }}"
85-
- "-linkmode={{ .Env.LINKMODE }}"
86-
- -extldflags "-lc -lrt -lpthread"
87+
- "{{ .Env.BUILD_LDFLAGS }}"
88+
- -s -w
89+
- -linkmode=external
90+
- -extldflags "-L./.cache/lib -lwasmvm_muslc.aarch64 -Wl,-z,muldefs -lm -lrt -lc"
8791
universal_binaries:
8892
- id: akash-darwin-universal
8993
ids:
@@ -121,7 +125,7 @@ checksum:
121125
name_template: "akash_{{ .Version }}_checksums.txt"
122126

123127
dockers:
124-
- dockerfile: _build/Dockerfile.akash
128+
- dockerfile: _build/akash.Dockerfile
125129
use: buildx
126130
goarch: amd64
127131
goos: linux
@@ -138,7 +142,7 @@ dockers:
138142
- '{{ .Env.DOCKER_IMAGE }}:{{ .ShortCommit }}-amd64'
139143
- '{{ .Env.DOCKER_IMAGE }}:{{ replace .Version "+" "-" }}-amd64'
140144
- '{{ .Env.DOCKER_IMAGE }}:{{if eq .Env.STABLE "true"}}stable{{else}}latest{{end}}-amd64'
141-
- dockerfile: _build/Dockerfile.akash
145+
- dockerfile: _build/akash.Dockerfile
142146
use: buildx
143147
goarch: arm64
144148
goos: linux

Makefile

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ APP_DIR := ./app
22

33
GOBIN ?= $(shell go env GOPATH)/bin
44

5-
KIND_APP_IP ?= $(shell make -sC _run/kube kind-k8s-ip)
6-
KIND_APP_PORT ?= $(shell make -sC _run/kube app-http-port)
7-
KIND_VARS ?= KUBE_INGRESS_IP="$(KIND_APP_IP)" KUBE_INGRESS_PORT="$(KIND_APP_PORT)"
8-
95
include make/init.mk
106

117
.DEFAULT_GOAL := bins
@@ -29,39 +25,70 @@ GOMOD ?= readonly
2925
BUILD_TAGS ?= osusergo,netgo,hidraw,ledger
3026
GORELEASER_STRIP_FLAGS ?=
3127

28+
3229
ifeq ($(IS_MAINNET), true)
3330
ifeq ($(IS_PREREL), false)
3431
IS_STABLE := true
3532
endif
3633
endif
3734

35+
GOMOD ?= readonly
36+
37+
ifneq ($(UNAME_OS),Darwin)
38+
BUILD_OPTIONS ?= static-link
39+
endif
40+
41+
BUILD_TAGS := osusergo netgo ledger muslc gcc
42+
DB_BACKEND := goleveldb
43+
BUILD_FLAGS :=
44+
45+
GORELEASER_STRIP_FLAGS ?=
46+
47+
ifeq (cleveldb,$(findstring cleveldb,$(BUILD_OPTIONS)))
48+
DB_BACKEND=cleveldb
49+
else ifeq (rocksdb,$(findstring rocksdb,$(BUILD_OPTIONS)))
50+
DB_BACKEND=rocksdb
51+
else ifeq (goleveldb,$(findstring goleveldb,$(BUILD_OPTIONS)))
52+
DB_BACKEND=goleveldb
53+
endif
54+
3855
ifneq (,$(findstring cgotrace,$(BUILD_OPTIONS)))
39-
BUILD_TAGS := $(BUILD_TAGS),cgotrace
56+
BUILD_TAGS += cgotrace
4057
endif
4158

42-
GORELEASER_BUILD_VARS := \
43-
-X github.com/cosmos/cosmos-sdk/version.Name=akash \
44-
-X github.com/cosmos/cosmos-sdk/version.AppName=akash \
45-
-X github.com/cosmos/cosmos-sdk/version.BuildTags=\"$(BUILD_TAGS)\" \
46-
-X github.com/cosmos/cosmos-sdk/version.Version=$(RELEASE_TAG) \
47-
-X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_HEAD_COMMIT_LONG)
59+
build_tags := $(strip $(BUILD_TAGS))
60+
build_tags_cs := $(subst $(WHITESPACE),$(COMMA),$(build_tags))
4861

49-
ldflags = -linkmode=$(GO_LINKMODE) -X github.com/cosmos/cosmos-sdk/version.Name=akash \
62+
ldflags := -X github.com/cosmos/cosmos-sdk/version.Name=akash \
5063
-X github.com/cosmos/cosmos-sdk/version.AppName=akash \
51-
-X github.com/cosmos/cosmos-sdk/version.BuildTags="$(BUILD_TAGS)" \
64+
-X github.com/cosmos/cosmos-sdk/version.BuildTags="$(build_tags_cs)" \
5265
-X github.com/cosmos/cosmos-sdk/version.Version=$(shell git describe --tags | sed 's/^v//') \
53-
-X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_HEAD_COMMIT_LONG)
66+
-X github.com/cosmos/cosmos-sdk/version.Commit=$(GIT_HEAD_COMMIT_LONG) \
67+
-X github.com/cosmos/cosmos-sdk/types.DBBackend=$(DB_BACKEND)
68+
69+
GORELEASER_LDFLAGS := $(ldflags)
70+
71+
ldflags += -linkmode=external
72+
73+
ifeq (static-link,$(findstring static-link,$(BUILD_OPTIONS)))
74+
ldflags += -extldflags "-L$(AKASH_DEVCACHE_LIB) -lm -Wl,-z,muldefs -static"
75+
else
76+
ldflags += -extldflags "-L$(AKASH_DEVCACHE_LIB)"
77+
endif
5478

5579
# check for nostrip option
5680
ifeq (,$(findstring nostrip,$(BUILD_OPTIONS)))
57-
ldflags += -s -w
58-
GORELEASER_STRIP_FLAGS += -s -w
81+
ldflags += -s -w
82+
BUILD_FLAGS += -trimpath
5983
endif
6084

6185
ldflags += $(LDFLAGS)
6286
ldflags := $(strip $(ldflags))
6387

64-
BUILD_FLAGS := -mod=$(GOMOD) -tags='$(BUILD_TAGS)' -ldflags '$(ldflags)'
88+
GORELEASER_TAGS := $(BUILD_TAGS)
89+
GORELEASER_FLAGS := $(BUILD_FLAGS) -mod=$(GOMOD) -tags='$(build_tags)'
90+
91+
BUILD_FLAGS += -mod=$(GOMOD) -tags='$(build_tags_cs)' -ldflags '$(ldflags)'
6592

6693
.PHONY: all
6794
all: build bins
@@ -70,6 +97,7 @@ all: build bins
7097
clean: cache-clean
7198
rm -f $(BINS)
7299

100+
include make/cosmwasm.mk
73101
include make/releasing.mk
74102
include make/mod.mk
75103
include make/lint.mk

0 commit comments

Comments
 (0)