changes for tendermint v0.34.21

This commit is contained in:
0xmuralik
2022-09-30 12:11:39 +05:30
parent fa02642220
commit 01fbfc6c38
28 changed files with 1358 additions and 341 deletions
+6 -3
View File
@@ -15,7 +15,7 @@ import (
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
tmrpctypes "github.com/tendermint/tendermint/rpc/coretypes"
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
@@ -103,7 +103,10 @@ func NewEVMBackend(ctx *server.Context, logger log.Logger, clientCtx client.Cont
panic(err)
}
appConf := config.GetConfig(ctx.Viper)
appConf, err := config.GetConfig(ctx.Viper)
if err != nil {
panic(err)
}
return &EVMBackend{
ctx: context.Background(),
@@ -334,7 +337,7 @@ func (e *EVMBackend) BlockBloom(height *int64) (ethtypes.Bloom, error) {
}
for _, attr := range event.Attributes {
if attr.Key == string(bAttributeKeyEthereumBloom) {
if string(attr.Key) == string(bAttributeKeyEthereumBloom) {
return ethtypes.BytesToBloom([]byte(attr.Value)), nil
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ import (
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/rpc"
tmrpctypes "github.com/tendermint/tendermint/rpc/coretypes"
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
)
type (
+1 -1
View File
@@ -14,7 +14,7 @@ import (
"time"
"github.com/davecgh/go-spew/spew"
tmrpctypes "github.com/tendermint/tendermint/rpc/coretypes"
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
+1 -1
View File
@@ -20,7 +20,7 @@ import (
"github.com/pkg/errors"
"github.com/spf13/viper"
"github.com/tendermint/tendermint/libs/log"
tmrpctypes "github.com/tendermint/tendermint/rpc/coretypes"
tmrpctypes "github.com/tendermint/tendermint/rpc/core/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
+2 -8
View File
@@ -11,7 +11,7 @@ import (
"github.com/tendermint/tendermint/libs/log"
coretypes "github.com/tendermint/tendermint/rpc/coretypes"
coretypes "github.com/tendermint/tendermint/rpc/core/types"
rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
tmtypes "github.com/tendermint/tendermint/types"
@@ -371,13 +371,7 @@ func (api *PublicFilterAPI) Logs(ctx context.Context, crit filters.FilterCriteri
}
// filter only events from EVM module txs
var isMsgEthereumTx bool
for _, event := range ev.Events {
if event.Type == evmtypes.TypeMsgEthereumTx {
isMsgEthereumTx = true
}
}
_, isMsgEthereumTx := ev.Events[evmtypes.TypeMsgEthereumTx]
if !isMsgEthereumTx {
// ignore transaction as it's not from the evm module
@@ -11,7 +11,7 @@ import (
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
tmquery "github.com/tendermint/tendermint/libs/pubsub/query"
coretypes "github.com/tendermint/tendermint/rpc/coretypes"
coretypes "github.com/tendermint/tendermint/rpc/core/types"
rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
tmtypes "github.com/tendermint/tendermint/types"
@@ -27,9 +27,9 @@ import (
)
var (
txEvents = tmtypes.QueryForEvent(tmtypes.EventTxValue).String()
evmEvents = tmquery.MustCompile(fmt.Sprintf("%s='%s' AND %s.%s='%s'", tmtypes.EventTypeKey, tmtypes.EventTxValue, sdk.EventTypeMessage, sdk.AttributeKeyModule, evmtypes.ModuleName)).String()
headerEvents = tmtypes.QueryForEvent(tmtypes.EventNewBlockHeaderValue).String()
txEvents = tmtypes.QueryForEvent(tmtypes.EventTx).String()
evmEvents = tmquery.MustParse(fmt.Sprintf("%s='%s' AND %s.%s='%s'", tmtypes.EventTypeKey, tmtypes.EventTx, sdk.EventTypeMessage, sdk.AttributeKeyModule, evmtypes.ModuleName)).String()
headerEvents = tmtypes.QueryForEvent(tmtypes.EventNewBlockHeader).String()
)
// EventSystem creates subscriptions, processes events and broadcasts them to the
@@ -7,7 +7,7 @@ import (
ethtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/eth/filters"
"github.com/ethereum/go-ethereum/rpc"
coretypes "github.com/tendermint/tendermint/rpc/coretypes"
coretypes "github.com/tendermint/tendermint/rpc/core/types"
)
// Subscription defines a wrapper for the private subscription
+8 -2
View File
@@ -80,7 +80,10 @@ func (api *API) SetEtherbase(etherbase common.Address) bool {
}
// Fetch minimun gas price to calculate fees using the configuration.
appConf := config.GetConfig(api.ctx.Viper)
appConf, err := config.GetConfig(api.ctx.Viper)
if err != nil {
panic(err)
}
minGasPrices := appConf.GetMinGasPrices()
if len(minGasPrices) == 0 || minGasPrices.Empty() {
@@ -160,7 +163,10 @@ func (api *API) SetEtherbase(etherbase common.Address) bool {
// to use float values, the gas prices must be configured using the configuration file
func (api *API) SetGasPrice(gasPrice hexutil.Big) bool {
api.logger.Info(api.ctx.Viper.ConfigFileUsed())
appConf := config.GetConfig(api.ctx.Viper)
appConf, err := config.GetConfig(api.ctx.Viper)
if err != nil {
panic(err)
}
var unit string
minGasPrices := appConf.GetMinGasPrices()
+1 -1
View File
@@ -6,7 +6,7 @@ import (
"github.com/pkg/errors"
coretypes "github.com/tendermint/tendermint/rpc/coretypes"
coretypes "github.com/tendermint/tendermint/rpc/core/types"
)
type UnsubscribeFunc func()
+1 -1
View File
@@ -8,7 +8,7 @@ import (
"time"
"github.com/stretchr/testify/require"
coretypes "github.com/tendermint/tendermint/rpc/coretypes"
coretypes "github.com/tendermint/tendermint/rpc/core/types"
)
func TestAddTopic(t *testing.T) {
+1 -1
View File
@@ -242,7 +242,7 @@ func BaseFeeFromEvents(events []abci.Event) *big.Int {
}
for _, attr := range event.Attributes {
if attr.Key == feemarkettypes.AttributeKeyBaseFee {
if bytes.Equal(attr.Key, []byte(feemarkettypes.AttributeKeyBaseFee)) {
result, success := new(big.Int).SetString(string(attr.Value), 10)
if success {
return result