Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
## 🛠️ Upgrades
- Token Factory module
   - PR: #186
- wasmd fork
   - PR: #177
 - Upgrade IBC to 7.4.0
   - PR: #165

## 🔨 Fixes
- fixes for jwk utils and queries
   - PR: #185
- Fix Release GH Action build target
   - PR: #191

##  🚧 Chores
- pre-audit linting and cleanup
   - PR: #188
- Add IBC upgrade table-driven tests
   - PR: #190

**Full Changelog**: v5.0.0...v6.0.0
  • Loading branch information
2xburnt committed Dec 21, 2024
1 parent d2ac3d0 commit c5f312e
Show file tree
Hide file tree
Showing 122 changed files with 1,883 additions and 806 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aws-ecr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,4 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
target: xion-release
target: release
4 changes: 2 additions & 2 deletions .github/workflows/docker-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
target: xion-release
target: release

build-dev:
name: Build Dev Image
Expand Down Expand Up @@ -90,4 +90,4 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
target: xion-dev
target: dev
2 changes: 1 addition & 1 deletion .github/workflows/docker-scout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
target: xion-release
target: release

- name: Run Docker Scout
uses: docker/scout-action@v1
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GO_VERSION: 1.21

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v4

- name: golangci-lint-xiond
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout=10m --tests=false
61 changes: 61 additions & 0 deletions .github/workflows/heighliner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Heighliner Build

on:
push:
branches:
- main
tags:
- '*'
pull_request:
workflow_dispatch:

env:
REGISTRY: ghcr.io

jobs:
heighliner:
permissions:
contents: read
packages: write
runs-on: ubuntu-latest

steps:

- name: checkout
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: container-login
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata for docker using shell
id: shell_meta
run: |
SHA=$(git rev-parse --short HEAD)
echo "SHA=$SHA" >> $GITHUB_ENV
echo "::set-output name=sha::sha-$SHA"
- name: Build Heighliner image
id: heighliner
uses: burnt-labs/[email protected]
with:
local: true
tag: ${{ steps.shell_meta.outputs.sha }}
chain: xion
github-organization: burnt-labs
github-repo: xion
dockerfile: cosmos
build-target: make install
binaries: '["/go/bin/xiond"]'
build-env: '["BUILD_TAGS=muslc"]'

- name: Push Heighliner image
run: |
docker tag ${{ steps.heighliner.outputs.tag }} ghcr.io/burnt-labs/xion/${{ steps.heighliner.outputs.tag }}
docker push ghcr.io/burnt-labs/xion/${{ steps.heighliner.outputs.tag }}
1 change: 1 addition & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
- "WebAuthNAbstractAccount"
- "XionMinimumFeeDefault"
- "XionMinimumFeeZero"
- "XionTokenFactory"

steps:
- name: Set up Go 1.21
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
target: xion-release
target: release

- name: Copy xiond binary from linux/amd64 container
id: copy-binary-amd64
Expand Down
64 changes: 25 additions & 39 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,65 +1,51 @@
run:
tests: true
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m
timeout: 10m
tests: true

linters:
disable-all: true
enable:
- bodyclose
- depguard
- dogsled
- errcheck
- exportloopref
- goconst
- gocritic
- gofumpt
- gci
- revive
- gosec
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- nolintlint
- revive
- exportloopref
- staticcheck
- stylecheck
- typecheck
- unconvert
- unparam
- unused

issues:
exclude-rules:
- text: "simtypes"
linters:
- staticcheck
- text: "Use of weak random number generator"
linters:
- gosec
- text: "ST1003:"
linters:
- stylecheck
# FIXME: Disabled until golangci-lint updates stylecheck with this fix:
# https://github.com/dominikh/go-tools/issues/389
- text: "ST1016:"
linters:
- stylecheck
- path: "migrations"
text: "SA1019:"
linters:
- staticcheck

max-issues-per-linter: 10000
max-same-issues: 10000
- unparam
- misspell

linters-settings:
revive:
# When set to false, ignores files with "GENERATED" header, similar to golint
ignore-generated-header: true
gci:
custom-order: true
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- blank # blank imports
- dot # dot imports
- prefix(github.com/cometbft/cometbft)
- prefix(github.com/cosmos)
- prefix(cosmossdk.io)
- prefix(github.com/cosmos/cosmos-sdk)
- prefix(github.com/burnt-labs/xion)
gosec:
excludes:
- G404

nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: false
require-specific: false
issues:
max-issues-per-linter: 0
max-same-issues: 0
80 changes: 36 additions & 44 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,53 +1,45 @@
FROM golang:1.21-alpine3.18 AS go-builder
ARG arch=x86_64
# syntax=docker/dockerfile:1

ENV WASMVM_VERSION=v1.5.2
ENV WASMVM_CHECKSUM_AARCH64=e78b224c15964817a3b75a40e59882b4d0e06fd055b39514d61646689cef8c6e
ENV WASMVM_CHECKSUM_x86_64=e660a38efb2930b34ee6f6b0bb12730adccb040b6ab701b8f82f34453a426ae7
# --------------------------------------------------------
# Builder
# --------------------------------------------------------

