Skip to content

Commit

Permalink
chore(CL): merge main into concentrated-liquidity-main (#3211)
Browse files Browse the repository at this point in the history
* Add servers to openapi spec file (#2980)

* Chain.schema.json: Added ibc data, fix genesis name, formatting (#3077)

Closes: #XXX

## What is the purpose of the change

> Add a description of the overall background and high level changes that this PR introduces

*(E.g.: This pull request improves documation of area A by adding ....*

To update the chain schema codebase data. This file Auto-updates the chain registry.


## Brief Changelog

*(for example:)*
 
  - *The metadata is stored in the blob store on job creation time as a persistent artifact*
  - *Deployments RPC transmits only the blob storage reference*
  - *Daemons retrieve the RPC data from the blob cache*

Added ibc data (ibc go version and enabled features(ics-20),
fix genesis name, (was version number before, now goes by name)
minor formatting chg.


## Testing and Verifying

*(Please pick one of the following options)*

--> This change is a trivial rework / code cleanup without any test coverage.

*(or)*

This change is already covered by existing tests, such as *(please describe tests)*.

*(or)*

This change added tests and can be verified as follows:

*(example:)*
  - *Added unit test that validates ...*
  - *Added integration tests for end-to-end deployment with ...*
  - *Extended integration test for ...*
  - *Manually verified the change by ...*

## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? (yes / no) No
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? (yes / no) No
  - How is the feature or change documented? (not applicable   /   specification (`x/<module>/spec/`)  /  [Osmosis docs repo](https://github.com/osmosis-labs/docs)   /   not documented) not documented

* labels (#3082)

* [x/gamm][stableswap]: Expand inverse relation tests to multi assets and add scaling factors (#3006)

* expand inverse relation tests to multi assets and add scaling factors

* tighten binary search bounds to fit spec

* remove todo

* Fix sped

* move output negation to caller

Co-authored-by: Dev Ojha <[email protected]>

* remove all uses of two-asset binary search solver (#3084)

* [stableswap]: Implement simplified direct multi-asset CFMM solver (#3068)

Closes: #2730

## What is the purpose of the change

This PR implements a direct solver for our multi-asset CFMM. Similar to our two-asset direct solver, it is intended to be kept in our codebase as a reference implementation and proof for our CFMM but is outclassed by our binary search solver for practical use.

## Brief Changelog

- Implement direct multi-asset solver and test it against our full suite of CFMM cases

## Testing and Verifying

- The solver implementation is tested against our full multi-asset CFMM test suite in `amm_test.go`

## Documentation and Release Note

  - Does this pull request introduce a new feature or user-facing behavior changes? (no)
  - Is a relevant changelog entry added to the `Unreleased` section in `CHANGELOG.md`? (no)
  - How is the feature or change documented? (not documented)

* refactor: remove PokePool from the PoolI interface, define on extension instead (#3035)

* refactor: remove PokePool from the PoolI interface, use extension instead

* changelog

* fix weights bug

* Update x/gamm/keeper/pool_test.go

Co-authored-by: Matt, Park <[email protected]>

* Update x/gamm/keeper/pool_test.go

* address comments

Co-authored-by: Matt, Park <[email protected]>

* ci(CL): run tests on CL branch and add backport config (#3095)

* ci(CL): run tests on CL branch and add backport config

* Update .github/mergify.yml

* After create pool test (#2783)

* add test for afterCreatePool

* format

* add test to check trackChangePool

Co-authored-by: Matt, Park <[email protected]>

* fix GetModuleToDistributeCoins (#2957)

* update comment in gamm module (#3103)

* chore(deps): Bump github.com/tendermint/tendermint (#3106)

Bumps [github.com/tendermint/tendermint](https://github.com/tendermint/tendermint) from 0.34.21 to 0.34.22.
- [Release notes](https://github.com/tendermint/tendermint/releases)
- [Changelog](https://github.com/tendermint/tendermint/blob/main/CHANGELOG.md)
- [Commits](tendermint/tendermint@v0.34.21...v0.34.22)

---
updated-dependencies:
- dependency-name: github.com/tendermint/tendermint
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump github.com/golangci/golangci-lint (#3104)

Bumps [github.com/golangci/golangci-lint](https://github.com/golangci/golangci-lint) from 1.50.0 to 1.50.1.
- [Release notes](https://github.com/golangci/golangci-lint/releases)
- [Changelog](https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md)
- [Commits](golangci/golangci-lint@v1.50.0...v1.50.1)

---
updated-dependencies:
- dependency-name: github.com/golangci/golangci-lint
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump github.com/stretchr/testify from 1.8.0 to 1.8.1 (#3105)

Bumps [github.com/stretchr/testify](https://github.com/stretchr/testify) from 1.8.0 to 1.8.1.
- [Release notes](https://github.com/stretchr/testify/releases)
- [Commits](stretchr/testify@v1.8.0...v1.8.1)

---
updated-dependencies:
- dependency-name: github.com/stretchr/testify
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore: update concentrated liquidity backport label (#3115)

* feat(osmomath): log2 approximation (#2788)

* feat: osmomath log2 approximation

* lint

* fix comment

* comment

* Update osmomath/decimal.go

* improve accuracy with narrower range

* comment

* implement and test precise log for x >= 1

* tests for negative values

* make non-mutative and test

* bench

* changelog

* remove redundant assignments

* improve comments

* [stableswap]: Cap number of assets and post-scaled asset amounts to ensure pools never overflow (#3055)

* add tests for 10-asset pools with 10B per asset

* add max post-scaled asset check and create pool tests

* add sanity tests for new swap guardrails

* move max scaled asset amt to constant

* add join-pool-internal tests for new functionality

* Remove unused versions in mergify (#3121)

* Query lockup params (#3098)

* change proto

* add grpc & cli query

* test

* set params in genesis

* add test case: setParams & query

* CI: Delete failing step (#3124)

* Delete failing step

* Fix int overflow in test logic

* [x/gamm][stableswap]: Add inverse join/exit tests, fix single asset join bug, and remove uneven ratio joins (#3102)

* add tests for 10-asset pools with 10B per asset

* add max post-scaled asset check and create pool tests

* add sanity tests for new swap guardrails

* move max scaled asset amt to constant

* add join-pool-internal tests for new functionality

* fix single join bug, remove uneven ratio joins, and add inverse join tests

* add error checks to single asset joins

* fix mistake in test case

* remove commented line

Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>

* Stableswap implement JoinPoolNoSwap (#2942)

* ...

* add tests and denom validation check

* make format

Co-authored-by: alpo <[email protected]>
Co-authored-by: alpo <[email protected]>

* Make testing suite to ensure queries never alter state (#3001)

* create func to check alter state

* add tests

* format

* Update app/apptesting/test_suite.go

Co-authored-by: Roman <[email protected]>

* remove fmt

* epochs: try to use Invoke

* gamm: use Invoke

* incentives: use Invoke

* lockup: use Invoke

* mint: use Invoke

* pool-incentives: use Invoke

* superfluid: use Invoke

* tokenfactory

* txfees

* format

* fix

Co-authored-by: Roman <[email protected]>

* Remove streamswap (#3146)

* remove proto files

* remove x/streamswap

* updated the contract to cosmwasm 1.1 and Uint256 for amounts (#2950)

* chore: use environment variable instead of build tags to control e2e (#3179)

* Rate limit - Cleaner tests (#3183)

* improved testing framework

* can test both send and recv for success and failure

* cleanner testing framework

* added contract instantiation

* working wasm integration

* added params for contract config

* extracted param registration

* active rate limiting

* calculating channel value

* cleaner tests

* fix issue with epochs

* fixed tests

* testing rate limit reset

* linting

* added receive middleware

* added test for non-configured channel

* make format

* Revert "make format"

This reverts commit 9ffdc37.

* only applying format to ibc-rate-limit

* applying fmt to app.go

* added gov_module and changed no-quota default to "allow all"

* added asymetric quotas

* moved getters to modules.go

* initial work to support multiple quotas

* added multiple quotas

* small fixes

* reordered imports

* added management messages

* reorganized management messages and experimenting with e2e testing

* commenting out test configuration test for now

* added query

* added flow unit test

* cleanup

* added AddChannel tests

* format

* test values are properly stored

* testing remove channel

* some more rate limiting tests

* moved tests about test setup to the right place

* fixed params

* merged main

* running gofumpt

* added ibc-rate-limiting contract

* added ibc-rate-limit middleware

* added chain integration and tests

* reverted change to match merged branch in main (#2341 instead of #2274)

* added cosmwasm workflow

* added a migrate message

* added some doc comments to the state

* added doc comments

* fixed dependency after merging osmosis-labs/cosmos-sdk#312

* added migration msg

* added workflow

* experimenting with better workflow

* added missing $

* using env

* Update x/ibc-rate-limit/contracts/rate-limiter/src/msg.rs

Co-authored-by: Dev Ojha <[email protected]>

* using stable for clippy

* removed gitkeep

* using the minimal profile for clippy

* experimenting with cache

* removed target from lints

* cleaner matrix?

* COmments & questions

* debugging

* more debugging

* debug faster

* quick cache debug

* typo

* quick workflow check

* working tests with optimization

* testing artifacts

* split the wasm target into its own step

* artifacts without slash

* full working tests

* clippy fixes

* workflow without test data checks and clippy fixes

* renamed CHANNEL_FLOWS

* renaming and code clenaup

* more renames

* renames and code fixes

* reordered imports

* cargo fmt

* added danom tracking

* cleanup

* refactoring

* changes to the expiration logic so that balances are calculated based on the direction (as suggested by @ValarDragon)

* slightly slower but considerably cleanner

* cleanup attributes and removed redundancy when not testing

* update to edition 2021

* added comments explaining the tests

* removed .beaker

* unified gitignore

* removed second gitignore

* better doc comments

* spelling

* spelling

* added channel value cache

* updated the middlware to use the new contract interface

* update middleware to match new contract interface

* added missing updates

* updated dependencies

* added missing helpers

* go.mod changes shouldn't be in this branch

* Revert "go.mod changes shouldn't be in this branch"

This reverts commit f8b972a.

* moved send and receive to sudo

* reorganizing

* calling the contract via sudo

* lint

* removed gitkeep

* using sudo instead of execute

* cleaned up and updated contract and integration

* updated x86 test wasm file

* fixed bad print

* storing and instantiating the contract

* setting up E2E tests for ibc rate limits

* fixed proposal. Now just have to get the math right and cleanup

* Using the supply for the channel value

* experimenting with e2e tests

* passing the contract keeper instead of instantiating it each time

* changes from code review

* added contract from main and changes to the middleware from code review

* using the correct bank supply method

* debugging issues with e2e tests. Everything works after one interaction from the cli, but not before

* updated dependency to match latest sdk form (now that the changes to this repo have been applied)

* working E2E test for rate limiting

* added e2e tests and changes from code review

* removed debug logs

* remove debug logs

* updated test to also use GetSupplyWithOffset

* using correct GetSupplyWithOffset method

* using correct GetSupplyWithOffset method

* lint

* removed e2e from this branch as it's not doing anything without the integration

* lint

* tests fail on CI because of "inactive" proposal. Is the deposit the issue?

* remove rate limiting after the test so it doesn't interfeer with the other tests

* using standard proposals instead of expedited

* added packet reverts on unsuccessful acks and timeouts

* lint

* ran gofumpt

* lint

* added undo to the contract

* integrating undo

* updated contract with x86 wasm file

* added undo for sent packages when they are rejected bia timeout or a bad ack

* added a readme

* markdown lint

* added readme

* abstracted params

* better params and param tests

* using a helper function instead of returning from the test

* updated contract to allow for undo

* added undo, readme, and cleanup based on reviews

* updated wasm file with x86 version

* using string params in e2e tests

* updated to v12

* removed unnecessary keeper

* only exposing what's needed

* refactoring

* updated types

* added shell history to gitignore

* adding only one wasm file to the codebase

* remove test for same wasm files. No longer needed.

* refactor based on code review

* removed integration tests as they won't pass without integration

* added params unit test

* reorganized tests

* reorganizing tests

* refactoring

* added address length limit

* added tests and fixed lack of return

* remove tests from bad merge

* remove from bad merge again

* comment

* test helpers for cosmwasm contracts

* added helpers for ibctesting

* comments

* removed unnecessary txConfig

* fixed typos

* clearer comment

* using second helper function for ExportGenesis

* added new wasm file

* updated the contract to cosmwasm 1.1 and Uint256 for amounts

* Fixed send with ibc assets. Better tests and error messages

* updated contract with x86 version

* gofumpt

* fixed clippy errors

* using the escrowed value as the channel value for native tokens

* gofumpt

* update fail string

* initial experiments with moving the calculations into the contract

* initial experiments with using the packet inside the contract

* improved tests. Experiments with packet in the contract.

* original contract

* cleaner tests

* more test cleanup

* cleaner tests

* cleanup

* align values from the tests and the contract

* fixed amounts for receive and cleanup code

* removed redundant wrapping logic

* adaped failed send test to the new testing abstractions

* only manipulate time on chain A

* remove commented out block

* changed lints to stable so they change less often

* gofumpt

* update channel value tests

* added x86 version of the contract for ci

* remove lint type that doesn't exist on stable

Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>

* changed lints to stable so they change less often (#3184)

* update version numbers (#3168)

* update version numbers

added "v" in recommended_version number to unify with chain registry

* Update chain.schema.json

Co-authored-by: Dev Ojha <[email protected]>

Co-authored-by: Dev Ojha <[email protected]>

* chore(deps): Bump github.com/spf13/cobra from 1.6.0 to 1.6.1 (#3187)

Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.6.0 to 1.6.1.
- [Release notes](https://github.com/spf13/cobra/releases)
- [Commits](spf13/cobra@v1.6.0...v1.6.1)

---
updated-dependencies:
- dependency-name: github.com/spf13/cobra
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump github.com/mattn/go-sqlite3 from 1.14.15 to 1.14.16 (#3186)

Bumps [github.com/mattn/go-sqlite3](https://github.com/mattn/go-sqlite3) from 1.14.15 to 1.14.16.
- [Release notes](https://github.com/mattn/go-sqlite3/releases)
- [Commits](mattn/go-sqlite3@v1.14.15...v1.14.16)

---
updated-dependencies:
- dependency-name: github.com/mattn/go-sqlite3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(e2e): add vscode debug configurations (#3180)

* osmomath(log/CL): ln(x), log_1.0001(x), log_custom(x) (#3169)

* natural logarithm

* tick log

* save

* save

* customBase

* logs

Co-authored-by: Ruslan Akhtariev <[email protected]>

* feat(release): Automated post-upgrade tasks by code generating upgrade handler and auto-increasing e2e version (#3100)

* automate post-upgrade tasks by code generating upgrade handler and setting e2e in makefile

* automate post-upgrade tasks by code generating upgrade handler and setting e2e in makefile

* save

* save

* save

* yaml

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* On release auto upgrade

* docs

* save

* also changes app.go

* also changes app.go

* also changes app.go

* test using ci because will run forever on m1 with qemu

* save

* post release action

* post release github action

* auto postrelease action

* cleanup

* cleanup

* cleanup

* del

* docs

* major

* save

* save

* save

* Save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* save

* s

* s

* s

* s

* s

* only on major upgrades

* docs

Co-authored-by: Ruslan Akhtariev <[email protected]>

* chore: Tx post-handler example snippet #3194

* Progress on IBC rate limit spec (#3190)

* Progress on IBC rate limit spec

* Fix CI

* Fix lints

* More updates

* fix mdlinter

* More notes

* one more todo

* More README update

* Update x/ibc-rate-limit/README.md

Co-authored-by: Adam Tucker <[email protected]>

Co-authored-by: Adam Tucker <[email protected]>

* fix(e2e): various e2e build issues breaking debugging on linux amd64 (#3207)

* fix(e2e): various e2e build issues breaking debugging on linux amd64

* fix test-e2e-debug

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Daniel Farina <[email protected]>
Co-authored-by: JeremyParish69 <[email protected]>
Co-authored-by: Adam Tucker <[email protected]>
Co-authored-by: alpo <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: Matt, Park <[email protected]>
Co-authored-by: Hieu Vu <[email protected]>
Co-authored-by: khanh-notional <[email protected]>
Co-authored-by: Nguyen Thanh Nhan <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Niccolo Raspa <[email protected]>
Co-authored-by: Dev Ojha <[email protected]>
Co-authored-by: alpo <[email protected]>
Co-authored-by: Nicolas Lara <[email protected]>
Co-authored-by: doggystylez <[email protected]>
Co-authored-by: Ruslan Akhtariev <[email protected]>
Co-authored-by: Ruslan Akhtariev <[email protected]>
Co-authored-by: Aleksandr Bezobchuk <[email protected]>
  • Loading branch information
19 people authored Nov 2, 2022
1 parent 9090e98 commit ce38877
Show file tree
Hide file tree
Showing 60 changed files with 1,896 additions and 8,966 deletions.
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

0 comments on commit ce38877

Please sign in to comment.