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

Consensus min gas fee of .0025 uosmo #4244

Merged
merged 25 commits into from
Feb 16, 2023
Merged

Conversation

ValarDragon
Copy link
Member

Cref #3320 , does the raw osmo amount component, not the TWAP.

What is the purpose of the change

Implements a consensus min gas fee of .0025 uosmo / gas. The mempool policy is set to max(localMempoolPolicy, Consensus minimum)

This consensus minimum is not being exposed as a governance parameter right now, as it seems far more effective to get to adaptive, demand based fee markets (ala EIP-1559).

Brief Changelog

Testing and Verifying

I've updated the existing test vectors to account for the consensus minimum, which includes adapting no fee and sub-consensus minimum test vectors to fail. Furthermore this PR refactors the test vector setup to be more succinct. (Removing extraneous fields, and using a for loop to combine Check and Deliver)

Documentation and Release Note

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

@ValarDragon ValarDragon added the V:state/breaking State machine breaking PR label Feb 7, 2023
Comment on lines -99 to -135
name: "doesn't work with not enough converted fee in checktx",
txFee: sdk.NewCoins(sdk.NewInt64Coin(uion, 1)),
minGasPrices: sdk.NewDecCoins(sdk.NewDecCoinFromDec(baseDenom,
sdk.MustNewDecFromStr("0.1"))),
gasRequested: 10000,
isCheckTx: true,
expectPass: false,
baseDenomGas: false,
},
{
name: "works with not enough converted fee in delivertx",
txFee: sdk.NewCoins(sdk.NewInt64Coin(uion, 1)),
minGasPrices: sdk.NewDecCoins(sdk.NewDecCoinFromDec(baseDenom,
sdk.MustNewDecFromStr("0.1"))),
gasRequested: 10000,
isCheckTx: false,
expectPass: true,
baseDenomGas: false,
},
{
name: "multiple fee coins - checktx",
txFee: sdk.NewCoins(sdk.NewInt64Coin(baseDenom, 1), sdk.NewInt64Coin(uion, 1)),
minGasPrices: sdk.NewDecCoins(),
gasRequested: 10000,
isCheckTx: true,
expectPass: false,
baseDenomGas: false,
},
{
name: "multiple fee coins - delivertx",
txFee: sdk.NewCoins(sdk.NewInt64Coin(baseDenom, 1), sdk.NewInt64Coin(uion, 1)),
minGasPrices: sdk.NewDecCoins(),
gasRequested: 10000,
isCheckTx: false,
expectPass: false,
baseDenomGas: false,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to be deduplicated across check/deliver

expectPass: true,
baseDenomGas: true,
isCheckTx: true,
expectPass: true,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deduplicated above

Comment on lines -40 to -57
{
name: "no min gas price - checktx",
txFee: sdk.NewCoins(),
minGasPrices: sdk.NewDecCoins(),
gasRequested: 10000,
isCheckTx: true,
expectPass: true,
baseDenomGas: true,
},
{
name: "no min gas price - delivertx",
txFee: sdk.NewCoins(),
minGasPrices: sdk.NewDecCoins(),
gasRequested: 10000,
isCheckTx: false,
expectPass: true,
baseDenomGas: true,
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to be consensus min gas failure tests.

Comment on lines +195 to +197
if tc.txFee[0].Denom != baseDenom {
moduleName = types.NonNativeFeeCollectorName
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Base denom gas was an unnecessary field, its role is automated with this if statement.

@ValarDragon
Copy link
Member Author

ValarDragon commented Feb 7, 2023

The failure in go tests is that our ibc-hooks tests use ibctesting. Ibctesting uses 0 fees in its tests, right here: https://github.com/cosmos/ibc-go/blob/v4.3.0/testing/chain.go#L312-L322

@github-actions github-actions bot added the C:simulator Edits simulator or simulations label Feb 8, 2023
Copy link
Member

@mattverse mattverse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🌮

x/txfees/keeper/feedecorator_test.go Show resolved Hide resolved
x/txfees/keeper/feedecorator_test.go Outdated Show resolved Hide resolved
x/txfees/keeper/feedecorator_test.go Outdated Show resolved Hide resolved
x/txfees/types/constants.go Show resolved Hide resolved
@ValarDragon ValarDragon added the A:backport/v15.x backport patches to v15.x branch label Feb 8, 2023
Comment on lines +365 to +386
// setup fee pool, between "e2e_default_fee_token" and "uosmo"
feePoolParams := balancer.NewPoolParams(sdk.MustNewDecFromStr("0.01"), sdk.ZeroDec(), nil)
feePoolAssets := []balancer.PoolAsset{
{
Weight: sdk.NewInt(100),
Token: sdk.NewCoin("uosmo", sdk.NewInt(100000000000)),
},
{
Weight: sdk.NewInt(100),
Token: sdk.NewCoin(E2EFeeToken, sdk.NewInt(100000000000)),
},
}
pool1, err := balancer.NewBalancerPool(1, feePoolParams, feePoolAssets, "", time.Unix(0, 0))
if err != nil {
panic(err)
}
anyPool, err := types1.NewAnyWithValue(&pool1)
if err != nil {
panic(err)
}
gammGenState.Pools = []*types1.Any{anyPool}
gammGenState.NextPoolNumber = 2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this and instead re-create this via CLI?

This interferes with pool IDs that we are creating via CLI

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two questions:

  • Why does it interfere?
  • Where do I do it in CLI such that it comes first? It needs to be first so that other txs can pay fees, and we'd have to make distinct custom methods for paying fees to set this up.

Copy link
Member

@p0mvn p0mvn Feb 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The reason is that we also create pre-upgrade pools as a result the pool id of 1 is already assigned after upgrade. It is possible to work around this by first making a separate PR to v14 genesis.

  2. Makes sense. I will work around number 1 then and make the changes to v14 before main

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, for 2, it should be possible to create a pool with the fee via pool file, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pool file doesn't contain the tx fee. (Adding something custom for the tx fee for initialization isn't really a big deal. It just has to come first, if you point me to where I do that, I can add it in relatively easily)

@@ -127,7 +128,7 @@ func (n *NodeConfig) SendIBCTransfer(from, recipient, amount, memo string) {

cmd := []string{"osmosisd", "tx", "ibc-transfer", "transfer", "transfer", "channel-0", recipient, amount, fmt.Sprintf("--from=%s", from), "--memo", memo}

_, _, err := n.containerManager.ExecTxCmdWithSuccessString(n.t, n.chainId, n.Name, cmd, "code: 0")
_, _, err := n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this done?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a driveby change to get the execution stack to have one entry point. (At the time I did this line, I thought I'd do the gas if statement in this method, ended up not doing that)

So can be reverted, but looks identical to the ExecTxCmd as far as I can tell?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I think this is fine, was getting sidetracked by this but the change LGTM now.

I think I found the main problem. Should have the fix soon

* chore(e2e): update init image on main for #4244

* changes

* fix more problems

* more fixes

* lint

* twap gebug logs

* arithmetic fix

* skip twap test

* link issue
@github-actions github-actions bot added the C:docs Improvements or additions to documentation label Feb 16, 2023
@p0mvn
Copy link
Member

p0mvn commented Feb 16, 2023

I think we can disable geometric TWAP as well. These are likely related. I'm still investigating separately

@ValarDragon ValarDragon merged commit 05fda4d into main Feb 16, 2023
@ValarDragon ValarDragon deleted the dev/consensus_min_gas_fee branch February 16, 2023 14:32
mergify bot pushed a commit that referenced this pull request Feb 16, 2023
* Refactor tests a bit

* Add consensus min gas fee

* Fix tests

* Delete more crud

* Cleanup more duplicate test cases

* flip isCheckTx sign

* One more test needed

* Run invalid fee denom test across both check & deliver

* Remove extra line

* Add hack to get around txfee problem in ibctesting

* Handle genesis

* Minor code cleanup

* tryfix simulation

* Fix for legacy simulator

* Update x/txfees/keeper/feedecorator_test.go

Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>

* Apply matt comments

* See what happens by adding fees

* Add genesis logic update

* Try fixing e2e

* Add some better logging to find error

* remove stat, fix typo

* fix(e2e): fix e2e test for consensus min gas fee #4244 (#4317)

* chore(e2e): update init image on main for #4244

* changes

* fix more problems

* more fixes

* lint

* twap gebug logs

* arithmetic fix

* skip twap test

* link issue

* Temp disable geo twap E2E

---------

Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>
Co-authored-by: Roman <roman@osmosis.team>
(cherry picked from commit 05fda4d)
ValarDragon added a commit that referenced this pull request Feb 16, 2023
* Refactor tests a bit

* Add consensus min gas fee

* Fix tests

* Delete more crud

* Cleanup more duplicate test cases

* flip isCheckTx sign

* One more test needed

* Run invalid fee denom test across both check & deliver

* Remove extra line

* Add hack to get around txfee problem in ibctesting

* Handle genesis

* Minor code cleanup

* tryfix simulation

* Fix for legacy simulator

* Update x/txfees/keeper/feedecorator_test.go

Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>

* Apply matt comments

* See what happens by adding fees

* Add genesis logic update

* Try fixing e2e

* Add some better logging to find error

* remove stat, fix typo

* fix(e2e): fix e2e test for consensus min gas fee #4244 (#4317)

* chore(e2e): update init image on main for #4244

* changes

* fix more problems

* more fixes

* lint

* twap gebug logs

* arithmetic fix

* skip twap test

* link issue

* Temp disable geo twap E2E

---------

Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>
Co-authored-by: Roman <roman@osmosis.team>
(cherry picked from commit 05fda4d)

Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
pysel pushed a commit that referenced this pull request Feb 18, 2023
* Refactor tests a bit

* Add consensus min gas fee

* Fix tests

* Delete more crud

* Cleanup more duplicate test cases

* flip isCheckTx sign

* One more test needed

* Run invalid fee denom test across both check & deliver

* Remove extra line

* Add hack to get around txfee problem in ibctesting

* Handle genesis

* Minor code cleanup

* tryfix simulation

* Fix for legacy simulator

* Update x/txfees/keeper/feedecorator_test.go

Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>

* Apply matt comments

* See what happens by adding fees

* Add genesis logic update

* Try fixing e2e

* Add some better logging to find error

* remove stat, fix typo

* fix(e2e): fix e2e test for consensus min gas fee #4244 (#4317)

* chore(e2e): update init image on main for #4244

* changes

* fix more problems

* more fixes

* lint

* twap gebug logs

* arithmetic fix

* skip twap test

* link issue

* Temp disable geo twap E2E

---------

Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>
Co-authored-by: Roman <roman@osmosis.team>
pysel pushed a commit that referenced this pull request Feb 21, 2023
* Refactor tests a bit

* Add consensus min gas fee

* Fix tests

* Delete more crud

* Cleanup more duplicate test cases

* flip isCheckTx sign

* One more test needed

* Run invalid fee denom test across both check & deliver

* Remove extra line

* Add hack to get around txfee problem in ibctesting

* Handle genesis

* Minor code cleanup

* tryfix simulation

* Fix for legacy simulator

* Update x/txfees/keeper/feedecorator_test.go

Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>

* Apply matt comments

* See what happens by adding fees

* Add genesis logic update

* Try fixing e2e

* Add some better logging to find error

* remove stat, fix typo

* fix(e2e): fix e2e test for consensus min gas fee #4244 (#4317)

* chore(e2e): update init image on main for #4244

* changes

* fix more problems

* more fixes

* lint

* twap gebug logs

* arithmetic fix

* skip twap test

* link issue

* Temp disable geo twap E2E

---------

Co-authored-by: Matt, Park <45252226+mattverse@users.noreply.github.com>
Co-authored-by: Roman <roman@osmosis.team>
@github-actions github-actions bot mentioned this pull request Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:backport/v15.x backport patches to v15.x branch C:docs Improvements or additions to documentation C:simulator Edits simulator or simulations C:x/txfees V:state/breaking State machine breaking PR
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants