Skip to content

Commit 689b7af

Browse files
authored
Merge pull request #111 from xpladev/release/v1.4.x
v1.4.0
2 parents 453df45 + 6f54c1c commit 689b7af

Some content is hidden

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

68 files changed

+541
-256
lines changed

.github/release-drafter-config.yaml

-37
This file was deleted.

.github/workflows/integration-test.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Integration test
1+
name: End-to-end test
22

33
on:
44
push:
@@ -17,17 +17,17 @@ jobs:
1717
- name: Setup network
1818
run: |
1919
mkdir ~/genesis
20-
cd integration_test && docker-compose up -d
20+
cd tests/e2e && docker-compose up -d
2121
docker ps
2222
sleep 20
2323
2424
- name: Set up Go
2525
uses: actions/setup-go@v3
2626
with:
27-
go-version: 1.18.x
27+
go-version: 1.19.x
2828

29-
- name: Integration test
30-
run: cd integration_test && go test
29+
- name: End-to-end test
30+
run: cd tests/e2e && go test
3131

3232
- name: Teardown
33-
run: cd integration_test && docker-compose down
33+
run: cd tests/e2e && docker-compose down

.github/workflows/release-drafter.yaml

-13
This file was deleted.

.github/workflows/release.yaml

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: "Release"
2+
3+
on:
4+
# can be used to re-release an existing tag
5+
workflow_dispatch:
6+
7+
push:
8+
tags:
9+
- "v[0-9]+\\.[0-9]+\\.[0-9]+"
10+
- "v[0-9]+\\.[0-9]+\\.[0-9]+-*"
11+
12+
jobs:
13+
release:
14+
env:
15+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
if: startsWith(github.ref, 'refs/tags/')
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Create release for ${{ github.ref_name }}
20+
run: gh release create ${{ github.ref_name }} --prerelease --generate-notes --repo ${{ github.repository }}
21+
22+
23+
artifacts:
24+
if: startsWith(github.ref, 'refs/tags/')
25+
needs: release
26+
runs-on: ubuntu-latest
27+
env:
28+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
strategy:
30+
matrix:
31+
build_type: ['build-release-arm64', 'build-release-amd64']
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v3
35+
- name: Set version tag
36+
run: echo "VERSION=$(echo ${{ github.ref_name }} | sed 's/^v//')" >> $GITHUB_ENV
37+
- name: Create build directory
38+
run: mkdir -p build/release
39+
- name: Build ${{ matrix.build_type }}
40+
run: make ${{ matrix.build_type }}
41+
- name: Upload the artifacts to release
42+
run: gh release upload ${{ github.ref_name }} ./build/release/*
43+
44+
calculate-checksums:
45+
needs: artifacts
46+
env:
47+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
if: startsWith(github.ref, 'refs/tags/')
49+
runs-on: ubuntu-latest
50+
steps:
51+
- name: Create build directory
52+
run: mkdir -p build/release
53+
- name: Download artifacts
54+
run: gh release download ${{ github.ref_name }} --pattern '*.tar.gz' --dir build/release --repo ${{ github.repository }}
55+
- name: Create checksums
56+
run: |
57+
cd build/release
58+
sha256sum *.tar.gz > checksum.txt
59+
- name: Display checksums
60+
run: cat build/release/checksum.txt
61+
- name: Upload the checksum to release
62+
run: gh release upload ${{github.ref_name}} build/release/checksum.txt --repo ${{github.repository}}
63+
64+
generate-json:
65+
needs: calculate-checksums
66+
env:
67+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
if: startsWith(github.ref, 'refs/tags/')
69+
runs-on: ubuntu-latest
70+
steps:
71+
- name: Install jq
72+
run: sudo apt-get update && sudo apt-get install -y jq
73+
- name: Create build directory
74+
run: mkdir -p build/release
75+
- name: Download artifacts
76+
run: gh release download ${{github.ref_name}} --pattern '*.tar.gz' --dir build/release --repo ${{github.repository}}
77+
- name: Generate JSON file
78+
run: |
79+
cd build/release
80+
binaries=()
81+
for file in *.tar.gz; do
82+
checksum=$(sha256sum $file | awk '{print $1}')
83+
url="https://github.com/${{github.repository}}/releases/download/${{github.ref_name}}/$file?checksum=sha256:$checksum"
84+
declare -A TRANSLATION_MATRIX
85+
TRANSLATION_MATRIX=( ["Linux_x86_64"]="linux/amd64" ["Linux_arm64"]="linux/arm64" ["Darwin_arm64"]="darwin/arm64" )
86+
os_architecture_translated=""
87+
for key in "${!TRANSLATION_MATRIX[@]}"; do
88+
if [[ "$file" == *"$key"* ]]; then
89+
os_architecture_translated="${TRANSLATION_MATRIX[$key]}"
90+
break
91+
fi
92+
done
93+
if [ -z "$os_architecture_translated" ]
94+
then
95+
echo "Could not translate OS and architecture information from binary name: $file"
96+
exit 1
97+
fi
98+
binaries+=(" \"$os_architecture_translated\": \"$url\"")
99+
done
100+
binaries_json=$(IFS=$',\n'; echo "${binaries[*]}")
101+
cat << EOF > binaries.json.raw
102+
{
103+
"binaries": {
104+
$binaries_json
105+
}
106+
}
107+
EOF
108+
109+
- name: Pretty-print JSON file using jq
110+
run: |
111+
cd build/release
112+
jq . < binaries.json.raw > binaries.json && rm binaries.json.raw
113+
114+
- name: Display JSON file
115+
run: cat build/release/binaries.json
116+
- name: Upload the JSON file to release
117+
run: gh release upload ${{ github.ref_name }} build/release/binaries.json --repo ${{ github.repository }}

Dockerfile

+16-20
Original file line numberDiff line numberDiff line change
@@ -8,41 +8,37 @@
88

99
### BUILD
1010
FROM golang:1.19-alpine AS build
11-
WORKDIR /localnet
1211

1312
# Create appuser.
1413
RUN adduser -D -g '' valiuser
1514
# Install required binaries
1615
RUN apk add --update --no-cache zip git make cmake build-base linux-headers musl-dev libc-dev
1716

18-
# Copy source files
19-
COPY . /localnet/
20-
21-
ENV LIBWASMVM_VERSION=v1.3.0
22-
17+
WORKDIR /
2318
RUN git clone --depth 1 https://github.com/microsoft/mimalloc; cd mimalloc; mkdir build; cd build; cmake ..; make -j$(nproc); make install
2419
ENV MIMALLOC_RESERVE_HUGE_OS_PAGES=4
2520

26-
# See https://github.com/CosmWasm/wasmvm/releases
27-
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASMVM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
28-
ADD https://github.com/CosmWasm/wasmvm/releases/download/${LIBWASMVM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
29-
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep b1610f9c8ad8bdebf5b8f819f71d238466f83521c74a2deb799078932e862722
30-
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep b4aad4480f9b4c46635b4943beedbb72c929eab1d1b9467fe3b43e6dbf617e32
3121

32-
# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc`
33-
RUN cp /lib/libwasmvm_muslc.`uname -m`.a /lib/libwasmvm_muslc.a
22+
WORKDIR /workspace
23+
# Copy source files
24+
COPY . .
25+
# Download dependencies and CosmWasm libwasmvm if found.
26+
RUN set -eux; \
27+
export ARCH=$(uname -m); \
28+
WASM_VERSION=$(go list -mod=readonly -m all | grep github.com/CosmWasm/wasmvm | awk '{print $2}'); \
29+
if [ ! -z "${WASM_VERSION}" ]; then \
30+
wget -O /lib/libwasmvm_muslc.a https://github.com/CosmWasm/wasmvm/releases/download/${WASM_VERSION}/libwasmvm_muslc.${ARCH}.a; \
31+
fi; \
32+
go mod download;
3433

3534
# Build executable
36-
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS='-linkmode=external -extldflags "-L/localnet/mimalloc/build -lmimalloc -Wl,-z,muldefs -static"' make build
35+
RUN LEDGER_ENABLED=false BUILD_TAGS=muslc LDFLAGS='-linkmode=external -extldflags "-L/mimalloc/build -lmimalloc -Wl,-z,muldefs -static"' make build
3736

3837
# --------------------------------------------------------
39-
FROM alpine:3.15 AS runtime
40-
41-
WORKDIR /opt
42-
RUN [ "mkdir", "-p", "/opt/integration_test" ]
38+
FROM alpine:3.18 AS runtime
4339

44-
COPY --from=build /localnet/build/xplad /usr/bin/xplad
45-
COPY --from=build /localnet/integration_test /opt/integration_test
40+
COPY --from=build /workspace/build/xplad /usr/bin/xplad
41+
COPY --from=build /workspace/tests/e2e /opt/tests/e2e
4642

4743
# Expose Cosmos ports
4844
EXPOSE 9090

Makefile

+47
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@ NAME := xpla
1616
APPNAME := xplad
1717
LEDGER_ENABLED ?= true
1818
TM_VERSION := $(shell go list -m github.com/tendermint/tendermint | sed 's:.* ::') # grab everything after the space in "github.com/tendermint/tendermint v0.34.7"
19+
BUILDDIR ?= $(CURDIR)/build
20+
GO_VERSION ?= "1.19"
1921

2022
# for dockerized protobuf tools
2123
DOCKER := $(shell which docker)
24+
DOCKER_COMPOSE := $(shell which docker-compose)
2225
BUF_IMAGE=bufbuild/buf@sha256:3cb1f8a4b48bd5ad8f09168f10f607ddc318af202f5c057d52a45216793d85e5 #v1.4.0
2326
DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(BUF_IMAGE)
2427

@@ -87,12 +90,56 @@ endif
8790

8891
all: install
8992

93+
.PHONY: install
9094
install: go.sum
9195
go install -mod=readonly $(BUILD_FLAGS) ./cmd/xplad
9296

97+
.PHONY: build
9398
build: go.sum
9499
go build -mod=readonly $(BUILD_FLAGS) -o build/xplad ./cmd/xplad
95100

101+
build-release: build/linux/amd64 build/linux/arm64
102+
103+
build-release-amd64: go.sum $(BUILDDIR)/
104+
$(DOCKER) buildx create --name xpla-builder || true
105+
$(DOCKER) buildx use xpla-builder
106+
$(DOCKER) buildx build \
107+
--build-arg GO_VERSION=$(GO_VERSION) \
108+
--build-arg GIT_VERSION=$(VERSION) \
109+
--build-arg GIT_COMMIT=$(COMMIT) \
110+
--build-arg GOOS=linux \
111+
--build-arg GOARCH=amd64 \
112+
--platform linux/amd64 \
113+
-t xpla:local-amd64 \
114+
--load \
115+
-f Dockerfile .
116+
$(DOCKER) rm -f xpla-builder || true
117+
$(DOCKER) create -ti --name xpla-builder xpla:local-amd64
118+
$(DOCKER) cp xpla-builder:/usr/bin/xplad $(BUILDDIR)/release/xplad
119+
tar -czvf $(BUILDDIR)/release/xpla_$(VERSION)_Linux_x86_64.tar.gz -C $(BUILDDIR)/release/ xplad
120+
rm $(BUILDDIR)/release/xplad
121+
$(DOCKER) rm -f xpla-builder
122+
123+
build-release-arm64: go.sum $(BUILDDIR)/
124+
$(DOCKER) buildx create --name xpla-builder || true
125+
$(DOCKER) buildx use xpla-builder
126+
$(DOCKER) buildx build \
127+
--build-arg GO_VERSION=$(GO_VERSION) \
128+
--build-arg GIT_VERSION=$(VERSION) \
129+
--build-arg GIT_COMMIT=$(COMMIT) \
130+
--build-arg GOOS=linux \
131+
--build-arg GOARCH=arm64 \
132+
--platform linux/arm64 \
133+
-t xpla:local-arm64 \
134+
--load \
135+
-f Dockerfile .
136+
$(DOCKER) rm -f xpla-builder || true
137+
$(DOCKER) create -ti --name xpla-builder xpla:local-arm64
138+
$(DOCKER) cp xpla-builder:/usr/bin/xplad $(BUILDDIR)/release/xplad
139+
tar -czvf $(BUILDDIR)/release/xpla_$(VERSION)_Linux_arm64.tar.gz -C $(BUILDDIR)/release/ xplad
140+
rm $(BUILDDIR)/release/xplad
141+
$(DOCKER) rm -f xpla-builder
142+
96143
.PHONY: test
97144
test: go.sum
98145
go test -short ./...

app/app.go

+10
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import (
5858
"github.com/xpladev/xpla/docs"
5959

6060
evmupgrade "github.com/xpladev/xpla/app/upgrades/evm"
61+
"github.com/xpladev/xpla/app/upgrades/v1_4"
6162
"github.com/xpladev/xpla/app/upgrades/volunteer"
6263
xplareward "github.com/xpladev/xpla/app/upgrades/xpla_reward"
6364
)
@@ -422,6 +423,12 @@ func (app *XplaApp) setUpgradeHandlers() {
422423
volunteer.CreateUpgradeHandler(app.mm, app.configurator, &app.AppKeepers),
423424
)
424425

426+
// v1_4 upgrade handler
427+
app.UpgradeKeeper.SetUpgradeHandler(
428+
v1_4.UpgradeName,
429+
v1_4.CreateUpgradeHandler(app.mm, app.configurator, app.AppKeepers.AccountKeeper, &app.AppKeepers.StakingKeeper),
430+
)
431+
425432
// When a planned update height is reached, the old binary will panic
426433
// writing on disk the height and name of the update that triggered it
427434
// This will read that value, and execute the preparations for the upgrade.
@@ -449,6 +456,9 @@ func (app *XplaApp) setUpgradeHandlers() {
449456
storeUpgrades = &storetypes.StoreUpgrades{
450457
Added: volunteer.AddModules,
451458
}
459+
case v1_4.UpgradeName:
460+
storeUpgrades = &storetypes.StoreUpgrades{}
461+
452462
}
453463

454464
if storeUpgrades != nil {

app/keepers/keepers.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ import (
4343
"github.com/cosmos/cosmos-sdk/x/upgrade"
4444
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
4545
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
46+
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4/router"
47+
routerkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4/router/keeper"
48+
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4/router/types"
4649
icacontroller "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller"
4750
icacontrollerkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/keeper"
4851
icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types"
@@ -69,9 +72,6 @@ import (
6972
"github.com/evmos/evmos/v9/x/erc20"
7073
erc20keeper "github.com/evmos/evmos/v9/x/erc20/keeper"
7174
erc20types "github.com/evmos/evmos/v9/x/erc20/types"
72-
"github.com/strangelove-ventures/packet-forward-middleware/v4/router"
73-
routerkeeper "github.com/strangelove-ventures/packet-forward-middleware/v4/router/keeper"
74-
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
7575
tmos "github.com/tendermint/tendermint/libs/os"
7676
rewardkeeper "github.com/xpladev/xpla/x/reward/keeper"
7777
rewardtypes "github.com/xpladev/xpla/x/reward/types"

app/keepers/keys.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
1818
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
1919
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
20+
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v4/router/types"
2021
icacontrollertypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/controller/types"
2122
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
2223
ibcfeetypes "github.com/cosmos/ibc-go/v4/modules/apps/29-fee/types"
@@ -25,7 +26,6 @@ import (
2526
evmtypes "github.com/evmos/ethermint/x/evm/types"
2627
feemarkettypes "github.com/evmos/ethermint/x/feemarket/types"
2728
erc20types "github.com/evmos/evmos/v9/x/erc20/types"
28-
routertypes "github.com/strangelove-ventures/packet-forward-middleware/v4/router/types"
2929
rewardtypes "github.com/xpladev/xpla/x/reward/types"
3030
volunteertypes "github.com/xpladev/xpla/x/volunteer/types"
3131
)

0 commit comments

Comments
 (0)