Commit c92aa876 authored by Dev Ojha's avatar Dev Ojha
Browse files

Merge branch 'main' into dev/move_prefix_sumtree_into_osmoutils

parents 60234c91 73ab3776
Showing with 154 additions and 5 deletions
+154 -5
......@@ -7,6 +7,11 @@
# osmolabs/osmosis:X # is updated to X.Y.Z
# osmolabs/osmosis:latest # is updated to X.Y.Z
#
# On every new `vX.Y.0` tag the following images are pushed:
#
# osmolabs/osmosis-e2e-init-chain:X.Y.0 # is pushed
# osmolabs/osmosis-e2e-init-chain:X.Y # is updated to X.Y.0
# osmolabs/osmosis-e2e-init-chain:X # is updated to X.Y.0
# The same osmosisd binary is copied in different base runner images:
#
# - `osmolabs/osmosis:X.Y.Z` uses `gcr.io/distroless/static-debian11`
......@@ -33,7 +38,7 @@ env:
RUNNER_BASE_IMAGE_ALPINE: alpine:3.16
jobs:
docker:
osmosisd-images:
runs-on: self-hosted
steps:
-
......@@ -131,3 +136,51 @@ jobs:
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}-alpine
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}-alpine
${{ env.DOCKER_REPOSITORY }}:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}-alpine
e2e-init-chain-images:
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '.0')
runs-on: ubuntu-latest
steps:
-
name: Check out the repo
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Parse tag
id: tag
run: |
VERSION=$(echo ${{ github.ref_name }} | sed "s/v//")
MAJOR_VERSION=$(echo $VERSION | cut -d '.' -f 1)
MINOR_VERSION=$(echo $VERSION | cut -d '.' -f 2)
PATCH_VERSION=$(echo $VERSION | cut -d '.' -f 3)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV
echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV
echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV
-
name: Build and push
id: build_push_e2e_init_image
uses: docker/build-push-action@v3
with:
file: tests/e2e/initialization/init.Dockerfile
context: .
push: true
platforms: linux/amd64,linux/arm64
build-args: |
E2E_SCRIPT_NAME=chain
tags: |
osmolabs/osmosis-e2e-init-chain:${{ env.MAJOR_VERSION }}
osmolabs/osmosis-e2e-init-chain:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
osmolabs/osmosis-e2e-init-chain:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}
name: Test-E2E-Makefile
on:
push:
branches:
- "main"
jobs:
e2e:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
-
name: Setup Go
uses: actions/setup-go@v2.2.0
with:
go-version: 1.18
-
name: Check out repository code
uses: actions/checkout@v2
-
name: Get git diff
uses: technote-space/get-diff-action@v6.0.1
with:
PATTERNS: |
**/**.go
go.mod
go.sum
-
name: Get data from build cache
uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-docker-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-docker-${{ matrix.go-version }}-
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Build e2e init chain image
run: make docker-build-e2e-init-chain
-
name: Test e2e short
run: make test-e2e-short
\ No newline at end of file
......@@ -295,8 +295,8 @@ require (
replace (
github.com/CosmWasm/wasmd => github.com/osmosis-labs/wasmd v0.28.0-osmo-v12.1
// Our cosmos-sdk branch is: https://github.com/osmosis-labs/cosmos-sdk, current branch: v13.x. Direct commit link: https://github.com/osmosis-labs/cosmos-sdk/commit/8757a61551aa1ea993c85a523e18094ab555b1d7
// tag: https://github.com/osmosis-labs/cosmos-sdk/releases/tag/sdk-v13.0.0-rc1
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20221110061840-8757a61551aa
// tag: https://github.com/osmosis-labs/cosmos-sdk/releases/tag/sdk-v13.0.0-rc2
github.com/cosmos/cosmos-sdk => github.com/osmosis-labs/cosmos-sdk v0.45.1-0.20221118211718-545aed73e94e
// use cosmos-compatible protobufs
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
// use grpc compatible with cosmos protobufs
......
......@@ -30,6 +30,7 @@ func ApplyFuncIfNoError(ctx sdk.Context, f func(ctx sdk.Context) error) (err err
} else {
// no error, write the output of f
write()
ctx.EventManager().EmitEvents(cacheCtx.EventManager().Events())
}
return err
}
......
......@@ -1253,3 +1253,41 @@ func TestStableswapSpotPrice(t *testing.T) {
})
}
}
func TestValidateScalingFactors(t *testing.T) {
tests := map[string]struct {
scalingFactors []uint64
numAssets int
expectError bool
}{
"number of scaling factors match number of assets": {
numAssets: 4,
scalingFactors: []uint64{10, 10, 10, 10},
expectError: false,
},
"number of scaling factors and assets mismatch": {
numAssets: 3,
scalingFactors: []uint64{10, 10, 10, 10},
expectError: true,
},
"all scaling factors equal to zero": {
numAssets: 3,
scalingFactors: []uint64{0, 0, 0},
expectError: true,
},
}
for name, tc := range tests {
t.Run(name, func(t *testing.T) {
err := validateScalingFactors(tc.scalingFactors, tc.numAssets)
if tc.expectError != false {
require.Error(t, err)
return
}
require.NoError(t, err)
})
}
}
......@@ -17,6 +17,7 @@ func (k Keeper) InitGenesis(ctx sdk.Context, genState types.GenesisState) {
panic(err)
}
}
k.SetLastGaugeID(ctx, genState.LastGaugeId)
}
// ExportGenesis returns the x/incentives module's exported genesis.
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment