Skip to content

Commit

Permalink
add comment about effective gas price of dynamic fee tx
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Jul 22, 2024
1 parent 4a028af commit 1b8fda7
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions indexer/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ func (e *EVMIndexerImpl) ListenFinalizeBlock(ctx context.Context, req abci.Reque
batch := e.db.NewBatch()
defer batch.Close()

// compute base fee from the opChild gas prices
baseFee, err := e.baseFee(ctx)
if err != nil {
e.logger.Error("failed to get base fee", "err", err)
return err
}

txIndex := uint(0)
cumulativeGasUsed := uint64(0)
ethTxs := make([]*coretypes.Transaction, 0, len(req.Txs))
Expand Down Expand Up @@ -81,6 +88,11 @@ func (e *EVMIndexerImpl) ListenFinalizeBlock(ctx context.Context, req abci.Reque
EffectiveGasPrice: ethTx.GasPrice(),
}

// currently we do not support fee refund, so the effective gas price is the same as the gas price
// if ethTx.Type() == coretypes.DynamicFeeTxType {
// receipt.EffectiveGasPrice = new(big.Int).Add(ethTx.EffectiveGasTipValue(baseFee.ToInt()), baseFee.ToInt())
// }

// fill in contract address if it's a contract creation
if contractAddr != nil {
receipt.ContractAddress = *contractAddr
Expand All @@ -93,13 +105,6 @@ func (e *EVMIndexerImpl) ListenFinalizeBlock(ctx context.Context, req abci.Reque
blockGasMeter := sdkCtx.BlockGasMeter()
blockHeight := sdkCtx.BlockHeight()

// compute base fee from the opChild gas prices
baseFee, err := e.baseFee(ctx)
if err != nil {
e.logger.Error("failed to get base fee", "err", err)
return err
}

hasher := trie.NewStackTrie(nil)
blockHeader := coretypes.Header{
TxHash: coretypes.DeriveSha(coretypes.Transactions(ethTxs), hasher),
Expand Down

0 comments on commit 1b8fda7

Please sign in to comment.