Skip to content

Commit

Permalink
Merge branch 'main' into faddat/tm-db-master
Browse files Browse the repository at this point in the history
  • Loading branch information
ValarDragon authored May 28, 2022
2 parents 5916414 + e9062fc commit 045c622
Show file tree
Hide file tree
Showing 118 changed files with 5,949 additions and 2,521 deletions.
62 changes: 0 additions & 62 deletions .github/workflows/codeql-analysis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ jobs:
file: Dockerfile
context: .
push: true
platforms: linux/amd64
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}

-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
18 changes: 18 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ jobs:
**/**.go
go.mod
go.sum
- name: Get data from build cache
uses: actions/cache@v2
with:
# In order:
# * Module download cache
# * Linter cache (Linux)
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-linter-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-linter-${{ matrix.go-version }}-
- name: Run golangci-lint
run: make lint
if: env.GIT_DIFF
Expand Down
105 changes: 84 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,128 @@ name: Tests & Code Coverage

on:
pull_request:
push:
branches:
- "**"
push:
branches:
- "main"
- "v[0-9]**"
workflow_dispatch:

jobs:
should_run_go_test:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
-
id: skip_check
uses: fkirc/skip-duplicate-actions@master
with:
cancel_others: "true" # workflow-runs from outdated commits will be cancelled.
concurrent_skipping: "same_content"
skip_after_successful_duplicate: "true"
paths: '["**/*.go", "**/*.mod", "**/*.sum"]'
do_not_skip: '["pull_request", "workflow_dispatch", "schedule"]'
- name: Skipping test
-
name: Skipping test
run: echo Should I skip tests? ${{ steps.skip_check.outputs.should_skip }}

