Skip to content

Commit

Permalink
Merge branch 'main' into roman/e2e-twap-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
p0mvn committed Feb 16, 2023
2 parents 401df5c + 05fda4d commit 4ccc2e3
Show file tree
Hide file tree
Showing 50 changed files with 1,970 additions and 417 deletions.
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
];
}
5 changes: 5 additions & 0 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,9 @@ func (s *IntegrationTestSuite) TestAddToExistingLock() {
// because twap keep time = epoch time / 4 and we use a timer
// to wait for at least the twap keep time.
func (s *IntegrationTestSuite) TestArithmeticTWAP() {

s.T().Skip("TODO: investigate further: https://github.com/osmosis-labs/osmosis/issues/4342")

const (
poolFile = "nativeDenomThreeAssetPool.json"
walletName = "arithmetic-twap-wallet"
Expand Down Expand Up @@ -859,6 +862,8 @@ func (s *IntegrationTestSuite) TestExpeditedProposals() {
// Upon swapping 1_000_000 uosmo for stake, supply changes, making uosmo less expensive.
// As a result of the swap, twap changes to 0.5.
func (s *IntegrationTestSuite) TestGeometricTWAP() {
s.T().Skip("TODO: investigate further: https://github.com/osmosis-labs/osmosis/issues/4342")

const (
// This pool contains 1_000_000 uosmo and 2_000_000 stake.
// Equals weights.
Expand Down
7 changes: 6 additions & 1 deletion x/concentrated-liquidity/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,12 @@ We will use the following terms throughout the document:

- `Tick` - TODO

- `Position` - TODO
- `FullPosition` - A single user's liquidity in a single pool spread out between two ticks with a frozenUntil timestamp. Unlike Position, FullPosition can
only describe a single instance of liquidity. If a user adds liquidity to the same pool between the same two ticks, but with a different frozenUntil timestamp, then it will be a different FullPosition.

- `Position` - A single user's liquidity in a single pool spread out between two ticks. Unlike FullPosition, position does not
take into consideration the frozenUntil timestamp. Therefore, a position can describe multiple instances of liquidity
between the same two ticks in the same pool, but with different frozenUntil timestamps.

- `Range` - TODO

Expand Down
8 changes: 5 additions & 3 deletions x/concentrated-liquidity/clmodule/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ func (am AppModule) GenerateGenesisState(simState *module.SimulationState, s *si
func (am AppModule) Actions() []simtypes.Action {
return []simtypes.Action{
simtypes.NewMsgBasedAction("CreateConcentratedPool", am.keeper, simulation.RandomMsgCreateConcentratedPool),
// simtypes.NewMsgBasedAction("CreatePosition", am.keeper, simulation.RandMsgCreatePosition),
// simtypes.NewMsgBasedAction("WithdrawPosition", am.keeper, simulation.RandMsgWithdrawPosition),
// simtypes.NewMsgBasedAction("CollectFees", am.keeper, simulation.RandMsgCollectFees),
simtypes.NewMsgBasedAction("CreatePosition", am.keeper, simulation.RandMsgCreatePosition),
//simtypes.NewMsgBasedAction("CLSwapExactAmountIn", am.keeper, simulation.RandomSwapExactAmountIn),
//simtypes.NewMsgBasedAction("CLSwapExactAmountOut", am.keeper, simulation.RandomSwapExactAmountOut),
simtypes.NewMsgBasedAction("WithdrawPosition", am.keeper, simulation.RandMsgWithdrawPosition),
simtypes.NewMsgBasedAction("CollectFees", am.keeper, simulation.RandMsgCollectFees),
}
}
4 changes: 4 additions & 0 deletions x/concentrated-liquidity/export_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ func (k Keeper) ChargeFee(ctx sdk.Context, poolId uint64, feeUpdate sdk.DecCoin)
return k.chargeFee(ctx, poolId, feeUpdate)
}

func ValidateTickInRangeIsValid(tickSpacing uint64, exponentAtPriceOne sdk.Int, lowerTick int64, upperTick int64) error {
return validateTickRangeIsValid(tickSpacing, exponentAtPriceOne, lowerTick, upperTick)
}

func FormatPositionAccumulatorKey(poolId uint64, owner sdk.AccAddress, lowerTick, upperTick int64) string {
return formatFeePositionAccumulatorKey(poolId, owner, lowerTick, upperTick)
}
Expand Down
Loading

0 comments on commit 4ccc2e3

Please sign in to comment.