cosmos / cosmos-sdk

:chains: A Framework for Building High Value Public Blockchains :sparkles:
https://cosmos.network/
Apache License 2.0
6.27k stars 3.63k forks source link

Add in protocol min gas price #12269

Closed robert-zaremba closed 2 years ago

robert-zaremba commented 2 years ago

Summary

Last year we had many discussions about gas price problems and a need for solid fee market model

Problem Definition

Chains need a more robust way to define minimum gas price to better protect against network spam. We agree that the ultimate solution will be something like eip1559. But nobody is building it so far, and everyone has other priorities until they will see a fire. Crypto.com takes more responsible approach and contributed with the multi-layer gas fee proposal. Tgrade implemented what we were proposing a short term solution: gov controlled min gas price. It seams Gaia team is looking to do it as well.

Proposal

Implement gov controlled min gas price. We need to decide how this will be handled:

  1. new gov param
  2. new message in x/auth

Personally I prefer the first one, unless we are really deprecating params and moving away from them.

This will be implemented as antehandler unless we take other directions on how "middlewares" will evolve next.

We can reuse one of:

Related


For Admin Use

alexanderbez commented 2 years ago

We just need to bring over https://github.com/cosmos/gaia/tree/yaru/rho-glob-fee/x/globalfee or the TGrade implementation. I don't see a need to re-invent the wheel.

alexanderbez commented 2 years ago

Also, this seems to be a duplicate of the original global min fee issue I wrote, which @marbar3778 closed in favor of your issue https://github.com/cosmos/cosmos-sdk/issues/8917, which I personally think is too broad in scope and should be closed with more concrete proposals.

robert-zaremba commented 2 years ago

oh, https://github.com/cosmos/cosmos-sdk/issues/8917 is a meta issue.

Where is your original issue? I don't see it mentioned in #8917 ...unless you are think about #4527

We just need to bring ...

Sure! Let's decide. How about using the Gaia implementation?

alexanderbez commented 2 years ago

Yes https://github.com/cosmos/cosmos-sdk/issues/4527. I think we should just adopt what Gaia has IMO as a versioned module ;)

robert-zaremba commented 2 years ago

OK, I can handle that. IMO https://github.com/cosmos/cosmos-sdk/issues/4527 is different than this task.

tac0turtle commented 2 years ago

im not sure if this should be a module, I was thinking it could be a base app param, that if an app wants to use they can set to > 0.

robert-zaremba commented 2 years ago

That was the original idea: to use the param, but I think we want to go to module owned logic.

robert-zaremba commented 2 years ago

@alexanderbez it looks that @yaruwangway used the TGrade solution in Gaia.

The provenance solution is more complex. They have a mechanism to assess additional fees for every possible message type and smart contract. TGrade does what we need. Question is if we want to handle it through new module or bundle it in an existing module.

alexanderbez commented 2 years ago

Sorry! I never meant to mention Provenance -- I meant TGrade the entire time (I got the two mixed up) :)

Yes, Gaia already uses the TGrade approach (a simple module). I think they modified it slightly? Is that true @yaruwangway?

In any case, I would say get that module into the SDK and we can call it a day. It's extremely simple and addresses users needs. I don't think this needs to exist in BaseApp @marbar3778.

robert-zaremba commented 2 years ago

I'm rebuilding that module in Umee to:

  1. Use gov execution
  2. Use the latest module structure
yaruwangway commented 2 years ago

@alexanderbez , sry for the late reply.(was on holiday). gaia will introduce global fee and we plan to propose the global fee by gov proposal later. It is same module as tgrade. except we will still let global fee to bypass some configured msg types.

alexanderbez commented 2 years ago

Got it. I think we should bring this module into the SDK and sub-module version it.

cc @marbar3778

I would close this issue and open a new one that states we will integrate or bring in the Tgrade module.

yaruwangway commented 2 years ago

could we also allow bypass fees like https://github.com/cosmos/gaia/pull/1447/files ? for both global fee and the node's min_gas setup in app.toml

robert-zaremba commented 2 years ago

so these are two different features. I think we should do it separately but in the same module.

alexanderbez commented 2 years ago

Message filtering is app specific -- that wouldn't belong in the SDK. If we want, we can add a no-op/empty list message filter ante handler decorator that apps can use to extend.

alexanderbez commented 2 years ago

I'm closing this issue. The hub already introduced a min-fee mechanism via x/globalfee, which is based off of the work done in TGrade.

If we deem it necessary, we can simply just include that module in the SDK.