upgrade to ethermint v0.21.0 #99

Closed
0xmuralik wants to merge 384 commits from murali/update-fork into main
3 changed files with 36 additions and 12 deletions
Showing only changes of commit cad7ff66b0 - Show all commits

View File

@ -43,6 +43,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
- (feemarket) [tharsis#1104](https://github.com/tharsis/ethermint/pull/1104) Enforce a minimum gas price for Cosmos and EVM transactions through the `MinGasPrice` parameter. - (feemarket) [tharsis#1104](https://github.com/tharsis/ethermint/pull/1104) Enforce a minimum gas price for Cosmos and EVM transactions through the `MinGasPrice` parameter.
- (rpc) [tharsis#1081](https://github.com/tharsis/ethermint/pull/1081) Deduplicate some json-rpc logic codes, cleanup several dead functions. - (rpc) [tharsis#1081](https://github.com/tharsis/ethermint/pull/1081) Deduplicate some json-rpc logic codes, cleanup several dead functions.
- (ante) [tharsis#1062](https://github.com/tharsis/ethermint/pull/1062) Emit event of eth tx hash in ante handler to support query failed transactions. - (ante) [tharsis#1062](https://github.com/tharsis/ethermint/pull/1062) Emit event of eth tx hash in ante handler to support query failed transactions.
- (analytics) [tharsis#1106](https://github.com/tharsis/ethermint/pull/1106) Update telemetry to Ethermint modules.
### Improvements ### Improvements

View File

@ -30,11 +30,12 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
tx := msg.AsTransaction() tx := msg.AsTransaction()
txIndex := k.GetTxIndexTransient(ctx) txIndex := k.GetTxIndexTransient(ctx)
labels := []metrics.Label{telemetry.NewLabel("tx_type", fmt.Sprintf("%d", tx.Type()))} labels := []metrics.Label{
telemetry.NewLabel("tx_type", fmt.Sprintf("%d", tx.Type())),
telemetry.NewLabel("from", sender),
}
if tx.To() == nil { if tx.To() == nil {
labels = []metrics.Label{ labels = []metrics.Label{telemetry.NewLabel("execution", "create")}
telemetry.NewLabel("execution", "create"),
}
} else { } else {
labels = []metrics.Label{ labels = []metrics.Label{
telemetry.NewLabel("execution", "call"), telemetry.NewLabel("execution", "call"),
@ -48,18 +49,31 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
} }
defer func() { defer func() {
if tx.Value().IsInt64() {
telemetry.SetGauge(
float32(tx.Value().Int64()),
"tx", "msg", "ethereum_tx",
)
}
telemetry.IncrCounterWithLabels( telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, "ethereum_tx"}, []string{"tx", "msg", "ethereum_tx", "total"},
1, 1,
labels, labels,
) )
if response.GasUsed != 0 {
telemetry.IncrCounterWithLabels(
[]string{"tx", "msg", "ethereum_tx", "gas_used", "total"},
float32(response.GasUsed),
labels,
)
// Observe which users define a gas limit >> gas used. Note, that
// gas_limit and gas_used are always > 0
gasLimit := sdk.NewDec(int64(tx.Gas()))
gasRatio, err := gasLimit.QuoInt64(int64(response.GasUsed)).Float64()
if err == nil {
telemetry.SetGaugeWithLabels(
[]string{"tx", "msg", "ethereum_tx", "gas_limit", "per", "gas_used"},
float32(gasRatio),
labels,
)
}
}
}() }()
attrs := []sdk.Attribute{ attrs := []sdk.Attribute{

View File

@ -6,6 +6,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types" abci "github.com/tendermint/tendermint/abci/types"
"github.com/tharsis/ethermint/x/feemarket/types" "github.com/tharsis/ethermint/x/feemarket/types"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
) )
@ -20,6 +21,10 @@ func (k *Keeper) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {
k.SetBaseFee(ctx, baseFee) k.SetBaseFee(ctx, baseFee)
defer func() {
telemetry.SetGauge(float32(baseFee.Int64()), "feemarket", "base_fee")
}()
// Store current base fee in event // Store current base fee in event
ctx.EventManager().EmitEvents(sdk.Events{ ctx.EventManager().EmitEvents(sdk.Events{
sdk.NewEvent( sdk.NewEvent(
@ -42,6 +47,10 @@ func (k *Keeper) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) {
k.SetBlockGasUsed(ctx, gasUsed) k.SetBlockGasUsed(ctx, gasUsed)
defer func() {
telemetry.SetGauge(float32(gasUsed), "feemarket", "block_gas")
}()
ctx.EventManager().EmitEvent(sdk.NewEvent( ctx.EventManager().EmitEvent(sdk.NewEvent(
"block_gas", "block_gas",
sdk.NewAttribute("height", fmt.Sprintf("%d", ctx.BlockHeight())), sdk.NewAttribute("height", fmt.Sprintf("%d", ctx.BlockHeight())),