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

feat!: Introduce feemarket module #3028

Merged
merged 32 commits into from
Jun 18, 2024
Merged

feat!: Introduce feemarket module #3028

merged 32 commits into from
Jun 18, 2024

Conversation

stana-miric
Copy link
Contributor

@stana-miric stana-miric commented Mar 27, 2024

Description

Note: This is a new PR description written by @dusan-maksimovic after the latest changes were made by @stana-miric and myself.

This PR includes:

  1. Integration of the feemarket module
  2. Removal of auth module's DeductFeeDecorator from the app (replaced by the feemarket)
  3. Removal of globalfee module from the app (also replaced by the feemarket)

The main changes are in "ante" and "app" directories, and other changes are removal of globalfee module and fixing of failing tests.

Currently, we are targeting the latest feemarket commit on SDK 47. Once Skip creates a new release for SDK 47, we should target that tag instead.

Feemarket module is configured in following way:

  • BaseFee (minimal allowed, as well as the initial value) = 0.005uatom, which is the current min gas price on the mainnet that is enforced by the globalfee module
  • DistributeFees = true, which means that tx fees will not be burned (which is the default EIP-1559 implementation), but they would instead be sent to the fee collector and later distributed to validators and delegators, as it was the case before the feemarket was introduced. Also, feemarket will send some amount of tx fees to the block proposer, if the tx sender decided to pay fees above the minimal required base fee amount
  • MaxBlockUtilization = 100000000, which is the current max block gas, as per this proposal
  • TargetBlockUtilization = 50000000, 50% of MaxBlockUtilization which means the base fee will start increasing once the block gas consumptions exceeds 50% of the block gas limit

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • Included the correct type prefix in the PR title
  • Added ! to the type prefix if API, client, or state breaking change (i.e., requires minor or major version bump)
  • Targeted the correct branch (see PR Targeting)
  • Provided a link to the relevant issue or specification
  • Followed the guidelines for building SDK modules
  • Included the necessary unit and integration tests
  • Added a changelog entry in .changelog (for details, see contributing guidelines)
  • Included comments for documenting Go code
  • Updated the relevant documentation or specification
  • Reviewed "Files changed" and left comments if necessary
  • Confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage

tests/integration/test_utils.go Dismissed Show resolved Hide resolved
tests/integration/test_utils.go Dismissed Show resolved Hide resolved
@dusan-maksimovic dusan-maksimovic force-pushed the blocksdk-fee-market branch 2 times, most recently from b0a7667 to 89d57b3 Compare May 27, 2024 13:36
stana-miric and others added 15 commits May 31, 2024 12:21
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Stana Miric <stana.miric@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Dusan Maksimovic <dusan.maksimovic@ethernal.tech>
Co-authored-by: Stana Miric <stana.miric@ethernal.tech>
Co-authored-by: Stana Miric <stana.miric@ethernal.tech>
@dusan-maksimovic dusan-maksimovic changed the title feat!: Introduce skip block sdk and fee market module feat!: Introduce feemarket module May 31, 2024
@@ -230,9 +230,15 @@ replace (
// Use special SDK v0.47.x release with support for both ICS and LSM
github.com/cosmos/cosmos-sdk => github.com/cosmos/cosmos-sdk v0.47.13-ics-lsm

github.com/cosmos/gogoproto => github.com/cosmos/gogoproto v1.4.10
Copy link
Contributor

Choose a reason for hiding this comment

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

These three new replacement directives are due to the feemarket module bumping this dependencies, after which Gaia stopped compiling, so we had to revert to previous versions.

)

// UseFeeMarketDecorator to make the integration testing easier: we can switch off its ante and post decorators with this flag
Copy link
Contributor

@dusan-maksimovic dusan-maksimovic May 31, 2024

Choose a reason for hiding this comment

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

This is a workaround to make the integration tests based on IBC testing framework work without the need to override the SendMsgs() function, since this would also require changes to the ICS repository to modify the CCVTestSuite. The only thing we would need to override is to specify the tx fees, which is not essential for these tests, so we decided not to do it. Also, our non-determinism tests were failing because the tx fees are not provided, and we are unable to provide the tx fees to the framework used, so we opted for this work-around. For the override of the SendMsgs() see the FeeMarketTestSuite.