go_test:
needs: should_run_go_test
if: ${{ needs.should_run_test.outputs.should_skip != 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out repository code
-
name: Check out repository code
uses: actions/checkout@v2
- name: Setup Golang
-
name: Setup Golang
uses: actions/[email protected]
with:
go-version: 1.18
- name: Display go version
-
name: Display go version
run: go version
- name: Run all tests
run: |
make test-cover
- name: Codecov
-
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-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
-
name: Run all tests
run: make test-cover
-
name: Codecov
uses: codecov/[email protected]

e2e_test:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/[email protected]
-
name: Setup Go
uses: actions/[email protected]
with:
go-version: 1.18
- uses: actions/checkout@v2
- uses: technote-space/[email protected]
-
name: Check out repository code
uses: actions/checkout@v2
-
name: Get git diff
uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Build Docker Image
run: |
make docker-build-debug
if: env.GIT_DIFF
- name: Test E2E and Upgrade
run: |
make test-e2e
if: env.GIT_DIFF
-
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 image
uses: docker/build-push-action@v3
with:
load: true
context: .
tags: osmosis:debug
# Use experimental Cache backend API: https://github.com/docker/build-push-action/blob/master/docs/advanced/cache.md#cache-backend-api
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
BASE_IMG_TAG=debug
-
name: Test e2e and Upgrade
run: make test-e2e
1 change: 1 addition & 0 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Default state for all rules
default: true
MD024: false
MD003:
# Heading style
style: "atx"
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## Unreleased

* [#1570](https://github.com/osmosis-labs/osmosis/pull/1570) upgrade sdk with app version fix for state-sync
* [#1554](https://github.com/osmosis-labs/osmosis/pull/1554) local dev environment
* [#1535](https://github.com/osmosis-labs/osmosis/pull/1535) upgrade wasmd to v0.27.0.rc3-osmo and ibc-go to v3
* [#1435] `x/tokenfactory` create denom fee for spam resistance
* [#1429] solver for multi-asset CFMM
* [#1253] Add lockup duration edit method
* [#1253] Add lockup duration edit method
* [#1312] Stableswap: Createpool logic
* [#1230] Stableswap CFMM equations
* [#1541] Add arm64 support to Docker

## [v8.0.0 - Emergency proposals upgrade](https://github.com/osmosis-labs/osmosis/releases/tag/v8.0.0)

Expand Down
32 changes: 20 additions & 12 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,46 @@
# syntax=docker/dockerfile:1

ARG BASE_IMG_TAG=nonroot
ARG BASE_IMG_TAG=nonroot

# --------------------------------------------------------
# Build
# --------------------------------------------------------

## Build Image
FROM golang:1.18.2-alpine3.15 as build

RUN set -eux; apk add --no-cache ca-certificates build-base;

RUN apk add git

# needed by github.com/zondax/hid
# Needed by github.com/zondax/hid
RUN apk add linux-headers

WORKDIR /osmosis
COPY . /osmosis

# From https://github.com/CosmWasm/wasmd/blob/master/Dockerfile
# For more details see https://github.com/CosmWasm/wasmvm#builds-of-libwasmvm
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.a
RUN sha256sum /lib/libwasmvm_muslc.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479
# CosmWasm: see https://github.com/CosmWasm/wasmvm/releases
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.aarch64.a /lib/libwasmvm_muslc.aarch64.a
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.0.0/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.x86_64.a
RUN sha256sum /lib/libwasmvm_muslc.aarch64.a | grep 7d2239e9f25e96d0d4daba982ce92367aacf0cbd95d2facb8442268f2b1cc1fc
RUN sha256sum /lib/libwasmvm_muslc.x86_64.a | grep f6282df732a13dec836cda1f399dd874b1e3163504dbd9607c6af915b2740479

# CosmWasm: copy the right library according to architecture. The final location will be found by the linker flag `-lwasmvm_muslc`
RUN cp /lib/libwasmvm_muslc.$(uname -m).a /lib/libwasmvm_muslc.a

RUN BUILD_TAGS=muslc LINK_STATICALLY=true make build

## Deploy image
# --------------------------------------------------------
# Runner
# --------------------------------------------------------

FROM gcr.io/distroless/base-debian11:${BASE_IMG_TAG}

COPY --from=build /osmosis/build/osmosisd /bin/osmosisd

ENV HOME /osmosis
WORKDIR $HOME

EXPOSE 26656
EXPOSE 26656
EXPOSE 26657
EXPOSE 1317

ENTRYPOINT ["osmosisd"]
CMD [ "start" ]
CMD [ "start" ]
11 changes: 11 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,17 @@ format:
### Localnet ###
###############################################################################

localnet-keys:
. tests/localosmosis/keys.sh

localnet-build:
@docker build -t local:osmosis -f tests/localosmosis/Dockerfile .

localnet-start:
@docker-compose -f tests/localosmosis/docker-compose.yml up

localnet-remove:
@docker-compose -f tests/localosmosis/docker-compose.yml down

.PHONY: all build-linux install format lint \
go-mod-cache draw-deps clean build build-contract-tests-hooks \
Expand Down
14 changes: 8 additions & 6 deletions ante/sendblock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,21 @@ func TestSendBlockDecorator(t *testing.T) {
to sdk.AccAddress
expectPass bool
}{
{sdk.AccAddress("honest-sender"), sdk.AccAddress("honest-address"), true},
{sdk.AccAddress("honest-sender"), sdk.AccAddress("recovery-address"), true},
{sdk.AccAddress("malicious-sender"), sdk.AccAddress("recovery-address"), true},
{sdk.AccAddress("malicious-sender"), sdk.AccAddress("random-address"), false},
{sdk.AccAddress("honest-sender_______"), sdk.AccAddress("honest-address"), true},
{sdk.AccAddress("honest-sender_______"), sdk.AccAddress("recovery-address"), true},
{sdk.AccAddress("malicious-sender____"), sdk.AccAddress("recovery-address"), true},
{sdk.AccAddress("malicious-sender____"), sdk.AccAddress("random-address"), false},
}

permittedOnlySendTo := map[string]string{
sdk.AccAddress("malicious-sender").String(): sdk.AccAddress("recovery-address").String(),
sdk.AccAddress("malicious-sender____").String(): sdk.AccAddress("recovery-address").String(),
}
decorator := NewSendBlockDecorator(SendBlockOptions{permittedOnlySendTo})

for _, testCase := range testCases {
err := decorator.CheckIfBlocked([]sdk.Msg{bank.NewMsgSend(testCase.from, testCase.to, sdk.NewCoins(sdk.NewInt64Coin("test", 1)))})
err := decorator.CheckIfBlocked(
[]sdk.Msg{
bank.NewMsgSend(testCase.from, testCase.to, sdk.NewCoins(sdk.NewInt64Coin("test", 1)))})
if testCase.expectPass {
require.NoError(t, err)
} else {
Expand Down
4 changes: 2 additions & 2 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/auth/signing"

osmoante "github.com/osmosis-labs/osmosis/v7/ante"
v9 "github.com/osmosis-labs/osmosis/v7/app/upgrades/v9"

v8 "github.com/osmosis-labs/osmosis/v7/app/upgrades/v8"
txfeeskeeper "github.com/osmosis-labs/osmosis/v7/x/txfees/keeper"
txfeestypes "github.com/osmosis-labs/osmosis/v7/x/txfees/types"
)
Expand Down Expand Up @@ -42,7 +42,7 @@ func NewAnteHandler(
wasmkeeper.NewLimitSimulationGasDecorator(wasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(txCounterStoreKey),
ante.NewRejectExtensionOptionsDecorator(),
v8.MsgFilterDecorator{},
v9.MsgFilterDecorator{},
// Use Mempool Fee Decorator from our txfees module instead of default one from auth
// https://github.com/cosmos/cosmos-sdk/blob/master/x/auth/middleware/fee.go#L34
mempoolFeeDecorator,
Expand Down
Loading

0 comments on commit 045c622

Please sign in to comment.