Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Token Factory and upgrade IBC to 7.4.0 #165

Merged
merged 69 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
a3f5d70
initial migration pass
ash-burnt Feb 13, 2024
d13e32b
original contract
ash-burnt Feb 16, 2024
dd586f0
initial pass of migration test
ash-burnt Feb 16, 2024
a29fce3
log format
ash-burnt Feb 16, 2024
7cae0ef
test in ci
ash-burnt Feb 19, 2024
e46543c
pull code IDs from params
ash-burnt Feb 19, 2024
a107335
notes
ash-burnt Feb 19, 2024
7cf7c12
add upgrade, to execute migration of codeIDs; WIP
edjroz Feb 20, 2024
6c83692
run upgrade; WIP
edjroz Feb 25, 2024
9c077fb
the second contract should be the new contract
ash-burnt Feb 26, 2024
79938fa
modify default params for aa module; WIP
edjroz Feb 27, 2024
949d4e4
Merge branch 'feat/aa-migration' of github.com:burnt-labs/xion into f…
edjroz Feb 27, 2024
c92621d
nil causes errors, try empty byte array
ash-burnt Feb 27, 2024
072de93
rebuild account contract
ash-burnt Feb 28, 2024
bd31ec6
no custom migrate type
ash-burnt Feb 28, 2024
304d863
lets try again
ash-burnt Feb 28, 2024
100b698
define migratemsg type, and then submit empty json
ash-burnt Feb 28, 2024
64d85a1
fmt type
ash-burnt Feb 28, 2024
b9c58cd
change to struct
ash-burnt Feb 28, 2024
a7c99c4
assert contract has updated codeID after upgrade
edjroz Feb 28, 2024
57c3170
merge main
ash-burnt Mar 7, 2024
984de1c
Merge branch 'feat/aa-migration' of github.com-ash:burnt-labs/xion in…
ash-burnt Mar 7, 2024
8894eac
review notes
ash-burnt Mar 7, 2024
62919ff
Feat/fork wasmd (#177)
Peartes Apr 8, 2024
d5da4cf
merge main and lint
ash-burnt Apr 8, 2024
3d64ad1
merge main
ash-burnt Apr 8, 2024
a3af2e9
incorrect func sig
ash-burnt Apr 8, 2024
8fe3753
[WIP] v7 upgrade
edjroz Apr 8, 2024
cf2905b
Merge branch 'feat/aa-migration' of github.com:burnt-labs/xion into f…
edjroz Apr 8, 2024
cbe9c6b
test migration with arbitrary number of accounts
edjroz Apr 8, 2024
ef3f380
consildate v7 into v6
edjroz Apr 9, 2024
9f07daa
Rework existing upgrade test to leverage prebuilt heighliner packages
froch Apr 3, 2024
4bf3430
Update dependencies
froch Apr 3, 2024
b637510
Rebuild xiond with private ibc-go
froch Apr 3, 2024
28d8921
Checkpoint 038_039
froch Apr 5, 2024
2b0628a
Add test docstring
froch Apr 5, 2024
8204151
Setup interchain with Xion <=> Osmosis relaying
froch Apr 5, 2024
10de0ee
Add Xion <=> Axelar to interchain relaying
froch Apr 5, 2024
105d877
Kidnap IBC conformance tests
froch Apr 5, 2024
62b620b
Use ibc.GetTransferChannel between srcChainID and dstChainID
froch Apr 6, 2024
3aec164
Remove renamed upgrade test
froch Apr 9, 2024
b15e3d1
Remove mention of IBC in existing upgrade test; it doesn't test it
froch Apr 9, 2024
bbc71be
Rename TestXionUpgradeIBC for genericity
froch Apr 9, 2024
e7b1020
Convert IBC test to table-driven; testing only one interchain pair
froch Apr 9, 2024
3816ce7
Restrict IBC conformance to a single test case for now
froch Apr 10, 2024
50247ca
Add GH Action for standalone Heighliner build
froch Apr 10, 2024
a44fe77
Upgrade ibc-go to v7.4.0
froch Apr 10, 2024
872993e
Tag standalone heighliner build with git SHA instead of latest
froch Apr 10, 2024
f360fde
Remove v7 upgrade because it's not being used
froch Apr 10, 2024
2ff8334
Add Software Upgrade govprop for IBC using prebuilt heighliners
froch Apr 10, 2024
0e1ee54
Test IBC conformance after Software Upgrade govprop passes
froch Apr 10, 2024
380b01b
Fix upgadeTest
froch Apr 10, 2024
c777e6e
Add docstring
froch Apr 10, 2024
7eba16a
Fix Docker Scout GH Action target
froch Apr 10, 2024
bb510e0
Add `--tests false` to golangci GH Action
froch Apr 10, 2024
0772270
Fix Docker image builds for ECR and Dockerhub
froch Apr 10, 2024
312ded1
Parameterize AA wasm codeID according to chainID
froch Apr 11, 2024
239a8b9
Ensure to close the semaphore channel
froch Apr 11, 2024
ee6caf8
Add atomic counter for final migrated contracts tally
froch Apr 11, 2024
267cd3f
Set chainID to xion-integration-1 for integration tests
froch Apr 11, 2024
50b8ef3
Remove extra Dockerfile steps
froch Apr 11, 2024
669a686
Tweak logging
froch Apr 11, 2024
8593f58
Add IBC upgrade table-driven tests and concurrent migrations (#190)
froch Apr 15, 2024
7a842b3
Add paramchange proposal
froch Apr 15, 2024
7ece4ee
Update go.mod for interchaintests fork
froch Apr 15, 2024
8e3d0f1
Remove a branch listener for Heighliner GH Action
froch Apr 15, 2024
275c474
Remove Xion from v6 upgrade
froch Apr 15, 2024
73c7322
Remove AA paramChange govprop from IBC test
froch Apr 15, 2024
8f15878
Rename xion-integration-1 to xion-1
froch Apr 16, 2024
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
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
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
uses: golangci/golangci-lint-action@v4
with:
version: latest
args: --timeout 10m
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 }}
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
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,15 @@ test-integration-xion-token-factory: compile_integration_tests
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
26 changes: 16 additions & 10 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -617,14 +617,6 @@ func NewWasmApp(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.XionKeeper = xionkeeper.NewKeeper(
appCodec,
keys[xiontypes.StoreKey],
app.GetSubspace(xiontypes.ModuleName),
app.BankKeeper,
app.AccountKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String())

// Configure the hooks keeper
hooksKeeper := ibchookskeeper.NewKeeper(
keys[ibchookstypes.StoreKey],
Expand Down Expand Up @@ -742,6 +734,20 @@ func NewWasmApp(
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
)

app.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(app.WasmKeeper)
app.Ics20WasmHooks.ContractKeeper = &app.WasmKeeper

app.XionKeeper = xionkeeper.NewKeeper(
appCodec,
keys[xiontypes.StoreKey],
app.GetSubspace(xiontypes.ModuleName),
app.BankKeeper,
app.AccountKeeper,
app.ContractKeeper,
app.WasmKeeper,
app.AbstractAccountKeeper,
authtypes.NewModuleAddress(govtypes.ModuleName).String())

// Set legacy router for backwards compatibility with gov v1beta1
app.GovKeeper.SetLegacyRouter(govRouter)

Expand Down Expand Up @@ -821,11 +827,11 @@ func NewWasmApp(
nftmodule.NewAppModule(appCodec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),
tokenfactory.NewAppModule(app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(tokenfactorytypes.ModuleName)),
xion.NewAppModule(app.XionKeeper),
jwk.NewAppModule(appCodec, app.JwkKeeper, app.GetSubspace(jwktypes.ModuleName)),
globalfee.NewAppModule(app.GetSubspace(globalfee.ModuleName)),
wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
aa.NewAppModule(app.AbstractAccountKeeper),
xion.NewAppModule(app.XionKeeper),
ibc.NewAppModule(app.IBCKeeper),
transfer.NewAppModule(app.TransferKeeper),
ibcfee.NewAppModule(app.IBCFeeKeeper),
Expand All @@ -851,7 +857,6 @@ func NewWasmApp(
vestingtypes.ModuleName, consensusparamtypes.ModuleName,
tokenfactorytypes.ModuleName,
globalfee.ModuleName,
xiontypes.ModuleName,
jwktypes.ModuleName,
// additional non simd modules
ibctransfertypes.ModuleName,
Expand All @@ -861,6 +866,7 @@ func NewWasmApp(
ibcfeetypes.ModuleName,
wasmtypes.ModuleName,
aatypes.ModuleName,
xiontypes.ModuleName,
ibchookstypes.ModuleName,
packetforwardtypes.ModuleName,
)
Expand Down
8 changes: 1 addition & 7 deletions app/upgrades/v6/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import (
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

/*
const NewDenomCreationGasConsume uint64 = 2_000_000
var DenomCreationFee = sdk.NewCoins(sdk.NewInt64Coin(`uxion`, 50_000_000))
*/

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
Expand All @@ -24,7 +18,7 @@ func CreateUpgradeHandler(
return vm, err
}

ctx.Logger().Info("Upgrade complete")
ctx.Logger().Info("Upgrade v6 complete")
return vm, err
}
}
13 changes: 4 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,25 @@ version: "3.9"
services:

testnet:
image: burnt/xion:develop
build:
context: .
dockerfile: Dockerfile
target: xion-dev
target: dev
platform: linux/amd64
volumes:
- testnet-data:/xion/
ports:
- "1317:1317"
- "26656:26656"
- "26657:26657"

release:
image: burnt/xion:release
build:
context: .
dockerfile: Dockerfile
target: xion-release
target: release
platform: linux/amd64
volumes:
- testnet-data:/xion/data
ports:
- "1317:1317"
- "26656:26656"
- "26657:26657"

volumes:
testnet-data:
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/gogoproto v1.4.10
github.com/cosmos/iavl v0.20.1 // indirect
github.com/cosmos/ibc-go/v7 v7.3.1
github.com/cosmos/ibc-go/v7 v7.4.0
github.com/cosmos/ics23/go v0.10.0 // indirect
github.com/docker/distribution v2.8.2+incompatible // indirect
github.com/dvsekhvalnov/jose2go v1.6.0
Expand All @@ -20,7 +20,6 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.16.0
github.com/rakyll/statik v0.1.7 // indirect
github.com/snikch/goodman v0.0.0-20171125024755-10e37e294daa
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5 // indirect
Expand Down Expand Up @@ -57,13 +56,11 @@ require (
)

require (
github.com/cosmos/ibc-apps/modules/async-icq/v7 v7.0.0 // indirect
github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-0.20231213092633-b306e7a706e1 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/goccy/go-json v0.10.2 // indirect
github.com/lestrrat-go/backoff/v2 v2.0.8 // indirect
github.com/skip-mev/pob v1.0.4 // indirect
github.com/opencontainers/runc v1.1.5 // indirect
go.opentelemetry.io/otel v1.19.0 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 // indirect
Expand Down Expand Up @@ -218,6 +215,9 @@ require (

replace (
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0

github.com/CosmWasm/wasmd => github.com/burnt-labs/wasmd v0.45.1-0.20240312170141-3dfd94af17a8

github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7 => github.com/burnt-labs/ibc-apps/middleware/packet-forward-middleware/v7 v7.1.3-0.20240308232808-736bd51c54ad
// dgrijalva/jwt-go is deprecated and doesn't receive security updates.
// See: https://github.com/cosmos/cosmos-sdk/issues/13134
Expand Down
Loading
Loading