rename ethermintApp to laconicApp
This commit is contained in:
parent
395b2dcde6
commit
fc60016453
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
sdkmath "cosmossdk.io/math"
|
sdkmath "cosmossdk.io/math"
|
||||||
|
|
||||||
ethermint "github.com/cerc-io/laconicd/types"
|
laconicd "github.com/cerc-io/laconicd/types"
|
||||||
"github.com/cerc-io/laconicd/x/evm/types"
|
"github.com/cerc-io/laconicd/x/evm/types"
|
||||||
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"
|
||||||
@ -49,7 +49,7 @@ func NewDynamicFeeChecker(k DynamicFeeEVMKeeper) authante.TxFeeChecker {
|
|||||||
// get the priority tip cap from the extension option.
|
// get the priority tip cap from the extension option.
|
||||||
if hasExtOptsTx, ok := tx.(authante.HasExtensionOptionsTx); ok {
|
if hasExtOptsTx, ok := tx.(authante.HasExtensionOptionsTx); ok {
|
||||||
for _, opt := range hasExtOptsTx.GetExtensionOptions() {
|
for _, opt := range hasExtOptsTx.GetExtensionOptions() {
|
||||||
if extOpt, ok := opt.GetCachedValue().(*ethermint.ExtensionOptionDynamicFeeTx); ok {
|
if extOpt, ok := opt.GetCachedValue().(*laconicd.ExtensionOptionDynamicFeeTx); ok {
|
||||||
maxPriorityPrice = extOpt.MaxPriorityPrice
|
maxPriorityPrice = extOpt.MaxPriorityPrice
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,7 +55,7 @@ type AnteTestSuite struct {
|
|||||||
suite.Suite
|
suite.Suite
|
||||||
|
|
||||||
ctx sdk.Context
|
ctx sdk.Context
|
||||||
app *app.EthermintApp
|
app *app.LaconicApp
|
||||||
clientCtx client.Context
|
clientCtx client.Context
|
||||||
anteHandler sdk.AnteHandler
|
anteHandler sdk.AnteHandler
|
||||||
ethSigner ethtypes.Signer
|
ethSigner ethtypes.Signer
|
||||||
@ -73,7 +73,7 @@ func (suite *AnteTestSuite) StateDB() *statedb.StateDB {
|
|||||||
func (suite *AnteTestSuite) SetupTest() {
|
func (suite *AnteTestSuite) SetupTest() {
|
||||||
checkTx := false
|
checkTx := false
|
||||||
|
|
||||||
suite.app = app.Setup(checkTx, func(app *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
suite.app = app.Setup(checkTx, func(app *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
if suite.enableFeemarket {
|
if suite.enableFeemarket {
|
||||||
// setup feemarketGenesis params
|
// setup feemarketGenesis params
|
||||||
feemarketGenesis := feemarkettypes.DefaultGenesisState()
|
feemarketGenesis := feemarkettypes.DefaultGenesisState()
|
||||||
|
|||||||
62
app/app.go
62
app/app.go
@ -199,14 +199,14 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ simapp.App = (*EthermintApp)(nil)
|
var _ simapp.App = (*LaconicApp)(nil)
|
||||||
|
|
||||||
// var _ server.Application (*EthermintApp)(nil)
|
// var _ server.Application (*LaconicApp)(nil)
|
||||||
|
|
||||||
// EthermintApp implements an extended ABCI application. It is an application
|
// LaconicApp implements an extended ABCI application. It is an application
|
||||||
// that may process transactions through Ethereum's EVM running atop of
|
// that may process transactions through Ethereum's EVM running atop of
|
||||||
// Tendermint consensus.
|
// Tendermint consensus.
|
||||||
type EthermintApp struct {
|
type LaconicApp struct {
|
||||||
*baseapp.BaseApp
|
*baseapp.BaseApp
|
||||||
|
|
||||||
// encoding
|
// encoding
|
||||||
@ -263,8 +263,8 @@ type EthermintApp struct {
|
|||||||
configurator module.Configurator
|
configurator module.Configurator
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEthermintApp returns a reference to a new initialized Ethermint application.
|
// NewLaconicApp returns a reference to a new initialized Ethermint application.
|
||||||
func NewEthermintApp(
|
func NewLaconicApp(
|
||||||
logger log.Logger,
|
logger log.Logger,
|
||||||
db dbm.DB,
|
db dbm.DB,
|
||||||
traceStore io.Writer,
|
traceStore io.Writer,
|
||||||
@ -275,7 +275,7 @@ func NewEthermintApp(
|
|||||||
encodingConfig simappparams.EncodingConfig,
|
encodingConfig simappparams.EncodingConfig,
|
||||||
appOpts servertypes.AppOptions,
|
appOpts servertypes.AppOptions,
|
||||||
baseAppOptions ...func(*baseapp.BaseApp),
|
baseAppOptions ...func(*baseapp.BaseApp),
|
||||||
) *EthermintApp {
|
) *LaconicApp {
|
||||||
appCodec := encodingConfig.Codec
|
appCodec := encodingConfig.Codec
|
||||||
cdc := encodingConfig.Amino
|
cdc := encodingConfig.Amino
|
||||||
interfaceRegistry := encodingConfig.InterfaceRegistry
|
interfaceRegistry := encodingConfig.InterfaceRegistry
|
||||||
@ -313,7 +313,7 @@ func NewEthermintApp(
|
|||||||
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
|
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey)
|
||||||
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
|
||||||
|
|
||||||
app := &EthermintApp{
|
app := &LaconicApp{
|
||||||
BaseApp: bApp,
|
BaseApp: bApp,
|
||||||
cdc: cdc,
|
cdc: cdc,
|
||||||
appCodec: appCodec,
|
appCodec: appCodec,
|
||||||
@ -707,7 +707,7 @@ func NewEthermintApp(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// use Ethermint's custom AnteHandler
|
// use Ethermint's custom AnteHandler
|
||||||
func (app *EthermintApp) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) {
|
func (app *LaconicApp) setAnteHandler(txConfig client.TxConfig, maxGasWanted uint64) {
|
||||||
anteHandler, err := ante.NewAnteHandler(ante.HandlerOptions{
|
anteHandler, err := ante.NewAnteHandler(ante.HandlerOptions{
|
||||||
AccountKeeper: app.AccountKeeper,
|
AccountKeeper: app.AccountKeeper,
|
||||||
BankKeeper: app.BankKeeper,
|
BankKeeper: app.BankKeeper,
|
||||||
@ -726,7 +726,7 @@ func (app *EthermintApp) setAnteHandler(txConfig client.TxConfig, maxGasWanted u
|
|||||||
app.SetAnteHandler(anteHandler)
|
app.SetAnteHandler(anteHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (app *EthermintApp) setPostHandler() {
|
func (app *LaconicApp) setPostHandler() {
|
||||||
postHandler, err := posthandler.NewPostHandler(
|
postHandler, err := posthandler.NewPostHandler(
|
||||||
posthandler.HandlerOptions{},
|
posthandler.HandlerOptions{},
|
||||||
)
|
)
|
||||||
@ -738,20 +738,20 @@ func (app *EthermintApp) setPostHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Name returns the name of the App
|
// Name returns the name of the App
|
||||||
func (app *EthermintApp) Name() string { return app.BaseApp.Name() }
|
func (app *LaconicApp) Name() string { return app.BaseApp.Name() }
|
||||||
|
|
||||||
// BeginBlocker updates every begin block
|
// BeginBlocker updates every begin block
|
||||||
func (app *EthermintApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
|
func (app *LaconicApp) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock {
|
||||||
return app.mm.BeginBlock(ctx, req)
|
return app.mm.BeginBlock(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// EndBlocker updates every end block
|
// EndBlocker updates every end block
|
||||||
func (app *EthermintApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
|
func (app *LaconicApp) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock {
|
||||||
return app.mm.EndBlock(ctx, req)
|
return app.mm.EndBlock(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
// InitChainer updates at chain initialization
|
// InitChainer updates at chain initialization
|
||||||
func (app *EthermintApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
|
func (app *LaconicApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain {
|
||||||
var genesisState simapp.GenesisState
|
var genesisState simapp.GenesisState
|
||||||
if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
|
if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
@ -761,12 +761,12 @@ func (app *EthermintApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LoadHeight loads state at a particular height
|
// LoadHeight loads state at a particular height
|
||||||
func (app *EthermintApp) LoadHeight(height int64) error {
|
func (app *LaconicApp) LoadHeight(height int64) error {
|
||||||
return app.LoadVersion(height)
|
return app.LoadVersion(height)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ModuleAccountAddrs returns all the app's module account addresses.
|
// ModuleAccountAddrs returns all the app's module account addresses.
|
||||||
func (app *EthermintApp) ModuleAccountAddrs() map[string]bool {
|
func (app *LaconicApp) ModuleAccountAddrs() map[string]bool {
|
||||||
modAccAddrs := make(map[string]bool)
|
modAccAddrs := make(map[string]bool)
|
||||||
// #nosec G705
|
// #nosec G705
|
||||||
for acc := range maccPerms {
|
for acc := range maccPerms {
|
||||||
@ -778,7 +778,7 @@ func (app *EthermintApp) ModuleAccountAddrs() map[string]bool {
|
|||||||
|
|
||||||
// BlockedAddrs returns all the app's module account addresses that are not
|
// BlockedAddrs returns all the app's module account addresses that are not
|
||||||
// allowed to receive external tokens.
|
// allowed to receive external tokens.
|
||||||
func (app *EthermintApp) BlockedAddrs() map[string]bool {
|
func (app *LaconicApp) BlockedAddrs() map[string]bool {
|
||||||
blockedAddrs := make(map[string]bool)
|
blockedAddrs := make(map[string]bool)
|
||||||
// #nosec G705
|
// #nosec G705
|
||||||
for acc := range maccPerms {
|
for acc := range maccPerms {
|
||||||
@ -788,64 +788,64 @@ func (app *EthermintApp) BlockedAddrs() map[string]bool {
|
|||||||
return blockedAddrs
|
return blockedAddrs
|
||||||
}
|
}
|
||||||
|
|
||||||
// LegacyAmino returns EthermintApp's amino codec.
|
// LegacyAmino returns LaconicApp's amino codec.
|
||||||
//
|
//
|
||||||
// NOTE: This is solely to be used for testing purposes as it may be desirable
|
// NOTE: This is solely to be used for testing purposes as it may be desirable
|
||||||
// for modules to register their own custom testing types.
|
// for modules to register their own custom testing types.
|
||||||
func (app *EthermintApp) LegacyAmino() *codec.LegacyAmino {
|
func (app *LaconicApp) LegacyAmino() *codec.LegacyAmino {
|
||||||
return app.cdc
|
return app.cdc
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppCodec returns EthermintApp's app codec.
|
// AppCodec returns LaconicApp's app codec.
|
||||||
//
|
//
|
||||||
// NOTE: This is solely to be used for testing purposes as it may be desirable
|
// NOTE: This is solely to be used for testing purposes as it may be desirable
|
||||||
// for modules to register their own custom testing types.
|
// for modules to register their own custom testing types.
|
||||||
func (app *EthermintApp) AppCodec() codec.Codec {
|
func (app *LaconicApp) AppCodec() codec.Codec {
|
||||||
return app.appCodec
|
return app.appCodec
|
||||||
}
|
}
|
||||||
|
|
||||||
// InterfaceRegistry returns EthermintApp's InterfaceRegistry
|
// InterfaceRegistry returns LaconicApp's InterfaceRegistry
|
||||||
func (app *EthermintApp) InterfaceRegistry() types.InterfaceRegistry {
|
func (app *LaconicApp) InterfaceRegistry() types.InterfaceRegistry {
|
||||||
return app.interfaceRegistry
|
return app.interfaceRegistry
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetKey returns the KVStoreKey for the provided store key.
|
// GetKey returns the KVStoreKey for the provided store key.
|
||||||
//
|
//
|
||||||
// NOTE: This is solely to be used for testing purposes.
|
// NOTE: This is solely to be used for testing purposes.
|
||||||
func (app *EthermintApp) GetKey(storeKey string) *storetypes.KVStoreKey {
|
func (app *LaconicApp) GetKey(storeKey string) *storetypes.KVStoreKey {
|
||||||
return app.keys[storeKey]
|
return app.keys[storeKey]
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTKey returns the TransientStoreKey for the provided store key.
|
// GetTKey returns the TransientStoreKey for the provided store key.
|
||||||
//
|
//
|
||||||
// NOTE: This is solely to be used for testing purposes.
|
// NOTE: This is solely to be used for testing purposes.
|
||||||
func (app *EthermintApp) GetTKey(storeKey string) *storetypes.TransientStoreKey {
|
func (app *LaconicApp) GetTKey(storeKey string) *storetypes.TransientStoreKey {
|
||||||
return app.tkeys[storeKey]
|
return app.tkeys[storeKey]
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetMemKey returns the MemStoreKey for the provided mem key.
|
// GetMemKey returns the MemStoreKey for the provided mem key.
|
||||||
//
|
//
|
||||||
// NOTE: This is solely used for testing purposes.
|
// NOTE: This is solely used for testing purposes.
|
||||||
func (app *EthermintApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
|
func (app *LaconicApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
|
||||||
return app.memKeys[storeKey]
|
return app.memKeys[storeKey]
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetSubspace returns a param subspace for a given module name.
|
// GetSubspace returns a param subspace for a given module name.
|
||||||
//
|
//
|
||||||
// NOTE: This is solely to be used for testing purposes.
|
// NOTE: This is solely to be used for testing purposes.
|
||||||
func (app *EthermintApp) GetSubspace(moduleName string) paramstypes.Subspace {
|
func (app *LaconicApp) GetSubspace(moduleName string) paramstypes.Subspace {
|
||||||
subspace, _ := app.ParamsKeeper.GetSubspace(moduleName)
|
subspace, _ := app.ParamsKeeper.GetSubspace(moduleName)
|
||||||
return subspace
|
return subspace
|
||||||
}
|
}
|
||||||
|
|
||||||
// SimulationManager implements the SimulationApp interface
|
// SimulationManager implements the SimulationApp interface
|
||||||
func (app *EthermintApp) SimulationManager() *module.SimulationManager {
|
func (app *LaconicApp) SimulationManager() *module.SimulationManager {
|
||||||
return app.sm
|
return app.sm
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterAPIRoutes registers all application module routes with the provided
|
// RegisterAPIRoutes registers all application module routes with the provided
|
||||||
// API server.
|
// API server.
|
||||||
func (app *EthermintApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
|
func (app *LaconicApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) {
|
||||||
clientCtx := apiSvr.ClientCtx
|
clientCtx := apiSvr.ClientCtx
|
||||||
// Register new tx routes from grpc-gateway.
|
// Register new tx routes from grpc-gateway.
|
||||||
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter)
|
||||||
@ -862,12 +862,12 @@ func (app *EthermintApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.
|
|||||||
}
|
}
|
||||||
|
|
||||||
// RegisterTxService implements the Application.RegisterTxService method.
|
// RegisterTxService implements the Application.RegisterTxService method.
|
||||||
func (app *EthermintApp) RegisterTxService(clientCtx client.Context) {
|
func (app *LaconicApp) RegisterTxService(clientCtx client.Context) {
|
||||||
authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry)
|
authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterTendermintService implements the Application.RegisterTendermintService method.
|
// RegisterTendermintService implements the Application.RegisterTendermintService method.
|
||||||
func (app *EthermintApp) RegisterTendermintService(clientCtx client.Context) {
|
func (app *LaconicApp) RegisterTendermintService(clientCtx client.Context) {
|
||||||
tmservice.RegisterTendermintService(
|
tmservice.RegisterTendermintService(
|
||||||
clientCtx,
|
clientCtx,
|
||||||
app.BaseApp.GRPCQueryRouter(),
|
app.BaseApp.GRPCQueryRouter(),
|
||||||
|
|||||||
@ -14,13 +14,13 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/encoding"
|
"github.com/cerc-io/laconicd/encoding"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestEthermintAppExport(t *testing.T) {
|
func TestLaconicAppExport(t *testing.T) {
|
||||||
db := dbm.NewMemDB()
|
db := dbm.NewMemDB()
|
||||||
app := SetupWithDB(false, nil, db)
|
app := SetupWithDB(false, nil, db)
|
||||||
app.Commit()
|
app.Commit()
|
||||||
|
|
||||||
// Making a new app object with the db, so that initchain hasn't been called
|
// Making a new app object with the db, so that initchain hasn't been called
|
||||||
app2 := NewEthermintApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encoding.MakeConfig(ModuleBasics), simapp.EmptyAppOptions{})
|
app2 := NewLaconicApp(log.NewTMLogger(log.NewSyncWriter(os.Stdout)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encoding.MakeConfig(ModuleBasics), simapp.EmptyAppOptions{})
|
||||||
_, err := app2.ExportAppStateAndValidators(false, []string{})
|
_, err := app2.ExportAppStateAndValidators(false, []string{})
|
||||||
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
|
require.NoError(t, err, "ExportAppStateAndValidators should not have an error")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,9 +12,9 @@ import (
|
|||||||
dbm "github.com/tendermint/tm-db"
|
dbm "github.com/tendermint/tm-db"
|
||||||
)
|
)
|
||||||
|
|
||||||
func BenchmarkEthermintApp_ExportAppStateAndValidators(b *testing.B) {
|
func BenchmarkLaconicApp_ExportAppStateAndValidators(b *testing.B) {
|
||||||
db := dbm.NewMemDB()
|
db := dbm.NewMemDB()
|
||||||
app := NewEthermintApp(log.NewTMLogger(io.Discard), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encoding.MakeConfig(ModuleBasics), simapp.EmptyAppOptions{})
|
app := NewLaconicApp(log.NewTMLogger(io.Discard), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encoding.MakeConfig(ModuleBasics), simapp.EmptyAppOptions{})
|
||||||
|
|
||||||
genesisState := NewTestGenesisState(app.AppCodec())
|
genesisState := NewTestGenesisState(app.AppCodec())
|
||||||
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
|
stateBytes, err := json.MarshalIndent(genesisState, "", " ")
|
||||||
@ -36,7 +36,7 @@ func BenchmarkEthermintApp_ExportAppStateAndValidators(b *testing.B) {
|
|||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
// Making a new app object with the db, so that initchain hasn't been called
|
// Making a new app object with the db, so that initchain hasn't been called
|
||||||
app2 := NewEthermintApp(log.NewTMLogger(log.NewSyncWriter(io.Discard)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encoding.MakeConfig(ModuleBasics), simapp.EmptyAppOptions{})
|
app2 := NewLaconicApp(log.NewTMLogger(log.NewSyncWriter(io.Discard)), db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encoding.MakeConfig(ModuleBasics), simapp.EmptyAppOptions{})
|
||||||
if _, err := app2.ExportAppStateAndValidators(false, []string{}); err != nil {
|
if _, err := app2.ExportAppStateAndValidators(false, []string{}); err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ func NewDefaultGenesisState() simapp.GenesisState {
|
|||||||
|
|
||||||
// ExportAppStateAndValidators exports the state of the application for a genesis
|
// ExportAppStateAndValidators exports the state of the application for a genesis
|
||||||
// file.
|
// file.
|
||||||
func (app *EthermintApp) ExportAppStateAndValidators(
|
func (app *LaconicApp) ExportAppStateAndValidators(
|
||||||
forZeroHeight bool, jailAllowedAddrs []string,
|
forZeroHeight bool, jailAllowedAddrs []string,
|
||||||
) (servertypes.ExportedApp, error) {
|
) (servertypes.ExportedApp, error) {
|
||||||
// Creates context with current height and checks txs for ctx to be usable by start of next block
|
// Creates context with current height and checks txs for ctx to be usable by start of next block
|
||||||
@ -63,7 +63,7 @@ func (app *EthermintApp) ExportAppStateAndValidators(
|
|||||||
// prepare for fresh start at zero height
|
// prepare for fresh start at zero height
|
||||||
// NOTE zero height genesis is a temporary feature which will be deprecated
|
// NOTE zero height genesis is a temporary feature which will be deprecated
|
||||||
// in favor of export at a block height
|
// in favor of export at a block height
|
||||||
func (app *EthermintApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) error {
|
func (app *LaconicApp) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) error {
|
||||||
applyAllowedAddrs := false
|
applyAllowedAddrs := false
|
||||||
|
|
||||||
// check if there is a allowed address list
|
// check if there is a allowed address list
|
||||||
|
|||||||
@ -64,9 +64,9 @@ func fauxMerkleModeOpt(bapp *baseapp.BaseApp) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewSimApp disable feemarket on native tx, otherwise the cosmos-sdk simulation tests will fail.
|
// NewSimApp disable feemarket on native tx, otherwise the cosmos-sdk simulation tests will fail.
|
||||||
func NewSimApp(logger log.Logger, db dbm.DB) (*EthermintApp, error) {
|
func NewSimApp(logger log.Logger, db dbm.DB) (*LaconicApp, error) {
|
||||||
encodingConfig := MakeEncodingConfig()
|
encodingConfig := MakeEncodingConfig()
|
||||||
app := NewEthermintApp(logger, db, nil, false, map[int64]bool{}, DefaultNodeHome, simapp.FlagPeriodValue, encodingConfig, simapp.EmptyAppOptions{}, fauxMerkleModeOpt)
|
app := NewLaconicApp(logger, db, nil, false, map[int64]bool{}, DefaultNodeHome, simapp.FlagPeriodValue, encodingConfig, simapp.EmptyAppOptions{}, fauxMerkleModeOpt)
|
||||||
// disable feemarket on native tx
|
// disable feemarket on native tx
|
||||||
anteHandler, err := ante.NewAnteHandler(ante.HandlerOptions{
|
anteHandler, err := ante.NewAnteHandler(ante.HandlerOptions{
|
||||||
AccountKeeper: app.AccountKeeper,
|
AccountKeeper: app.AccountKeeper,
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import (
|
|||||||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (app *EthermintApp) RegisterUpgradeHandlers() {
|
func (app *LaconicApp) RegisterUpgradeHandlers() {
|
||||||
planName := "integration-test-upgrade"
|
planName := "integration-test-upgrade"
|
||||||
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
|
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
|
||||||
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
|
return app.mm.RunMigrations(ctx, app.configurator, fromVM)
|
||||||
|
|||||||
12
app/utils.go
12
app/utils.go
@ -34,7 +34,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// DefaultConsensusParams defines the default Tendermint consensus params used in
|
// DefaultConsensusParams defines the default Tendermint consensus params used in
|
||||||
// EthermintApp testing.
|
// LaconicApp testing.
|
||||||
var DefaultConsensusParams = &abci.ConsensusParams{
|
var DefaultConsensusParams = &abci.ConsensusParams{
|
||||||
Block: &abci.BlockParams{
|
Block: &abci.BlockParams{
|
||||||
MaxBytes: 200000,
|
MaxBytes: 200000,
|
||||||
@ -52,14 +52,14 @@ var DefaultConsensusParams = &abci.ConsensusParams{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup initializes a new EthermintApp. A Nop logger is set in EthermintApp.
|
// Setup initializes a new LaconicApp. A Nop logger is set in LaconicApp.
|
||||||
func Setup(isCheckTx bool, patchGenesis func(*EthermintApp, simapp.GenesisState) simapp.GenesisState) *EthermintApp {
|
func Setup(isCheckTx bool, patchGenesis func(*LaconicApp, simapp.GenesisState) simapp.GenesisState) *LaconicApp {
|
||||||
return SetupWithDB(isCheckTx, patchGenesis, dbm.NewMemDB())
|
return SetupWithDB(isCheckTx, patchGenesis, dbm.NewMemDB())
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetupWithDB initializes a new EthermintApp. A Nop logger is set in EthermintApp.
|
// SetupWithDB initializes a new LaconicApp. A Nop logger is set in LaconicApp.
|
||||||
func SetupWithDB(isCheckTx bool, patchGenesis func(*EthermintApp, simapp.GenesisState) simapp.GenesisState, db dbm.DB) *EthermintApp {
|
func SetupWithDB(isCheckTx bool, patchGenesis func(*LaconicApp, simapp.GenesisState) simapp.GenesisState, db dbm.DB) *LaconicApp {
|
||||||
app := NewEthermintApp(log.NewNopLogger(),
|
app := NewLaconicApp(log.NewNopLogger(),
|
||||||
db,
|
db,
|
||||||
nil,
|
nil,
|
||||||
true,
|
true,
|
||||||
|
|||||||
@ -76,7 +76,7 @@ func TestStateFn(t *testing.T) {
|
|||||||
require.NoError(t, os.RemoveAll(dir))
|
require.NoError(t, os.RemoveAll(dir))
|
||||||
}()
|
}()
|
||||||
|
|
||||||
app := NewEthermintApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, simapp.FlagPeriodValue, MakeEncodingConfig(), simapp.EmptyAppOptions{}, fauxMerkleModeOpt)
|
app := NewLaconicApp(logger, db, nil, true, map[int64]bool{}, DefaultNodeHome, simapp.FlagPeriodValue, MakeEncodingConfig(), simapp.EmptyAppOptions{}, fauxMerkleModeOpt)
|
||||||
require.Equal(t, appName, app.Name())
|
require.Equal(t, appName, app.Name())
|
||||||
|
|
||||||
appStateFn := StateFn(app.AppCodec(), app.SimulationManager())
|
appStateFn := StateFn(app.AppCodec(), app.SimulationManager())
|
||||||
|
|||||||
@ -231,7 +231,7 @@ func (a appCreator) newApp(logger tmlog.Logger, db dbm.DB, traceStore io.Writer,
|
|||||||
cast.ToUint32(appOpts.Get(sdkserver.FlagStateSyncSnapshotKeepRecent)),
|
cast.ToUint32(appOpts.Get(sdkserver.FlagStateSyncSnapshotKeepRecent)),
|
||||||
)
|
)
|
||||||
|
|
||||||
ethermintApp := app.NewEthermintApp(
|
laconicApp := app.NewLaconicApp(
|
||||||
logger, db, traceStore, true, skipUpgradeHeights,
|
logger, db, traceStore, true, skipUpgradeHeights,
|
||||||
cast.ToString(appOpts.Get(flags.FlagHome)),
|
cast.ToString(appOpts.Get(flags.FlagHome)),
|
||||||
cast.ToUint(appOpts.Get(sdkserver.FlagInvCheckPeriod)),
|
cast.ToUint(appOpts.Get(sdkserver.FlagInvCheckPeriod)),
|
||||||
@ -248,7 +248,7 @@ func (a appCreator) newApp(logger tmlog.Logger, db dbm.DB, traceStore io.Writer,
|
|||||||
baseapp.SetSnapshot(snapshotStore, snapshotOptions),
|
baseapp.SetSnapshot(snapshotStore, snapshotOptions),
|
||||||
)
|
)
|
||||||
|
|
||||||
return ethermintApp
|
return laconicApp
|
||||||
}
|
}
|
||||||
|
|
||||||
// appExport creates a new simapp (optionally at a given height)
|
// appExport creates a new simapp (optionally at a given height)
|
||||||
@ -257,21 +257,21 @@ func (a appCreator) appExport(
|
|||||||
logger tmlog.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string,
|
logger tmlog.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string,
|
||||||
appOpts servertypes.AppOptions,
|
appOpts servertypes.AppOptions,
|
||||||
) (servertypes.ExportedApp, error) {
|
) (servertypes.ExportedApp, error) {
|
||||||
var ethermintApp *app.EthermintApp
|
var laconicApp *app.LaconicApp
|
||||||
homePath, ok := appOpts.Get(flags.FlagHome).(string)
|
homePath, ok := appOpts.Get(flags.FlagHome).(string)
|
||||||
if !ok || homePath == "" {
|
if !ok || homePath == "" {
|
||||||
return servertypes.ExportedApp{}, errors.New("application home not set")
|
return servertypes.ExportedApp{}, errors.New("application home not set")
|
||||||
}
|
}
|
||||||
|
|
||||||
if height != -1 {
|
if height != -1 {
|
||||||
ethermintApp = app.NewEthermintApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1), a.encCfg, appOpts)
|
laconicApp = app.NewLaconicApp(logger, db, traceStore, false, map[int64]bool{}, "", uint(1), a.encCfg, appOpts)
|
||||||
|
|
||||||
if err := ethermintApp.LoadHeight(height); err != nil {
|
if err := laconicApp.LoadHeight(height); err != nil {
|
||||||
return servertypes.ExportedApp{}, err
|
return servertypes.ExportedApp{}, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ethermintApp = app.NewEthermintApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1), a.encCfg, appOpts)
|
laconicApp = app.NewLaconicApp(logger, db, traceStore, true, map[int64]bool{}, "", uint(1), a.encCfg, appOpts)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ethermintApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs)
|
return laconicApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ func init() {
|
|||||||
type ImporterTestSuite struct {
|
type ImporterTestSuite struct {
|
||||||
suite.Suite
|
suite.Suite
|
||||||
|
|
||||||
app *app.EthermintApp
|
app *app.LaconicApp
|
||||||
ctx sdk.Context
|
ctx sdk.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -68,7 +68,7 @@ type AppConstructor = func(val Validator) servertypes.Application
|
|||||||
// NewAppConstructor returns a new simapp AppConstructor
|
// NewAppConstructor returns a new simapp AppConstructor
|
||||||
func NewAppConstructor(encodingCfg params.EncodingConfig) AppConstructor {
|
func NewAppConstructor(encodingCfg params.EncodingConfig) AppConstructor {
|
||||||
return func(val Validator) servertypes.Application {
|
return func(val Validator) servertypes.Application {
|
||||||
return app.NewEthermintApp(
|
return app.NewLaconicApp(
|
||||||
val.Ctx.Logger, dbm.NewMemDB(), nil, true, make(map[int64]bool), val.Ctx.Config.RootDir, 0,
|
val.Ctx.Logger, dbm.NewMemDB(), nil, true, make(map[int64]bool), val.Ctx.Config.RootDir, 0,
|
||||||
encodingCfg,
|
encodingCfg,
|
||||||
simapp.EmptyAppOptions{},
|
simapp.EmptyAppOptions{},
|
||||||
|
|||||||
@ -16,13 +16,13 @@ import (
|
|||||||
|
|
||||||
type KeeperTestSuite struct {
|
type KeeperTestSuite struct {
|
||||||
suite.Suite
|
suite.Suite
|
||||||
app *app.EthermintApp
|
app *app.LaconicApp
|
||||||
ctx sdk.Context
|
ctx sdk.Context
|
||||||
queryClient types.QueryClient
|
queryClient types.QueryClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) SetupTest() {
|
func (suite *KeeperTestSuite) SetupTest() {
|
||||||
testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
testApp := app.Setup(false, func(ea *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
return genesis
|
return genesis
|
||||||
})
|
})
|
||||||
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||||
@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) SetupTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParams(t *testing.T) {
|
func TestParams(t *testing.T) {
|
||||||
testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
testApp := app.Setup(false, func(ea *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
return genesis
|
return genesis
|
||||||
})
|
})
|
||||||
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||||
|
|||||||
@ -16,13 +16,13 @@ import (
|
|||||||
|
|
||||||
type KeeperTestSuite struct {
|
type KeeperTestSuite struct {
|
||||||
suite.Suite
|
suite.Suite
|
||||||
app *app.EthermintApp
|
app *app.LaconicApp
|
||||||
ctx sdk.Context
|
ctx sdk.Context
|
||||||
queryClient types.QueryClient
|
queryClient types.QueryClient
|
||||||
}
|
}
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) SetupTest() {
|
func (suite *KeeperTestSuite) SetupTest() {
|
||||||
testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
testApp := app.Setup(false, func(ea *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
return genesis
|
return genesis
|
||||||
})
|
})
|
||||||
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||||
@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) SetupTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParams(t *testing.T) {
|
func TestParams(t *testing.T) {
|
||||||
testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
testApp := app.Setup(false, func(ea *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
return genesis
|
return genesis
|
||||||
})
|
})
|
||||||
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
|
func TestItCreatesModuleAccountOnInitBlock(t *testing.T) {
|
||||||
app := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
app := app.Setup(false, func(ea *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
return genesis
|
return genesis
|
||||||
})
|
})
|
||||||
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
ctx := app.BaseApp.NewContext(false, tmproto.Header{})
|
||||||
|
|||||||
@ -50,7 +50,7 @@ type EvmTestSuite struct {
|
|||||||
|
|
||||||
ctx sdk.Context
|
ctx sdk.Context
|
||||||
handler sdk.Handler
|
handler sdk.Handler
|
||||||
app *app.EthermintApp
|
app *app.LaconicApp
|
||||||
codec codec.Codec
|
codec codec.Codec
|
||||||
chainID *big.Int
|
chainID *big.Int
|
||||||
|
|
||||||
@ -77,7 +77,7 @@ func (suite *EvmTestSuite) DoSetupTest(t require.TestingT) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
consAddress := sdk.ConsAddress(priv.PubKey().Address())
|
consAddress := sdk.ConsAddress(priv.PubKey().Address())
|
||||||
|
|
||||||
suite.app = app.Setup(checkTx, func(app *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
suite.app = app.Setup(checkTx, func(app *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
if suite.dynamicTxFee {
|
if suite.dynamicTxFee {
|
||||||
feemarketGenesis := feemarkettypes.DefaultGenesisState()
|
feemarketGenesis := feemarkettypes.DefaultGenesisState()
|
||||||
feemarketGenesis.Params.EnableHeight = 1
|
feemarketGenesis.Params.EnableHeight = 1
|
||||||
|
|||||||
@ -168,7 +168,7 @@ func setupChain(localMinGasPricesStr string) {
|
|||||||
// Initialize the app, so we can use SetMinGasPrices to set the
|
// Initialize the app, so we can use SetMinGasPrices to set the
|
||||||
// validator-specific min-gas-prices setting
|
// validator-specific min-gas-prices setting
|
||||||
db := dbm.NewMemDB()
|
db := dbm.NewMemDB()
|
||||||
newapp := app.NewEthermintApp(
|
newapp := app.NewLaconicApp(
|
||||||
log.NewNopLogger(),
|
log.NewNopLogger(),
|
||||||
db,
|
db,
|
||||||
nil,
|
nil,
|
||||||
|
|||||||
@ -56,7 +56,7 @@ type KeeperTestSuite struct {
|
|||||||
suite.Suite
|
suite.Suite
|
||||||
|
|
||||||
ctx sdk.Context
|
ctx sdk.Context
|
||||||
app *app.EthermintApp
|
app *app.LaconicApp
|
||||||
queryClient types.QueryClient
|
queryClient types.QueryClient
|
||||||
address common.Address
|
address common.Address
|
||||||
consAddress sdk.ConsAddress
|
consAddress sdk.ConsAddress
|
||||||
@ -110,7 +110,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
suite.consAddress = sdk.ConsAddress(priv.PubKey().Address())
|
suite.consAddress = sdk.ConsAddress(priv.PubKey().Address())
|
||||||
|
|
||||||
suite.app = app.Setup(checkTx, func(app *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
suite.app = app.Setup(checkTx, func(app *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
feemarketGenesis := feemarkettypes.DefaultGenesisState()
|
feemarketGenesis := feemarkettypes.DefaultGenesisState()
|
||||||
if suite.enableFeemarket {
|
if suite.enableFeemarket {
|
||||||
feemarketGenesis.Params.EnableHeight = 1
|
feemarketGenesis.Params.EnableHeight = 1
|
||||||
|
|||||||
@ -483,7 +483,7 @@ func setupChain(localMinGasPricesStr string) {
|
|||||||
// Initialize the app, so we can use SetMinGasPrices to set the
|
// Initialize the app, so we can use SetMinGasPrices to set the
|
||||||
// validator-specific min-gas-prices setting
|
// validator-specific min-gas-prices setting
|
||||||
db := dbm.NewMemDB()
|
db := dbm.NewMemDB()
|
||||||
newapp := app.NewEthermintApp(
|
newapp := app.NewLaconicApp(
|
||||||
log.NewNopLogger(),
|
log.NewNopLogger(),
|
||||||
db,
|
db,
|
||||||
nil,
|
nil,
|
||||||
|
|||||||
@ -44,7 +44,7 @@ type KeeperTestSuite struct {
|
|||||||
suite.Suite
|
suite.Suite
|
||||||
|
|
||||||
ctx sdk.Context
|
ctx sdk.Context
|
||||||
app *app.EthermintApp
|
app *app.LaconicApp
|
||||||
queryClient types.QueryClient
|
queryClient types.QueryClient
|
||||||
address common.Address
|
address common.Address
|
||||||
consAddress sdk.ConsAddress
|
consAddress sdk.ConsAddress
|
||||||
|
|||||||
@ -21,7 +21,7 @@ var seed = int64(233)
|
|||||||
|
|
||||||
type KeeperTestSuite struct {
|
type KeeperTestSuite struct {
|
||||||
suite.Suite
|
suite.Suite
|
||||||
app *app.EthermintApp
|
app *app.LaconicApp
|
||||||
ctx sdk.Context
|
ctx sdk.Context
|
||||||
queryClient types.QueryClient
|
queryClient types.QueryClient
|
||||||
accounts []sdk.AccAddress
|
accounts []sdk.AccAddress
|
||||||
@ -29,7 +29,7 @@ type KeeperTestSuite struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (suite *KeeperTestSuite) SetupTest() {
|
func (suite *KeeperTestSuite) SetupTest() {
|
||||||
testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
testApp := app.Setup(false, func(ea *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
return genesis
|
return genesis
|
||||||
})
|
})
|
||||||
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||||
@ -58,7 +58,7 @@ func (suite *KeeperTestSuite) SetupTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestParams(t *testing.T) {
|
func TestParams(t *testing.T) {
|
||||||
testApp := app.Setup(false, func(ea *app.EthermintApp, genesis simapp.GenesisState) simapp.GenesisState {
|
testApp := app.Setup(false, func(ea *app.LaconicApp, genesis simapp.GenesisState) simapp.GenesisState {
|
||||||
return genesis
|
return genesis
|
||||||
})
|
})
|
||||||
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user