forked from cerc-io/laconicd-deprecated
changes for tendermint v0.34.21
This commit is contained in:
@@ -8,8 +8,8 @@ import (
|
||||
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
||||
ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante"
|
||||
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
|
||||
ibcante "github.com/cosmos/ibc-go/v5/modules/core/ante"
|
||||
ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper"
|
||||
|
||||
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||
)
|
||||
@@ -76,7 +76,7 @@ func newCosmosAnteHandler(options HandlerOptions) sdk.AnteHandler {
|
||||
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
|
||||
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
|
||||
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
|
||||
ibcante.NewAnteDecorator(options.IBCKeeper),
|
||||
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -98,6 +98,6 @@ func newCosmosAnteHandlerEip712(options HandlerOptions) sdk.AnteHandler {
|
||||
// Note: signature verification uses EIP instead of the cosmos signature validator
|
||||
NewEip712SigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
|
||||
ante.NewIncrementSequenceDecorator(options.AccountKeeper),
|
||||
ibcante.NewAnteDecorator(options.IBCKeeper),
|
||||
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
|
||||
)
|
||||
}
|
||||
|
||||
+12
-47
@@ -18,17 +18,16 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/cosmos/cosmos-sdk/codec/types"
|
||||
"github.com/cosmos/cosmos-sdk/db"
|
||||
"github.com/cosmos/cosmos-sdk/server/api"
|
||||
"github.com/cosmos/cosmos-sdk/server/config"
|
||||
servertypes "github.com/cosmos/cosmos-sdk/server/types"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
simappparams "github.com/cosmos/cosmos-sdk/simapp/params"
|
||||
"github.com/cosmos/cosmos-sdk/store/streaming"
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/v2alpha1"
|
||||
"github.com/cosmos/cosmos-sdk/store/v2alpha1/multi"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
"github.com/cosmos/cosmos-sdk/types/module"
|
||||
"github.com/cosmos/cosmos-sdk/version"
|
||||
@@ -91,15 +90,15 @@ import (
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmos "github.com/tendermint/tendermint/libs/os"
|
||||
|
||||
"github.com/cosmos/ibc-go/v3/modules/apps/transfer"
|
||||
ibctransferkeeper "github.com/cosmos/ibc-go/v3/modules/apps/transfer/keeper"
|
||||
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
|
||||
ibc "github.com/cosmos/ibc-go/v3/modules/core"
|
||||
ibcclient "github.com/cosmos/ibc-go/v3/modules/core/02-client"
|
||||
ibcclientclient "github.com/cosmos/ibc-go/v3/modules/core/02-client/client"
|
||||
porttypes "github.com/cosmos/ibc-go/v3/modules/core/05-port/types"
|
||||
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
|
||||
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
|
||||
"github.com/cosmos/ibc-go/v5/modules/apps/transfer"
|
||||
ibctransferkeeper "github.com/cosmos/ibc-go/v5/modules/apps/transfer/keeper"
|
||||
ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"
|
||||
ibc "github.com/cosmos/ibc-go/v5/modules/core"
|
||||
ibcclient "github.com/cosmos/ibc-go/v5/modules/core/02-client"
|
||||
ibcclientclient "github.com/cosmos/ibc-go/v5/modules/core/02-client/client"
|
||||
porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types"
|
||||
ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host"
|
||||
ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper"
|
||||
|
||||
// unnamed import of statik for swagger UI support
|
||||
_ "github.com/cerc-io/laconicd/client/docs/statik"
|
||||
@@ -268,7 +267,7 @@ type EthermintApp struct {
|
||||
// NewEthermintApp returns a reference to a new initialized Ethermint application.
|
||||
func NewEthermintApp(
|
||||
logger log.Logger,
|
||||
db db.DBConnection,
|
||||
db dbm.DB,
|
||||
traceStore io.Writer,
|
||||
loadLatest bool,
|
||||
skipUpgradeHeights map[int64]bool,
|
||||
@@ -276,7 +275,7 @@ func NewEthermintApp(
|
||||
invCheckPeriod uint,
|
||||
encodingConfig simappparams.EncodingConfig,
|
||||
appOpts servertypes.AppOptions,
|
||||
baseAppOptions ...baseapp.AppOption,
|
||||
baseAppOptions ...func(*baseapp.BaseApp),
|
||||
) *EthermintApp {
|
||||
appCodec := encodingConfig.Codec
|
||||
cdc := encodingConfig.Amino
|
||||
@@ -303,40 +302,6 @@ func NewEthermintApp(
|
||||
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey)
|
||||
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
||||
|
||||
// initialize stores
|
||||
setNamespaces := func(config *multi.StoreParams, ver uint64) error {
|
||||
for _, key := range keys {
|
||||
typ, err := storetypes.StoreKeyToType(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = config.RegisterSubstore(key, typ); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, key := range memKeys {
|
||||
typ, err := storetypes.StoreKeyToType(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = config.RegisterSubstore(key, typ); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
for _, key := range tkeys {
|
||||
typ, err := storetypes.StoreKeyToType(key)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = config.RegisterSubstore(key, typ); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
baseAppOptions = append(baseAppOptions, baseapp.StoreOption(setNamespaces))
|
||||
|
||||
// NOTE we use custom transaction decoder that supports the sdk.Tx interface instead of sdk.StdTx
|
||||
bApp := baseapp.NewBaseApp(
|
||||
appName,
|
||||
|
||||
+6
-4
@@ -1,9 +1,11 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
memdb "github.com/cosmos/cosmos-sdk/db/memdb"
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
@@ -13,8 +15,8 @@ import (
|
||||
|
||||
func TestEthermintAppExport(t *testing.T) {
|
||||
encCfg := encoding.MakeConfig(ModuleBasics)
|
||||
db := memdb.NewDB()
|
||||
logger, _ := log.NewDefaultLogger("plain", "info", false)
|
||||
db := dbm.NewMemDB()
|
||||
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||
app := NewTestAppWithCustomOptions(t, false, SetupOptions{
|
||||
Logger: logger,
|
||||
DB: db,
|
||||
@@ -35,7 +37,7 @@ func TestEthermintAppExport(t *testing.T) {
|
||||
}
|
||||
|
||||
app.Commit()
|
||||
logger2, _ := log.NewDefaultLogger("plain", "info", false)
|
||||
logger2 := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||
|
||||
// Making a new app object with the db, so that initchain hasn't been called
|
||||
app2 := NewEthermintApp(logger2, db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, EmptyAppOptions{})
|
||||
|
||||
@@ -2,18 +2,20 @@ package app
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/cerc-io/laconicd/encoding"
|
||||
"github.com/cosmos/cosmos-sdk/db/memdb"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
)
|
||||
|
||||
func BenchmarkEthermintApp_ExportAppStateAndValidators(b *testing.B) {
|
||||
db := memdb.NewDB()
|
||||
logger, _ := log.NewDefaultLogger("plain", "info", false)
|
||||
db := dbm.NewMemDB()
|
||||
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
|
||||
|
||||
app := NewEthermintApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encoding.MakeConfig(ModuleBasics), simapp.EmptyAppOptions{})
|
||||
|
||||
genesisState := NewDefaultGenesisState(app.appCodec)
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/baseapp"
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
"github.com/cosmos/cosmos-sdk/simapp/params"
|
||||
"github.com/cosmos/cosmos-sdk/store"
|
||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
@@ -28,13 +29,13 @@ import (
|
||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
|
||||
evmenc "github.com/cerc-io/laconicd/encoding"
|
||||
"github.com/cosmos/cosmos-sdk/db/memdb"
|
||||
storetypes "github.com/cosmos/cosmos-sdk/store/types"
|
||||
ibctransfertypes "github.com/cosmos/ibc-go/v3/modules/apps/transfer/types"
|
||||
ibchost "github.com/cosmos/ibc-go/v3/modules/core/24-host"
|
||||
ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types"
|
||||
ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host"
|
||||
abci "github.com/tendermint/tendermint/abci/types"
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
)
|
||||
|
||||
// MakeEncodingConfig creates the EncodingConfig
|
||||
@@ -56,15 +57,15 @@ type storeKeysPrefixes struct {
|
||||
|
||||
// fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of
|
||||
// an IAVLStore for faster simulation speed.
|
||||
var fauxMerkleModeOpt = baseapp.AppOptionFunc(func(bapp *baseapp.BaseApp) {
|
||||
func fauxMerkleModeOpt(bapp *baseapp.BaseApp) {
|
||||
bapp.SetFauxMerkleMode()
|
||||
})
|
||||
}
|
||||
|
||||
// interBlockCacheOpt returns a BaseApp option function that sets the persistent
|
||||
// inter-block write-through cache.
|
||||
// TODO: implement this cache as enhancement to v2 multistore
|
||||
func interBlockCacheOpt() baseapp.AppOptionFunc {
|
||||
return func(*baseapp.BaseApp) {}
|
||||
func interBlockCacheOpt() func(*baseapp.BaseApp) {
|
||||
return baseapp.SetInterBlockCache(store.NewCommitKVStoreCacheManager())
|
||||
}
|
||||
|
||||
func TestFullAppSimulation(t *testing.T) {
|
||||
@@ -312,7 +313,7 @@ func TestAppStateDeterminism(t *testing.T) {
|
||||
logger = log.NewNopLogger()
|
||||
}
|
||||
|
||||
db := memdb.NewDB()
|
||||
db := dbm.NewMemDB()
|
||||
app := NewEthermintApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, simapp.FlagPeriodValue, MakeEncodingConfig(), simapp.EmptyAppOptions{}, interBlockCacheOpt())
|
||||
|
||||
fmt.Printf(
|
||||
|
||||
+7
-8
@@ -1,7 +1,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -22,7 +21,6 @@ import (
|
||||
"github.com/stretchr/testify/require"
|
||||
tmjson "github.com/tendermint/tendermint/libs/json"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/db/memdb"
|
||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
|
||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||
@@ -31,6 +29,7 @@ import (
|
||||
"github.com/tendermint/tendermint/libs/log"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
tmtypes "github.com/tendermint/tendermint/types"
|
||||
dbm "github.com/tendermint/tm-db"
|
||||
)
|
||||
|
||||
// GenesisState of the blockchain is represented here as a map of raw json
|
||||
@@ -43,8 +42,8 @@ import (
|
||||
|
||||
// DefaultConsensusParams defines the default Tendermint consensus params used in
|
||||
// EthermintApp testing.
|
||||
var DefaultConsensusParams = &tmproto.ConsensusParams{
|
||||
Block: &tmproto.BlockParams{
|
||||
var DefaultConsensusParams = &abci.ConsensusParams{
|
||||
Block: &abci.BlockParams{
|
||||
MaxBytes: 200000,
|
||||
MaxGas: -1, // no limit
|
||||
},
|
||||
@@ -63,7 +62,7 @@ var DefaultConsensusParams = &tmproto.ConsensusParams{
|
||||
// SetupOptions defines arguments that are passed into `Simapp` constructor.
|
||||
type SetupOptions struct {
|
||||
Logger log.Logger
|
||||
DB *memdb.MemDB
|
||||
DB dbm.DB
|
||||
InvCheckPeriod uint
|
||||
HomePath string
|
||||
SkipUpgradeHeights map[int64]bool
|
||||
@@ -75,7 +74,7 @@ func NewTestAppWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOpti
|
||||
t.Helper()
|
||||
|
||||
privVal := mock.NewPV()
|
||||
pubKey, err := privVal.GetPubKey(context.TODO())
|
||||
pubKey, err := privVal.GetPubKey()
|
||||
require.NoError(t, err)
|
||||
// create validator set with single validator
|
||||
validator := tmtypes.NewValidator(pubKey, 1)
|
||||
@@ -125,7 +124,7 @@ func Setup(t *testing.T, isCheckTx bool, patchGenesis func(*EthermintApp, simapp
|
||||
t.Helper()
|
||||
|
||||
privVal := mock.NewPV()
|
||||
pubKey, err := privVal.GetPubKey(context.TODO())
|
||||
pubKey, err := privVal.GetPubKey()
|
||||
require.NoError(t, err)
|
||||
|
||||
// create validator set with single validator
|
||||
@@ -153,7 +152,7 @@ func Setup(t *testing.T, isCheckTx bool, patchGenesis func(*EthermintApp, simapp
|
||||
|
||||
func setup(withGenesis bool, invCheckPeriod uint, patchGenesis func(*EthermintApp, simapp.GenesisState) simapp.GenesisState) (*EthermintApp, simapp.GenesisState) {
|
||||
encCdc := encoding.MakeConfig(ModuleBasics)
|
||||
app := NewEthermintApp(log.NewNopLogger(), memdb.NewDB(), nil, true, map[int64]bool{}, DefaultNodeHome, invCheckPeriod, encCdc, EmptyAppOptions{})
|
||||
app := NewEthermintApp(log.NewNopLogger(), dbm.NewMemDB(), nil, true, map[int64]bool{}, DefaultNodeHome, invCheckPeriod, encCdc, EmptyAppOptions{})
|
||||
if withGenesis {
|
||||
genesisState := NewDefaultGenesisState(encCdc.Codec)
|
||||
if patchGenesis != nil {
|
||||
|
||||
Reference in New Issue
Block a user