-
Notifications
You must be signed in to change notification settings - Fork 281
EVM
EVM in Opera works the same way as in Ethereum with the following exceptions:
- 10% of unspent gas gets spent as a disincentive to militate against excessive transaction gas limits (see examples below) [^1]
- Transactions in blocks aren't necessarily sorted by gas price. Even though transactions in each event and in the txpool are sorted by gas price, events are sorted by their topological ordering in the DAG. A new block includes transactions from multiple confirmed events in that topological order. [^2]
- Berlin and London upgrades are supported only in public testnet but not mainnet yet.
[^1] The disincentive is required because Fantom is leaderless decentralized aBFT and blocks are not known in advance to a validator (unlike Ethereum miner) until blocks are created from confirmed events. There is no single proposer who originated transactions for a block and so validator doesn't know in advance how much gas will be spent by a transaction, this is different from Ethereum and so adjustments were made to address this issue. The penalty (10% charge of unspent gas) is introduced to avoid many of such cases.
[^2] This is due to the usage of our Lachesis -- a DAG aBFT consensus algorithm.
Case with perfect gas limit:
- Transaction gas limit is
500000
, and it used500000
for its execution. Finalgas used
is500000
. Penalty is 0%.
Case with normal gas limit:
- Transaction gas limit is
500000
, and it used490000
for its execution. Finalgas used
is490000+(500000−490000)×0,1 = 491000
. Penalty is 0.2%.
Case with excessive gas limit:
- Transaction gas limit is
500000
, and it used21000
for its execution. Finalgas used
is21000+(500000−21000)×0,1 = 68900
. Penalty is 228%.
The gas limit returned by MetaMask is sometimes much larger than needed for a transaction. It could be due to the estimate from the application API that connect to MetaMask, so you'd better to double check your transaction's requirement. To avoid penalty for excessive gas limit, make sure you specify a suitable gas limit amount.