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

chore(CL): merge main into concentrated-liquidity-main #3211

Merged
merged 38 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
42d73f1
Add servers to openapi spec file (#2980)
daniel-farina Oct 19, 2022
ec7a7a8
Chain.schema.json: Added ibc data, fix genesis name, formatting (#3077)
JeremyParish69 Oct 20, 2022
fdbdc78
labels (#3082)
czarcas7ic Oct 21, 2022
4a67cdd
[x/gamm][stableswap]: Expand inverse relation tests to multi assets a…
AlpinYukseloglu Oct 21, 2022
d812334
remove all uses of two-asset binary search solver (#3084)
AlpinYukseloglu Oct 21, 2022
edfb19b
[stableswap]: Implement simplified direct multi-asset CFMM solver (#3…
AlpinYukseloglu Oct 21, 2022
c51a248
refactor: remove PokePool from the PoolI interface, define on extensi…
p0mvn Oct 21, 2022
f0f31d0
ci(CL): run tests on CL branch and add backport config (#3095)
p0mvn Oct 21, 2022
7f62b6d
After create pool test (#2783)
hieuvubk Oct 22, 2022
b552bab
fix GetModuleToDistributeCoins (#2957)
catShaark Oct 24, 2022
975aeb9
update comment in gamm module (#3103)
ThanhNhann Oct 24, 2022
9176a51
chore(deps): Bump github.com/tendermint/tendermint (#3106)
dependabot[bot] Oct 24, 2022
18f4afa
chore(deps): Bump github.com/golangci/golangci-lint (#3104)
dependabot[bot] Oct 24, 2022
6548902
chore(deps): Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 (#3…
dependabot[bot] Oct 24, 2022
7119419
chore: update concentrated liquidity backport label (#3115)
p0mvn Oct 24, 2022
8590b80
feat(osmomath): log2 approximation (#2788)
p0mvn Oct 24, 2022
ced84c1
[stableswap]: Cap number of assets and post-scaled asset amounts to e…
AlpinYukseloglu Oct 24, 2022
0aa0263
Remove unused versions in mergify (#3121)
niccoloraspa Oct 24, 2022
df9102e
Query lockup params (#3098)
hieuvubk Oct 24, 2022
6274617
CI: Delete failing step (#3124)
ValarDragon Oct 24, 2022
184a85c
[x/gamm][stableswap]: Add inverse join/exit tests, fix single asset j…
AlpinYukseloglu Oct 24, 2022
805f80c
Stableswap implement JoinPoolNoSwap (#2942)
ValarDragon Oct 24, 2022
2ce796c
Make testing suite to ensure queries never alter state (#3001)
hieuvubk Oct 25, 2022
1e80a2a
Remove streamswap (#3146)
hieuvubk Oct 25, 2022
20c72cc
updated the contract to cosmwasm 1.1 and Uint256 for amounts (#2950)
nicolaslara Oct 29, 2022
46d0053
chore: use environment variable instead of build tags to control e2e …
p0mvn Oct 31, 2022
bb5c1c9
Rate limit - Cleaner tests (#3183)
nicolaslara Oct 31, 2022
d8b6d54
changed lints to stable so they change less often (#3184)
nicolaslara Oct 31, 2022
5abf7a4
update version numbers (#3168)
doggystylez Oct 31, 2022
434b42f
chore(deps): Bump github.com/spf13/cobra from 1.6.0 to 1.6.1 (#3187)
dependabot[bot] Oct 31, 2022
a3d0110
chore(deps): Bump github.com/mattn/go-sqlite3 from 1.14.15 to 1.14.16…
dependabot[bot] Oct 31, 2022
5c9bc1b
chore(e2e): add vscode debug configurations (#3180)
p0mvn Oct 31, 2022
5c408f9
osmomath(log/CL): ln(x), log_1.0001(x), log_custom(x) (#3169)
pysel Nov 1, 2022
8cd07fd
feat(release): Automated post-upgrade tasks by code generating upgrad…
pysel Nov 1, 2022
2620afd
chore: Tx post-handler example snippet #3194
alexanderbez Nov 1, 2022
d874d6d
Progress on IBC rate limit spec (#3190)
ValarDragon Nov 1, 2022
29c8561
fix(e2e): various e2e build issues breaking debugging on linux amd64 …
p0mvn Nov 2, 2022
a7acb4f
Merge branch 'main' into roman/merge-main
p0mvn Nov 2, 2022
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
1 change: 0 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ docs/
networks/
proto/
scripts/
tests/
tools/
.github/
.git/
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/auto-update-upgrade.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# When new major release is created this workflow will be triggered and will do 3 things:
# 1) it will create a directory with an empty upgrade handler in app/upgrades folder
# 2) will increase an E2E_UPGRADE_VERSION variable in Makefile
# 3) create a pull request with these changes to main

name: On Release Auto Upgrade

on:
release:
types: [published]

jobs:
post_release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]

- name: Run version script
run: bash ./scripts/check_release.sh ${{ github.event.release.tag_name }}

- name: Run post release script
if: env.MAJOR == 1 # 1 means vX of existing upgrade handler is smaller than A in tag vA.B.C
run: bash ./scripts/empty_upgrade_handler_gen.sh

- name: Create PR
if: env.MAJOR == 1
uses: peter-evans/create-pull-request@v4
with:
base: ${{ github.event.repository.default_branch }}
body: |
Update report
- Created a new empty upgrade handler
- Increased E2E_UPGRADE_VERSION in Makefile by 1
labels: |
T:auto
C:e2e
C:app-wiring
48 changes: 41 additions & 7 deletions .github/workflows/contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ on:

jobs:
test:
name: Test Suite
name: Test Cosmwasm Contracts
runs-on: ubuntu-latest
strategy:
matrix:
contract: [{workdir: ./x/ibc-rate-limit/, output: testdata/rate_limiter.wasm, build: artifacts/rate_limiter-x86_64.wasm, name: rate_limiter}]
contract: [{workdir: ./x/ibc-rate-limit/, output: bytecode/rate_limiter.wasm, build: artifacts/rate_limiter-x86_64.wasm, name: rate_limiter}]

steps:
- name: Checkout sources
Expand Down Expand Up @@ -82,8 +82,42 @@ jobs:
path: ${{ matrix.contract.workdir }}${{ matrix.contract.build }}
retention-days: 1

# - name: Check Test Data
# working-directory: ${{ matrix.contract.workdir }}
# if: ${{ matrix.contract.output != null }}
# run: >
# diff ${{ matrix.contract.output }} ${{ matrix.contract.build }}
- name: Check Test Data
working-directory: ${{ matrix.contract.workdir }}
if: ${{ matrix.contract.output != null }}
run: >
diff ${{ matrix.contract.output }} ${{ matrix.contract.build }}


lints:
name: Cosmwasm Lints
runs-on: ubuntu-latest
strategy:
matrix:
workdir: [./x/ibc-rate-limit]

steps:
- name: Checkout sources
uses: actions/checkout@v2
- uses: technote-space/[email protected]
with:
PATTERNS: |
**/**.rs
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rustfmt, clippy

- name: Format
working-directory: ${{ matrix.workdir }}
run: >
cargo fmt --all -- --check

- name: run cargo clippy
working-directory: ${{ matrix.workdir }}
run: >
cargo clippy -- -D warnings

7 changes: 1 addition & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,4 @@ jobs:
# within `super-linter`.
fetch-depth: 0
- name: Run documentation linter
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_MARKDOWN: true
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: make mdlint
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -230,3 +230,7 @@ Cargo.lock
.beaker
blocks.db
**/blocks.db*

# Ignore e2e test artifacts (which clould leak information if commited)
.ash_history
.bash_history
2 changes: 0 additions & 2 deletions .markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ MD042: true
MD048: true
MD051: true
# MD004: false
# # Can't disable MD007 :/
# MD007: false
# MD009: false
# MD010:
# code_blocks: false
Expand Down
30 changes: 30 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "E2E: (make test-e2e-short)",
"type": "go",
"request": "launch",
"mode": "test",
"program": "${workspaceFolder}/tests/e2e",
"args": [
"-test.timeout",
"30m",
"-test.run",
"IntegrationTestSuite",
"-test.v"
],
"buildFlags": "-tags e2e",
"env": {
"OSMOSIS_E2E": "True",
"OSMOSIS_E2E_SKIP_IBC": "true",
"OSMOSIS_E2E_SKIP_UPGRADE": "true",
"OSMOSIS_E2E_SKIP_CLEANUP": "true",
"OSMOSIS_E2E_SKIP_STATE_SYNC": "true",
"OSMOSIS_E2E_UPGRADE_VERSION": "v13",
"OSMOSIS_E2E_DEBUG_LOG": "true",
},
"preLaunchTask": "e2e-setup"
}
]
}
12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "e2e-setup",
"type": "shell",
"command": "make e2e-setup"
}
]
}
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ run-querygen:
###############################################################################

PACKAGES_UNIT=$(shell go list ./... | grep -E -v 'tests/simulator|e2e')
PACKAGES_E2E=$(shell go list -tags e2e ./... | grep '/e2e')
PACKAGES_E2E=$(shell go list ./... | grep '/e2e')
PACKAGES_SIM=$(shell go list ./... | grep '/tests/simulator')
TEST_PACKAGES=./...

Expand Down Expand Up @@ -261,25 +261,25 @@ test-sim-bench:
# In that case, run `make e2e-remove-resources`
# manually.
# Utilizes Go cache.
test-e2e: e2e-setup test-e2e-ci
test-e2e: OSMOSIS_E2E=True e2e-setup test-e2e-ci

# test-e2e-ci runs a full e2e test suite
# does not do any validation about the state of the Docker environment
# As a result, avoid using this locally.
test-e2e-ci:
@VERSION=$(VERSION) OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) go test -tags e2e -mod=readonly -timeout=25m -v $(PACKAGES_E2E)
@VERSION=$(VERSION) OSMOSIS_E2E=True OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E)

# test-e2e-debug runs a full e2e test suite but does
# not attempt to delete Docker resources at the end.
test-e2e-debug: e2e-setup
@VERSION=$(VERSION) OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) OSMOSIS_E2E_SKIP_CLEANUP=True go test -tags e2e -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1
@VERSION=$(VERSION) OSMOSIS_E2E=True OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_UPGRADE_VERSION=$(E2E_UPGRADE_VERSION) OSMOSIS_E2E_SKIP_CLEANUP=True go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1

# test-e2e-short runs the e2e test with only short tests.
# Does not delete any of the containers after running.
# Deletes any existing containers before running.
# Does not use Go cache.
test-e2e-short: e2e-setup
@VERSION=$(VERSION) OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_SKIP_UPGRADE=True OSMOSIS_E2E_SKIP_IBC=True OSMOSIS_E2E_SKIP_STATE_SYNC=True OSMOSIS_E2E_SKIP_CLEANUP=True go test -tags e2e -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1
@VERSION=$(VERSION) OSMOSIS_E2E=True OSMOSIS_E2E_DEBUG_LOG=True OSMOSIS_E2E_SKIP_UPGRADE=True OSMOSIS_E2E_SKIP_IBC=True OSMOSIS_E2E_SKIP_STATE_SYNC=True OSMOSIS_E2E_SKIP_CLEANUP=True go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1

test-mutation:
@bash scripts/mutation-test.sh $(MODULES)
Expand All @@ -296,10 +296,10 @@ docker-build-debug:
@DOCKER_BUILDKIT=1 docker tag osmosis:${COMMIT} osmosis:debug

docker-build-e2e-init-chain:
@DOCKER_BUILDKIT=1 docker build -t osmosis-e2e-init-chain:debug --build-arg E2E_SCRIPT_NAME=chain -f tests/e2e/initialization/init.Dockerfile .
@DOCKER_BUILDKIT=1 docker build -t osmosis-e2e-init-chain:debug --build-arg E2E_SCRIPT_NAME=chain --platform=linux/x86_64 -f tests/e2e/initialization/init.Dockerfile .

docker-build-e2e-init-node:
@DOCKER_BUILDKIT=1 docker build -t osmosis-e2e-init-node:debug --build-arg E2E_SCRIPT_NAME=node -f tests/e2e/initialization/init.Dockerfile .
@DOCKER_BUILDKIT=1 docker build -t osmosis-e2e-init-node:debug --build-arg E2E_SCRIPT_NAME=node --platform=linux/x86_64 -f tests/e2e/initialization/init.Dockerfile .

e2e-setup: e2e-check-image-sha e2e-remove-resources
@echo Finished e2e environment setup, ready to start the test
Expand Down
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ func NewOsmosisApp(
app.IBCKeeper,
),
)
// Uncomment to enable postHandlers:
// app.SetPostHandler(NewTxPostHandler())
app.SetEndBlocker(app.EndBlocker)

// Register snapshot extensions to enable state-sync for wasm.
Expand Down
6 changes: 6 additions & 0 deletions app/apptesting/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ func (s *KeeperTestHelper) AssertEventEmitted(ctx sdk.Context, eventTypeExpected

func (s *KeeperTestHelper) FindEvent(events []sdk.Event, name string) sdk.Event {
index := slices.IndexFunc(events, func(e sdk.Event) bool { return e.Type == name })
if index == -1 {
return sdk.Event{}
}
return events[index]
}

func (s *KeeperTestHelper) ExtractAttributes(event sdk.Event) map[string]string {
attrs := make(map[string]string)
if event.Attributes == nil {
return attrs
}
for _, a := range event.Attributes {
attrs[string(a.Key)] = string(a.Value)
}
Expand Down
32 changes: 29 additions & 3 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package keepers

import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -33,6 +34,9 @@ import (
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

ibcratelimit "github.com/osmosis-labs/osmosis/v12/x/ibc-rate-limit"
ibcratelimittypes "github.com/osmosis-labs/osmosis/v12/x/ibc-rate-limit/types"

icahost "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/host/types"
Expand Down Expand Up @@ -115,12 +119,14 @@ type AppKeepers struct {
SuperfluidKeeper *superfluidkeeper.Keeper
GovKeeper *govkeeper.Keeper
WasmKeeper *wasm.Keeper
ContractKeeper *wasmkeeper.PermissionedKeeper
TokenFactoryKeeper *tokenfactorykeeper.Keeper
SwapRouterKeeper *swaprouter.Keeper
ConcentratedLiquidityKeeper *concentratedliquidity.Keeper
// IBC modules
// transfer module
TransferModule transfer.AppModule
TransferModule transfer.AppModule
RateLimitingICS4Wrapper *ibcratelimit.ICS4Wrapper

// keys to access the substores
keys map[string]*sdk.KVStoreKey
Expand Down Expand Up @@ -202,12 +208,24 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.ScopedIBCKeeper,
)

// ChannelKeeper wrapper for rate limiting SendPacket(). The wasmKeeper needs to be added after it's created
rateLimitingParams := appKeepers.GetSubspace(ibcratelimittypes.ModuleName)
rateLimitingParams = rateLimitingParams.WithKeyTable(ibcratelimittypes.ParamKeyTable())
rateLimitingICS4Wrapper := ibcratelimit.NewICS4Middleware(
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.AccountKeeper,
nil,
appKeepers.BankKeeper,
rateLimitingParams,
)
appKeepers.RateLimitingICS4Wrapper = &rateLimitingICS4Wrapper

// Create Transfer Keepers
transferKeeper := ibctransferkeeper.NewKeeper(
appCodec,
appKeepers.keys[ibctransfertypes.StoreKey],
appKeepers.GetSubspace(ibctransfertypes.ModuleName),
appKeepers.IBCKeeper.ChannelKeeper,
appKeepers.RateLimitingICS4Wrapper, // The ICS4Wrapper is replaced by the rateLimitingICS4Wrapper instead of the channel
appKeepers.IBCKeeper.ChannelKeeper,
&appKeepers.IBCKeeper.PortKeeper,
appKeepers.AccountKeeper,
Expand All @@ -218,6 +236,9 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.TransferModule = transfer.NewAppModule(*appKeepers.TransferKeeper)
transferIBCModule := transfer.NewIBCModule(*appKeepers.TransferKeeper)

// RateLimiting IBC Middleware
rateLimitingTransferModule := ibcratelimit.NewIBCModule(transferIBCModule, appKeepers.RateLimitingICS4Wrapper)

icaHostKeeper := icahostkeeper.NewKeeper(
appCodec, appKeepers.keys[icahosttypes.StoreKey],
appKeepers.GetSubspace(icahosttypes.SubModuleName),
Expand All @@ -233,7 +254,8 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
// Create static IBC router, add transfer route, then set and seal it
ibcRouter := porttypes.NewRouter()
ibcRouter.AddRoute(icahosttypes.SubModuleName, icaHostIBCModule).
AddRoute(ibctransfertypes.ModuleName, transferIBCModule)
// The transferIBC module is replaced by rateLimitingTransferModule
AddRoute(ibctransfertypes.ModuleName, &rateLimitingTransferModule)
// Note: the sealing is done after creating wasmd and wiring that up

// create evidence keeper with router
Expand Down Expand Up @@ -360,6 +382,9 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
wasmOpts...,
)
appKeepers.WasmKeeper = &wasmKeeper
// Update the ICS4Wrapper with the proper contractKeeper
appKeepers.ContractKeeper = wasmkeeper.NewDefaultPermissionKeeper(appKeepers.WasmKeeper)
appKeepers.RateLimitingICS4Wrapper.ContractKeeper = appKeepers.ContractKeeper

// wire up x/wasm to IBC
ibcRouter.AddRoute(wasm.ModuleName, wasm.NewIBCHandler(appKeepers.WasmKeeper, appKeepers.IBCKeeper.ChannelKeeper))
Expand Down Expand Up @@ -455,6 +480,7 @@ func (appKeepers *AppKeepers) initParamsKeeper(appCodec codec.BinaryCodec, legac
paramsKeeper.Subspace(tokenfactorytypes.ModuleName)
paramsKeeper.Subspace(twaptypes.ModuleName)
paramsKeeper.Subspace(swaproutertypes.ModuleName)
paramsKeeper.Subspace(ibcratelimittypes.ModuleName)

return paramsKeeper
}
Expand Down
9 changes: 9 additions & 0 deletions app/tx_post_handler.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package app

import (
sdk "github.com/cosmos/cosmos-sdk/types"
)

func NewTxPostHandler() sdk.AnteHandler {
panic("not implemented")
}
8 changes: 4 additions & 4 deletions chain.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"$schema": "http://json-schema.org/draft-07/schema#",
"codebase":{
"git_repo": "https://github.com/osmosis-labs/osmosis",
"recommended_version": "12.2.0",
"recommended_version": "v12.2.0",
"compatible_versions": [
"12.2.0"
"v12.2.0"
],
"binaries": {
"linux/amd64": "https://github.com/osmosis-labs/osmosis/releases/download/v12.1.0/osmosisd-12.1.0-linux-amd64?checksum=sha256:44433f93946338b8cb167d9030ebbcfe924294d95d745026ada5dbe8f50d5010",
"linux/arm64": "https://github.com/osmosis-labs/osmosis/releases/download/v12.1.0/osmosisd-12.1.0-linux-arm64?checksum=sha256:ef2c3d60156be5481534ecb33f9d94d73afa38a1b016e7e1c6d3fe10e3e69b3a"
"linux/amd64": "https://github.com/osmosis-labs/osmosis/releases/download/v12.2.0/osmosisd-12.2.0-linux-amd64?checksum=sha256:b4a0296b142b1a535f3116021d39660868a83fc66b290ab0891b06211f86fd31",
"linux/arm64": "https://github.com/osmosis-labs/osmosis/releases/download/v12.2.0/osmosisd-12.2.0-linux-arm64?checksum=sha256:84717e741b61ef3616fef403aae42067614e58a0208347cd642f6d03240b7778"
},
"cosmos_sdk_version": "0.45",
"tendermint_version": "0.34",
Expand Down
Loading