WIP: Propose the gas system for mutation and query session
DB3 is an open-source decentralized firebase firestore alternative.
Brought to you by:
xutweety
Originally created by: imotai
Originally owned by: jingchen2222
Originally posted by: jingchen2222
Concept of Gas and Fee
Gas
The concept of Gas represents the amount of computational effort required to execute specific operations on the state machine.
Gas is used to track the resource usage of operations during the execution
GasMeter
GasMeter: keeps track of the gas consumed during executions that lead to state transitions. It is reset on every transaction execution.
BlockGasMeter
BlockGasMeter: keeps track of the gas consumed in a block and enforces that the gas does not go over a predefined limit. This limit is defined in the Tendermint consensus parameters and can be changed via governance parameter change proposals.
why we need gas fee
Gas is used to evaluate the estimation effort or resource required to execute transactions, including read, write and computation.
EIP Gas Fee Model
EIP 1599
https://eips.ethereum.org/EIPS/eip-1559
How to estimate gas for mutation and query
In this section, we are looking into ways to evaluate mutation and query.
https://ethereum.org/en/developers/docs/evm/opcodes/
Mutation gas
Regarding mutation, we are considering proposing a gas formula as shown below:
Query gas
BlockGasMeter
It is necessary to set up a limit on the maximum gas for each block so that we can guarantee every node can finish the execution with the given minimum configuration.
Block Gas Check
Reference