diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index b8415fac..15f83483 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -311,7 +311,7 @@ func (suite AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9000-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "laconic_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -322,7 +322,7 @@ func (suite AnteTestSuite) TestAnteHandler() { gas := uint64(200000) coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas))) amount := sdk.NewCoins(coinAmount) - txBuilder := suite.CreateTestEIP712TxBuilderMsgDelegate(from, privKey, "ethermint_9000-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgDelegate(from, privKey, "laconic_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -333,7 +333,7 @@ func (suite AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgCreateValidator(from, privKey, "ethermint_9000-1", gas, amount) + txBuilder := suite.CreateTestEIP712MsgCreateValidator(from, privKey, "laconic_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -346,7 +346,7 @@ func (suite AnteTestSuite) TestAnteHandler() { gas := uint64(200000) // reusing the gasAmount for deposit deposit := sdk.NewCoins(coinAmount) - txBuilder := suite.CreateTestEIP712SubmitProposal(from, privKey, "ethermint_9000-1", gas, gasAmount, deposit) + txBuilder := suite.CreateTestEIP712SubmitProposal(from, privKey, "laconic_9000-1", gas, gasAmount, deposit) return txBuilder.GetTx() }, false, false, true, }, @@ -364,7 +364,7 @@ func (suite AnteTestSuite) TestAnteHandler() { from, grantee, &banktypes.SendAuthorization{SpendLimit: gasAmount}, &expiresAt, ) suite.Require().NoError(err) - return suite.CreateTestEIP712CosmosTxBuilder(from, privKey, "ethermint_9000-1", gas, gasAmount, msg).GetTx() + return suite.CreateTestEIP712CosmosTxBuilder(from, privKey, "laconic_9000-1", gas, gasAmount, msg).GetTx() }, false, false, true, }, @@ -375,7 +375,7 @@ func (suite AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) gasAmount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712GrantAllowance(from, privKey, "ethermint_9000-1", gas, gasAmount) + txBuilder := suite.CreateTestEIP712GrantAllowance(from, privKey, "laconic_9000-1", gas, gasAmount) return txBuilder.GetTx() }, false, false, true, }, @@ -386,7 +386,7 @@ func (suite AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgEditValidator(from, privKey, "ethermint_9000-1", gas, amount) + txBuilder := suite.CreateTestEIP712MsgEditValidator(from, privKey, "laconic_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -397,7 +397,7 @@ func (suite AnteTestSuite) TestAnteHandler() { coinAmount := sdk.NewCoin(evmtypes.DefaultEVMDenom, sdk.NewInt(20)) amount := sdk.NewCoins(coinAmount) gas := uint64(200000) - txBuilder := suite.CreateTestEIP712MsgEditValidator(from, privKey, "ethermint_9000-1", gas, amount) + txBuilder := suite.CreateTestEIP712MsgEditValidator(from, privKey, "laconic_9000-1", gas, amount) return txBuilder.GetTx() }, false, false, true, }, @@ -407,7 +407,7 @@ func (suite AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9002-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "laconic_9002-1", gas, amount) return txBuilder.GetTx() }, false, false, false, }, @@ -417,7 +417,7 @@ func (suite AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9001-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "laconic_9001-1", gas, amount) txBuilder.SetGasLimit(uint64(300000)) txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(30)))) return txBuilder.GetTx() @@ -429,7 +429,7 @@ func (suite AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9001-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "laconic_9001-1", gas, amount) sigsV2 := signing.SignatureV2{} txBuilder.SetSignatures(sigsV2) return txBuilder.GetTx() @@ -441,7 +441,7 @@ func (suite AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9001-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "laconic_9001-1", gas, amount) nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, acc.GetAddress()) suite.Require().NoError(err) sigsV2 := signing.SignatureV2{ @@ -461,7 +461,7 @@ func (suite AnteTestSuite) TestAnteHandler() { from := acc.GetAddress() gas := uint64(200000) amount := sdk.NewCoins(sdk.NewCoin(evmtypes.DefaultEVMDenom, sdkmath.NewInt(100*int64(gas)))) - txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "ethermint_9001-1", gas, amount) + txBuilder := suite.CreateTestEIP712TxBuilderMsgSend(from, privKey, "laconic_9001-1", gas, amount) nonce, err := suite.app.AccountKeeper.GetSequence(suite.ctx, acc.GetAddress()) suite.Require().NoError(err) sigsV2 := signing.SignatureV2{ diff --git a/app/ante/eip712.go b/app/ante/eip712.go index 6b845981..5f5adcb2 100644 --- a/app/ante/eip712.go +++ b/app/ante/eip712.go @@ -15,7 +15,7 @@ import ( "github.com/cerc-io/laconicd/crypto/ethsecp256k1" "github.com/cerc-io/laconicd/ethereum/eip712" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" ethcrypto "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/secp256k1" @@ -25,7 +25,7 @@ var ethermintCodec codec.ProtoCodecMarshaler func init() { registry := codectypes.NewInterfaceRegistry() - ethermint.RegisterInterfaces(registry) + laconicd.RegisterInterfaces(registry) ethermintCodec = codec.NewProtoCodec(registry) } @@ -178,7 +178,7 @@ func VerifySignature( msgs, tx.GetMemo(), tx.GetTip(), ) - signerChainID, err := ethermint.ParseChainID(signerData.ChainID) + signerChainID, err := laconicd.ParseChainID(signerData.ChainID) if err != nil { return sdkerrors.Wrapf(err, "failed to parse chainID: %s", signerData.ChainID) } @@ -192,7 +192,7 @@ func VerifySignature( return sdkerrors.Wrap(sdkerrors.ErrUnknownExtensionOptions, "tx doesnt contain expected amount of extension options") } - extOpt, ok := opts[0].GetCachedValue().(*ethermint.ExtensionOptionsWeb3Tx) + extOpt, ok := opts[0].GetCachedValue().(*laconicd.ExtensionOptionsWeb3Tx) if !ok { return sdkerrors.Wrap(sdkerrors.ErrInvalidChainID, "unknown extension option") } diff --git a/app/ante/eth.go b/app/ante/eth.go index 2ae2622b..a496726e 100644 --- a/app/ante/eth.go +++ b/app/ante/eth.go @@ -12,7 +12,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" authante "github.com/cosmos/cosmos-sdk/x/auth/ante" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmkeeper "github.com/cerc-io/laconicd/x/evm/keeper" "github.com/cerc-io/laconicd/x/evm/statedb" evmtypes "github.com/cerc-io/laconicd/x/evm/types" @@ -236,7 +236,7 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula ctx.EventManager().EmitEvents(events) // TODO: deprecate after https://github.com/cosmos/cosmos-sdk/issues/9514 is fixed on SDK - blockGasLimit := ethermint.BlockGasLimit(ctx) + blockGasLimit := laconicd.BlockGasLimit(ctx) // NOTE: safety check if blockGasLimit > 0 { @@ -248,7 +248,7 @@ func (egcd EthGasConsumeDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simula // Set ctx.GasMeter with a limit of GasWanted (gasLimit) gasConsumed := ctx.GasMeter().GasConsumed() - ctx = ctx.WithGasMeter(ethermint.NewInfiniteGasMeterWithLimit(gasWanted)) + ctx = ctx.WithGasMeter(laconicd.NewInfiniteGasMeterWithLimit(gasWanted)) ctx.GasMeter().ConsumeGas(gasConsumed, "copy gas consumed") newCtx := ctx.WithPriority(minPriority) diff --git a/app/ante/fee_checker.go b/app/ante/fee_checker.go index 645b2a70..3b0781e6 100644 --- a/app/ante/fee_checker.go +++ b/app/ante/fee_checker.go @@ -6,7 +6,7 @@ import ( 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" sdk "github.com/cosmos/cosmos-sdk/types" 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. if hasExtOptsTx, ok := tx.(authante.HasExtensionOptionsTx); ok { for _, opt := range hasExtOptsTx.GetExtensionOptions() { - if extOpt, ok := opt.GetCachedValue().(*ethermint.ExtensionOptionDynamicFeeTx); ok { + if extOpt, ok := opt.GetCachedValue().(*laconicd.ExtensionOptionDynamicFeeTx); ok { maxPriorityPrice = extOpt.MaxPriorityPrice break } diff --git a/app/ante/fee_checker_test.go b/app/ante/fee_checker_test.go index 200c19c9..c3490698 100644 --- a/app/ante/fee_checker_test.go +++ b/app/ante/fee_checker_test.go @@ -7,7 +7,7 @@ import ( "github.com/stretchr/testify/require" "github.com/cerc-io/laconicd/encoding" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -172,7 +172,7 @@ func TestSDKTxFeeChecker(t *testing.T) { txBuilder.SetGasLimit(1) txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin("aphoton", sdk.NewInt(10).Mul(types.DefaultPriorityReduction)))) - option, err := codectypes.NewAnyWithValue(ðermint.ExtensionOptionDynamicFeeTx{}) + option, err := codectypes.NewAnyWithValue(&laconicd.ExtensionOptionDynamicFeeTx{}) require.NoError(t, err) txBuilder.SetExtensionOptions(option) return txBuilder.GetTx() @@ -192,7 +192,7 @@ func TestSDKTxFeeChecker(t *testing.T) { txBuilder.SetGasLimit(1) txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin("aphoton", sdk.NewInt(10).Mul(types.DefaultPriorityReduction).Add(sdk.NewInt(10))))) - option, err := codectypes.NewAnyWithValue(ðermint.ExtensionOptionDynamicFeeTx{ + option, err := codectypes.NewAnyWithValue(&laconicd.ExtensionOptionDynamicFeeTx{ MaxPriorityPrice: sdk.NewInt(5).Mul(types.DefaultPriorityReduction), }) require.NoError(t, err) diff --git a/app/ante/utils_test.go b/app/ante/utils_test.go index e9c6f6d8..96491dc7 100644 --- a/app/ante/utils_test.go +++ b/app/ante/utils_test.go @@ -55,7 +55,7 @@ type AnteTestSuite struct { suite.Suite ctx sdk.Context - app *app.EthermintApp + app *app.LaconicApp clientCtx client.Context anteHandler sdk.AnteHandler ethSigner ethtypes.Signer @@ -73,7 +73,7 @@ func (suite *AnteTestSuite) StateDB() *statedb.StateDB { func (suite *AnteTestSuite) SetupTest() { 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 { // setup feemarketGenesis params feemarketGenesis := feemarkettypes.DefaultGenesisState() @@ -100,7 +100,7 @@ func (suite *AnteTestSuite) SetupTest() { return genesis }) - suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 2, ChainID: "ethermint_9000-1", Time: time.Now().UTC()}) + suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{Height: 2, ChainID: "laconic_9000-1", Time: time.Now().UTC()}) suite.ctx = suite.ctx.WithMinGasPrices(sdk.NewDecCoins(sdk.NewDecCoin(evmtypes.DefaultEVMDenom, sdk.OneInt()))) suite.ctx = suite.ctx.WithBlockGasMeter(sdk.NewGasMeter(1000000000000000000)) suite.app.EvmKeeper.WithChainID(suite.ctx) diff --git a/app/app.go b/app/app.go index 99221660..9b2a368b 100644 --- a/app/app.go +++ b/app/app.go @@ -102,7 +102,7 @@ import ( "github.com/cerc-io/laconicd/app/ante" srvflags "github.com/cerc-io/laconicd/server/flags" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm" evmkeeper "github.com/cerc-io/laconicd/x/evm/keeper" evmtypes "github.com/cerc-io/laconicd/x/evm/types" @@ -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 // Tendermint consensus. -type EthermintApp struct { +type LaconicApp struct { *baseapp.BaseApp // encoding @@ -263,8 +263,8 @@ type EthermintApp struct { configurator module.Configurator } -// NewEthermintApp returns a reference to a new initialized Ethermint application. -func NewEthermintApp( +// NewLaconicApp returns a reference to a new initialized Ethermint application. +func NewLaconicApp( logger log.Logger, db dbm.DB, traceStore io.Writer, @@ -275,7 +275,7 @@ func NewEthermintApp( encodingConfig simappparams.EncodingConfig, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), -) *EthermintApp { +) *LaconicApp { appCodec := encodingConfig.Codec cdc := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry @@ -313,7 +313,7 @@ func NewEthermintApp( tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey, evmtypes.TransientKey, feemarkettypes.TransientKey) memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) - app := &EthermintApp{ + app := &LaconicApp{ BaseApp: bApp, cdc: cdc, appCodec: appCodec, @@ -343,7 +343,7 @@ func NewEthermintApp( app.AccountKeeper = authkeeper.NewAccountKeeper( appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), - ethermint.ProtoAccount, + laconicd.ProtoAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), ) @@ -707,7 +707,7 @@ func NewEthermintApp( } // 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{ AccountKeeper: app.AccountKeeper, BankKeeper: app.BankKeeper, @@ -726,7 +726,7 @@ func (app *EthermintApp) setAnteHandler(txConfig client.TxConfig, maxGasWanted u app.SetAnteHandler(anteHandler) } -func (app *EthermintApp) setPostHandler() { +func (app *LaconicApp) setPostHandler() { postHandler, err := posthandler.NewPostHandler( posthandler.HandlerOptions{}, ) @@ -738,20 +738,20 @@ func (app *EthermintApp) setPostHandler() { } // 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 -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) } // 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) } // 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 if err := json.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) @@ -761,12 +761,12 @@ func (app *EthermintApp) InitChainer(ctx sdk.Context, req abci.RequestInitChain) } // 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) } // 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) // #nosec G705 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 // allowed to receive external tokens. -func (app *EthermintApp) BlockedAddrs() map[string]bool { +func (app *LaconicApp) BlockedAddrs() map[string]bool { blockedAddrs := make(map[string]bool) // #nosec G705 for acc := range maccPerms { @@ -788,64 +788,64 @@ func (app *EthermintApp) BlockedAddrs() map[string]bool { 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 // for modules to register their own custom testing types. -func (app *EthermintApp) LegacyAmino() *codec.LegacyAmino { +func (app *LaconicApp) LegacyAmino() *codec.LegacyAmino { 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 // for modules to register their own custom testing types. -func (app *EthermintApp) AppCodec() codec.Codec { +func (app *LaconicApp) AppCodec() codec.Codec { return app.appCodec } -// InterfaceRegistry returns EthermintApp's InterfaceRegistry -func (app *EthermintApp) InterfaceRegistry() types.InterfaceRegistry { +// InterfaceRegistry returns LaconicApp's InterfaceRegistry +func (app *LaconicApp) InterfaceRegistry() types.InterfaceRegistry { return app.interfaceRegistry } // GetKey returns the KVStoreKey for the provided store key. // // 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] } // GetTKey returns the TransientStoreKey for the provided store key. // // 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] } // GetMemKey returns the MemStoreKey for the provided mem key. // // 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] } // GetSubspace returns a param subspace for a given module name. // // 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) return subspace } // SimulationManager implements the SimulationApp interface -func (app *EthermintApp) SimulationManager() *module.SimulationManager { +func (app *LaconicApp) SimulationManager() *module.SimulationManager { return app.sm } // RegisterAPIRoutes registers all application module routes with the provided // 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 // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) @@ -862,12 +862,12 @@ func (app *EthermintApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config. } // 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) } // RegisterTendermintService implements the Application.RegisterTendermintService method. -func (app *EthermintApp) RegisterTendermintService(clientCtx client.Context) { +func (app *LaconicApp) RegisterTendermintService(clientCtx client.Context) { tmservice.RegisterTendermintService( clientCtx, app.BaseApp.GRPCQueryRouter(), diff --git a/app/app_test.go b/app/app_test.go index 36be44a0..1279850e 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -14,13 +14,13 @@ import ( "github.com/cerc-io/laconicd/encoding" ) -func TestEthermintAppExport(t *testing.T) { +func TestLaconicAppExport(t *testing.T) { db := dbm.NewMemDB() app := SetupWithDB(false, nil, db) app.Commit() // 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{}) require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } diff --git a/app/benchmark_test.go b/app/benchmark_test.go index ce046d3f..ebed7e99 100644 --- a/app/benchmark_test.go +++ b/app/benchmark_test.go @@ -12,9 +12,9 @@ import ( dbm "github.com/tendermint/tm-db" ) -func BenchmarkEthermintApp_ExportAppStateAndValidators(b *testing.B) { +func BenchmarkLaconicApp_ExportAppStateAndValidators(b *testing.B) { 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()) stateBytes, err := json.MarshalIndent(genesisState, "", " ") @@ -25,7 +25,7 @@ func BenchmarkEthermintApp_ExportAppStateAndValidators(b *testing.B) { // Initialize the chain app.InitChain( abci.RequestInitChain{ - ChainId: "ethermint_9000-1", + ChainId: "laconic_9000-1", Validators: []abci.ValidatorUpdate{}, AppStateBytes: stateBytes, }, @@ -36,7 +36,7 @@ func BenchmarkEthermintApp_ExportAppStateAndValidators(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { // 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 { b.Fatal(err) } diff --git a/app/export.go b/app/export.go index ac7b1e92..d4e33834 100644 --- a/app/export.go +++ b/app/export.go @@ -24,7 +24,7 @@ func NewDefaultGenesisState() simapp.GenesisState { // ExportAppStateAndValidators exports the state of the application for a genesis // file. -func (app *EthermintApp) ExportAppStateAndValidators( +func (app *LaconicApp) ExportAppStateAndValidators( forZeroHeight bool, jailAllowedAddrs []string, ) (servertypes.ExportedApp, error) { // 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 // NOTE zero height genesis is a temporary feature which will be deprecated // 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 // check if there is a allowed address list diff --git a/app/simulation_test.go b/app/simulation_test.go index c0b565e7..145e860a 100644 --- a/app/simulation_test.go +++ b/app/simulation_test.go @@ -64,9 +64,9 @@ func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { } // 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() - 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 anteHandler, err := ante.NewAnteHandler(ante.HandlerOptions{ AccountKeeper: app.AccountKeeper, diff --git a/app/upgrades.go b/app/upgrades.go index 91230724..798cf2ae 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -6,7 +6,7 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) -func (app *EthermintApp) RegisterUpgradeHandlers() { +func (app *LaconicApp) RegisterUpgradeHandlers() { planName := "integration-test-upgrade" 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) diff --git a/app/utils.go b/app/utils.go index 4774bce9..a66f5e0f 100644 --- a/app/utils.go +++ b/app/utils.go @@ -17,7 +17,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cerc-io/laconicd/encoding" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" "github.com/cerc-io/laconicd/crypto/ethsecp256k1" @@ -34,7 +34,7 @@ import ( ) // DefaultConsensusParams defines the default Tendermint consensus params used in -// EthermintApp testing. +// LaconicApp testing. var DefaultConsensusParams = &abci.ConsensusParams{ Block: &abci.BlockParams{ MaxBytes: 200000, @@ -52,14 +52,14 @@ var DefaultConsensusParams = &abci.ConsensusParams{ }, } -// Setup initializes a new EthermintApp. A Nop logger is set in EthermintApp. -func Setup(isCheckTx bool, patchGenesis func(*EthermintApp, simapp.GenesisState) simapp.GenesisState) *EthermintApp { +// Setup initializes a new LaconicApp. A Nop logger is set in LaconicApp. +func Setup(isCheckTx bool, patchGenesis func(*LaconicApp, simapp.GenesisState) simapp.GenesisState) *LaconicApp { return SetupWithDB(isCheckTx, patchGenesis, dbm.NewMemDB()) } -// SetupWithDB initializes a new EthermintApp. A Nop logger is set in EthermintApp. -func SetupWithDB(isCheckTx bool, patchGenesis func(*EthermintApp, simapp.GenesisState) simapp.GenesisState, db dbm.DB) *EthermintApp { - app := NewEthermintApp(log.NewNopLogger(), +// SetupWithDB initializes a new LaconicApp. A Nop logger is set in LaconicApp. +func SetupWithDB(isCheckTx bool, patchGenesis func(*LaconicApp, simapp.GenesisState) simapp.GenesisState, db dbm.DB) *LaconicApp { + app := NewLaconicApp(log.NewNopLogger(), db, nil, true, @@ -83,7 +83,7 @@ func SetupWithDB(isCheckTx bool, patchGenesis func(*EthermintApp, simapp.Genesis // Initialize the chain app.InitChain( abci.RequestInitChain{ - ChainId: "ethermint_9000-1", + ChainId: "laconic_9000-1", Validators: []abci.ValidatorUpdate{}, ConsensusParams: DefaultConsensusParams, AppStateBytes: stateBytes, @@ -102,7 +102,7 @@ func RandomGenesisAccounts(simState *module.SimulationState) authtypes.GenesisAc for i, acc := range simState.Accounts { bacc := authtypes.NewBaseAccountWithAddress(acc.Address) - ethacc := ðermint.EthAccount{ + ethacc := &laconicd.EthAccount{ BaseAccount: bacc, CodeHash: common.BytesToHash(emptyCodeHash).String(), } diff --git a/app/utils_test.go b/app/utils_test.go index 8c34b4f3..71870d1c 100644 --- a/app/utils_test.go +++ b/app/utils_test.go @@ -17,7 +17,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cerc-io/laconicd/crypto/ethsecp256k1" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cosmos/cosmos-sdk/simapp" sdk "github.com/cosmos/cosmos-sdk/types" @@ -40,7 +40,7 @@ func TestRandomGenesisAccounts(t *testing.T) { subSpace, find := paramsKeeper.GetSubspace(authtypes.ModuleName) require.True(t, find) accountKeeper := authkeeper.NewAccountKeeper( - appCodec, sdk.NewKVStoreKey(authtypes.StoreKey), subSpace, ethermint.ProtoAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), + appCodec, sdk.NewKVStoreKey(authtypes.StoreKey), subSpace, laconicd.ProtoAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), ) authModule := auth.NewAppModule(appCodec, accountKeeper, RandomGenesisAccounts) @@ -56,7 +56,7 @@ func TestRandomGenesisAccounts(t *testing.T) { accounts, err := authtypes.UnpackAccounts(authState.Accounts) require.NoError(t, err) for _, acc := range accounts { - _, ok := acc.(ethermint.EthAccountI) + _, ok := acc.(laconicd.EthAccountI) require.True(t, ok) } } @@ -76,7 +76,7 @@ func TestStateFn(t *testing.T) { 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()) appStateFn := StateFn(app.AppCodec(), app.SimulationManager()) diff --git a/client/config.go b/client/config.go index 05b5b272..e108bcdb 100644 --- a/client/config.go +++ b/client/config.go @@ -12,7 +12,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) // InitConfig adds the chain-id, encoding and output flags to the persistent flag set. @@ -57,7 +57,7 @@ func ValidateChainID(baseCmd *cobra.Command) *cobra.Command { validateFn := func(cmd *cobra.Command, args []string) error { chainID, _ := cmd.Flags().GetString(flags.FlagChainID) - if !ethermint.IsValidChainID(chainID) { + if !laconicd.IsValidChainID(chainID) { return fmt.Errorf("invalid chain-id format: %s", chainID) } diff --git a/client/keys/add.go b/client/keys/add.go index 87ef16cf..3dc44268 100644 --- a/client/keys/add.go +++ b/client/keys/add.go @@ -7,7 +7,7 @@ import ( "fmt" "sort" - etherminthd "github.com/cerc-io/laconicd/crypto/hd" + laconicdhd "github.com/cerc-io/laconicd/crypto/hd" bip39 "github.com/cosmos/go-bip39" "github.com/spf13/cobra" @@ -68,7 +68,7 @@ func RunAddCmd(ctx client.Context, cmd *cobra.Command, args []string, inBuf *buf if dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun); dryRun { // use in memory keybase - kb = keyring.NewInMemory(ctx.Codec, etherminthd.EthSecp256k1Option()) + kb = keyring.NewInMemory(ctx.Codec, laconicdhd.EthSecp256k1Option()) } else { _, err = kb.Key(name) if err == nil { diff --git a/client/testnet.go b/client/testnet.go index 0444c1b3..a1c9146c 100644 --- a/client/testnet.go +++ b/client/testnet.go @@ -41,7 +41,7 @@ import ( "github.com/cerc-io/laconicd/crypto/hd" "github.com/cerc-io/laconicd/server/config" srvflags "github.com/cerc-io/laconicd/server/flags" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" "github.com/cerc-io/laconicd/testutil/network" @@ -91,7 +91,7 @@ func addTestnetFlagsToCmd(cmd *cobra.Command) { cmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") cmd.Flags().String(sdkserver.FlagMinGasPrices, fmt.Sprintf("0.000006%s", - ethermint.AttoPhoton), + laconicd.AttoPhoton), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.01photino,0.001stake)") cmd.Flags().String(flags.FlagKeyAlgorithm, string(hd.EthSecp256k1Type), "Key signing algorithm to generate keys for") } @@ -215,7 +215,7 @@ func initTestnetFiles( args initArgs, ) error { if args.chainID == "" { - args.chainID = fmt.Sprintf("ethermint_%d-1", tmrand.Int63n(9999999999999)+1) + args.chainID = fmt.Sprintf("laconic_%d-1", tmrand.Int63n(9999999999999)+1) } nodeIDs := make([]string, args.numValidators) @@ -296,22 +296,22 @@ func initTestnetFiles( return err } - accStakingTokens := sdk.TokensFromConsensusPower(5000, ethermint.PowerReduction) + accStakingTokens := sdk.TokensFromConsensusPower(5000, laconicd.PowerReduction) coins := sdk.Coins{ - sdk.NewCoin(ethermint.AttoPhoton, accStakingTokens), + sdk.NewCoin(laconicd.AttoPhoton, accStakingTokens), } genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()}) - genAccounts = append(genAccounts, ðermint.EthAccount{ + genAccounts = append(genAccounts, &laconicd.EthAccount{ BaseAccount: authtypes.NewBaseAccount(addr, nil, 0, 0), CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(), }) - valTokens := sdk.TokensFromConsensusPower(100, ethermint.PowerReduction) + valTokens := sdk.TokensFromConsensusPower(100, laconicd.PowerReduction) createValMsg, err := stakingtypes.NewMsgCreateValidator( sdk.ValAddress(addr), valPubKeys[i], - sdk.NewCoin(ethermint.AttoPhoton, valTokens), + sdk.NewCoin(laconicd.AttoPhoton, valTokens), stakingtypes.NewDescription(nodeDirName, "", "", "", ""), stakingtypes.NewCommissionRates(sdk.OneDec(), sdk.OneDec(), sdk.OneDec()), sdk.OneInt(), @@ -347,7 +347,7 @@ func initTestnetFiles( return err } - customAppTemplate, customAppConfig := config.AppConfig(ethermint.AttoPhoton) + customAppTemplate, customAppConfig := config.AppConfig(laconicd.AttoPhoton) srvconfig.SetConfigTemplate(customAppTemplate) if err := sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, tmconfig.DefaultConfig()); err != nil { return err @@ -356,7 +356,7 @@ func initTestnetFiles( srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config/app.toml"), appConfig) } - if err := initGenFiles(clientCtx, mbm, args.chainID, ethermint.AttoPhoton, genAccounts, genBalances, genFiles, args.numValidators); err != nil { + if err := initGenFiles(clientCtx, mbm, args.chainID, laconicd.AttoPhoton, genAccounts, genBalances, genFiles, args.numValidators); err != nil { return err } diff --git a/cmd/config/config.go b/cmd/config/config.go index ba445f25..33315825 100644 --- a/cmd/config/config.go +++ b/cmd/config/config.go @@ -3,7 +3,7 @@ package config import ( sdk "github.com/cosmos/cosmos-sdk/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) const ( @@ -38,9 +38,9 @@ func SetBech32Prefixes(config *sdk.Config) { // SetBip44CoinType sets the global coin type to be used in hierarchical deterministic wallets. func SetBip44CoinType(config *sdk.Config) { - config.SetCoinType(ethermint.Bip44CoinType) - config.SetPurpose(sdk.Purpose) // Shared - config.SetFullFundraiserPath(ethermint.BIP44HDPath) //nolint: staticcheck + config.SetCoinType(laconicd.Bip44CoinType) + config.SetPurpose(sdk.Purpose) // Shared + config.SetFullFundraiserPath(laconicd.BIP44HDPath) //nolint: staticcheck } // RegisterDenoms registers the base and display denominations to the SDK. @@ -49,7 +49,7 @@ func RegisterDenoms() { panic(err) } - if err := sdk.RegisterDenom(ethermint.AttoPhoton, sdk.NewDecWithPrec(1, ethermint.BaseDenomUnit)); err != nil { + if err := sdk.RegisterDenom(laconicd.AttoPhoton, sdk.NewDecWithPrec(1, laconicd.BaseDenomUnit)); err != nil { panic(err) } } diff --git a/cmd/config/config_test.go b/cmd/config/config_test.go index f82d769c..a46749dd 100644 --- a/cmd/config/config_test.go +++ b/cmd/config/config_test.go @@ -3,7 +3,7 @@ package config import ( "testing" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/crypto/hd" @@ -42,14 +42,14 @@ func TestSetCoinType(t *testing.T) { require.Equal(t, sdk.FullFundraiserPath, config.GetFullBIP44Path()) SetBip44CoinType(config) - require.Equal(t, int(ethermint.Bip44CoinType), int(config.GetCoinType())) + require.Equal(t, int(laconicd.Bip44CoinType), int(config.GetCoinType())) require.Equal(t, sdk.GetConfig().GetCoinType(), config.GetCoinType()) require.Equal(t, sdk.GetConfig().GetFullBIP44Path(), config.GetFullBIP44Path()) } func TestHDPath(t *testing.T) { - params := *hd.NewFundraiserParams(0, ethermint.Bip44CoinType, 0) + params := *hd.NewFundraiserParams(0, laconicd.Bip44CoinType, 0) hdPath := params.String() require.Equal(t, "m/44'/60'/0'/0/0", hdPath) - require.Equal(t, hdPath, ethermint.BIP44HDPath) + require.Equal(t, hdPath, laconicd.BIP44HDPath) } diff --git a/cmd/laconicd/cmd_test.go b/cmd/laconicd/cmd_test.go index ec202291..9e1a7fe1 100644 --- a/cmd/laconicd/cmd_test.go +++ b/cmd/laconicd/cmd_test.go @@ -17,10 +17,10 @@ import ( func TestInitCmd(t *testing.T) { rootCmd, _ := laconicd.NewRootCmd() rootCmd.SetArgs([]string{ - "init", // Test the init cmd - "etherminttest", // Moniker + "init", // Test the init cmd + "laconicdtest", // Moniker fmt.Sprintf("--%s=%s", cli.FlagOverwrite, "true"), // Overwrite genesis.json, in case it already exists - fmt.Sprintf("--%s=%s", flags.FlagChainID, "ethermint_9000-1"), + fmt.Sprintf("--%s=%s", flags.FlagChainID, "laconic_9000-1"), }) err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome) diff --git a/cmd/laconicd/genaccounts.go b/cmd/laconicd/genaccounts.go index 34f5a352..3bfb700c 100644 --- a/cmd/laconicd/genaccounts.go +++ b/cmd/laconicd/genaccounts.go @@ -19,7 +19,7 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cerc-io/laconicd/crypto/hd" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" ) @@ -114,7 +114,7 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa return errors.New("invalid vesting parameters; must supply start and end time or end time") } } else { - genAccount = ðermint.EthAccount{ + genAccount = &laconicd.EthAccount{ BaseAccount: baseAccount, CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(), } diff --git a/cmd/laconicd/root.go b/cmd/laconicd/root.go index 1ac16106..225e44c2 100644 --- a/cmd/laconicd/root.go +++ b/cmd/laconicd/root.go @@ -33,14 +33,14 @@ import ( genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" "github.com/cerc-io/laconicd/app" - ethermintclient "github.com/cerc-io/laconicd/client" + laconicdclient "github.com/cerc-io/laconicd/client" "github.com/cerc-io/laconicd/client/debug" "github.com/cerc-io/laconicd/crypto/hd" "github.com/cerc-io/laconicd/encoding" "github.com/cerc-io/laconicd/server" servercfg "github.com/cerc-io/laconicd/server/config" srvflags "github.com/cerc-io/laconicd/server/flags" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) const EnvPrefix = "ETHERMINT" @@ -63,7 +63,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { rootCmd := &cobra.Command{ Use: "laconicd", - Short: "Ethermint Daemon", + Short: "Laconic Daemon", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) @@ -84,7 +84,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { } // FIXME: replace AttoPhoton with bond denom - customAppTemplate, customAppConfig := servercfg.AppConfig(ethermint.AttoPhoton) + customAppTemplate, customAppConfig := servercfg.AppConfig(laconicd.AttoPhoton) return sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, tmcfg.DefaultConfig()) }, @@ -97,7 +97,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { cfg.Seal() rootCmd.AddCommand( - ethermintclient.ValidateChainID( + laconicdclient.ValidateChainID( genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), ), genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), @@ -106,7 +106,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { genutilcli.ValidateGenesisCmd(app.ModuleBasics), AddGenesisAccountCmd(app.DefaultNodeHome), tmcli.NewCompletionCmd(rootCmd, true), - ethermintclient.NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), + laconicdclient.NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), debug.Cmd(), config.Cmd(), ) @@ -119,7 +119,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { rpc.StatusCommand(), queryCommand(), txCommand(), - ethermintclient.KeyCommands(app.DefaultNodeHome), + laconicdclient.KeyCommands(app.DefaultNodeHome), ) rootCmd, err := srvflags.AddTxFlags(rootCmd) @@ -231,7 +231,7 @@ func (a appCreator) newApp(logger tmlog.Logger, db dbm.DB, traceStore io.Writer, cast.ToUint32(appOpts.Get(sdkserver.FlagStateSyncSnapshotKeepRecent)), ) - ethermintApp := app.NewEthermintApp( + laconicApp := app.NewLaconicApp( logger, db, traceStore, true, skipUpgradeHeights, cast.ToString(appOpts.Get(flags.FlagHome)), 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), ) - return ethermintApp + return laconicApp } // 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, appOpts servertypes.AppOptions, ) (servertypes.ExportedApp, error) { - var ethermintApp *app.EthermintApp + var laconicApp *app.LaconicApp homePath, ok := appOpts.Get(flags.FlagHome).(string) if !ok || homePath == "" { return servertypes.ExportedApp{}, errors.New("application home not set") } 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 } } 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) } diff --git a/crypto/hd/algorithm_test.go b/crypto/hd/algorithm_test.go index 85728a32..2bb2dfb5 100644 --- a/crypto/hd/algorithm_test.go +++ b/crypto/hd/algorithm_test.go @@ -17,7 +17,7 @@ import ( cryptocodec "github.com/cerc-io/laconicd/crypto/codec" enccodec "github.com/cerc-io/laconicd/encoding/codec" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) var TestCodec codec.Codec @@ -46,7 +46,7 @@ func TestKeyring(t *testing.T) { require.Nil(t, info) mockIn.Reset("password\npassword\n") - info, mnemonic, err := kr.NewMnemonic("foo", keyring.English, ethermint.BIP44HDPath, keyring.DefaultBIP39Passphrase, EthSecp256k1) + info, mnemonic, err := kr.NewMnemonic("foo", keyring.English, laconicd.BIP44HDPath, keyring.DefaultBIP39Passphrase, EthSecp256k1) require.NoError(t, err) require.NotEmpty(t, mnemonic) require.Equal(t, "foo", info.Name) @@ -55,7 +55,7 @@ func TestKeyring(t *testing.T) { require.NoError(t, err) require.Equal(t, string(EthSecp256k1Type), pubKey.Type()) - hdPath := ethermint.BIP44HDPath + hdPath := laconicd.BIP44HDPath bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, hdPath) require.NoError(t, err) @@ -79,7 +79,7 @@ func TestKeyring(t *testing.T) { } func TestDerivation(t *testing.T) { - bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, ethermint.BIP44HDPath) + bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, laconicd.BIP44HDPath) require.NoError(t, err) require.NotEmpty(t, bz) @@ -97,7 +97,7 @@ func TestDerivation(t *testing.T) { wallet, err := hdwallet.NewFromMnemonic(mnemonic) require.NoError(t, err) - path := hdwallet.MustParseDerivationPath(ethermint.BIP44HDPath) + path := hdwallet.MustParseDerivationPath(laconicd.BIP44HDPath) account, err := wallet.Derive(path, false) require.NoError(t, err) diff --git a/crypto/hd/benchmark_test.go b/crypto/hd/benchmark_test.go index f8f7dd6d..bd00ab1c 100644 --- a/crypto/hd/benchmark_test.go +++ b/crypto/hd/benchmark_test.go @@ -3,7 +3,7 @@ package hd import ( "testing" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cosmos/cosmos-sdk/crypto/keyring" ) @@ -11,14 +11,14 @@ func BenchmarkEthSecp256k1Algo_Derive(b *testing.B) { b.ReportAllocs() for i := 0; i < b.N; i++ { deriveFn := EthSecp256k1.Derive() - if _, err := deriveFn(mnemonic, keyring.DefaultBIP39Passphrase, ethermint.BIP44HDPath); err != nil { + if _, err := deriveFn(mnemonic, keyring.DefaultBIP39Passphrase, laconicd.BIP44HDPath); err != nil { b.Fatal(err) } } } func BenchmarkEthSecp256k1Algo_Generate(b *testing.B) { - bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, ethermint.BIP44HDPath) + bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, laconicd.BIP44HDPath) if err != nil { b.Fatal(err) } diff --git a/encoding/codec/codec.go b/encoding/codec/codec.go index 01cc8c90..b7faea59 100644 --- a/encoding/codec/codec.go +++ b/encoding/codec/codec.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" cryptocodec "github.com/cerc-io/laconicd/crypto/codec" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) // RegisterLegacyAminoCodec registers Interfaces from types, crypto, and SDK std. @@ -21,5 +21,5 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) { std.RegisterInterfaces(interfaceRegistry) cryptocodec.RegisterInterfaces(interfaceRegistry) - ethermint.RegisterInterfaces(interfaceRegistry) + laconicd.RegisterInterfaces(interfaceRegistry) } diff --git a/ethereum/eip712/preprocess_test.go b/ethereum/eip712/preprocess_test.go index 06aa690b..2e000a94 100644 --- a/ethereum/eip712/preprocess_test.go +++ b/ethereum/eip712/preprocess_test.go @@ -24,7 +24,7 @@ import ( // Testing Constants var ( - chainId = "ethermint_9000-1" + chainId = "laconic_9000-1" ctx = client.Context{}.WithTxConfig( encoding.MakeConfig(app.ModuleBasics).TxConfig, ) diff --git a/indexer/kv_indexer.go b/indexer/kv_indexer.go index f9fd3c34..6145f415 100644 --- a/indexer/kv_indexer.go +++ b/indexer/kv_indexer.go @@ -15,7 +15,7 @@ import ( tmtypes "github.com/tendermint/tendermint/types" dbm "github.com/tendermint/tm-db" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" ) @@ -27,7 +27,7 @@ const ( TxIndexKeyLength = 1 + 8 + 8 ) -var _ ethermint.EVMTxIndexer = &KVIndexer{} +var _ laconicd.EVMTxIndexer = &KVIndexer{} // KVIndexer implements a eth tx indexer on a KV db. type KVIndexer struct { @@ -81,7 +81,7 @@ func (kv *KVIndexer) IndexBlock(block *tmtypes.Block, txResults []*abci.Response ethMsg := msg.(*evmtypes.MsgEthereumTx) txHash := common.HexToHash(ethMsg.Hash) - txResult := ethermint.TxResult{ + txResult := laconicd.TxResult{ Height: height, TxIndex: uint32(txIndex), MsgIndex: uint32(msgIndex), @@ -131,7 +131,7 @@ func (kv *KVIndexer) FirstIndexedBlock() (int64, error) { } // GetByTxHash finds eth tx by eth tx hash -func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*ethermint.TxResult, error) { +func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*laconicd.TxResult, error) { bz, err := kv.db.Get(TxHashKey(hash)) if err != nil { return nil, sdkerrors.Wrapf(err, "GetByTxHash %s", hash.Hex()) @@ -139,7 +139,7 @@ func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*ethermint.TxResult, error) if len(bz) == 0 { return nil, fmt.Errorf("tx not found, hash: %s", hash.Hex()) } - var txKey ethermint.TxResult + var txKey laconicd.TxResult if err := kv.clientCtx.Codec.Unmarshal(bz, &txKey); err != nil { return nil, sdkerrors.Wrapf(err, "GetByTxHash %s", hash.Hex()) } @@ -147,7 +147,7 @@ func (kv *KVIndexer) GetByTxHash(hash common.Hash) (*ethermint.TxResult, error) } // GetByBlockAndIndex finds eth tx by block number and eth tx index -func (kv *KVIndexer) GetByBlockAndIndex(blockNumber int64, txIndex int32) (*ethermint.TxResult, error) { +func (kv *KVIndexer) GetByBlockAndIndex(blockNumber int64, txIndex int32) (*laconicd.TxResult, error) { bz, err := kv.db.Get(TxIndexKey(blockNumber, txIndex)) if err != nil { return nil, sdkerrors.Wrapf(err, "GetByBlockAndIndex %d %d", blockNumber, txIndex) @@ -210,7 +210,7 @@ func isEthTx(tx sdk.Tx) bool { } // saveTxResult index the txResult into the kv db batch -func saveTxResult(codec codec.Codec, batch dbm.Batch, txHash common.Hash, txResult *ethermint.TxResult) error { +func saveTxResult(codec codec.Codec, batch dbm.Batch, txHash common.Hash, txResult *laconicd.TxResult) error { bz := codec.MustMarshal(txResult) if err := batch.Set(TxHashKey(txHash), bz); err != nil { return sdkerrors.Wrap(err, "set tx-hash key") diff --git a/init.bat b/init.bat index 002405a5..06b6ae84 100644 --- a/init.bat +++ b/init.bat @@ -9,7 +9,7 @@ rem 3. add path C:\msys64\mingw64\bin rem C:\msys64\usr\bin set KEY="mykey" -set CHAINID="ethermint_9000-1" +set CHAINID="laconic_9000-1" set MONIKER="localtestnet" set KEYRING="test" set KEYALGO="eth_secp256k1" diff --git a/init.sh b/init.sh index b06d0db4..b18ba487 100755 --- a/init.sh +++ b/init.sh @@ -1,7 +1,7 @@ #!/bin/bash KEY="mykey" -CHAINID="ethermint_9000-1" +CHAINID="laconic_9000-1" MONIKER="localtestnet" KEYRING="test" KEYALGO="eth_secp256k1" diff --git a/rpc/apis.go b/rpc/apis.go index 874b8f47..c072c998 100644 --- a/rpc/apis.go +++ b/rpc/apis.go @@ -19,7 +19,7 @@ import ( "github.com/cerc-io/laconicd/rpc/namespaces/ethereum/personal" "github.com/cerc-io/laconicd/rpc/namespaces/ethereum/txpool" "github.com/cerc-io/laconicd/rpc/namespaces/ethereum/web3" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client" ) @@ -49,7 +49,7 @@ type APICreator = func( clientCtx client.Context, tendermintWebsocketClient *rpcclient.WSClient, allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, + indexer laconicd.EVMTxIndexer, ) []rpc.API // apiCreators defines the JSON-RPC API namespaces. @@ -61,7 +61,7 @@ func init() { clientCtx client.Context, tmWSClient *rpcclient.WSClient, allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, + indexer laconicd.EVMTxIndexer, ) []rpc.API { evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) return []rpc.API{ @@ -79,7 +79,7 @@ func init() { }, } }, - Web3Namespace: func(*server.Context, client.Context, *rpcclient.WSClient, bool, ethermint.EVMTxIndexer) []rpc.API { + Web3Namespace: func(*server.Context, client.Context, *rpcclient.WSClient, bool, laconicd.EVMTxIndexer) []rpc.API { return []rpc.API{ { Namespace: Web3Namespace, @@ -89,7 +89,7 @@ func init() { }, } }, - NetNamespace: func(_ *server.Context, clientCtx client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API { + NetNamespace: func(_ *server.Context, clientCtx client.Context, _ *rpcclient.WSClient, _ bool, _ laconicd.EVMTxIndexer) []rpc.API { return []rpc.API{ { Namespace: NetNamespace, @@ -103,7 +103,7 @@ func init() { clientCtx client.Context, _ *rpcclient.WSClient, allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, + indexer laconicd.EVMTxIndexer, ) []rpc.API { evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) return []rpc.API{ @@ -115,7 +115,7 @@ func init() { }, } }, - TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ ethermint.EVMTxIndexer) []rpc.API { + TxPoolNamespace: func(ctx *server.Context, _ client.Context, _ *rpcclient.WSClient, _ bool, _ laconicd.EVMTxIndexer) []rpc.API { return []rpc.API{ { Namespace: TxPoolNamespace, @@ -129,7 +129,7 @@ func init() { clientCtx client.Context, _ *rpcclient.WSClient, allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, + indexer laconicd.EVMTxIndexer, ) []rpc.API { evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) return []rpc.API{ @@ -145,7 +145,7 @@ func init() { clientCtx client.Context, _ *rpcclient.WSClient, allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, + indexer laconicd.EVMTxIndexer, ) []rpc.API { evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer) return []rpc.API{ @@ -165,7 +165,7 @@ func GetRPCAPIs(ctx *server.Context, clientCtx client.Context, tmWSClient *rpcclient.WSClient, allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, + indexer laconicd.EVMTxIndexer, selectedAPIs []string, ) []rpc.API { var apis []rpc.API diff --git a/rpc/backend/backend.go b/rpc/backend/backend.go index 03fae557..5dce784e 100644 --- a/rpc/backend/backend.go +++ b/rpc/backend/backend.go @@ -8,7 +8,7 @@ import ( "github.com/cerc-io/laconicd/crypto/hd" rpctypes "github.com/cerc-io/laconicd/rpc/types" "github.com/cerc-io/laconicd/server/config" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -103,8 +103,8 @@ type EVMBackend interface { // Tx Info GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransaction, error) - GetTxByEthHash(txHash common.Hash) (*ethermint.TxResult, error) - GetTxByTxIndex(height int64, txIndex uint) (*ethermint.TxResult, error) + GetTxByEthHash(txHash common.Hash) (*laconicd.TxResult, error) + GetTxByTxIndex(height int64, txIndex uint) (*laconicd.TxResult, error) GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error) GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error) @@ -141,7 +141,7 @@ type Backend struct { chainID *big.Int cfg config.Config allowUnprotectedTxs bool - indexer ethermint.EVMTxIndexer + indexer laconicd.EVMTxIndexer } // NewBackend creates a new Backend instance for cosmos and ethereum namespaces @@ -150,9 +150,9 @@ func NewBackend( logger log.Logger, clientCtx client.Context, allowUnprotectedTxs bool, - indexer ethermint.EVMTxIndexer, + indexer laconicd.EVMTxIndexer, ) *Backend { - chainID, err := ethermint.ParseChainID(clientCtx.ChainID) + chainID, err := laconicd.ParseChainID(clientCtx.ChainID) if err != nil { panic(err) } diff --git a/rpc/backend/backend_suite_test.go b/rpc/backend/backend_suite_test.go index ee9bd51f..bb6205b8 100644 --- a/rpc/backend/backend_suite_test.go +++ b/rpc/backend/backend_suite_test.go @@ -51,7 +51,7 @@ func (suite *BackendTestSuite) SetupTest() { } encodingConfig := encoding.MakeConfig(app.ModuleBasics) - clientCtx := client.Context{}.WithChainID("ethermint_9000-1"). + clientCtx := client.Context{}.WithChainID("laconic_9000-1"). WithHeight(1). WithTxConfig(encodingConfig.TxConfig). WithKeyringDir(clientDir). diff --git a/rpc/backend/call_tx.go b/rpc/backend/call_tx.go index b4db61ae..f055786b 100644 --- a/rpc/backend/call_tx.go +++ b/rpc/backend/call_tx.go @@ -8,7 +8,7 @@ import ( "math/big" rpctypes "github.com/cerc-io/laconicd/rpc/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" "github.com/cosmos/cosmos-sdk/client/flags" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -35,7 +35,7 @@ func (b *Backend) Resend(args evmtypes.TransactionArgs, gasPrice *hexutil.Big, g // The signer used should always be the 'latest' known one because we expect // signers to be backwards-compatible with old transactions. - eip155ChainID, err := ethermint.ParseChainID(b.clientCtx.ChainID) + eip155ChainID, err := laconicd.ParseChainID(b.clientCtx.ChainID) if err != nil { return common.Hash{}, err } diff --git a/rpc/backend/chain_info.go b/rpc/backend/chain_info.go index 06318808..090b0996 100644 --- a/rpc/backend/chain_info.go +++ b/rpc/backend/chain_info.go @@ -6,7 +6,7 @@ import ( "strconv" rpctypes "github.com/cerc-io/laconicd/rpc/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" feemarkettypes "github.com/cerc-io/laconicd/x/feemarket/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -19,7 +19,7 @@ import ( // ChainID is the EIP-155 replay-protection chain id for the current ethereum chain config. func (b *Backend) ChainID() (*hexutil.Big, error) { - eip155ChainID, err := ethermint.ParseChainID(b.clientCtx.ChainID) + eip155ChainID, err := laconicd.ParseChainID(b.clientCtx.ChainID) if err != nil { panic(err) } diff --git a/rpc/backend/node_info.go b/rpc/backend/node_info.go index a3bff3aa..f9947522 100644 --- a/rpc/backend/node_info.go +++ b/rpc/backend/node_info.go @@ -9,7 +9,7 @@ import ( "github.com/cerc-io/laconicd/crypto/ethsecp256k1" rpctypes "github.com/cerc-io/laconicd/rpc/types" "github.com/cerc-io/laconicd/server/config" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -326,13 +326,13 @@ func (b *Backend) RPCBlockRangeCap() int32 { func (b *Backend) RPCMinGasPrice() int64 { evmParams, err := b.queryClient.Params(b.ctx, &evmtypes.QueryParamsRequest{}) if err != nil { - return ethermint.DefaultGasPrice + return laconicd.DefaultGasPrice } minGasPrice := b.cfg.GetMinGasPrices() amt := minGasPrice.AmountOf(evmParams.Params.EvmDenom).TruncateInt64() if amt == 0 { - return ethermint.DefaultGasPrice + return laconicd.DefaultGasPrice } return amt diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index da1c4d50..4cdd59b9 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -4,7 +4,7 @@ import ( "fmt" rpctypes "github.com/cerc-io/laconicd/rpc/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -277,7 +277,7 @@ func (b *Backend) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNum // GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash // TODO: Don't need to convert once hashing is fixed on Tendermint // https://github.com/tendermint/tendermint/issues/6539 -func (b *Backend) GetTxByEthHash(hash common.Hash) (*ethermint.TxResult, error) { +func (b *Backend) GetTxByEthHash(hash common.Hash) (*laconicd.TxResult, error) { if b.indexer != nil { return b.indexer.GetByTxHash(hash) } @@ -294,7 +294,7 @@ func (b *Backend) GetTxByEthHash(hash common.Hash) (*ethermint.TxResult, error) } // GetTxByTxIndex uses `/tx_query` to find transaction by tx index of valid ethereum txs -func (b *Backend) GetTxByTxIndex(height int64, index uint) (*ethermint.TxResult, error) { +func (b *Backend) GetTxByTxIndex(height int64, index uint) (*laconicd.TxResult, error) { if b.indexer != nil { return b.indexer.GetByBlockAndIndex(height, int32(index)) } @@ -314,7 +314,7 @@ func (b *Backend) GetTxByTxIndex(height int64, index uint) (*ethermint.TxResult, } // queryTendermintTxIndexer query tx in tendermint tx indexer -func (b *Backend) queryTendermintTxIndexer(query string, txGetter func(*rpctypes.ParsedTxs) *rpctypes.ParsedTx) (*ethermint.TxResult, error) { +func (b *Backend) queryTendermintTxIndexer(query string, txGetter func(*rpctypes.ParsedTxs) *rpctypes.ParsedTx) (*laconicd.TxResult, error) { resTxs, err := b.clientCtx.Client.TxSearch(b.ctx, query, false, nil, nil, "") if err != nil { return nil, err diff --git a/rpc/namespaces/ethereum/eth/api.go b/rpc/namespaces/ethereum/eth/api.go index 8f5d4cd8..52a55479 100644 --- a/rpc/namespaces/ethereum/eth/api.go +++ b/rpc/namespaces/ethereum/eth/api.go @@ -16,7 +16,7 @@ import ( "github.com/cerc-io/laconicd/rpc/backend" rpctypes "github.com/cerc-io/laconicd/rpc/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" ) @@ -293,7 +293,7 @@ func (e *PublicAPI) Call(args evmtypes.TransactionArgs, // ProtocolVersion returns the supported Ethereum protocol version. func (e *PublicAPI) ProtocolVersion() hexutil.Uint { e.logger.Debug("eth_protocolVersion") - return hexutil.Uint(ethermint.ProtocolVersion) + return hexutil.Uint(laconicd.ProtocolVersion) } // GasPrice returns the current gas price based on Ethermint's gas price oracle. diff --git a/rpc/namespaces/ethereum/net/api.go b/rpc/namespaces/ethereum/net/api.go index c469c92c..82cd9a8e 100644 --- a/rpc/namespaces/ethereum/net/api.go +++ b/rpc/namespaces/ethereum/net/api.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cosmos/cosmos-sdk/client" rpcclient "github.com/tendermint/tendermint/rpc/client" ) @@ -18,7 +18,7 @@ type PublicAPI struct { // NewPublicAPI creates an instance of the public Net Web3 API. func NewPublicAPI(clientCtx client.Context) *PublicAPI { // parse the chainID from a integer string - chainIDEpoch, err := ethermint.ParseChainID(clientCtx.ChainID) + chainIDEpoch, err := laconicd.ParseChainID(clientCtx.ChainID) if err != nil { panic(err) } diff --git a/rpc/namespaces/ethereum/personal/api.go b/rpc/namespaces/ethereum/personal/api.go index 85f8c839..c8505215 100644 --- a/rpc/namespaces/ethereum/personal/api.go +++ b/rpc/namespaces/ethereum/personal/api.go @@ -9,7 +9,7 @@ import ( "github.com/cerc-io/laconicd/rpc/backend" "github.com/cerc-io/laconicd/crypto/hd" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/tendermint/tendermint/libs/log" @@ -28,7 +28,7 @@ import ( type PrivateAccountAPI struct { backend backend.EVMBackend logger log.Logger - hdPathIter ethermint.HDPathIterator + hdPathIter laconicd.HDPathIterator } // NewAPI creates an instance of the public Personal Eth API. @@ -39,7 +39,7 @@ func NewAPI( cfg := sdk.GetConfig() basePath := cfg.GetFullBIP44Path() - iterator, err := ethermint.NewHDPathIterator(basePath, true) + iterator, err := laconicd.NewHDPathIterator(basePath, true) if err != nil { panic(err) } diff --git a/rpc/types/block.go b/rpc/types/block.go index 992b9555..5eed9b45 100644 --- a/rpc/types/block.go +++ b/rpc/types/block.go @@ -17,7 +17,7 @@ import ( grpctypes "github.com/cosmos/cosmos-sdk/types/grpc" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) // BlockNumber represents decoding hex string to block values @@ -182,7 +182,7 @@ func (bnh *BlockNumberOrHash) decodeFromString(input string) error { return err } - bnInt, err := ethermint.SafeInt64(blockNumber) + bnInt, err := laconicd.SafeInt64(blockNumber) if err != nil { return err } diff --git a/rpc/types/events.go b/rpc/types/events.go index 38189ba3..4f0073bb 100644 --- a/rpc/types/events.go +++ b/rpc/types/events.go @@ -4,7 +4,7 @@ import ( "fmt" "strconv" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/common" @@ -137,7 +137,7 @@ func ParseTxResult(result *abci.ResponseDeliverTx, tx sdk.Tx) (*ParsedTxs, error } // ParseTxIndexerResult parse tm tx result to a format compatible with the custom tx indexer. -func ParseTxIndexerResult(txResult *tmrpctypes.ResultTx, tx sdk.Tx, getter func(*ParsedTxs) *ParsedTx) (*ethermint.TxResult, error) { +func ParseTxIndexerResult(txResult *tmrpctypes.ResultTx, tx sdk.Tx, getter func(*ParsedTxs) *ParsedTx) (*laconicd.TxResult, error) { txs, err := ParseTxResult(&txResult.TxResult, tx) if err != nil { return nil, fmt.Errorf("failed to parse tx events: block %d, index %d, %v", txResult.Height, txResult.Index, err) @@ -148,7 +148,7 @@ func ParseTxIndexerResult(txResult *tmrpctypes.ResultTx, tx sdk.Tx, getter func( return nil, fmt.Errorf("ethereum tx not found in msgs: block %d, index %d", txResult.Height, txResult.Index) } - return ðermint.TxResult{ + return &laconicd.TxResult{ Height: txResult.Height, TxIndex: txResult.Index, MsgIndex: uint32(parsedTx.MsgIndex), diff --git a/scripts/contract-test.sh b/scripts/contract-test.sh index 58abc872..c26be846 100755 --- a/scripts/contract-test.sh +++ b/scripts/contract-test.sh @@ -1,7 +1,7 @@ #!/bin/bash KEY="mykey" -CHAINID="ethermint_9000-1" +CHAINID="laconic_9000-1" MONIKER="localtestnet" # stop and remove existing daemon and client data and process(es) diff --git a/scripts/ethermint-devnet.yaml b/scripts/ethermint-devnet.yaml index 3a0fa687..551541be 100755 --- a/scripts/ethermint-devnet.yaml +++ b/scripts/ethermint-devnet.yaml @@ -1,5 +1,5 @@ dotenv: .env -ethermint_9000-1: +laconic_9000-1: cmd: laconicd start-flags: "--trace" app-config: diff --git a/scripts/laconicd-devnet.yaml b/scripts/laconicd-devnet.yaml index 3a0fa687..551541be 100755 --- a/scripts/laconicd-devnet.yaml +++ b/scripts/laconicd-devnet.yaml @@ -1,5 +1,5 @@ dotenv: .env -ethermint_9000-1: +laconic_9000-1: cmd: laconicd start-flags: "--trace" app-config: diff --git a/scripts/start.sh b/scripts/start.sh index b25ed14a..ea8cf7d7 100755 --- a/scripts/start.sh +++ b/scripts/start.sh @@ -15,7 +15,7 @@ IP_ADDR="0.0.0.0" MODE="rpc" KEY="mykey" -CHAINID="ethermint_9000-1" +CHAINID="laconic_9000-1" MONIKER="mymoniker" ## default port prefixes for laconicd @@ -47,14 +47,14 @@ done set -euxo pipefail -DATA_DIR=$(mktemp -d -t ethermint_9000-datadir.XXXXX) +DATA_DIR=$(mktemp -d -t laconic_9000-datadir.XXXXX) if [[ ! "$DATA_DIR" ]]; then echo "Could not create $DATA_DIR" exit 1 fi -DATA_CLI_DIR=$(mktemp -d -t ethermint_9000-cli-datadir.XXXXX) +DATA_CLI_DIR=$(mktemp -d -t laconic_9000-cli-datadir.XXXXX) if [[ ! "$DATA_CLI_DIR" ]]; then echo "Could not create $DATA_CLI_DIR" diff --git a/server/indexer_service.go b/server/indexer_service.go index 373605da..c29f426a 100644 --- a/server/indexer_service.go +++ b/server/indexer_service.go @@ -8,7 +8,7 @@ import ( rpcclient "github.com/tendermint/tendermint/rpc/client" "github.com/tendermint/tendermint/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) const ( @@ -21,13 +21,13 @@ const ( type EVMIndexerService struct { service.BaseService - txIdxr ethermint.EVMTxIndexer + txIdxr laconicd.EVMTxIndexer client rpcclient.Client } // NewEVMIndexerService returns a new service instance. func NewEVMIndexerService( - txIdxr ethermint.EVMTxIndexer, + txIdxr laconicd.EVMTxIndexer, client rpcclient.Client, ) *EVMIndexerService { is := &EVMIndexerService{txIdxr: txIdxr, client: client} diff --git a/server/json_rpc.go b/server/json_rpc.go index 9fdb6afa..be0ec7af 100644 --- a/server/json_rpc.go +++ b/server/json_rpc.go @@ -15,7 +15,7 @@ import ( ethrpc "github.com/ethereum/go-ethereum/rpc" "github.com/cerc-io/laconicd/server/config" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) // StartJSONRPC starts the JSON-RPC server @@ -24,7 +24,7 @@ func StartJSONRPC(ctx *server.Context, tmRPCAddr, tmEndpoint string, config *config.Config, - indexer ethermint.EVMTxIndexer, + indexer laconicd.EVMTxIndexer, ) (*http.Server, chan struct{}, error) { tmWsClient := ConnectTmWS(tmRPCAddr, tmEndpoint, ctx.Logger) diff --git a/server/start.go b/server/start.go index 02b9fad7..41d96575 100644 --- a/server/start.go +++ b/server/start.go @@ -48,7 +48,7 @@ import ( ethdebug "github.com/cerc-io/laconicd/rpc/namespaces/ethereum/debug" "github.com/cerc-io/laconicd/server/config" srvflags "github.com/cerc-io/laconicd/server/flags" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) // StartCmd runs the service passed in, either stand-alone or in-process with @@ -341,7 +341,7 @@ func startInProcess(ctx *server.Context, clientCtx client.Context, appCreator ty app.RegisterTendermintService(clientCtx) } - var idxer ethermint.EVMTxIndexer + var idxer laconicd.EVMTxIndexer if config.JSONRPC.EnableIndexer { idxDB, err := OpenIndexerDB(home, server.GetAppDBBackend(ctx.Viper)) if err != nil { diff --git a/starport.yml b/starport.yml index 90580ce8..4c6df8bb 100644 --- a/starport.yml +++ b/starport.yml @@ -24,7 +24,7 @@ init: address: "0.0.0.0:8545" # change the JSON-RPC address and port ws-address: "0.0.0.0:8546" # change the JSON-RPC websocket address and port genesis: - chain_id: "ethermint_9000-1" + chain_id: "laconic_9000-1" app_state: staking: params: diff --git a/tests/e2e/integration_test.go b/tests/e2e/integration_test.go index 158338ce..be4032ea 100644 --- a/tests/e2e/integration_test.go +++ b/tests/e2e/integration_test.go @@ -31,7 +31,7 @@ import ( "github.com/cerc-io/laconicd/server/config" "github.com/cerc-io/laconicd/testutil/network" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) // var _ = Describe("E2e", func() { @@ -84,7 +84,7 @@ func (s *IntegrationTestSuite) SetupSuite() { s.rpcClient = rpcClient s.gethClient = gethclient.New(rpcClient) s.Require().NotNil(s.gethClient) - chainId, err := ethermint.ParseChainID(s.cfg.ChainID) + chainId, err := laconicd.ParseChainID(s.cfg.ChainID) s.Require().NoError(err) s.ethSigner = ethtypes.LatestSignerForChainID(chainId) } @@ -99,9 +99,9 @@ func (s *IntegrationTestSuite) TestChainID() { s.T().Log(chainID.Int64()) - eip155ChainID, err := ethermint.ParseChainID(s.network.Config.ChainID) + eip155ChainID, err := laconicd.ParseChainID(s.network.Config.ChainID) s.Require().NoError(err) - eip155ChainIDGen, err := ethermint.ParseChainID(genesisRes.Genesis.ChainID) + eip155ChainIDGen, err := laconicd.ParseChainID(genesisRes.Genesis.ChainID) s.Require().NoError(err) s.Require().Equal(chainID, eip155ChainID) diff --git a/tests/importer/importer_test.go b/tests/importer/importer_test.go index df8b4f71..33b66538 100644 --- a/tests/importer/importer_test.go +++ b/tests/importer/importer_test.go @@ -52,7 +52,7 @@ func init() { type ImporterTestSuite struct { suite.Suite - app *app.EthermintApp + app *app.LaconicApp ctx sdk.Context } @@ -66,7 +66,7 @@ func (suite *ImporterTestSuite) DoSetupTest(t require.TestingT) { consAddress := sdk.ConsAddress(priv.PubKey().Address()) suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{ Height: 1, - ChainID: "ethermint_9000-1", + ChainID: "laconic_9000-1", Time: time.Now().UTC(), ProposerAddress: consAddress.Bytes(), Version: tmversion.Consensus{ diff --git a/tests/integration_tests/configs/cosmovisor.jsonnet b/tests/integration_tests/configs/cosmovisor.jsonnet index 1fbf075f..a7b80471 100644 --- a/tests/integration_tests/configs/cosmovisor.jsonnet +++ b/tests/integration_tests/configs/cosmovisor.jsonnet @@ -1,7 +1,7 @@ local config = import 'default.jsonnet'; config { - 'ethermint_9000-1'+: { + 'laconic_9000-1'+: { genesis+: { app_state+: { feemarket+: { diff --git a/tests/integration_tests/configs/default.jsonnet b/tests/integration_tests/configs/default.jsonnet index 890ef2ef..8a56753b 100644 --- a/tests/integration_tests/configs/default.jsonnet +++ b/tests/integration_tests/configs/default.jsonnet @@ -1,6 +1,6 @@ { dotenv: '../../../scripts/.env', - 'ethermint_9000-1': { + 'laconic_9000-1': { cmd: 'laconicd', 'start-flags': '--trace', config: { diff --git a/tests/integration_tests/configs/enable-indexer.jsonnet b/tests/integration_tests/configs/enable-indexer.jsonnet index c21c6a98..f50c2d7f 100644 --- a/tests/integration_tests/configs/enable-indexer.jsonnet +++ b/tests/integration_tests/configs/enable-indexer.jsonnet @@ -1,7 +1,7 @@ local config = import 'default.jsonnet'; config { - 'ethermint_9000-1'+: { + 'laconic_9000-1'+: { config+: { tx_index+: { indexer: 'null', diff --git a/tests/integration_tests/configs/pruned_node.jsonnet b/tests/integration_tests/configs/pruned_node.jsonnet index ffb6a830..37a47578 100644 --- a/tests/integration_tests/configs/pruned_node.jsonnet +++ b/tests/integration_tests/configs/pruned_node.jsonnet @@ -1,7 +1,7 @@ local config = import 'default.jsonnet'; config { - 'ethermint_9000-1'+: { + 'laconic_9000-1'+: { 'app-config'+: { pruning: 'everything', 'state-sync'+: { diff --git a/tests/integration_tests/configs/rollback-test.jsonnet b/tests/integration_tests/configs/rollback-test.jsonnet index e39437ec..9ca31e4c 100644 --- a/tests/integration_tests/configs/rollback-test.jsonnet +++ b/tests/integration_tests/configs/rollback-test.jsonnet @@ -1,7 +1,7 @@ local config = import 'default.jsonnet'; config { - 'ethermint_9000-1'+: { + 'laconic_9000-1'+: { validators: super.validators + [{ name: 'fullnode', }], diff --git a/tests/integration_tests/network.py b/tests/integration_tests/network.py index 28dcbb81..09dd2274 100644 --- a/tests/integration_tests/network.py +++ b/tests/integration_tests/network.py @@ -130,7 +130,7 @@ def setup_custom_ethermint( wait_for_port(ports.evmrpc_port(base_port)) wait_for_port(ports.evmrpc_ws_port(base_port)) yield Ethermint( - path / "ethermint_9000-1", chain_binary=chain_binary or DEFAULT_CHAIN_BINARY + path / "laconic_9000-1", chain_binary=chain_binary or DEFAULT_CHAIN_BINARY ) finally: os.killpg(os.getpgid(proc.pid), signal.SIGTERM) diff --git a/tests/integration_tests/test_rollback.py b/tests/integration_tests/test_rollback.py index 15f5249e..d7383645 100644 --- a/tests/integration_tests/test_rollback.py +++ b/tests/integration_tests/test_rollback.py @@ -15,7 +15,7 @@ def update_node2_cmd(path, cmd, i): ini = configparser.RawConfigParser() ini.read(ini_path) for section in ini.sections(): - if section == f"program:ethermint_9000-1-node{i}": + if section == f"program:laconic_9000-1-node{i}": ini[section].update( { "command": f"{cmd} start --home %(here)s/node{i}", @@ -28,7 +28,7 @@ def update_node2_cmd(path, cmd, i): def post_init(broken_binary): def inner(path, base_port, config): - chain_id = "ethermint_9000-1" + chain_id = "laconic_9000-1" update_node2_cmd(path / chain_id, broken_binary, 2) return inner @@ -82,7 +82,7 @@ def test_rollback(custom_ethermint): print("stop node2") supervisorctl( - custom_ethermint.base_dir / "../tasks.ini", "stop", "ethermint_9000-1-node2" + custom_ethermint.base_dir / "../tasks.ini", "stop", "laconic_9000-1-node2" ) print("do rollback on node2") diff --git a/tests/integration_tests/test_upgrade.py b/tests/integration_tests/test_upgrade.py index 8e63ef72..d8368ba5 100644 --- a/tests/integration_tests/test_upgrade.py +++ b/tests/integration_tests/test_upgrade.py @@ -36,7 +36,7 @@ def post_init(path, base_port, config): """ prepare cosmovisor for each node """ - chain_id = "ethermint_9000-1" + chain_id = "laconic_9000-1" cfg = json.loads((path / chain_id / "config.json").read_text()) for i, _ in enumerate(cfg["validators"]): home = path / chain_id / f"node{i}" diff --git a/tests/rpc/rpc_test.go b/tests/rpc/rpc_test.go index 95c46a8f..f9c36b41 100644 --- a/tests/rpc/rpc_test.go +++ b/tests/rpc/rpc_test.go @@ -18,7 +18,7 @@ import ( "github.com/stretchr/testify/require" rpctypes "github.com/cerc-io/laconicd/rpc/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" "github.com/ethereum/go-ethereum/common" @@ -134,7 +134,7 @@ func callWithError(method string, params interface{}) (*Response, error) { } func TestEth_protocolVersion(t *testing.T) { - expectedRes := hexutil.Uint(ethermint.ProtocolVersion) + expectedRes := hexutil.Uint(laconicd.ProtocolVersion) rpcRes := call(t, "eth_protocolVersion", []string{}) diff --git a/tests/solidity/init-test-node.sh b/tests/solidity/init-test-node.sh index 8727fa8e..7f776efe 100755 --- a/tests/solidity/init-test-node.sh +++ b/tests/solidity/init-test-node.sh @@ -1,6 +1,6 @@ #!/bin/bash -CHAINID="ethermint_9000-1" +CHAINID="laconic_9000-1" MONIKER="localtestnet" # localKey address 0x7cb61d4117ae31a12e393a1cfa3bac666481d02e diff --git a/testutil/network/network.go b/testutil/network/network.go index c235bc3c..0f804954 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -52,7 +52,7 @@ import ( "github.com/cerc-io/laconicd/crypto/hd" "github.com/cerc-io/laconicd/encoding" "github.com/cerc-io/laconicd/server/config" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" "github.com/cerc-io/laconicd/app" @@ -68,7 +68,7 @@ type AppConstructor = func(val Validator) servertypes.Application // NewAppConstructor returns a new simapp AppConstructor func NewAppConstructor(encodingCfg params.EncodingConfig) AppConstructor { 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, encodingCfg, simapp.EmptyAppOptions{}, @@ -122,13 +122,13 @@ func DefaultConfig() Config { AppConstructor: NewAppConstructor(encCfg), GenesisState: app.ModuleBasics.DefaultGenesis(encCfg.Codec), TimeoutCommit: 2 * time.Second, - ChainID: fmt.Sprintf("ethermint_%d-1", tmrand.Int63n(9999999999999)+1), + ChainID: fmt.Sprintf("laconic_%d-1", tmrand.Int63n(9999999999999)+1), NumValidators: 4, - BondDenom: ethermint.AttoPhoton, - MinGasPrices: fmt.Sprintf("0.000006%s", ethermint.AttoPhoton), - AccountTokens: sdk.TokensFromConsensusPower(1000, ethermint.PowerReduction), - StakingTokens: sdk.TokensFromConsensusPower(500, ethermint.PowerReduction), - BondedTokens: sdk.TokensFromConsensusPower(100, ethermint.PowerReduction), + BondDenom: laconicd.AttoPhoton, + MinGasPrices: fmt.Sprintf("0.000006%s", laconicd.AttoPhoton), + AccountTokens: sdk.TokensFromConsensusPower(1000, laconicd.PowerReduction), + StakingTokens: sdk.TokensFromConsensusPower(500, laconicd.PowerReduction), + BondedTokens: sdk.TokensFromConsensusPower(100, laconicd.PowerReduction), PruningStrategy: pruningtypes.PruningOptionNothing, CleanupDir: true, SigningAlgo: string(hd.EthSecp256k1Type), @@ -218,7 +218,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) { l.Log("acquiring test network lock") lock.Lock() - if !ethermint.IsValidChainID(cfg.ChainID) { + if !laconicd.IsValidChainID(cfg.ChainID) { return nil, fmt.Errorf("invalid chain-id: %s", cfg.ChainID) } @@ -412,7 +412,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) { genFiles = append(genFiles, tmCfg.GenesisFile()) genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: balances.Sort()}) - genAccounts = append(genAccounts, ðermint.EthAccount{ + genAccounts = append(genAccounts, &laconicd.EthAccount{ BaseAccount: authtypes.NewBaseAccount(addr, nil, 0, 0), CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(), }) @@ -470,7 +470,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) { return nil, err } - customAppTemplate, _ := config.AppConfig(ethermint.AttoPhoton) + customAppTemplate, _ := config.AppConfig(laconicd.AttoPhoton) srvconfig.SetConfigTemplate(customAppTemplate) srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config/app.toml"), appCfg) diff --git a/types/account_test.go b/types/account_test.go index 6fb66c1e..8d4f3af7 100644 --- a/types/account_test.go +++ b/types/account_test.go @@ -14,7 +14,7 @@ import ( cryptocodec "github.com/cerc-io/laconicd/crypto/codec" "github.com/cerc-io/laconicd/crypto/ethsecp256k1" - ethermintcodec "github.com/cerc-io/laconicd/encoding/codec" + laconicdcodec "github.com/cerc-io/laconicd/encoding/codec" "github.com/cerc-io/laconicd/types" ) @@ -42,7 +42,7 @@ func (suite *AccountTestSuite) SetupTest() { } interfaceRegistry := codectypes.NewInterfaceRegistry() - ethermintcodec.RegisterInterfaces(interfaceRegistry) + laconicdcodec.RegisterInterfaces(interfaceRegistry) suite.cdc = codec.NewProtoCodec(interfaceRegistry) } diff --git a/types/benchmark_test.go b/types/benchmark_test.go index 23d7790a..10e7433a 100644 --- a/types/benchmark_test.go +++ b/types/benchmark_test.go @@ -9,7 +9,7 @@ func BenchmarkParseChainID(b *testing.B) { b.ReportAllocs() // Start at 1, for valid EIP155, see regexEIP155 variable. for i := 1; i < b.N; i++ { - chainID := fmt.Sprintf("ethermint_1-%d", i) + chainID := fmt.Sprintf("laconic_1-%d", i) if _, err := ParseChainID(chainID); err != nil { b.Fatal(err) } diff --git a/types/chain_id.go b/types/chain_id.go index 0688423c..55f67fc6 100644 --- a/types/chain_id.go +++ b/types/chain_id.go @@ -15,7 +15,7 @@ var ( regexEIP155 = `[1-9][0-9]*` regexEpochSeparator = `-{1}` regexEpoch = `[1-9][0-9]*` - ethermintChainID = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)%s(%s)$`, + laconicChainID = regexp.MustCompile(fmt.Sprintf(`^(%s)%s(%s)%s(%s)$`, regexChainID, regexEIP155Separator, regexEIP155, @@ -29,7 +29,7 @@ func IsValidChainID(chainID string) bool { return false } - return ethermintChainID.MatchString(chainID) + return laconicChainID.MatchString(chainID) } // ParseChainID parses a string chain identifier's epoch to an Ethereum-compatible @@ -40,7 +40,7 @@ func ParseChainID(chainID string) (*big.Int, error) { return nil, sdkerrors.Wrapf(ErrInvalidChainID, "chain-id '%s' cannot exceed 48 chars", chainID) } - matches := ethermintChainID.FindStringSubmatch(chainID) + matches := laconicChainID.FindStringSubmatch(chainID) if matches == nil || len(matches) != 4 || matches[1] == "" { return nil, sdkerrors.Wrapf(ErrInvalidChainID, "%s: %v", chainID, matches) } diff --git a/types/chain_id_test.go b/types/chain_id_test.go index a527ac76..a750c756 100644 --- a/types/chain_id_test.go +++ b/types/chain_id_test.go @@ -16,7 +16,7 @@ func TestParseChainID(t *testing.T) { expInt *big.Int }{ { - "valid chain-id, single digit", "ethermint_1-1", false, big.NewInt(1), + "valid chain-id, single digit", "laconic_1-1", false, big.NewInt(1), }, { "valid chain-id, multiple digits", "aragonchain_256-1", false, big.NewInt(256), @@ -37,25 +37,25 @@ func TestParseChainID(t *testing.T) { "invalid chain-id, undefined identifier", "_1-1", true, nil, }, { - "invalid chain-id, uppercases", "ETHERMINT_1-1", true, nil, + "invalid chain-id, uppercases", "LACONIC_1-1", true, nil, }, { - "invalid chain-id, mixed cases", "Ethermint_1-1", true, nil, + "invalid chain-id, mixed cases", "Laconic_1-1", true, nil, }, { "invalid chain-id, special chars", "$&*#!_1-1", true, nil, }, { - "invalid eip155 chain-id, cannot start with 0", "ethermint_001-1", true, nil, + "invalid eip155 chain-id, cannot start with 0", "laconic_001-1", true, nil, }, { - "invalid eip155 chain-id, cannot invalid base", "ethermint_0x212-1", true, nil, + "invalid eip155 chain-id, cannot invalid base", "laconic_0x212-1", true, nil, }, { - "invalid eip155 chain-id, non-integer", "ethermint_ethermint_9000-1", true, nil, + "invalid eip155 chain-id, non-integer", "ethermint_laconic_9000-1", true, nil, }, { - "invalid epoch, undefined", "ethermint_-", true, nil, + "invalid epoch, undefined", "laconic_-", true, nil, }, { "blank chain ID", " ", true, nil, @@ -67,7 +67,7 @@ func TestParseChainID(t *testing.T) { "empty content for chain id, eip155 and epoch numbers", "_-", true, nil, }, { - "long chain-id", "ethermint_" + strings.Repeat("1", 40) + "-1", true, nil, + "long chain-id", "laconic_" + strings.Repeat("1", 40) + "-1", true, nil, }, } diff --git a/types/errors.go b/types/errors.go index a80e02e7..63d30aa7 100644 --- a/types/errors.go +++ b/types/errors.go @@ -6,7 +6,7 @@ import ( const ( // RootCodespace is the codespace for all errors defined in this package - RootCodespace = "ethermint" + RootCodespace = "laconicd" ) // NOTE: We can't use 1 since that error code is reserved for internal errors. diff --git a/x/auction/README.md b/x/auction/README.md index 565cdad7..f2778c10 100644 --- a/x/auction/README.md +++ b/x/auction/README.md @@ -20,7 +20,7 @@ The following steps need to be followed only before running the chain for the fi Keep a note of the keyring passphrase if you set it. 2. Init the chain: ``` - ./build/laconicd init test-moniker --chain-id ethermint_9000-1 + ./build/laconicd init test-moniker --chain-id laconic_9000-1 ``` 3. Add genesis account: ``` @@ -28,7 +28,7 @@ The following steps need to be followed only before running the chain for the fi ``` 4. Make a genesis tx: ``` - ./build/laconicd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 + ./build/laconicd gentx root 1000000000000000000stake --chain-id laconic_9000-1 ``` 5. Collect gentxs: ``` diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go index 9b95ccc3..91230c23 100644 --- a/x/auction/keeper/keeper_test.go +++ b/x/auction/keeper/keeper_test.go @@ -16,13 +16,13 @@ import ( type KeeperTestSuite struct { suite.Suite - app *app.EthermintApp + app *app.LaconicApp ctx sdk.Context queryClient types.QueryClient } 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 }) ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) @@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) SetupTest() { } 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 }) ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) diff --git a/x/bond/README.md b/x/bond/README.md index c774451c..12bd822d 100644 --- a/x/bond/README.md +++ b/x/bond/README.md @@ -9,9 +9,9 @@ $ make build ```bash ./build/laconicd keys add root -./build/laconicd init test-moniker --chain-id ethermint_9000-1 +./build/laconicd init test-moniker --chain-id laconic_9000-1 ./build/laconicd add-genesis-account $(./build/laconicd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake -./build/laconicd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 +./build/laconicd gentx root 1000000000000000000stake --chain-id laconic_9000-1 ./build/laconicd collect-gentxs ./build/laconicd start ``` diff --git a/x/bond/keeper/keeper_test.go b/x/bond/keeper/keeper_test.go index 9ce2b41f..0e51f196 100644 --- a/x/bond/keeper/keeper_test.go +++ b/x/bond/keeper/keeper_test.go @@ -16,13 +16,13 @@ import ( type KeeperTestSuite struct { suite.Suite - app *app.EthermintApp + app *app.LaconicApp ctx sdk.Context queryClient types.QueryClient } 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 }) ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) @@ -37,7 +37,7 @@ func (suite *KeeperTestSuite) SetupTest() { } 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 }) ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) diff --git a/x/bond/module_test.go b/x/bond/module_test.go index f7e872c8..65c2f9ac 100644 --- a/x/bond/module_test.go +++ b/x/bond/module_test.go @@ -11,7 +11,7 @@ import ( ) 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 }) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) diff --git a/x/evm/genesis.go b/x/evm/genesis.go index c09eddd2..32b0a366 100644 --- a/x/evm/genesis.go +++ b/x/evm/genesis.go @@ -10,7 +10,7 @@ import ( "github.com/ethereum/go-ethereum/crypto" abci "github.com/tendermint/tendermint/abci/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm/keeper" "github.com/cerc-io/laconicd/x/evm/types" ) @@ -40,7 +40,7 @@ func InitGenesis( panic(fmt.Errorf("account not found for address %s", account.Address)) } - ethAcct, ok := acc.(ethermint.EthAccountI) + ethAcct, ok := acc.(laconicd.EthAccountI) if !ok { panic( fmt.Errorf("account %s must be an EthAccount interface, got %T", @@ -69,7 +69,7 @@ func InitGenesis( func ExportGenesis(ctx sdk.Context, k *keeper.Keeper, ak types.AccountKeeper) *types.GenesisState { var ethGenAccounts []types.GenesisAccount ak.IterateAccounts(ctx, func(account authtypes.AccountI) bool { - ethAccount, ok := account.(ethermint.EthAccountI) + ethAccount, ok := account.(laconicd.EthAccountI) if !ok { // ignore non EthAccounts return false diff --git a/x/evm/handler_test.go b/x/evm/handler_test.go index e1c1d864..6ada8c3c 100644 --- a/x/evm/handler_test.go +++ b/x/evm/handler_test.go @@ -33,7 +33,7 @@ import ( "github.com/cerc-io/laconicd/app" "github.com/cerc-io/laconicd/crypto/ethsecp256k1" "github.com/cerc-io/laconicd/tests" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm" "github.com/cerc-io/laconicd/x/evm/statedb" "github.com/cerc-io/laconicd/x/evm/types" @@ -50,7 +50,7 @@ type EvmTestSuite struct { ctx sdk.Context handler sdk.Handler - app *app.EthermintApp + app *app.LaconicApp codec codec.Codec chainID *big.Int @@ -77,7 +77,7 @@ func (suite *EvmTestSuite) DoSetupTest(t require.TestingT) { require.NoError(t, err) 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 { feemarketGenesis := feemarkettypes.DefaultGenesisState() feemarketGenesis.Params.EnableHeight = 1 @@ -113,7 +113,7 @@ func (suite *EvmTestSuite) DoSetupTest(t require.TestingT) { // Initialize the chain suite.app.InitChain( abci.RequestInitChain{ - ChainId: "ethermint_9000-1", + ChainId: "laconic_9000-1", Validators: []abci.ValidatorUpdate{}, ConsensusParams: app.DefaultConsensusParams, AppStateBytes: stateBytes, @@ -122,7 +122,7 @@ func (suite *EvmTestSuite) DoSetupTest(t require.TestingT) { suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{ Height: 1, - ChainID: "ethermint_9000-1", + ChainID: "laconic_9000-1", Time: time.Now().UTC(), ProposerAddress: consAddress.Bytes(), Version: tmversion.Consensus{ @@ -147,7 +147,7 @@ func (suite *EvmTestSuite) DoSetupTest(t require.TestingT) { queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry()) types.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) - acc := ðermint.EthAccount{ + acc := &laconicd.EthAccount{ BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(address.Bytes()), nil, 0, 0), CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), } diff --git a/x/evm/keeper/benchmark_test.go b/x/evm/keeper/benchmark_test.go index b239d00b..f5f5cebc 100644 --- a/x/evm/keeper/benchmark_test.go +++ b/x/evm/keeper/benchmark_test.go @@ -11,7 +11,7 @@ import ( authante "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/ethereum/go-ethereum/common" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm/types" ethtypes "github.com/ethereum/go-ethereum/core/types" ) @@ -20,7 +20,7 @@ func SetupContract(b *testing.B) (*KeeperTestSuite, common.Address) { suite := KeeperTestSuite{} suite.SetupTest() - amt := sdk.Coins{ethermint.NewPhotonCoinInt64(1000000000000000000)} + amt := sdk.Coins{laconicd.NewPhotonCoinInt64(1000000000000000000)} err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt) require.NoError(b, err) err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt) @@ -36,7 +36,7 @@ func SetupTestMessageCall(b *testing.B) (*KeeperTestSuite, common.Address) { suite := KeeperTestSuite{} suite.SetupTest() - amt := sdk.Coins{ethermint.NewPhotonCoinInt64(1000000000000000000)} + amt := sdk.Coins{laconicd.NewPhotonCoinInt64(1000000000000000000)} err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt) require.NoError(b, err) err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt) diff --git a/x/evm/keeper/grpc_query.go b/x/evm/keeper/grpc_query.go index 6fa7d3ef..ced41ce9 100644 --- a/x/evm/keeper/grpc_query.go +++ b/x/evm/keeper/grpc_query.go @@ -25,7 +25,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" ethparams "github.com/ethereum/go-ethereum/params" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm/statedb" "github.com/cerc-io/laconicd/x/evm/types" ) @@ -42,7 +42,7 @@ func (k Keeper) Account(c context.Context, req *types.QueryAccountRequest) (*typ return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := ethermint.ValidateAddress(req.Address); err != nil { + if err := laconicd.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, err.Error(), ) @@ -65,7 +65,7 @@ func (k Keeper) CosmosAccount(c context.Context, req *types.QueryCosmosAccountRe return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := ethermint.ValidateAddress(req.Address); err != nil { + if err := laconicd.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, err.Error(), ) @@ -130,7 +130,7 @@ func (k Keeper) Balance(c context.Context, req *types.QueryBalanceRequest) (*typ return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := ethermint.ValidateAddress(req.Address); err != nil { + if err := laconicd.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, types.ErrZeroAddress.Error(), @@ -152,7 +152,7 @@ func (k Keeper) Storage(c context.Context, req *types.QueryStorageRequest) (*typ return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := ethermint.ValidateAddress(req.Address); err != nil { + if err := laconicd.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, types.ErrZeroAddress.Error(), @@ -178,7 +178,7 @@ func (k Keeper) Code(c context.Context, req *types.QueryCodeRequest) (*types.Que return nil, status.Error(codes.InvalidArgument, "empty request") } - if err := ethermint.ValidateAddress(req.Address); err != nil { + if err := laconicd.ValidateAddress(req.Address); err != nil { return nil, status.Error( codes.InvalidArgument, types.ErrZeroAddress.Error(), diff --git a/x/evm/keeper/grpc_query_test.go b/x/evm/keeper/grpc_query_test.go index 705a352e..2ca14161 100644 --- a/x/evm/keeper/grpc_query_test.go +++ b/x/evm/keeper/grpc_query_test.go @@ -19,7 +19,7 @@ import ( "github.com/cerc-io/laconicd/crypto/ethsecp256k1" "github.com/cerc-io/laconicd/server/config" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm/types" ) @@ -54,7 +54,7 @@ func (suite *KeeperTestSuite) TestQueryAccount() { { "success", func() { - amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)} + amt := sdk.Coins{laconicd.NewPhotonCoinInt64(100)} err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt) suite.Require().NoError(err) err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt) @@ -195,7 +195,7 @@ func (suite *KeeperTestSuite) TestQueryBalance() { { "success", func() { - amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)} + amt := sdk.Coins{laconicd.NewPhotonCoinInt64(100)} err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt) suite.Require().NoError(err) err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt) diff --git a/x/evm/keeper/integration_test.go b/x/evm/keeper/integration_test.go index 31b482a8..2cab498f 100644 --- a/x/evm/keeper/integration_test.go +++ b/x/evm/keeper/integration_test.go @@ -168,7 +168,7 @@ func setupChain(localMinGasPricesStr string) { // Initialize the app, so we can use SetMinGasPrices to set the // validator-specific min-gas-prices setting db := dbm.NewMemDB() - newapp := app.NewEthermintApp( + newapp := app.NewLaconicApp( log.NewNopLogger(), db, nil, @@ -190,7 +190,7 @@ func setupChain(localMinGasPricesStr string) { // Initialize the chain newapp.InitChain( abci.RequestInitChain{ - ChainId: "ethermint_9000-1", + ChainId: "laconic_9000-1", Validators: []abci.ValidatorUpdate{}, AppStateBytes: stateBytes, ConsensusParams: app.DefaultConsensusParams, diff --git a/x/evm/keeper/keeper.go b/x/evm/keeper/keeper.go index e287836c..7b6ad1ee 100644 --- a/x/evm/keeper/keeper.go +++ b/x/evm/keeper/keeper.go @@ -16,7 +16,7 @@ import ( "github.com/ethereum/go-ethereum/params" "github.com/tendermint/tendermint/libs/log" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm/statedb" "github.com/cerc-io/laconicd/x/evm/types" evm "github.com/cerc-io/laconicd/x/evm/vm" @@ -109,7 +109,7 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { // WithChainID sets the chain id to the local variable in the keeper func (k *Keeper) WithChainID(ctx sdk.Context) { - chainID, err := ethermint.ParseChainID(ctx.ChainID()) + chainID, err := laconicd.ParseChainID(ctx.ChainID()) if err != nil { panic(err) } @@ -258,7 +258,7 @@ func (k *Keeper) GetAccountWithoutBalance(ctx sdk.Context, addr common.Address) } codeHash := types.EmptyCodeHash - ethAcct, ok := acct.(ethermint.EthAccountI) + ethAcct, ok := acct.(laconicd.EthAccountI) if ok { codeHash = ethAcct.GetCodeHash().Bytes() } diff --git a/x/evm/keeper/keeper_test.go b/x/evm/keeper/keeper_test.go index 3472c9ca..a7a9bf8c 100644 --- a/x/evm/keeper/keeper_test.go +++ b/x/evm/keeper/keeper_test.go @@ -32,7 +32,7 @@ import ( "github.com/cerc-io/laconicd/encoding" "github.com/cerc-io/laconicd/server/config" "github.com/cerc-io/laconicd/tests" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm/statedb" "github.com/cerc-io/laconicd/x/evm/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" @@ -56,7 +56,7 @@ type KeeperTestSuite struct { suite.Suite ctx sdk.Context - app *app.EthermintApp + app *app.LaconicApp queryClient types.QueryClient address common.Address consAddress sdk.ConsAddress @@ -110,7 +110,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) { require.NoError(t, err) 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() if suite.enableFeemarket { feemarketGenesis.Params.EnableHeight = 1 @@ -155,7 +155,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) { // Initialize the chain suite.app.InitChain( abci.RequestInitChain{ - ChainId: "ethermint_9000-1", + ChainId: "laconic_9000-1", Validators: []abci.ValidatorUpdate{}, ConsensusParams: app.DefaultConsensusParams, AppStateBytes: stateBytes, @@ -165,7 +165,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) { suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{ Height: 1, - ChainID: "ethermint_9000-1", + ChainID: "laconic_9000-1", Time: time.Now().UTC(), ProposerAddress: suite.consAddress.Bytes(), Version: tmversion.Consensus{ @@ -191,7 +191,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) { types.RegisterQueryServer(queryHelper, suite.app.EvmKeeper) suite.queryClient = types.NewQueryClient(queryHelper) - acc := ðermint.EthAccount{ + acc := &laconicd.EthAccount{ BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0), CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), } diff --git a/x/evm/keeper/state_transition.go b/x/evm/keeper/state_transition.go index 39ab08e4..c0b5c115 100644 --- a/x/evm/keeper/state_transition.go +++ b/x/evm/keeper/state_transition.go @@ -13,7 +13,7 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" "github.com/cerc-io/laconicd/x/evm/statedb" "github.com/cerc-io/laconicd/x/evm/types" evm "github.com/cerc-io/laconicd/x/evm/vm" @@ -84,7 +84,7 @@ func (k *Keeper) NewEVM( Transfer: core.Transfer, GetHash: k.GetHashFn(ctx), Coinbase: cfg.CoinBase, - GasLimit: ethermint.BlockGasLimit(ctx), + GasLimit: laconicd.BlockGasLimit(ctx), BlockNumber: big.NewInt(ctx.BlockHeight()), Time: big.NewInt(ctx.BlockHeader().Time.Unix()), Difficulty: big.NewInt(0), // unused. Only required in PoW context @@ -126,7 +126,7 @@ func (k Keeper) VMConfig(ctx sdk.Context, msg core.Message, cfg *types.EVMConfig // 3. The requested height is from a height greater than the latest one func (k Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc { return func(height uint64) common.Hash { - h, err := ethermint.SafeInt64(height) + h, err := laconicd.SafeInt64(height) if err != nil { k.Logger(ctx).Error("failed to cast height to int64", "error", err) return common.Hash{} diff --git a/x/evm/keeper/statedb.go b/x/evm/keeper/statedb.go index 11484bca..c8b39500 100644 --- a/x/evm/keeper/statedb.go +++ b/x/evm/keeper/statedb.go @@ -6,7 +6,7 @@ import ( 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/statedb" "github.com/cerc-io/laconicd/x/evm/types" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -117,7 +117,7 @@ func (k *Keeper) SetAccount(ctx sdk.Context, addr common.Address, account stated codeHash := common.BytesToHash(account.CodeHash) - if ethAcct, ok := acct.(ethermint.EthAccountI); ok { + if ethAcct, ok := acct.(laconicd.EthAccountI); ok { if err := ethAcct.SetCodeHash(codeHash); err != nil { return err } @@ -187,7 +187,7 @@ func (k *Keeper) DeleteAccount(ctx sdk.Context, addr common.Address) error { } // NOTE: only Ethereum accounts (contracts) can be selfdestructed - _, ok := acct.(ethermint.EthAccountI) + _, ok := acct.(laconicd.EthAccountI) if !ok { return sdkerrors.Wrapf(types.ErrInvalidAccount, "type %T, address %s", acct, addr) } diff --git a/x/evm/types/genesis.go b/x/evm/types/genesis.go index 8b1283e4..d3a531d9 100644 --- a/x/evm/types/genesis.go +++ b/x/evm/types/genesis.go @@ -3,12 +3,12 @@ package types import ( "fmt" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) // Validate performs a basic validation of a GenesisAccount fields. func (ga GenesisAccount) Validate() error { - if err := ethermint.ValidateAddress(ga.Address); err != nil { + if err := laconicd.ValidateAddress(ga.Address); err != nil { return err } return ga.Storage.Validate() diff --git a/x/evm/types/logs.go b/x/evm/types/logs.go index bad1e311..7620bb22 100644 --- a/x/evm/types/logs.go +++ b/x/evm/types/logs.go @@ -7,7 +7,7 @@ import ( "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" ) // NewTransactionLogs creates a new NewTransactionLogs instance. @@ -28,7 +28,7 @@ func NewTransactionLogsFromEth(hash common.Hash, ethlogs []*ethtypes.Log) Transa // Validate performs a basic validation of a GenesisAccount fields. func (tx TransactionLogs) Validate() error { - if ethermint.IsEmptyHash(tx.Hash) { + if laconicd.IsEmptyHash(tx.Hash) { return fmt.Errorf("hash cannot be the empty %s", tx.Hash) } @@ -53,16 +53,16 @@ func (tx TransactionLogs) EthLogs() []*ethtypes.Log { // Validate performs a basic validation of an ethereum Log fields. func (log *Log) Validate() error { - if err := ethermint.ValidateAddress(log.Address); err != nil { + if err := laconicd.ValidateAddress(log.Address); err != nil { return fmt.Errorf("invalid log address %w", err) } - if ethermint.IsEmptyHash(log.BlockHash) { + if laconicd.IsEmptyHash(log.BlockHash) { return fmt.Errorf("block hash cannot be the empty %s", log.BlockHash) } if log.BlockNumber == 0 { return errors.New("block number cannot be zero") } - if ethermint.IsEmptyHash(log.TxHash) { + if laconicd.IsEmptyHash(log.TxHash) { return fmt.Errorf("tx hash cannot be the empty %s", log.TxHash) } return nil diff --git a/x/feemarket/keeper/integration_test.go b/x/feemarket/keeper/integration_test.go index 9a0ee2c7..e23cd884 100644 --- a/x/feemarket/keeper/integration_test.go +++ b/x/feemarket/keeper/integration_test.go @@ -483,7 +483,7 @@ func setupChain(localMinGasPricesStr string) { // Initialize the app, so we can use SetMinGasPrices to set the // validator-specific min-gas-prices setting db := dbm.NewMemDB() - newapp := app.NewEthermintApp( + newapp := app.NewLaconicApp( log.NewNopLogger(), db, nil, @@ -505,7 +505,7 @@ func setupChain(localMinGasPricesStr string) { // Initialize the chain newapp.InitChain( abci.RequestInitChain{ - ChainId: "ethermint_9000-1", + ChainId: "laconic_9000-1", Validators: []abci.ValidatorUpdate{}, AppStateBytes: stateBytes, ConsensusParams: app.DefaultConsensusParams, diff --git a/x/feemarket/keeper/keeper_test.go b/x/feemarket/keeper/keeper_test.go index 0f2126b5..a254641a 100644 --- a/x/feemarket/keeper/keeper_test.go +++ b/x/feemarket/keeper/keeper_test.go @@ -25,7 +25,7 @@ import ( "github.com/cerc-io/laconicd/crypto/ethsecp256k1" "github.com/cerc-io/laconicd/encoding" "github.com/cerc-io/laconicd/tests" - ethermint "github.com/cerc-io/laconicd/types" + laconicd "github.com/cerc-io/laconicd/types" evmtypes "github.com/cerc-io/laconicd/x/evm/types" "github.com/cerc-io/laconicd/x/feemarket/types" @@ -44,7 +44,7 @@ type KeeperTestSuite struct { suite.Suite ctx sdk.Context - app *app.EthermintApp + app *app.LaconicApp queryClient types.QueryClient address common.Address consAddress sdk.ConsAddress @@ -91,7 +91,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) { suite.ctx = suite.app.BaseApp.NewContext(checkTx, tmproto.Header{ Height: 1, - ChainID: "ethermint_9000-1", + ChainID: "laconic_9000-1", Time: time.Now().UTC(), ProposerAddress: suite.consAddress.Bytes(), Version: tmversion.Consensus{ @@ -117,7 +117,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) { types.RegisterQueryServer(queryHelper, suite.app.FeeMarketKeeper) suite.queryClient = types.NewQueryClient(queryHelper) - acc := ðermint.EthAccount{ + acc := &laconicd.EthAccount{ BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0), CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(), } diff --git a/x/registry/README.md b/x/registry/README.md index 20a3ecb3..e8c44e0a 100644 --- a/x/registry/README.md +++ b/x/registry/README.md @@ -9,9 +9,9 @@ $ make build ```bash ./build/laconicd keys add root -./build/laconicd init test-moniker --chain-id ethermint_9000-1 +./build/laconicd init test-moniker --chain-id laconic_9000-1 ./build/laconicd add-genesis-account $(./build/laconicd keys show root -a) 1000000000000000000aphoton,1000000000000000000stake -./build/laconicd gentx root 1000000000000000000stake --chain-id ethermint_9000-1 +./build/laconicd gentx root 1000000000000000000stake --chain-id laconic_9000-1 ./build/laconicd collect-gentxs ./build/laconicd start ``` @@ -58,7 +58,7 @@ $ ./build/laconicd q registry params -o json | jq . > First you have to Create bond ```bash -$ ./build/laconicd tx registry set ~/Desktop/examples/records/service_provider_example.yml 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 --yes -o json +$ ./build/laconicd tx registry set ~/Desktop/examples/records/service_provider_example.yml 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id laconic_9000-1 --yes -o json { "height": "0", "txhash": "BA44ABE1194724694E7CB290F9F3121DB4E63E1A030D95CB84813EEA132CF95F", @@ -121,7 +121,7 @@ $ ./build/laconicd q registry get bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my ## Reserve name ```bash - ./build/laconicd tx registry reserve-name hello --from root --chain-id ethermint_9000-1 --owner $(./build/laconicd key + ./build/laconicd tx registry reserve-name hello --from root --chain-id laconic_9000-1 --owner $(./build/laconicd key s show root -a) -y -o json | jq . { "height": "0", @@ -181,8 +181,8 @@ $ ./build/laconicd q registry balance -o json | jq . ## add bond to the authority ```bash -$ ./build/laconicd tx registry authority-bond [Authority Name] [Bond ID ] --from root --chain-id ethermint_9000-1 -y -o json | jq . -$ ./build/laconicd tx registry authority-bond hello 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id ethermint_9000-1 -y -o json | jq . +$ ./build/laconicd tx registry authority-bond [Authority Name] [Bond ID ] --from root --chain-id laconic_9000-1 -y -o json | jq . +$ ./build/laconicd tx registry authority-bond hello 95f68b1b862bfd1609b0c9aaf7300287b92fec90ac64027092c3e723af36e83d --from root --chain-id laconic_9000-1 -y -o json | jq . ``` ## Query the records by associate bond id @@ -209,7 +209,7 @@ $ ./build/laconicd q registry query-by-bond 95f68b1b862bfd1609b0c9aaf7300287b92f ## dissociate bond from record ```bash -$ ./build/laconicd tx registry dissociate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id ethermint_9000-1 +$ ./build/laconicd tx registry dissociate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id laconic_9000-1 {"body":{"messages":[{"@type":"/vulcanize.registry.v1beta1.MsgDissociateBond","record_id":"bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae","signer":"ethm1mfdjngh5jvjs9lqtt9a7y2hlgw8v3syh3hsqzk"}],"memo":"","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":[]} confirm transaction before signing and broadcasting [y/N]: y @@ -231,7 +231,7 @@ txhash: 7AFEF524CB0D92D6576FC08601A787786E802449888FD8DDAA7635698CC85060 ## Associate bond with record ```bash -./build/laconicd tx registry associate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id ethermint_9000-1 -y -o json | jq . +./build/laconicd tx registry associate-bond bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id laconic_9000-1 -y -o json | jq . { "height": "0", "txhash": "F75C2BF2FE73668AE1332E1237F924AC549E31E822A56394DE5AC17200B199F9", @@ -252,7 +252,7 @@ txhash: 7AFEF524CB0D92D6576FC08601A787786E802449888FD8DDAA7635698CC85060 ## dissociate-records => remove all record from bond ```bash -$./build/laconicd tx registry dissociate-records c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id ethermint_9000-1 -y -o json | jq . +$./build/laconicd tx registry dissociate-records c3f7a78c5042d2003880962ba31ff3b01fcf5942960e0bc3ca331f816346a440 --from root --chain-id laconic_9000-1 -y -o json | jq . { "height": "0", "txhash": "0316F503E5DEA47CB108AE6C7C7FFAF3F71CC56BC22F63CB97322E1BE48B33B9", @@ -274,14 +274,14 @@ $./build/laconicd tx registry dissociate-records c3f7a78c5042d2003880962ba31ff3b > When a record is expires , needs to renew record ```bash -$ ./build/laconicd tx registry renew-record bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id ethermint_9000-1 +$ ./build/laconicd tx registry renew-record bafyreih7un2ntk235wshncebus5emlozdhdixrrv675my5umb6fgdergae --from root --chain-id laconic_9000-1 ``` ## Set the authority name ```bash -$ ./build/laconicd tx registry set-name crn://hello/test test_hello_cid --from root --chain-id ethermint_9000-1 -y -o json | jq . +$ ./build/laconicd tx registry set-name crn://hello/test test_hello_cid --from root --chain-id laconic_9000-1 -y -o json | jq . { "height": "0", "txhash": "66A63C73B076EEE9A2F7605354448EDEB161F0115D4D03AF68C01BA28DB97486", @@ -301,7 +301,7 @@ $ ./build/laconicd tx registry set-name crn://hello/test test_hello_cid --from ## Delete the name ```bash -$./build/laconicd tx registry delete-name crn://hello/test --from root --chain-id ethermint_9000-1 -y +$./build/laconicd tx registry delete-name crn://hello/test --from root --chain-id laconic_9000-1 -y code: 0 codespace: "" data: "" diff --git a/x/registry/keeper/keeper_test.go b/x/registry/keeper/keeper_test.go index 7e5b06da..2cb3ce23 100644 --- a/x/registry/keeper/keeper_test.go +++ b/x/registry/keeper/keeper_test.go @@ -21,7 +21,7 @@ var seed = int64(233) type KeeperTestSuite struct { suite.Suite - app *app.EthermintApp + app *app.LaconicApp ctx sdk.Context queryClient types.QueryClient accounts []sdk.AccAddress @@ -29,7 +29,7 @@ type KeeperTestSuite struct { } 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 }) ctx := testApp.BaseApp.NewContext(false, tmproto.Header{}) @@ -58,7 +58,7 @@ func (suite *KeeperTestSuite) SetupTest() { } 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 }) ctx := testApp.BaseApp.NewContext(false, tmproto.Header{})