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

clarify gas metering #59

Closed
liamsi opened this issue Mar 20, 2021 · 4 comments
Closed

clarify gas metering #59

liamsi opened this issue Mar 20, 2021 · 4 comments

Comments

@liamsi
Copy link
Member

liamsi commented Mar 20, 2021

Summary

Clarify how to meter for gas for messages and state-relevant Txs too.

Context

Dropping some raw notes from discussions we had:

Transaction cost metering should only be based on bytes .
potenial workarounds: implicitly set gas limit to infinity (maybe not infinity, maybe use gas used purely for byte cost). This means no need for gas limit field in tx.

Some context:
In the SDK applications can define gas metering as they please.

Here is an example of metering based on bytes: https://github.com/cosmos/cosmos-sdk/blob/eb8aaf939513d3bf6e82bd13691cfbe9ef4ad28c/x/auth/ante/basic.go#L88-L95

more docs:
https://docs.cosmos.network/master/basics/gas-fees.html#block-gas-meter
and the AnteHandler: https://docs.cosmos.network/master/basics/gas-fees.html#antehandler

Timeline / Action Items

Note the implementation can happen for the incentivized testnet but we should definitely "de-risk" this earlier, i.e. we should start looking into what exact changes will be necessary certainly before the test-net milsetone.

@adlerjohn
Copy link
Member

Extra info: If you set the gas per all ops to 0 and the gas per byte to 1 gas per byte, then you exactly have metering per byte.

In terms on gas limit, the implicit gas limit should be the deterministic gas cost of a tx, not infinity. If it's infinity, accounts won't have sufficient balance to pay fees and the txs will be invalid. Of course, this point depends on where the implicit gas limit is injected; if after the validity checks then there's less of an issue.

@evan-forbes
Copy link
Member

evan-forbes commented Aug 5, 2021

The example mentioned is the default that we're using, so gas is determined strictly per byte basis. Unless we add some additional operational gas cost, that will be zero too. What the default mechanism doesn't account for, is that we process messages before calling the function that deducts gas during DeliverTx. We only have to add another anteHandler to account for the message's size.

@evan-forbes
Copy link
Member

I think we can close with after #397

@evan-forbes
Copy link
Member

we also have our resource pricing specs https://github.com/celestiaorg/celestia-app/blob/main/specs/src/specs/resource_pricing.md so this feels safe to close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

No branches or pull requests

3 participants