@dusan-maksimovic dusan-maksimovic marked this pull request as ready for review May 31, 2024 12:52
tests/e2e/e2e_bank_test.go Outdated Show resolved Hide resolved
tests/e2e/e2e_distribution_test.go Outdated Show resolved Hide resolved
app/app.go Outdated Show resolved Hide resolved
@p-offtermatt
Copy link
Contributor

As commented on Slack, I think we should have a fallback for when the feemarket is disabled, e.g. via governance

gas_price = { price = 0.00001, denom = 'uatom' }
gas_multiplier = 1.2
gas_price = { price = 0.005, denom = 'uatom' }
gas_multiplier = 2
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO: revert this value to 1.2 (in all 4 places) once the gas estimation is fixed in the feemarket module and we upgrade to a new version

Copy link
Contributor

Choose a reason for hiding this comment

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

We need to add the dynamic fees for hermes. I think that will fix the high gas_multiplier.

https://hermes.informal.systems/documentation/configuration/dynamic-gas-fees.html

@dusan-maksimovic
Copy link
Contributor

@p-offtermatt Skip team already implemented a fallback to alternative (arbitrary) decorator, so I just provided the auth modules' DeductFeesDecorator and introduced minTxFeesChecker instead of noOpTxChecker to enforce the minimum fees if the feemarket is disabled.

Copy link
Contributor

@p-offtermatt p-offtermatt left a comment

Choose a reason for hiding this comment

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

LGTM. I looked mostly at the params.
From experimenting a bit, it seems an arbitrary 1000 block range of usual activity on the hub would need to have ~30 times bigger usage to actually make the price consistently higher than the base.

I didn't look as closely at the wiring, but just in terms of configuration of the feemarket, I think it's good.

Copy link
Contributor

@MSalopek MSalopek left a comment

Choose a reason for hiding this comment

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

E2E were updated, globalfee was removed and feemarket was integrated.

Any patches to the feemarket (if needed) will be reflected in a different PRs.

Copy link
Contributor

@mpoke mpoke left a comment

Choose a reason for hiding this comment

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

Great work. See my comments below.

.changelog/unreleased/features/3028-add-feemarket Outdated Show resolved Hide resolved
.changelog/unreleased/state-breaking/3028-add-feemarket Outdated Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

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

Add one more changelog entry under api-breaking. Removing the globalfee module breaks the API, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Added.

@@ -21,7 +21,7 @@ BUILDDIR ?= $(CURDIR)/build
TEST_DOCKER_REPO=cosmos/contrib-gaiatest

GO_SYSTEM_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1-2)
REQUIRE_GO_VERSION = 1.21
REQUIRE_GO_VERSION = 1.22
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to bump the go version? If so, please add a changelog entry.

Copy link
Contributor

@MSalopek MSalopek Jun 18, 2024

Choose a reason for hiding this comment

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

Yes.

Added changelog.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this file duplicated?

Copy link
Contributor

Choose a reason for hiding this comment

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

It has existed before this PR. Hence, not relevant here. It can be removed in a different PR.

Comment on lines +43 to +45
params.DistributeFees = true
params.MinBaseGasPrice = sdk.MustNewDecFromStr("0.005")
params.MaxBlockUtilization = 100000000
Copy link
Contributor

@mpoke mpoke Jun 18, 2024

Choose a reason for hiding this comment

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

Are these params as discussed with Philip?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes.

Also, these are the current network params.

MSalopek and others added 3 commits June 18, 2024 13:28
Co-authored-by: Marius Poke <marius.poke@posteo.de>
Co-authored-by: Marius Poke <marius.poke@posteo.de>
@MSalopek MSalopek merged commit 2758025 into main Jun 18, 2024
17 checks passed
@MSalopek MSalopek deleted the blocksdk-fee-market branch June 18, 2024 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants