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

Min consensus fee arithmetic twap debugging #4341

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
dfe43ca
Refactor tests a bit
ValarDragon Feb 7, 2023
38946b7
Add consensus min gas fee
ValarDragon Feb 7, 2023
c676d48
Fix tests
ValarDragon Feb 7, 2023
923b45e
Delete more crud
ValarDragon Feb 7, 2023
7a82e14
Cleanup more duplicate test cases
ValarDragon Feb 7, 2023
125d59d
flip isCheckTx sign
ValarDragon Feb 7, 2023
13679ce
One more test needed
ValarDragon Feb 7, 2023
295aebb
Run invalid fee denom test across both check & deliver
ValarDragon Feb 7, 2023
a374529
Remove extra line
ValarDragon Feb 7, 2023
8c7f27d
Merge branch 'main' into dev/consensus_min_gas_fee
ValarDragon Feb 7, 2023
e42e675
Add hack to get around txfee problem in ibctesting
ValarDragon Feb 8, 2023
f40b0c7
Handle genesis
ValarDragon Feb 8, 2023
b278a48
Minor code cleanup
ValarDragon Feb 8, 2023
5db078c
tryfix simulation
ValarDragon Feb 8, 2023
a8b5c4c
Fix for legacy simulator
ValarDragon Feb 8, 2023
275cfb8
Update x/txfees/keeper/feedecorator_test.go
ValarDragon Feb 8, 2023
e7db7e1
Apply matt comments
ValarDragon Feb 8, 2023
1896d2e
See what happens by adding fees
ValarDragon Feb 8, 2023
f3ffdcb
Merge branch 'main' into dev/consensus_min_gas_fee
ValarDragon Feb 13, 2023
bf1b8bc
Add genesis logic update
ValarDragon Feb 13, 2023
81ea3fd
Try fixing e2e
ValarDragon Feb 13, 2023
efe1326
Add some better logging to find error
ValarDragon Feb 13, 2023
540eaff
remove stat, fix typo
ValarDragon Feb 13, 2023
27c6f27
chore(e2e): update init image on main for #4244
p0mvn Feb 14, 2023
e71b4ee
changes
p0mvn Feb 14, 2023
a8a3ad5
fix more problems
p0mvn Feb 14, 2023
52589f1
more fixes
p0mvn Feb 15, 2023
b7d5fbd
lint
p0mvn Feb 15, 2023
28219f3
twap gebug logs
p0mvn Feb 15, 2023
6bb33f8
arithmetic fix
p0mvn Feb 15, 2023
e4a3ba8
support for quote denom in 3 asset pools
p0mvn Feb 16, 2023
177b049
cli fix
p0mvn Feb 16, 2023
15e15c5
add logs
p0mvn Feb 16, 2023
2ef0d10
better logs
p0mvn Feb 16, 2023
3850b77
better log
p0mvn Feb 16, 2023
a38ae28
more logic
p0mvn Feb 16, 2023
101bd5e
more logs
p0mvn Feb 16, 2023
f509302
more logs
p0mvn Feb 16, 2023
b16ec2f
logs
p0mvn Feb 16, 2023
c25b1a5
merge
p0mvn Feb 17, 2023
fa04f8a
fix
p0mvn Feb 17, 2023
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
71 changes: 30 additions & 41 deletions .github/workflows/check-state-compatibility.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
# This workflow checks that a specific commit / branch / tag is state compatible
# This workflow checks that a specific commit / branch / tag is state compatible
# with the latest osmosis version by:

# - building the new `osmosisd` binary with the latest changes
# - replaying a configurable number of previous blocks from chain history

# Currently, the node starts from a snapshot taken some blocks before the last epoch
# Currently, the node starts from a snapshot taken some blocks before the last epoch
# and waits `DELTA_HALT_HEIGHT` blocks after epoch before finally halting.

# Important Caveat:

# The fact that this workflow succeeds and the binary doesn't fail doesn't
# The fact that this workflow succeeds and the binary doesn't fail doesn't
# directly imply that the new binary is state-compatible.
# It could be that the binary is not state-compatible, but the condition
# It could be that the binary is not state-compatible, but the condition
# which would break state compatibility was not present in the chunk of block history used.

# On the other hand, if the workflow fails, the binary is not state-compatible.

name: Check state compatibility

# ************************************ NOTE ************************************
#
#
# DO NOT TRIGGER THIS WORKFLOW ON PUBLIC FORKS
#
# This workflow runs on a self-hosted runner and forks to this repository
# can potentially run dangerous code on the self-hosted runner machine
# This workflow runs on a self-hosted runner and forks to this repository
# can potentially run dangerous code on the self-hosted runner machine
# by creating a pull request that executes the code in a workflow.
#
#
# ******************************************************************************

on:
pull_request:
branches:
- 'v[0-9]+.x'
- "v[0-9]+.x"

env:
GOLANG_VERSION: 1.18
Expand All @@ -43,29 +43,26 @@ env:
DELTA_HALT_HEIGHT: 50

jobs:

compare_versions:
# Compare current mainnet osmosis major version with the major version of github branch
# Skip the next job if the current github major is greater than the current mainnet major
# Compare current mainnet osmosis major version with the major version of github branch
# Skip the next job if the current github major is greater than the current mainnet major
runs-on: self-hosted
outputs:
should_i_run: ${{ steps.compare_versions.outputs.should_i_run }}
mainnet_major_version: ${{ steps.mainnet_version.outputs.mainnet_major_version }}
steps:
-
name: Get mainnet major version
- name: Get mainnet major version
id: mainnet_version
run: |
run: |
# Find current major version via rpc.osmosis.zone/abci_info
RPC_ABCI_INFO=$(curl -s --retry 5 --retry-delay 5 --connect-timeout 30 -H "Accept: application/json" ${{ env.RPC_ENDPOINT }}/abci_info)
MAINNET_MAJOR_VERSION=$(echo $RPC_ABCI_INFO | dasel --plain -r json 'result.response.version' | cut -f 1 -d '.')

echo "MAINNET_MAJOR_VERSION=$MAINNET_MAJOR_VERSION" >> $GITHUB_ENV
echo "mainnet_major_version=$MAINNET_MAJOR_VERSION" >> $GITHUB_OUTPUT
-
name: Get GitHub branch major version
- name: Get GitHub branch major version
id: compare_versions
run: |
run: |
CURRENT_BRANCH_MAJOR_VERSION=$(echo ${{ github.event.pull_request.base.ref }} | tr -dc '0-9')
SHOULD_I_RUN=$(( $CURRENT_BRANCH_MAJOR_VERSION <= $MAINNET_MAJOR_VERSION ))

Expand All @@ -85,24 +82,20 @@ jobs:
needs: compare_versions
runs-on: self-hosted
steps:
-
name: Checkout branch
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0
-
name: 🐿 Setup Golang
- name: 🐿 Setup Golang
uses: actions/setup-go@v3
with:
go-version: '^${{ env.GOLANG_VERSION }}'
-
name: 🔨 Build the osmosisd binary
go-version: "^${{ env.GOLANG_VERSION }}"
- name: 🔨 Build the osmosisd binary
run: |
make build
build/osmosisd version
-
name: 🧪 Initialize Osmosis Node
run: |
- name: 🧪 Initialize Osmosis Node
run: |
rm -rf $HOME/.osmosisd/ || true
build/osmosisd init runner -o

Expand All @@ -114,10 +107,9 @@ jobs:

# Copy genesis to config folder
cp /mnt/data/genesis/osmosis-1/genesis.json $HOME/.osmosisd/config/genesis.json
-
name: ⏬ Download last pre-epoch snapshot
run: |
REPO_MAJOR_VERSION=$(echo $(git describe --tags) | cut -f 1 -d '.') # with v prefix
- name: ⏬ Download last pre-epoch snapshot
run: |
REPO_MAJOR_VERSION=v14
SNAPSHOT_INFO_URL=${{ env.SNAPSHOT_BUCKET }}/$REPO_MAJOR_VERSION/snapshots.json

# Get the latest pre-epoch snapshot information from bucket
Expand All @@ -135,13 +127,12 @@ jobs:

# Copy snapshot in Data folder
cp -R /mnt/data/snapshots/$REPO_MAJOR_VERSION/$SNAPSHOT_ID/* $HOME/.osmosisd/
-
name: 🧪 Configure Osmosis Node
run: |
- name: 🧪 Configure Osmosis Node
run: |
CONFIG_FOLDER=$HOME/.osmosisd/config

# Find last epoch block comparing repo version to current chain version
REPO_MAJOR_VERSION=$(echo $(git describe --tags) | sed 's/^v//' | cut -f 1 -d '.') # without v prefix
REPO_MAJOR_VERSION=14

if [ $REPO_MAJOR_VERSION == $MAINNET_MAJOR_VERSION ]; then
# I'm in the latest major, fetch the epoch info from the lcd endpoint
Expand Down Expand Up @@ -174,10 +165,8 @@ jobs:

# Download addrbook
wget -q -O $CONFIG_FOLDER/addrbook.json ${{ env.ADDRBOOK_URL }}
-
name: 🧪 Start Osmosis Node
- name: 🧪 Start Osmosis Node
run: build/osmosisd start
-
name: 🧹 Clean up Osmosis Home
- name: 🧹 Clean up Osmosis Home
if: always()
run: rm -rf $HOME/.osmosisd/ || true
11 changes: 11 additions & 0 deletions .github/workflows/push-dev-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,15 @@ jobs:
GIT_COMMIT=${{ github.sha }}
tags: |
${{ env.OSMOSIS_DEV_IMAGE_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }}
-
name: Build and Push E2E Init Docker Images
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: |
${{ env.OSMOSIS_INIT_CHAIN_IMAGE_REPOSITORY }}:${{ env.DOCKER_IMAGE_TAG }}
37 changes: 2 additions & 35 deletions .github/workflows/push-docker-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,42 +136,9 @@ 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
if: startsWith(github.ref, 'refs/tags/v') && endsWith(github.ref, '.0')
name: Build and push (e2e-chain-init)
uses: docker/build-push-action@v3
with:
file: tests/e2e/initialization/init.Dockerfile
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

* [#3715](https://github.com/osmosis-labs/osmosis/pull/3715) Fix x/gamm (golang API) CalculateSpotPrice, balancer.SpotPrice and Stableswap.SpotPrice base and quote asset.
* [#3746](https://github.com/osmosis-labs/osmosis/pull/3746) Make ApplyFuncIfNoErr logic preserve panics for OutOfGas behavior.
* [#4306](https://github.com/osmosis-labs/osmosis/pull/4306) Prevent adding more tokens to an already finished gauge

## v14.0.1

### Bug fixes

* [#4132](https://github.com/osmosis-labs/osmosis/pull/4132) Fix CLI for EstimateSwapExactAmountIn and EstimateSwapExactAmountOut in x/gamm.
* [#4262](https://github.com/osmosis-labs/osmosis/pull/4262) Fix geometric twap genesis validation.

## v14
## v14.0.0

This release's main features are utility helpers for smart contract developers. This release contains:

Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Contributions come in the form of writing documentation, raising issues / PRs, a

The first step is to find an issue you want to fix. To identify issues we think are good for first-time contributors, we add the **good first issue** label. [You can see a list of issues to contribute here](https://github.com/osmosis-labs/osmosis/contribute).

We recommend setting up your IDE as per our [recommended IDE setup](https://docs.osmosis.zone/developing/osmosis-core/ide-guide.html) before proceeding.
We recommend setting up your IDE as per our [recommended IDE setup](https://docs.osmosis.zone/osmosis-core/ide-guide) before proceeding.

If you have a feature request, please use the [feature-request repo](https://github.com/osmosis-labs/feature-requests). We also welcome you to [make an issue](https://github.com/osmosis-labs/osmosis/issues/new/choose) for anything of substance, or posting an issue if you want to work on it.

Expand Down Expand Up @@ -74,7 +74,7 @@ To simplify (and speed up) the process of writing unit tests that fit our standa

#### 1. Setup

Note: this section assumes you already have the Go plugin for Vscode installed. Please refer to our [IDE setup docs](https://docs.osmosis.zone/developing/osmosis-core/ide-guide.html) if you haven't done any IDE setup yet.
Note: this section assumes you already have the Go plugin for Vscode installed. Please refer to our [IDE setup docs](https:/docs.osmosis.zone/osmosis-core/ide-guide) if you haven't done any IDE setup yet.

Copy the `templates` folder into your `.vscode` folder from our main repo [here](https://github.com/osmosis-labs/osmosis/tree/main/.vscode). This folder has our custom templates for generating tests that fit our testing standards as accurately as possible.

Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ func (appKeepers *AppKeepers) InitNormalKeepers(
appKeepers.SuperfluidKeeper = superfluidkeeper.NewKeeper(
appKeepers.keys[superfluidtypes.StoreKey], appKeepers.GetSubspace(superfluidtypes.ModuleName),
*appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, appKeepers.DistrKeeper, appKeepers.EpochsKeeper, appKeepers.LockupKeeper, appKeepers.GAMMKeeper, appKeepers.IncentivesKeeper,
lockupkeeper.NewMsgServerImpl(appKeepers.LockupKeeper))
lockupkeeper.NewMsgServerImpl(appKeepers.LockupKeeper), appKeepers.ConcentratedLiquidityKeeper)

mintKeeper := mintkeeper.NewKeeper(
appKeepers.keys[minttypes.StoreKey],
Expand Down
1 change: 1 addition & 0 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func appModules(
app.LockupKeeper,
app.GAMMKeeper,
app.EpochsKeeper,
app.ConcentratedLiquidityKeeper,
),
tokenfactory.NewAppModule(*app.TokenFactoryKeeper, app.AccountKeeper, app.BankKeeper),
valsetprefmodule.NewAppModule(appCodec, *app.ValidatorSetPreferenceKeeper),
Expand Down
2 changes: 0 additions & 2 deletions proto/osmosis/gamm/pool-models/balancer/tx/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ message MsgMigrateSharesToFullRangeConcentratedPosition {
(gogoproto.moretags) = "yaml:\"shares_to_migrate\"",
(gogoproto.nullable) = false
];
// temporary field, eventually gamm pool should be linked to cl pool
uint64 pool_id_entering = 3;
}

message MsgMigrateSharesToFullRangeConcentratedPositionResponse {
Expand Down
34 changes: 34 additions & 0 deletions proto/osmosis/superfluid/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ service Msg {

rpc UnPoolWhitelistedPool(MsgUnPoolWhitelistedPool)
returns (MsgUnPoolWhitelistedPoolResponse);

rpc UnlockAndMigrateSharesToFullRangeConcentratedPosition(
MsgUnlockAndMigrateSharesToFullRangeConcentratedPosition)
returns (
MsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse);
}

message MsgSuperfluidDelegate {
Expand Down Expand Up @@ -103,3 +108,32 @@ message MsgUnPoolWhitelistedPool {
message MsgUnPoolWhitelistedPoolResponse {
repeated uint64 exited_lock_ids = 1;
}

// =====================
// MsgUnlockAndMigrateSharesToFullRangeConcentratedPosition
message MsgUnlockAndMigrateSharesToFullRangeConcentratedPosition {
string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ];
uint64 lock_id = 2 [ (gogoproto.moretags) = "yaml:\"lock_id\"" ];
cosmos.base.v1beta1.Coin shares_to_migrate = 3 [
(gogoproto.moretags) = "yaml:\"shares_to_migrate\"",
(gogoproto.nullable) = false
];
}

message MsgUnlockAndMigrateSharesToFullRangeConcentratedPositionResponse {
string amount0 = 1 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"amount0\"",
(gogoproto.nullable) = false
];
string amount1 = 2 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int",
(gogoproto.moretags) = "yaml:\"amount1\"",
(gogoproto.nullable) = false
];
string liquidity_created = 3 [
(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec",
(gogoproto.moretags) = "yaml:\"liquidity_created\"",
(gogoproto.nullable) = false
];
}
2 changes: 1 addition & 1 deletion simulation/simtypes/txbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (sim *SimCtx) defaultTxBuilder(
txConfig := params.MakeEncodingConfig().TxConfig // TODO: unhardcode
// TODO: Consider making a default tx builder that charges some random fees
// Low value for amount of work right now though.
fees := sdk.Coins{}
fees := sdk.NewCoins(sdk.NewInt64Coin(sdk.DefaultBondDenom, 25000))
tx, err := genTx(
txConfig,
[]sdk.Msg{msg},
Expand Down
26 changes: 26 additions & 0 deletions tests/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,32 @@ This section contains common "gotchas" that is sometimes very good to know when

To fix that, check the docker container and see if you node is working. Or remove all related container then rerun e2e test

3. Transaction fees.

Consensus min fee is set to "0.0025". This is how much is charged for 1 unit of gas. By default, we specify the gas limit
of `40000`. Therefore, each transaction should take `fee = 0.0025 uosmo / gas * 400000 gas = 1000 fee token.
The fee denom is set in `tests/e2e/initialization/config.go` by the value of `E2EFeeToken`.
See "Hermes Relayer - Consensus Min Fee" section for the relevant relayer configuration.

## Hermes Relayer

The configuration is built using the script in `tests/e2e/scripts/hermes_bootstrap.sh`

Repository: <https://github.dev/informalsystems/hermes>

### Consensus Min Fee

We set the following parameters Hermes configs to enable the consensus min fee in Osmosis:

- `gas_price` - Specifies the price per gas used of the fee to submit a transaction and
the denomination of the fee. The specified gas price should always be greater or equal to the `min-gas-price`
configured on the chain. This is to ensure that at least some minimal price is
paid for each unit of gas per transaction.
In Osmosis, we set consensus min fee = .0025 uosmo / gas * 400000 gas = 1000
See ConsensusMinFee in x/txfees/types/constants.go

- `default_gas` - the gas amount to use when simulation fails.

## Debugging

This section contains information about debugging osmosis's `e2e` tests.
Expand Down
Loading