RUN set -euxo pipefail \
&& apk add --no-cache \
ca-certificates \
FROM golang:1.21-alpine3.18 AS builder

RUN apk add --no-cache \
ca-certificates \
build-base \
linux-headers \
git

# NOTE: add these to run with LEDGER_ENABLED=true
# RUN apk add libusb-dev linux-headers

WORKDIR /code
COPY go.mod /code/
COPY go.sum /code/
RUN go mod download

COPY ./.git /code/.git
COPY ./app /code/app
COPY ./cmd /code/cmd
COPY ./contrib /code/contrib
COPY ./proto /code/proto
COPY ./x /code/x
COPY ./wasmbindings /code/wasmbindings
COPY Makefile /code/

# See https://github.com/CosmWasm/wasmvm/releases
ADD https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/${WASMVM_VERSION}/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep ${WASMVM_CHECKSUM_AARCH64}
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep ${WASMVM_CHECKSUM_x86_64}

# Copy the library you want to the final location that will be found by the linker flag `-lwasmvm_muslc`
RUN cp -vf /lib/libwasmvm_muslc.${arch}.a /lib/libwasmvm_muslc.a

# force it to use static lib (from above) not standard libgo_cosmwasm.so file
RUN set -eux \
&& make test-version \
&& LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build

RUN echo "Ensuring binary is statically linked ..." \
&& (file /code/build/xiond | grep "statically linked")
# Download go dependencies
WORKDIR /xion
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go mod download

# Cosmwasm - Download correct libwasmvm version
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \
-O /lib/libwasmvm_muslc.a && \
# verify checksum
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$(uname -m) | cut -d ' ' -f 1)

# Build xiond binary
COPY . .
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
make test-version \
&& LEDGER_ENABLED=false BUILD_TAGS=muslc LINK_STATICALLY=true make build

# --------------------------------------------------------
# Runner
# --------------------------------------------------------

FROM alpine:3.19.1 AS xion-base
COPY --from=go-builder /code/build/xiond /usr/bin/xiond
COPY --from=builder /xion/build/xiond /usr/bin/xiond

# api
EXPOSE 1317
Expand All @@ -72,15 +64,15 @@ RUN set -euxo pipefail \
tini

# --------------------------------------------------------
FROM xion-base AS xion-dev
FROM xion-base AS dev

COPY ./docker/entrypoint.sh /home/xiond/entrypoint.sh
WORKDIR /home/xiond/

CMD ["/home/xiond/entrypoint.sh"]

# --------------------------------------------------------
FROM xion-base as xion-release
FROM xion-base AS release

RUN set -euxo pipefail \
&& addgroup -S xiond \
Expand Down
18 changes: 11 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,18 +161,21 @@ test-integration-xion-min-default: compile_integration_tests
test-integration-xion-min-zero: compile_integration_tests
@XION_IMAGE=$(XION_IMAGE) ./integration_tests/integration_tests.test -test.failfast -test.v -test.run TestXionMinimumFeeZero

test-integration-xion-token-factory: compile_integration_tests
@XION_IMAGE=$(XION_IMAGE) ./integration_tests/integration_tests.test -test.failfast -test.v -test.run TestXionTokenFactory

test-integration-min:
@XION_IMAGE=$(XION_IMAGE) cd integration_tests && go test -v -run TestXionMinimumFeeDefault -mod=readonly -tags='ledger test_ledger_mock' ./...

test-integration-mig:
@XION_IMAGE=$(XION_IMAGE) cd integration_tests && go test -v -run TestAbstractAccountMigration -mod=readonly -tags='ledger test_ledger_mock' ./...

test-integration-web-auth-n-abstract-account: compile_integration_tests
@XION_IMAGE=$(XION_IMAGE) ./integration_tests/integration_tests.test -test.failfast -test.v -test.run WebAuthNAbstractAccount

test-integration-upgrade:
@XION_IMAGE=$(XION_IMAGE) cd integration_tests && go test -v -run TestXionUpgradeIBC -mod=readonly -tags='ledger test_ledger_mock' ./...

test-integration-xion-mig: compile_integration_tests
@XION_IMAGE=$(XION_IMAGE) ./integration_tests/integration_tests.test -test.failfast -test.v -test.run TestAbstractAccountMigration

test-race:
@VERSION=$(VERSION) go test -mod=readonly -race -tags='ledger test_ledger_mock' ./...

Expand Down Expand Up @@ -205,12 +208,13 @@ format-tools:

lint: format-tools
golangci-lint run --tests=false
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*_test.go" | xargs gofumpt -d
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*_test.go" -not -path "*.pb.go" -not -path "*.pb.gw.go" | xargs gofumpt -d

format: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofumpt -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/burnt-labs/xiond
golangci-lint run --fix
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -path "*.pb.go" -not -path "*.pb.gw.go" | xargs gofumpt -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -path "*.pb.go" -not -path "*.pb.gw.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" -not -path "*.pb.go" -not -path "*.pb.gw.go" | xargs goimports -w -local github.com/burnt-labs/xiond


###############################################################################
Expand Down
Loading

0 comments on commit c5f312e

Please sign in to comment.