Skip to content

Commit 67679c1

Browse files
maxwellgordonjjwill
authored andcommittedJan 8, 2020
LIB-204: Replace "\_" with "_" in code styled text
1 parent 1659766 commit 67679c1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed
 

‎website/blog/2020-01-08-how-gas-works-on-libra-blockchain.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Gas is a way to ensure that all programs terminate; it also provides the ability
2828

2929
### _What does gas look like for a developer?_
3030

31-
The transaction a client submits for execution contains a specified `max\_gas\_amount` and `gas\_price`. `max\_gas\_amount` is the maximum amount of gas that can be used to execute the transaction, and therefore it bounds the amount of computational resources that can be consumed by the transaction. `gas\_price` is a way to move from the abstract units of resource consumption that are used in the virtual machine (VM) — _gas units_ — into Libra. Consequently, the transaction submitter is guaranteed to be charged _at most_ `gas\_price \* max\_gas\_amount` (the "gas liability") for the execution of the transaction.
31+
The transaction a client submits for execution contains a specified `max_gas_amount` and `gas_price`. `max_gas_amount` is the maximum amount of gas that can be used to execute the transaction, and therefore it bounds the amount of computational resources that can be consumed by the transaction. `gas_price` is a way to move from the abstract units of resource consumption that are used in the virtual machine (VM) — _gas units_ — into Libra. Consequently, the transaction submitter is guaranteed to be charged _at most_ `gas_price \* max_gas_amount` (the "gas liability") for the execution of the transaction.
3232

3333
### Similarities with other blockchains
3434

@@ -68,9 +68,9 @@ Note in the diagram that both the prologue and epilogue sections are marked in r
6868

6969
- The epilogue is in part responsible for debiting the execution fee from the sending account and distributing it [1]. Because of this, the epilogue must run even if the transaction execution has run out of gas. Likewise, we don't want it to run out of gas while debiting the transaction sender's account as this would cause additional computation to be performed without any transaction fee being charged.
7070

71-
Taken together, this non-metering of both the prologue and epilogue requires the `MIN\_TXN\_FEE` to be enough to cover the average cost of running both. This is fairly straightforward to determine since metering must be deterministic and since both of these are relatively simple pieces of code that don't perform any complex operations.
71+
Taken together, this non-metering of both the prologue and epilogue requires the `MIN_TXN_FEE` to be enough to cover the average cost of running both. This is fairly straightforward to determine since metering must be deterministic and since both of these are relatively simple pieces of code that don't perform any complex operations.
7272

73-
After the prologue has run and we've checked in part that the account can cover its gas liability, the rest of the transaction flow starts with the "gas tank" full at `max\_gas\_amount`. The `MIN\_TXN\_FEE` is charged, after which the gas tank is then deducted (or "charged") for each instruction executed by the VM. This per-instruction deduction continues until either (1) the execution of the transaction has completed — in which case, the epilogue is run and the execution fee deducted — or (2) the "gas tank" becomes empty, in which case an `OutOfGas` error is raised. In the former, the fee is distributed and the result of the transaction is persisted. The latter causes the execution of the transaction to stop when the error is raised, following which the total gas liability of the transaction is deducted and distributed. No other remnants of the execution are persisted other than the deduction in this case [2].
73+
After the prologue has run and we've checked in part that the account can cover its gas liability, the rest of the transaction flow starts with the "gas tank" full at `max_gas_amount`. The `MIN_TXN_FEE` is charged, after which the gas tank is then deducted (or "charged") for each instruction executed by the VM. This per-instruction deduction continues until either (1) the execution of the transaction has completed — in which case, the epilogue is run and the execution fee deducted — or (2) the "gas tank" becomes empty, in which case an `OutOfGas` error is raised. In the former, the fee is distributed and the result of the transaction is persisted. The latter causes the execution of the transaction to stop when the error is raised, following which the total gas liability of the transaction is deducted and distributed. No other remnants of the execution are persisted other than the deduction in this case [2].
7474

7575
## Wrapping things up
7676

0 commit comments

Comments
 (0)
Please sign in to comment.