upgrade to ethermint v0.21.0 #99

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

View File

@ -46,6 +46,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (cli) [tharsis#1086](https://github.com/tharsis/ethermint/pull/1086) Add rollback command. * (cli) [tharsis#1086](https://github.com/tharsis/ethermint/pull/1086) Add rollback command.
* (specs) [tharsis#1095](https://github.com/tharsis/ethermint/pull/1095) Add more evm specs concepts. * (specs) [tharsis#1095](https://github.com/tharsis/ethermint/pull/1095) Add more evm specs concepts.
* (evm) [tharsis#1101](https://github.com/tharsis/ethermint/pull/1101) Add tx_type, gas and counter telemetry for ethereum txs.
### Bug Fixes ### Bug Fixes

2
go.mod
View File

@ -3,6 +3,7 @@ module github.com/tharsis/ethermint
go 1.17 go 1.17
require ( require (
github.com/armon/go-metrics v0.3.10
github.com/btcsuite/btcd v0.22.1 github.com/btcsuite/btcd v0.22.1
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce
github.com/cosmos/cosmos-sdk v0.45.4 github.com/cosmos/cosmos-sdk v0.45.4
@ -45,7 +46,6 @@ require (
github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/Workiva/go-datastructures v1.0.53 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect
github.com/armon/go-metrics v0.3.10 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 // indirect

View File

@ -9,6 +9,8 @@ import (
tmbytes "github.com/tendermint/tendermint/libs/bytes" tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmtypes "github.com/tendermint/tendermint/types" tmtypes "github.com/tendermint/tendermint/types"
"github.com/armon/go-metrics"
"github.com/cosmos/cosmos-sdk/telemetry"
sdk "github.com/cosmos/cosmos-sdk/types" sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
@ -28,11 +30,38 @@ 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()))}
if tx.To() == nil {
labels = []metrics.Label{
telemetry.NewLabel("execution", "create"),
}
} else {
labels = []metrics.Label{
telemetry.NewLabel("execution", "call"),
telemetry.NewLabel("to", tx.To().Hex()), // recipient address (contract or account)
}
}
response, err := k.ApplyTransaction(ctx, tx) response, err := k.ApplyTransaction(ctx, tx)
if err != nil { if err != nil {
return nil, sdkerrors.Wrap(err, "failed to apply transaction") return nil, sdkerrors.Wrap(err, "failed to apply transaction")
} }
defer func() {
if tx.Value().IsInt64() {
telemetry.SetGauge(
float32(tx.Value().Int64()),
"tx", "msg", "ethereum_tx",
)
}
telemetry.IncrCounterWithLabels(
[]string{types.ModuleName, "ethereum_tx"},
1,
labels,
)
}()
attrs := []sdk.Attribute{ attrs := []sdk.Attribute{
sdk.NewAttribute(sdk.AttributeKeyAmount, tx.Value().String()), sdk.NewAttribute(sdk.AttributeKeyAmount, tx.Value().String()),
// add event for ethereum transaction hash format // add event for ethereum transaction hash format