renaming from ethermint to laconic #69
@ -15,7 +15,7 @@ import (
|
|||||||
|
|
||||||
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
||||||
"github.com/cerc-io/laconicd/ethereum/eip712"
|
"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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
ethcrypto "github.com/ethereum/go-ethereum/crypto"
|
ethcrypto "github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/ethereum/go-ethereum/crypto/secp256k1"
|
"github.com/ethereum/go-ethereum/crypto/secp256k1"
|
||||||
@ -25,7 +25,7 @@ var ethermintCodec codec.ProtoCodecMarshaler
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
registry := codectypes.NewInterfaceRegistry()
|
registry := codectypes.NewInterfaceRegistry()
|
||||||
ethermint.RegisterInterfaces(registry)
|
laconicd.RegisterInterfaces(registry)
|
||||||
ethermintCodec = codec.NewProtoCodec(registry)
|
ethermintCodec = codec.NewProtoCodec(registry)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ func VerifySignature(
|
|||||||
msgs, tx.GetMemo(), tx.GetTip(),
|
msgs, tx.GetMemo(), tx.GetTip(),
|
||||||
)
|
)
|
||||||
|
|
||||||
signerChainID, err := ethermint.ParseChainID(signerData.ChainID)
|
signerChainID, err := laconicd.ParseChainID(signerData.ChainID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sdkerrors.Wrapf(err, "failed to parse chainID: %s", signerData.ChainID)
|
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")
|
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 {
|
if !ok {
|
||||||
return sdkerrors.Wrap(sdkerrors.ErrInvalidChainID, "unknown extension option")
|
return sdkerrors.Wrap(sdkerrors.ErrInvalidChainID, "unknown extension option")
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
|
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"
|
evmkeeper "github.com/cerc-io/laconicd/x/evm/keeper"
|
||||||
"github.com/cerc-io/laconicd/x/evm/statedb"
|
"github.com/cerc-io/laconicd/x/evm/statedb"
|
||||||
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
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)
|
ctx.EventManager().EmitEvents(events)
|
||||||
|
|
||||||
// TODO: deprecate after https://github.com/cosmos/cosmos-sdk/issues/9514 is fixed on SDK
|
// 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
|
// NOTE: safety check
|
||||||
if blockGasLimit > 0 {
|
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)
|
// Set ctx.GasMeter with a limit of GasWanted (gasLimit)
|
||||||
gasConsumed := ctx.GasMeter().GasConsumed()
|
gasConsumed := ctx.GasMeter().GasConsumed()
|
||||||
ctx = ctx.WithGasMeter(ethermint.NewInfiniteGasMeterWithLimit(gasWanted))
|
ctx = ctx.WithGasMeter(laconicd.NewInfiniteGasMeterWithLimit(gasWanted))
|
||||||
ctx.GasMeter().ConsumeGas(gasConsumed, "copy gas consumed")
|
ctx.GasMeter().ConsumeGas(gasConsumed, "copy gas consumed")
|
||||||
|
|
||||||
newCtx := ctx.WithPriority(minPriority)
|
newCtx := ctx.WithPriority(minPriority)
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/encoding"
|
"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"
|
"github.com/cerc-io/laconicd/x/evm/types"
|
||||||
evmtypes "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"
|
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
|
||||||
@ -172,7 +172,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
|
|||||||
txBuilder.SetGasLimit(1)
|
txBuilder.SetGasLimit(1)
|
||||||
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin("aphoton", sdk.NewInt(10).Mul(types.DefaultPriorityReduction))))
|
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)
|
require.NoError(t, err)
|
||||||
txBuilder.SetExtensionOptions(option)
|
txBuilder.SetExtensionOptions(option)
|
||||||
return txBuilder.GetTx()
|
return txBuilder.GetTx()
|
||||||
@ -192,7 +192,7 @@ func TestSDKTxFeeChecker(t *testing.T) {
|
|||||||
txBuilder.SetGasLimit(1)
|
txBuilder.SetGasLimit(1)
|
||||||
txBuilder.SetFeeAmount(sdk.NewCoins(sdk.NewCoin("aphoton", sdk.NewInt(10).Mul(types.DefaultPriorityReduction).Add(sdk.NewInt(10)))))
|
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),
|
MaxPriorityPrice: sdk.NewInt(5).Mul(types.DefaultPriorityReduction),
|
||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
@ -102,7 +102,7 @@ import (
|
|||||||
|
|
||||||
"github.com/cerc-io/laconicd/app/ante"
|
"github.com/cerc-io/laconicd/app/ante"
|
||||||
srvflags "github.com/cerc-io/laconicd/server/flags"
|
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"
|
"github.com/cerc-io/laconicd/x/evm"
|
||||||
evmkeeper "github.com/cerc-io/laconicd/x/evm/keeper"
|
evmkeeper "github.com/cerc-io/laconicd/x/evm/keeper"
|
||||||
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
@ -343,7 +343,7 @@ func NewEthermintApp(
|
|||||||
app.AccountKeeper = authkeeper.NewAccountKeeper(
|
app.AccountKeeper = authkeeper.NewAccountKeeper(
|
||||||
appCodec, keys[authtypes.StoreKey],
|
appCodec, keys[authtypes.StoreKey],
|
||||||
app.GetSubspace(authtypes.ModuleName),
|
app.GetSubspace(authtypes.ModuleName),
|
||||||
ethermint.ProtoAccount,
|
laconicd.ProtoAccount,
|
||||||
maccPerms,
|
maccPerms,
|
||||||
sdk.GetConfig().GetBech32AccountAddrPrefix(),
|
sdk.GetConfig().GetBech32AccountAddrPrefix(),
|
||||||
)
|
)
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/encoding"
|
"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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
||||||
@ -102,7 +102,7 @@ func RandomGenesisAccounts(simState *module.SimulationState) authtypes.GenesisAc
|
|||||||
for i, acc := range simState.Accounts {
|
for i, acc := range simState.Accounts {
|
||||||
bacc := authtypes.NewBaseAccountWithAddress(acc.Address)
|
bacc := authtypes.NewBaseAccountWithAddress(acc.Address)
|
||||||
|
|
||||||
ethacc := ðermint.EthAccount{
|
ethacc := &laconicd.EthAccount{
|
||||||
BaseAccount: bacc,
|
BaseAccount: bacc,
|
||||||
CodeHash: common.BytesToHash(emptyCodeHash).String(),
|
CodeHash: common.BytesToHash(emptyCodeHash).String(),
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
"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"
|
"github.com/cosmos/cosmos-sdk/simapp"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
@ -40,7 +40,7 @@ func TestRandomGenesisAccounts(t *testing.T) {
|
|||||||
subSpace, find := paramsKeeper.GetSubspace(authtypes.ModuleName)
|
subSpace, find := paramsKeeper.GetSubspace(authtypes.ModuleName)
|
||||||
require.True(t, find)
|
require.True(t, find)
|
||||||
accountKeeper := authkeeper.NewAccountKeeper(
|
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)
|
authModule := auth.NewAppModule(appCodec, accountKeeper, RandomGenesisAccounts)
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ func TestRandomGenesisAccounts(t *testing.T) {
|
|||||||
accounts, err := authtypes.UnpackAccounts(authState.Accounts)
|
accounts, err := authtypes.UnpackAccounts(authState.Accounts)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
for _, acc := range accounts {
|
for _, acc := range accounts {
|
||||||
_, ok := acc.(ethermint.EthAccountI)
|
_, ok := acc.(laconicd.EthAccountI)
|
||||||
require.True(t, ok)
|
require.True(t, ok)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
"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.
|
// 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 {
|
validateFn := func(cmd *cobra.Command, args []string) error {
|
||||||
chainID, _ := cmd.Flags().GetString(flags.FlagChainID)
|
chainID, _ := cmd.Flags().GetString(flags.FlagChainID)
|
||||||
|
|
||||||
if !ethermint.IsValidChainID(chainID) {
|
if !laconicd.IsValidChainID(chainID) {
|
||||||
return fmt.Errorf("invalid chain-id format: %s", chainID)
|
return fmt.Errorf("invalid chain-id format: %s", chainID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
etherminthd "github.com/cerc-io/laconicd/crypto/hd"
|
laconicdhd "github.com/cerc-io/laconicd/crypto/hd"
|
||||||
|
|
||||||
bip39 "github.com/cosmos/go-bip39"
|
bip39 "github.com/cosmos/go-bip39"
|
||||||
"github.com/spf13/cobra"
|
"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 {
|
if dryRun, _ := cmd.Flags().GetBool(flags.FlagDryRun); dryRun {
|
||||||
// use in memory keybase
|
// use in memory keybase
|
||||||
kb = keyring.NewInMemory(ctx.Codec, etherminthd.EthSecp256k1Option())
|
kb = keyring.NewInMemory(ctx.Codec, laconicdhd.EthSecp256k1Option())
|
||||||
} else {
|
} else {
|
||||||
_, err = kb.Key(name)
|
_, err = kb.Key(name)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
@ -41,7 +41,7 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/crypto/hd"
|
"github.com/cerc-io/laconicd/crypto/hd"
|
||||||
"github.com/cerc-io/laconicd/server/config"
|
"github.com/cerc-io/laconicd/server/config"
|
||||||
srvflags "github.com/cerc-io/laconicd/server/flags"
|
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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/testutil/network"
|
"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(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created")
|
||||||
cmd.Flags().String(sdkserver.FlagMinGasPrices,
|
cmd.Flags().String(sdkserver.FlagMinGasPrices,
|
||||||
fmt.Sprintf("0.000006%s",
|
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)")
|
"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")
|
cmd.Flags().String(flags.FlagKeyAlgorithm, string(hd.EthSecp256k1Type), "Key signing algorithm to generate keys for")
|
||||||
}
|
}
|
||||||
@ -215,7 +215,7 @@ func initTestnetFiles(
|
|||||||
args initArgs,
|
args initArgs,
|
||||||
) error {
|
) error {
|
||||||
if args.chainID == "" {
|
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)
|
nodeIDs := make([]string, args.numValidators)
|
||||||
@ -296,22 +296,22 @@ func initTestnetFiles(
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
accStakingTokens := sdk.TokensFromConsensusPower(5000, ethermint.PowerReduction)
|
accStakingTokens := sdk.TokensFromConsensusPower(5000, laconicd.PowerReduction)
|
||||||
coins := sdk.Coins{
|
coins := sdk.Coins{
|
||||||
sdk.NewCoin(ethermint.AttoPhoton, accStakingTokens),
|
sdk.NewCoin(laconicd.AttoPhoton, accStakingTokens),
|
||||||
}
|
}
|
||||||
|
|
||||||
genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: coins.Sort()})
|
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),
|
BaseAccount: authtypes.NewBaseAccount(addr, nil, 0, 0),
|
||||||
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
|
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
|
||||||
})
|
})
|
||||||
|
|
||||||
valTokens := sdk.TokensFromConsensusPower(100, ethermint.PowerReduction)
|
valTokens := sdk.TokensFromConsensusPower(100, laconicd.PowerReduction)
|
||||||
createValMsg, err := stakingtypes.NewMsgCreateValidator(
|
createValMsg, err := stakingtypes.NewMsgCreateValidator(
|
||||||
sdk.ValAddress(addr),
|
sdk.ValAddress(addr),
|
||||||
valPubKeys[i],
|
valPubKeys[i],
|
||||||
sdk.NewCoin(ethermint.AttoPhoton, valTokens),
|
sdk.NewCoin(laconicd.AttoPhoton, valTokens),
|
||||||
stakingtypes.NewDescription(nodeDirName, "", "", "", ""),
|
stakingtypes.NewDescription(nodeDirName, "", "", "", ""),
|
||||||
stakingtypes.NewCommissionRates(sdk.OneDec(), sdk.OneDec(), sdk.OneDec()),
|
stakingtypes.NewCommissionRates(sdk.OneDec(), sdk.OneDec(), sdk.OneDec()),
|
||||||
sdk.OneInt(),
|
sdk.OneInt(),
|
||||||
@ -347,7 +347,7 @@ func initTestnetFiles(
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
customAppTemplate, customAppConfig := config.AppConfig(ethermint.AttoPhoton)
|
customAppTemplate, customAppConfig := config.AppConfig(laconicd.AttoPhoton)
|
||||||
srvconfig.SetConfigTemplate(customAppTemplate)
|
srvconfig.SetConfigTemplate(customAppTemplate)
|
||||||
if err := sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, tmconfig.DefaultConfig()); err != nil {
|
if err := sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, tmconfig.DefaultConfig()); err != nil {
|
||||||
return err
|
return err
|
||||||
@ -356,7 +356,7 @@ func initTestnetFiles(
|
|||||||
srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config/app.toml"), appConfig)
|
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
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package config
|
|||||||
import (
|
import (
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
ethermint "github.com/cerc-io/laconicd/types"
|
laconicd "github.com/cerc-io/laconicd/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -38,9 +38,9 @@ func SetBech32Prefixes(config *sdk.Config) {
|
|||||||
|
|
||||||
// SetBip44CoinType sets the global coin type to be used in hierarchical deterministic wallets.
|
// SetBip44CoinType sets the global coin type to be used in hierarchical deterministic wallets.
|
||||||
func SetBip44CoinType(config *sdk.Config) {
|
func SetBip44CoinType(config *sdk.Config) {
|
||||||
config.SetCoinType(ethermint.Bip44CoinType)
|
config.SetCoinType(laconicd.Bip44CoinType)
|
||||||
config.SetPurpose(sdk.Purpose) // Shared
|
config.SetPurpose(sdk.Purpose) // Shared
|
||||||
config.SetFullFundraiserPath(ethermint.BIP44HDPath) //nolint: staticcheck
|
config.SetFullFundraiserPath(laconicd.BIP44HDPath) //nolint: staticcheck
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterDenoms registers the base and display denominations to the SDK.
|
// RegisterDenoms registers the base and display denominations to the SDK.
|
||||||
@ -49,7 +49,7 @@ func RegisterDenoms() {
|
|||||||
panic(err)
|
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)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package config
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
ethermint "github.com/cerc-io/laconicd/types"
|
laconicd "github.com/cerc-io/laconicd/types"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
"github.com/cosmos/cosmos-sdk/crypto/hd"
|
||||||
@ -42,14 +42,14 @@ func TestSetCoinType(t *testing.T) {
|
|||||||
require.Equal(t, sdk.FullFundraiserPath, config.GetFullBIP44Path())
|
require.Equal(t, sdk.FullFundraiserPath, config.GetFullBIP44Path())
|
||||||
|
|
||||||
SetBip44CoinType(config)
|
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().GetCoinType(), config.GetCoinType())
|
||||||
require.Equal(t, sdk.GetConfig().GetFullBIP44Path(), config.GetFullBIP44Path())
|
require.Equal(t, sdk.GetConfig().GetFullBIP44Path(), config.GetFullBIP44Path())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestHDPath(t *testing.T) {
|
func TestHDPath(t *testing.T) {
|
||||||
params := *hd.NewFundraiserParams(0, ethermint.Bip44CoinType, 0)
|
params := *hd.NewFundraiserParams(0, laconicd.Bip44CoinType, 0)
|
||||||
hdPath := params.String()
|
hdPath := params.String()
|
||||||
require.Equal(t, "m/44'/60'/0'/0/0", hdPath)
|
require.Equal(t, "m/44'/60'/0'/0/0", hdPath)
|
||||||
require.Equal(t, hdPath, ethermint.BIP44HDPath)
|
require.Equal(t, hdPath, laconicd.BIP44HDPath)
|
||||||
}
|
}
|
||||||
|
@ -17,8 +17,8 @@ import (
|
|||||||
func TestInitCmd(t *testing.T) {
|
func TestInitCmd(t *testing.T) {
|
||||||
rootCmd, _ := laconicd.NewRootCmd()
|
rootCmd, _ := laconicd.NewRootCmd()
|
||||||
rootCmd.SetArgs([]string{
|
rootCmd.SetArgs([]string{
|
||||||
"init", // Test the init cmd
|
"init", // Test the init cmd
|
||||||
"etherminttest", // Moniker
|
"laconicdtest", // Moniker
|
||||||
fmt.Sprintf("--%s=%s", cli.FlagOverwrite, "true"), // Overwrite genesis.json, in case it already exists
|
fmt.Sprintf("--%s=%s", cli.FlagOverwrite, "true"), // Overwrite genesis.json, in case it already exists
|
||||||
fmt.Sprintf("--%s=%s", flags.FlagChainID, "laconic_9000-1"),
|
fmt.Sprintf("--%s=%s", flags.FlagChainID, "laconic_9000-1"),
|
||||||
})
|
})
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/crypto/hd"
|
"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"
|
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")
|
return errors.New("invalid vesting parameters; must supply start and end time or end time")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
genAccount = ðermint.EthAccount{
|
genAccount = &laconicd.EthAccount{
|
||||||
BaseAccount: baseAccount,
|
BaseAccount: baseAccount,
|
||||||
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
|
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
|
||||||
}
|
}
|
||||||
|
@ -33,14 +33,14 @@ import (
|
|||||||
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/app"
|
"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/client/debug"
|
||||||
"github.com/cerc-io/laconicd/crypto/hd"
|
"github.com/cerc-io/laconicd/crypto/hd"
|
||||||
"github.com/cerc-io/laconicd/encoding"
|
"github.com/cerc-io/laconicd/encoding"
|
||||||
"github.com/cerc-io/laconicd/server"
|
"github.com/cerc-io/laconicd/server"
|
||||||
servercfg "github.com/cerc-io/laconicd/server/config"
|
servercfg "github.com/cerc-io/laconicd/server/config"
|
||||||
srvflags "github.com/cerc-io/laconicd/server/flags"
|
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"
|
const EnvPrefix = "ETHERMINT"
|
||||||
@ -63,7 +63,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
|
|||||||
|
|
||||||
rootCmd := &cobra.Command{
|
rootCmd := &cobra.Command{
|
||||||
Use: "laconicd",
|
Use: "laconicd",
|
||||||
Short: "Ethermint Daemon",
|
Short: "Laconic Daemon",
|
||||||
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
|
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
|
||||||
// set the default command outputs
|
// set the default command outputs
|
||||||
cmd.SetOut(cmd.OutOrStdout())
|
cmd.SetOut(cmd.OutOrStdout())
|
||||||
@ -84,7 +84,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: replace AttoPhoton with bond denom
|
// 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())
|
return sdkserver.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, tmcfg.DefaultConfig())
|
||||||
},
|
},
|
||||||
@ -97,7 +97,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
|
|||||||
cfg.Seal()
|
cfg.Seal()
|
||||||
|
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
ethermintclient.ValidateChainID(
|
laconicdclient.ValidateChainID(
|
||||||
genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome),
|
genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome),
|
||||||
),
|
),
|
||||||
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
|
genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome),
|
||||||
@ -106,7 +106,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
|
|||||||
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
|
genutilcli.ValidateGenesisCmd(app.ModuleBasics),
|
||||||
AddGenesisAccountCmd(app.DefaultNodeHome),
|
AddGenesisAccountCmd(app.DefaultNodeHome),
|
||||||
tmcli.NewCompletionCmd(rootCmd, true),
|
tmcli.NewCompletionCmd(rootCmd, true),
|
||||||
ethermintclient.NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}),
|
laconicdclient.NewTestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}),
|
||||||
debug.Cmd(),
|
debug.Cmd(),
|
||||||
config.Cmd(),
|
config.Cmd(),
|
||||||
)
|
)
|
||||||
@ -119,7 +119,7 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) {
|
|||||||
rpc.StatusCommand(),
|
rpc.StatusCommand(),
|
||||||
queryCommand(),
|
queryCommand(),
|
||||||
txCommand(),
|
txCommand(),
|
||||||
ethermintclient.KeyCommands(app.DefaultNodeHome),
|
laconicdclient.KeyCommands(app.DefaultNodeHome),
|
||||||
)
|
)
|
||||||
|
|
||||||
rootCmd, err := srvflags.AddTxFlags(rootCmd)
|
rootCmd, err := srvflags.AddTxFlags(rootCmd)
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
|
|
||||||
cryptocodec "github.com/cerc-io/laconicd/crypto/codec"
|
cryptocodec "github.com/cerc-io/laconicd/crypto/codec"
|
||||||
enccodec "github.com/cerc-io/laconicd/encoding/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
|
var TestCodec codec.Codec
|
||||||
@ -46,7 +46,7 @@ func TestKeyring(t *testing.T) {
|
|||||||
require.Nil(t, info)
|
require.Nil(t, info)
|
||||||
|
|
||||||
mockIn.Reset("password\npassword\n")
|
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.NoError(t, err)
|
||||||
require.NotEmpty(t, mnemonic)
|
require.NotEmpty(t, mnemonic)
|
||||||
require.Equal(t, "foo", info.Name)
|
require.Equal(t, "foo", info.Name)
|
||||||
@ -55,7 +55,7 @@ func TestKeyring(t *testing.T) {
|
|||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Equal(t, string(EthSecp256k1Type), pubKey.Type())
|
require.Equal(t, string(EthSecp256k1Type), pubKey.Type())
|
||||||
|
|
||||||
hdPath := ethermint.BIP44HDPath
|
hdPath := laconicd.BIP44HDPath
|
||||||
|
|
||||||
bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, hdPath)
|
bz, err := EthSecp256k1.Derive()(mnemonic, keyring.DefaultBIP39Passphrase, hdPath)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
@ -79,7 +79,7 @@ func TestKeyring(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestDerivation(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.NoError(t, err)
|
||||||
require.NotEmpty(t, bz)
|
require.NotEmpty(t, bz)
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ func TestDerivation(t *testing.T) {
|
|||||||
wallet, err := hdwallet.NewFromMnemonic(mnemonic)
|
wallet, err := hdwallet.NewFromMnemonic(mnemonic)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
path := hdwallet.MustParseDerivationPath(ethermint.BIP44HDPath)
|
path := hdwallet.MustParseDerivationPath(laconicd.BIP44HDPath)
|
||||||
account, err := wallet.Derive(path, false)
|
account, err := wallet.Derive(path, false)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ package hd
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
ethermint "github.com/cerc-io/laconicd/types"
|
laconicd "github.com/cerc-io/laconicd/types"
|
||||||
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
"github.com/cosmos/cosmos-sdk/crypto/keyring"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -11,14 +11,14 @@ func BenchmarkEthSecp256k1Algo_Derive(b *testing.B) {
|
|||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
for i := 0; i < b.N; i++ {
|
for i := 0; i < b.N; i++ {
|
||||||
deriveFn := EthSecp256k1.Derive()
|
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)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func BenchmarkEthSecp256k1Algo_Generate(b *testing.B) {
|
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 {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
|
||||||
cryptocodec "github.com/cerc-io/laconicd/crypto/codec"
|
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.
|
// RegisterLegacyAminoCodec registers Interfaces from types, crypto, and SDK std.
|
||||||
@ -21,5 +21,5 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
|
|||||||
func RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) {
|
func RegisterInterfaces(interfaceRegistry codectypes.InterfaceRegistry) {
|
||||||
std.RegisterInterfaces(interfaceRegistry)
|
std.RegisterInterfaces(interfaceRegistry)
|
||||||
cryptocodec.RegisterInterfaces(interfaceRegistry)
|
cryptocodec.RegisterInterfaces(interfaceRegistry)
|
||||||
ethermint.RegisterInterfaces(interfaceRegistry)
|
laconicd.RegisterInterfaces(interfaceRegistry)
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
tmtypes "github.com/tendermint/tendermint/types"
|
tmtypes "github.com/tendermint/tendermint/types"
|
||||||
dbm "github.com/tendermint/tm-db"
|
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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ const (
|
|||||||
TxIndexKeyLength = 1 + 8 + 8
|
TxIndexKeyLength = 1 + 8 + 8
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ ethermint.EVMTxIndexer = &KVIndexer{}
|
var _ laconicd.EVMTxIndexer = &KVIndexer{}
|
||||||
|
|
||||||
// KVIndexer implements a eth tx indexer on a KV db.
|
// KVIndexer implements a eth tx indexer on a KV db.
|
||||||
type KVIndexer struct {
|
type KVIndexer struct {
|
||||||
@ -81,7 +81,7 @@ func (kv *KVIndexer) IndexBlock(block *tmtypes.Block, txResults []*abci.Response
|
|||||||
ethMsg := msg.(*evmtypes.MsgEthereumTx)
|
ethMsg := msg.(*evmtypes.MsgEthereumTx)
|
||||||
txHash := common.HexToHash(ethMsg.Hash)
|
txHash := common.HexToHash(ethMsg.Hash)
|
||||||
|
|
||||||
txResult := ethermint.TxResult{
|
txResult := laconicd.TxResult{
|
||||||
Height: height,
|
Height: height,
|
||||||
TxIndex: uint32(txIndex),
|
TxIndex: uint32(txIndex),
|
||||||
MsgIndex: uint32(msgIndex),
|
MsgIndex: uint32(msgIndex),
|
||||||
@ -131,7 +131,7 @@ func (kv *KVIndexer) FirstIndexedBlock() (int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetByTxHash finds eth tx by eth tx hash
|
// 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))
|
bz, err := kv.db.Get(TxHashKey(hash))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrapf(err, "GetByTxHash %s", hash.Hex())
|
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 {
|
if len(bz) == 0 {
|
||||||
return nil, fmt.Errorf("tx not found, hash: %s", hash.Hex())
|
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 {
|
if err := kv.clientCtx.Codec.Unmarshal(bz, &txKey); err != nil {
|
||||||
return nil, sdkerrors.Wrapf(err, "GetByTxHash %s", hash.Hex())
|
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
|
// 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))
|
bz, err := kv.db.Get(TxIndexKey(blockNumber, txIndex))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, sdkerrors.Wrapf(err, "GetByBlockAndIndex %d %d", blockNumber, txIndex)
|
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
|
// 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)
|
bz := codec.MustMarshal(txResult)
|
||||||
if err := batch.Set(TxHashKey(txHash), bz); err != nil {
|
if err := batch.Set(TxHashKey(txHash), bz); err != nil {
|
||||||
return sdkerrors.Wrap(err, "set tx-hash key")
|
return sdkerrors.Wrap(err, "set tx-hash key")
|
||||||
|
20
rpc/apis.go
20
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/personal"
|
||||||
"github.com/cerc-io/laconicd/rpc/namespaces/ethereum/txpool"
|
"github.com/cerc-io/laconicd/rpc/namespaces/ethereum/txpool"
|
||||||
"github.com/cerc-io/laconicd/rpc/namespaces/ethereum/web3"
|
"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"
|
rpcclient "github.com/tendermint/tendermint/rpc/jsonrpc/client"
|
||||||
)
|
)
|
||||||
@ -49,7 +49,7 @@ type APICreator = func(
|
|||||||
clientCtx client.Context,
|
clientCtx client.Context,
|
||||||
tendermintWebsocketClient *rpcclient.WSClient,
|
tendermintWebsocketClient *rpcclient.WSClient,
|
||||||
allowUnprotectedTxs bool,
|
allowUnprotectedTxs bool,
|
||||||
indexer ethermint.EVMTxIndexer,
|
indexer laconicd.EVMTxIndexer,
|
||||||
) []rpc.API
|
) []rpc.API
|
||||||
|
|
||||||
// apiCreators defines the JSON-RPC API namespaces.
|
// apiCreators defines the JSON-RPC API namespaces.
|
||||||
@ -61,7 +61,7 @@ func init() {
|
|||||||
clientCtx client.Context,
|
clientCtx client.Context,
|
||||||
tmWSClient *rpcclient.WSClient,
|
tmWSClient *rpcclient.WSClient,
|
||||||
allowUnprotectedTxs bool,
|
allowUnprotectedTxs bool,
|
||||||
indexer ethermint.EVMTxIndexer,
|
indexer laconicd.EVMTxIndexer,
|
||||||
) []rpc.API {
|
) []rpc.API {
|
||||||
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
||||||
return []rpc.API{
|
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{
|
return []rpc.API{
|
||||||
{
|
{
|
||||||
Namespace: Web3Namespace,
|
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{
|
return []rpc.API{
|
||||||
{
|
{
|
||||||
Namespace: NetNamespace,
|
Namespace: NetNamespace,
|
||||||
@ -103,7 +103,7 @@ func init() {
|
|||||||
clientCtx client.Context,
|
clientCtx client.Context,
|
||||||
_ *rpcclient.WSClient,
|
_ *rpcclient.WSClient,
|
||||||
allowUnprotectedTxs bool,
|
allowUnprotectedTxs bool,
|
||||||
indexer ethermint.EVMTxIndexer,
|
indexer laconicd.EVMTxIndexer,
|
||||||
) []rpc.API {
|
) []rpc.API {
|
||||||
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
||||||
return []rpc.API{
|
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{
|
return []rpc.API{
|
||||||
{
|
{
|
||||||
Namespace: TxPoolNamespace,
|
Namespace: TxPoolNamespace,
|
||||||
@ -129,7 +129,7 @@ func init() {
|
|||||||
clientCtx client.Context,
|
clientCtx client.Context,
|
||||||
_ *rpcclient.WSClient,
|
_ *rpcclient.WSClient,
|
||||||
allowUnprotectedTxs bool,
|
allowUnprotectedTxs bool,
|
||||||
indexer ethermint.EVMTxIndexer,
|
indexer laconicd.EVMTxIndexer,
|
||||||
) []rpc.API {
|
) []rpc.API {
|
||||||
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
||||||
return []rpc.API{
|
return []rpc.API{
|
||||||
@ -145,7 +145,7 @@ func init() {
|
|||||||
clientCtx client.Context,
|
clientCtx client.Context,
|
||||||
_ *rpcclient.WSClient,
|
_ *rpcclient.WSClient,
|
||||||
allowUnprotectedTxs bool,
|
allowUnprotectedTxs bool,
|
||||||
indexer ethermint.EVMTxIndexer,
|
indexer laconicd.EVMTxIndexer,
|
||||||
) []rpc.API {
|
) []rpc.API {
|
||||||
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
evmBackend := backend.NewBackend(ctx, ctx.Logger, clientCtx, allowUnprotectedTxs, indexer)
|
||||||
return []rpc.API{
|
return []rpc.API{
|
||||||
@ -165,7 +165,7 @@ func GetRPCAPIs(ctx *server.Context,
|
|||||||
clientCtx client.Context,
|
clientCtx client.Context,
|
||||||
tmWSClient *rpcclient.WSClient,
|
tmWSClient *rpcclient.WSClient,
|
||||||
allowUnprotectedTxs bool,
|
allowUnprotectedTxs bool,
|
||||||
indexer ethermint.EVMTxIndexer,
|
indexer laconicd.EVMTxIndexer,
|
||||||
selectedAPIs []string,
|
selectedAPIs []string,
|
||||||
) []rpc.API {
|
) []rpc.API {
|
||||||
var apis []rpc.API
|
var apis []rpc.API
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/crypto/hd"
|
"github.com/cerc-io/laconicd/crypto/hd"
|
||||||
rpctypes "github.com/cerc-io/laconicd/rpc/types"
|
rpctypes "github.com/cerc-io/laconicd/rpc/types"
|
||||||
"github.com/cerc-io/laconicd/server/config"
|
"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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||||
@ -103,8 +103,8 @@ type EVMBackend interface {
|
|||||||
|
|
||||||
// Tx Info
|
// Tx Info
|
||||||
GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransaction, error)
|
GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransaction, error)
|
||||||
GetTxByEthHash(txHash common.Hash) (*ethermint.TxResult, error)
|
GetTxByEthHash(txHash common.Hash) (*laconicd.TxResult, error)
|
||||||
GetTxByTxIndex(height int64, txIndex uint) (*ethermint.TxResult, error)
|
GetTxByTxIndex(height int64, txIndex uint) (*laconicd.TxResult, error)
|
||||||
GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*rpctypes.RPCTransaction, error)
|
GetTransactionByBlockAndIndex(block *tmrpctypes.ResultBlock, idx hexutil.Uint) (*rpctypes.RPCTransaction, error)
|
||||||
GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error)
|
GetTransactionReceipt(hash common.Hash) (map[string]interface{}, error)
|
||||||
GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error)
|
GetTransactionByBlockHashAndIndex(hash common.Hash, idx hexutil.Uint) (*rpctypes.RPCTransaction, error)
|
||||||
@ -141,7 +141,7 @@ type Backend struct {
|
|||||||
chainID *big.Int
|
chainID *big.Int
|
||||||
cfg config.Config
|
cfg config.Config
|
||||||
allowUnprotectedTxs bool
|
allowUnprotectedTxs bool
|
||||||
indexer ethermint.EVMTxIndexer
|
indexer laconicd.EVMTxIndexer
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewBackend creates a new Backend instance for cosmos and ethereum namespaces
|
// NewBackend creates a new Backend instance for cosmos and ethereum namespaces
|
||||||
@ -150,9 +150,9 @@ func NewBackend(
|
|||||||
logger log.Logger,
|
logger log.Logger,
|
||||||
clientCtx client.Context,
|
clientCtx client.Context,
|
||||||
allowUnprotectedTxs bool,
|
allowUnprotectedTxs bool,
|
||||||
indexer ethermint.EVMTxIndexer,
|
indexer laconicd.EVMTxIndexer,
|
||||||
) *Backend {
|
) *Backend {
|
||||||
chainID, err := ethermint.ParseChainID(clientCtx.ChainID)
|
chainID, err := laconicd.ParseChainID(clientCtx.ChainID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
rpctypes "github.com/cerc-io/laconicd/rpc/types"
|
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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
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
|
// The signer used should always be the 'latest' known one because we expect
|
||||||
// signers to be backwards-compatible with old transactions.
|
// 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 {
|
if err != nil {
|
||||||
return common.Hash{}, err
|
return common.Hash{}, err
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
rpctypes "github.com/cerc-io/laconicd/rpc/types"
|
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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
feemarkettypes "github.com/cerc-io/laconicd/x/feemarket/types"
|
feemarkettypes "github.com/cerc-io/laconicd/x/feemarket/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/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.
|
// ChainID is the EIP-155 replay-protection chain id for the current ethereum chain config.
|
||||||
func (b *Backend) ChainID() (*hexutil.Big, error) {
|
func (b *Backend) ChainID() (*hexutil.Big, error) {
|
||||||
eip155ChainID, err := ethermint.ParseChainID(b.clientCtx.ChainID)
|
eip155ChainID, err := laconicd.ParseChainID(b.clientCtx.ChainID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
||||||
rpctypes "github.com/cerc-io/laconicd/rpc/types"
|
rpctypes "github.com/cerc-io/laconicd/rpc/types"
|
||||||
"github.com/cerc-io/laconicd/server/config"
|
"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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
"github.com/cosmos/cosmos-sdk/client/flags"
|
"github.com/cosmos/cosmos-sdk/client/flags"
|
||||||
"github.com/cosmos/cosmos-sdk/client/tx"
|
"github.com/cosmos/cosmos-sdk/client/tx"
|
||||||
@ -326,13 +326,13 @@ func (b *Backend) RPCBlockRangeCap() int32 {
|
|||||||
func (b *Backend) RPCMinGasPrice() int64 {
|
func (b *Backend) RPCMinGasPrice() int64 {
|
||||||
evmParams, err := b.queryClient.Params(b.ctx, &evmtypes.QueryParamsRequest{})
|
evmParams, err := b.queryClient.Params(b.ctx, &evmtypes.QueryParamsRequest{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ethermint.DefaultGasPrice
|
return laconicd.DefaultGasPrice
|
||||||
}
|
}
|
||||||
|
|
||||||
minGasPrice := b.cfg.GetMinGasPrices()
|
minGasPrice := b.cfg.GetMinGasPrices()
|
||||||
amt := minGasPrice.AmountOf(evmParams.Params.EvmDenom).TruncateInt64()
|
amt := minGasPrice.AmountOf(evmParams.Params.EvmDenom).TruncateInt64()
|
||||||
if amt == 0 {
|
if amt == 0 {
|
||||||
return ethermint.DefaultGasPrice
|
return laconicd.DefaultGasPrice
|
||||||
}
|
}
|
||||||
|
|
||||||
return amt
|
return amt
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
rpctypes "github.com/cerc-io/laconicd/rpc/types"
|
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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
@ -277,7 +277,7 @@ func (b *Backend) GetTransactionByBlockNumberAndIndex(blockNum rpctypes.BlockNum
|
|||||||
// GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash
|
// GetTxByEthHash uses `/tx_query` to find transaction by ethereum tx hash
|
||||||
// TODO: Don't need to convert once hashing is fixed on Tendermint
|
// TODO: Don't need to convert once hashing is fixed on Tendermint
|
||||||
// https://github.com/tendermint/tendermint/issues/6539
|
// 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 {
|
if b.indexer != nil {
|
||||||
return b.indexer.GetByTxHash(hash)
|
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
|
// 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 {
|
if b.indexer != nil {
|
||||||
return b.indexer.GetByBlockAndIndex(height, int32(index))
|
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
|
// 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, "")
|
resTxs, err := b.clientCtx.Client.TxSearch(b.ctx, query, false, nil, nil, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/rpc/backend"
|
"github.com/cerc-io/laconicd/rpc/backend"
|
||||||
|
|
||||||
rpctypes "github.com/cerc-io/laconicd/rpc/types"
|
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"
|
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.
|
// ProtocolVersion returns the supported Ethereum protocol version.
|
||||||
func (e *PublicAPI) ProtocolVersion() hexutil.Uint {
|
func (e *PublicAPI) ProtocolVersion() hexutil.Uint {
|
||||||
e.logger.Debug("eth_protocolVersion")
|
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.
|
// GasPrice returns the current gas price based on Ethermint's gas price oracle.
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
ethermint "github.com/cerc-io/laconicd/types"
|
laconicd "github.com/cerc-io/laconicd/types"
|
||||||
"github.com/cosmos/cosmos-sdk/client"
|
"github.com/cosmos/cosmos-sdk/client"
|
||||||
rpcclient "github.com/tendermint/tendermint/rpc/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.
|
// NewPublicAPI creates an instance of the public Net Web3 API.
|
||||||
func NewPublicAPI(clientCtx client.Context) *PublicAPI {
|
func NewPublicAPI(clientCtx client.Context) *PublicAPI {
|
||||||
// parse the chainID from a integer string
|
// parse the chainID from a integer string
|
||||||
chainIDEpoch, err := ethermint.ParseChainID(clientCtx.ChainID)
|
chainIDEpoch, err := laconicd.ParseChainID(clientCtx.ChainID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/rpc/backend"
|
"github.com/cerc-io/laconicd/rpc/backend"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/crypto/hd"
|
"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"
|
"github.com/tendermint/tendermint/libs/log"
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ import (
|
|||||||
type PrivateAccountAPI struct {
|
type PrivateAccountAPI struct {
|
||||||
backend backend.EVMBackend
|
backend backend.EVMBackend
|
||||||
logger log.Logger
|
logger log.Logger
|
||||||
hdPathIter ethermint.HDPathIterator
|
hdPathIter laconicd.HDPathIterator
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewAPI creates an instance of the public Personal Eth API.
|
// NewAPI creates an instance of the public Personal Eth API.
|
||||||
@ -39,7 +39,7 @@ func NewAPI(
|
|||||||
cfg := sdk.GetConfig()
|
cfg := sdk.GetConfig()
|
||||||
basePath := cfg.GetFullBIP44Path()
|
basePath := cfg.GetFullBIP44Path()
|
||||||
|
|
||||||
iterator, err := ethermint.NewHDPathIterator(basePath, true)
|
iterator, err := laconicd.NewHDPathIterator(basePath, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ import (
|
|||||||
|
|
||||||
grpctypes "github.com/cosmos/cosmos-sdk/types/grpc"
|
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
|
// BlockNumber represents decoding hex string to block values
|
||||||
@ -182,7 +182,7 @@ func (bnh *BlockNumberOrHash) decodeFromString(input string) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
bnInt, err := ethermint.SafeInt64(blockNumber)
|
bnInt, err := laconicd.SafeInt64(blockNumber)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
ethermint "github.com/cerc-io/laconicd/types"
|
laconicd "github.com/cerc-io/laconicd/types"
|
||||||
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"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.
|
// 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)
|
txs, err := ParseTxResult(&txResult.TxResult, tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to parse tx events: block %d, index %d, %v", txResult.Height, txResult.Index, err)
|
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 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,
|
Height: txResult.Height,
|
||||||
TxIndex: txResult.Index,
|
TxIndex: txResult.Index,
|
||||||
MsgIndex: uint32(parsedTx.MsgIndex),
|
MsgIndex: uint32(parsedTx.MsgIndex),
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
rpcclient "github.com/tendermint/tendermint/rpc/client"
|
||||||
"github.com/tendermint/tendermint/types"
|
"github.com/tendermint/tendermint/types"
|
||||||
|
|
||||||
ethermint "github.com/cerc-io/laconicd/types"
|
laconicd "github.com/cerc-io/laconicd/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -21,13 +21,13 @@ const (
|
|||||||
type EVMIndexerService struct {
|
type EVMIndexerService struct {
|
||||||
service.BaseService
|
service.BaseService
|
||||||
|
|
||||||
txIdxr ethermint.EVMTxIndexer
|
txIdxr laconicd.EVMTxIndexer
|
||||||
client rpcclient.Client
|
client rpcclient.Client
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEVMIndexerService returns a new service instance.
|
// NewEVMIndexerService returns a new service instance.
|
||||||
func NewEVMIndexerService(
|
func NewEVMIndexerService(
|
||||||
txIdxr ethermint.EVMTxIndexer,
|
txIdxr laconicd.EVMTxIndexer,
|
||||||
client rpcclient.Client,
|
client rpcclient.Client,
|
||||||
) *EVMIndexerService {
|
) *EVMIndexerService {
|
||||||
is := &EVMIndexerService{txIdxr: txIdxr, client: client}
|
is := &EVMIndexerService{txIdxr: txIdxr, client: client}
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
ethrpc "github.com/ethereum/go-ethereum/rpc"
|
ethrpc "github.com/ethereum/go-ethereum/rpc"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/server/config"
|
"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
|
// StartJSONRPC starts the JSON-RPC server
|
||||||
@ -24,7 +24,7 @@ func StartJSONRPC(ctx *server.Context,
|
|||||||
tmRPCAddr,
|
tmRPCAddr,
|
||||||
tmEndpoint string,
|
tmEndpoint string,
|
||||||
config *config.Config,
|
config *config.Config,
|
||||||
indexer ethermint.EVMTxIndexer,
|
indexer laconicd.EVMTxIndexer,
|
||||||
) (*http.Server, chan struct{}, error) {
|
) (*http.Server, chan struct{}, error) {
|
||||||
tmWsClient := ConnectTmWS(tmRPCAddr, tmEndpoint, ctx.Logger)
|
tmWsClient := ConnectTmWS(tmRPCAddr, tmEndpoint, ctx.Logger)
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ import (
|
|||||||
ethdebug "github.com/cerc-io/laconicd/rpc/namespaces/ethereum/debug"
|
ethdebug "github.com/cerc-io/laconicd/rpc/namespaces/ethereum/debug"
|
||||||
"github.com/cerc-io/laconicd/server/config"
|
"github.com/cerc-io/laconicd/server/config"
|
||||||
srvflags "github.com/cerc-io/laconicd/server/flags"
|
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
|
// 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)
|
app.RegisterTendermintService(clientCtx)
|
||||||
}
|
}
|
||||||
|
|
||||||
var idxer ethermint.EVMTxIndexer
|
var idxer laconicd.EVMTxIndexer
|
||||||
if config.JSONRPC.EnableIndexer {
|
if config.JSONRPC.EnableIndexer {
|
||||||
idxDB, err := OpenIndexerDB(home, server.GetAppDBBackend(ctx.Viper))
|
idxDB, err := OpenIndexerDB(home, server.GetAppDBBackend(ctx.Viper))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
|
|
||||||
"github.com/cerc-io/laconicd/server/config"
|
"github.com/cerc-io/laconicd/server/config"
|
||||||
"github.com/cerc-io/laconicd/testutil/network"
|
"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() {
|
// var _ = Describe("E2e", func() {
|
||||||
@ -84,7 +84,7 @@ func (s *IntegrationTestSuite) SetupSuite() {
|
|||||||
s.rpcClient = rpcClient
|
s.rpcClient = rpcClient
|
||||||
s.gethClient = gethclient.New(rpcClient)
|
s.gethClient = gethclient.New(rpcClient)
|
||||||
s.Require().NotNil(s.gethClient)
|
s.Require().NotNil(s.gethClient)
|
||||||
chainId, err := ethermint.ParseChainID(s.cfg.ChainID)
|
chainId, err := laconicd.ParseChainID(s.cfg.ChainID)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
s.ethSigner = ethtypes.LatestSignerForChainID(chainId)
|
s.ethSigner = ethtypes.LatestSignerForChainID(chainId)
|
||||||
}
|
}
|
||||||
@ -99,9 +99,9 @@ func (s *IntegrationTestSuite) TestChainID() {
|
|||||||
|
|
||||||
s.T().Log(chainID.Int64())
|
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)
|
s.Require().NoError(err)
|
||||||
eip155ChainIDGen, err := ethermint.ParseChainID(genesisRes.Genesis.ChainID)
|
eip155ChainIDGen, err := laconicd.ParseChainID(genesisRes.Genesis.ChainID)
|
||||||
s.Require().NoError(err)
|
s.Require().NoError(err)
|
||||||
|
|
||||||
s.Require().Equal(chainID, eip155ChainID)
|
s.Require().Equal(chainID, eip155ChainID)
|
||||||
|
@ -18,7 +18,7 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
rpctypes "github.com/cerc-io/laconicd/rpc/types"
|
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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
@ -134,7 +134,7 @@ func callWithError(method string, params interface{}) (*Response, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestEth_protocolVersion(t *testing.T) {
|
func TestEth_protocolVersion(t *testing.T) {
|
||||||
expectedRes := hexutil.Uint(ethermint.ProtocolVersion)
|
expectedRes := hexutil.Uint(laconicd.ProtocolVersion)
|
||||||
|
|
||||||
rpcRes := call(t, "eth_protocolVersion", []string{})
|
rpcRes := call(t, "eth_protocolVersion", []string{})
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/crypto/hd"
|
"github.com/cerc-io/laconicd/crypto/hd"
|
||||||
"github.com/cerc-io/laconicd/encoding"
|
"github.com/cerc-io/laconicd/encoding"
|
||||||
"github.com/cerc-io/laconicd/server/config"
|
"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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
|
|
||||||
"github.com/cerc-io/laconicd/app"
|
"github.com/cerc-io/laconicd/app"
|
||||||
@ -122,13 +122,13 @@ func DefaultConfig() Config {
|
|||||||
AppConstructor: NewAppConstructor(encCfg),
|
AppConstructor: NewAppConstructor(encCfg),
|
||||||
GenesisState: app.ModuleBasics.DefaultGenesis(encCfg.Codec),
|
GenesisState: app.ModuleBasics.DefaultGenesis(encCfg.Codec),
|
||||||
TimeoutCommit: 2 * time.Second,
|
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,
|
NumValidators: 4,
|
||||||
BondDenom: ethermint.AttoPhoton,
|
BondDenom: laconicd.AttoPhoton,
|
||||||
MinGasPrices: fmt.Sprintf("0.000006%s", ethermint.AttoPhoton),
|
MinGasPrices: fmt.Sprintf("0.000006%s", laconicd.AttoPhoton),
|
||||||
AccountTokens: sdk.TokensFromConsensusPower(1000, ethermint.PowerReduction),
|
AccountTokens: sdk.TokensFromConsensusPower(1000, laconicd.PowerReduction),
|
||||||
StakingTokens: sdk.TokensFromConsensusPower(500, ethermint.PowerReduction),
|
StakingTokens: sdk.TokensFromConsensusPower(500, laconicd.PowerReduction),
|
||||||
BondedTokens: sdk.TokensFromConsensusPower(100, ethermint.PowerReduction),
|
BondedTokens: sdk.TokensFromConsensusPower(100, laconicd.PowerReduction),
|
||||||
PruningStrategy: pruningtypes.PruningOptionNothing,
|
PruningStrategy: pruningtypes.PruningOptionNothing,
|
||||||
CleanupDir: true,
|
CleanupDir: true,
|
||||||
SigningAlgo: string(hd.EthSecp256k1Type),
|
SigningAlgo: string(hd.EthSecp256k1Type),
|
||||||
@ -218,7 +218,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
|
|||||||
l.Log("acquiring test network lock")
|
l.Log("acquiring test network lock")
|
||||||
lock.Lock()
|
lock.Lock()
|
||||||
|
|
||||||
if !ethermint.IsValidChainID(cfg.ChainID) {
|
if !laconicd.IsValidChainID(cfg.ChainID) {
|
||||||
return nil, fmt.Errorf("invalid chain-id: %s", 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())
|
genFiles = append(genFiles, tmCfg.GenesisFile())
|
||||||
genBalances = append(genBalances, banktypes.Balance{Address: addr.String(), Coins: balances.Sort()})
|
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),
|
BaseAccount: authtypes.NewBaseAccount(addr, nil, 0, 0),
|
||||||
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
|
CodeHash: common.BytesToHash(evmtypes.EmptyCodeHash).Hex(),
|
||||||
})
|
})
|
||||||
@ -470,7 +470,7 @@ func New(l Logger, baseDir string, cfg Config) (*Network, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
customAppTemplate, _ := config.AppConfig(ethermint.AttoPhoton)
|
customAppTemplate, _ := config.AppConfig(laconicd.AttoPhoton)
|
||||||
srvconfig.SetConfigTemplate(customAppTemplate)
|
srvconfig.SetConfigTemplate(customAppTemplate)
|
||||||
srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config/app.toml"), appCfg)
|
srvconfig.WriteConfigFile(filepath.Join(nodeDir, "config/app.toml"), appCfg)
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
|
|
||||||
cryptocodec "github.com/cerc-io/laconicd/crypto/codec"
|
cryptocodec "github.com/cerc-io/laconicd/crypto/codec"
|
||||||
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
"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"
|
"github.com/cerc-io/laconicd/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ func (suite *AccountTestSuite) SetupTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interfaceRegistry := codectypes.NewInterfaceRegistry()
|
interfaceRegistry := codectypes.NewInterfaceRegistry()
|
||||||
ethermintcodec.RegisterInterfaces(interfaceRegistry)
|
laconicdcodec.RegisterInterfaces(interfaceRegistry)
|
||||||
suite.cdc = codec.NewProtoCodec(interfaceRegistry)
|
suite.cdc = codec.NewProtoCodec(interfaceRegistry)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ func BenchmarkParseChainID(b *testing.B) {
|
|||||||
b.ReportAllocs()
|
b.ReportAllocs()
|
||||||
// Start at 1, for valid EIP155, see regexEIP155 variable.
|
// Start at 1, for valid EIP155, see regexEIP155 variable.
|
||||||
for i := 1; i < b.N; i++ {
|
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 {
|
if _, err := ParseChainID(chainID); err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ var (
|
|||||||
regexEIP155 = `[1-9][0-9]*`
|
regexEIP155 = `[1-9][0-9]*`
|
||||||
regexEpochSeparator = `-{1}`
|
regexEpochSeparator = `-{1}`
|
||||||
regexEpoch = `[1-9][0-9]*`
|
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,
|
regexChainID,
|
||||||
regexEIP155Separator,
|
regexEIP155Separator,
|
||||||
regexEIP155,
|
regexEIP155,
|
||||||
@ -29,7 +29,7 @@ func IsValidChainID(chainID string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return ethermintChainID.MatchString(chainID)
|
return laconicChainID.MatchString(chainID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParseChainID parses a string chain identifier's epoch to an Ethereum-compatible
|
// 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)
|
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] == "" {
|
if matches == nil || len(matches) != 4 || matches[1] == "" {
|
||||||
return nil, sdkerrors.Wrapf(ErrInvalidChainID, "%s: %v", chainID, matches)
|
return nil, sdkerrors.Wrapf(ErrInvalidChainID, "%s: %v", chainID, matches)
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ func TestParseChainID(t *testing.T) {
|
|||||||
expInt *big.Int
|
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),
|
"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, 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 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_laconic_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,
|
"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,
|
"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,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
// RootCodespace is the codespace for all errors defined in this package
|
// 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.
|
// NOTE: We can't use 1 since that error code is reserved for internal errors.
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
abci "github.com/tendermint/tendermint/abci/types"
|
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/keeper"
|
||||||
"github.com/cerc-io/laconicd/x/evm/types"
|
"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))
|
panic(fmt.Errorf("account not found for address %s", account.Address))
|
||||||
}
|
}
|
||||||
|
|
||||||
ethAcct, ok := acc.(ethermint.EthAccountI)
|
ethAcct, ok := acc.(laconicd.EthAccountI)
|
||||||
if !ok {
|
if !ok {
|
||||||
panic(
|
panic(
|
||||||
fmt.Errorf("account %s must be an EthAccount interface, got %T",
|
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 {
|
func ExportGenesis(ctx sdk.Context, k *keeper.Keeper, ak types.AccountKeeper) *types.GenesisState {
|
||||||
var ethGenAccounts []types.GenesisAccount
|
var ethGenAccounts []types.GenesisAccount
|
||||||
ak.IterateAccounts(ctx, func(account authtypes.AccountI) bool {
|
ak.IterateAccounts(ctx, func(account authtypes.AccountI) bool {
|
||||||
ethAccount, ok := account.(ethermint.EthAccountI)
|
ethAccount, ok := account.(laconicd.EthAccountI)
|
||||||
if !ok {
|
if !ok {
|
||||||
// ignore non EthAccounts
|
// ignore non EthAccounts
|
||||||
return false
|
return false
|
||||||
|
@ -33,7 +33,7 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/app"
|
"github.com/cerc-io/laconicd/app"
|
||||||
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
||||||
"github.com/cerc-io/laconicd/tests"
|
"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"
|
||||||
"github.com/cerc-io/laconicd/x/evm/statedb"
|
"github.com/cerc-io/laconicd/x/evm/statedb"
|
||||||
"github.com/cerc-io/laconicd/x/evm/types"
|
"github.com/cerc-io/laconicd/x/evm/types"
|
||||||
@ -147,7 +147,7 @@ func (suite *EvmTestSuite) DoSetupTest(t require.TestingT) {
|
|||||||
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry())
|
queryHelper := baseapp.NewQueryServerTestHelper(suite.ctx, suite.app.InterfaceRegistry())
|
||||||
types.RegisterQueryServer(queryHelper, suite.app.EvmKeeper)
|
types.RegisterQueryServer(queryHelper, suite.app.EvmKeeper)
|
||||||
|
|
||||||
acc := ðermint.EthAccount{
|
acc := &laconicd.EthAccount{
|
||||||
BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(address.Bytes()), nil, 0, 0),
|
BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(address.Bytes()), nil, 0, 0),
|
||||||
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(),
|
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(),
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
|
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"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"
|
"github.com/cerc-io/laconicd/x/evm/types"
|
||||||
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
||||||
)
|
)
|
||||||
@ -20,7 +20,7 @@ func SetupContract(b *testing.B) (*KeeperTestSuite, common.Address) {
|
|||||||
suite := KeeperTestSuite{}
|
suite := KeeperTestSuite{}
|
||||||
suite.SetupTest()
|
suite.SetupTest()
|
||||||
|
|
||||||
amt := sdk.Coins{ethermint.NewPhotonCoinInt64(1000000000000000000)}
|
amt := sdk.Coins{laconicd.NewPhotonCoinInt64(1000000000000000000)}
|
||||||
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
||||||
require.NoError(b, err)
|
require.NoError(b, err)
|
||||||
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
|
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 := KeeperTestSuite{}
|
||||||
suite.SetupTest()
|
suite.SetupTest()
|
||||||
|
|
||||||
amt := sdk.Coins{ethermint.NewPhotonCoinInt64(1000000000000000000)}
|
amt := sdk.Coins{laconicd.NewPhotonCoinInt64(1000000000000000000)}
|
||||||
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
||||||
require.NoError(b, err)
|
require.NoError(b, err)
|
||||||
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
|
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/core/vm"
|
"github.com/ethereum/go-ethereum/core/vm"
|
||||||
ethparams "github.com/ethereum/go-ethereum/params"
|
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/statedb"
|
||||||
"github.com/cerc-io/laconicd/x/evm/types"
|
"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")
|
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(
|
return nil, status.Error(
|
||||||
codes.InvalidArgument, err.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")
|
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(
|
return nil, status.Error(
|
||||||
codes.InvalidArgument, err.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")
|
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(
|
return nil, status.Error(
|
||||||
codes.InvalidArgument,
|
codes.InvalidArgument,
|
||||||
types.ErrZeroAddress.Error(),
|
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")
|
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(
|
return nil, status.Error(
|
||||||
codes.InvalidArgument,
|
codes.InvalidArgument,
|
||||||
types.ErrZeroAddress.Error(),
|
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")
|
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(
|
return nil, status.Error(
|
||||||
codes.InvalidArgument,
|
codes.InvalidArgument,
|
||||||
types.ErrZeroAddress.Error(),
|
types.ErrZeroAddress.Error(),
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
|
|
||||||
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
||||||
"github.com/cerc-io/laconicd/server/config"
|
"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"
|
"github.com/cerc-io/laconicd/x/evm/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ func (suite *KeeperTestSuite) TestQueryAccount() {
|
|||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
func() {
|
||||||
amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)}
|
amt := sdk.Coins{laconicd.NewPhotonCoinInt64(100)}
|
||||||
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
|
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
|
||||||
@ -195,7 +195,7 @@ func (suite *KeeperTestSuite) TestQueryBalance() {
|
|||||||
{
|
{
|
||||||
"success",
|
"success",
|
||||||
func() {
|
func() {
|
||||||
amt := sdk.Coins{ethermint.NewPhotonCoinInt64(100)}
|
amt := sdk.Coins{laconicd.NewPhotonCoinInt64(100)}
|
||||||
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
err := suite.app.BankKeeper.MintCoins(suite.ctx, types.ModuleName, amt)
|
||||||
suite.Require().NoError(err)
|
suite.Require().NoError(err)
|
||||||
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
|
err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, types.ModuleName, suite.address.Bytes(), amt)
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/params"
|
"github.com/ethereum/go-ethereum/params"
|
||||||
"github.com/tendermint/tendermint/libs/log"
|
"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/statedb"
|
||||||
"github.com/cerc-io/laconicd/x/evm/types"
|
"github.com/cerc-io/laconicd/x/evm/types"
|
||||||
evm "github.com/cerc-io/laconicd/x/evm/vm"
|
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
|
// WithChainID sets the chain id to the local variable in the keeper
|
||||||
func (k *Keeper) WithChainID(ctx sdk.Context) {
|
func (k *Keeper) WithChainID(ctx sdk.Context) {
|
||||||
chainID, err := ethermint.ParseChainID(ctx.ChainID())
|
chainID, err := laconicd.ParseChainID(ctx.ChainID())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ func (k *Keeper) GetAccountWithoutBalance(ctx sdk.Context, addr common.Address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
codeHash := types.EmptyCodeHash
|
codeHash := types.EmptyCodeHash
|
||||||
ethAcct, ok := acct.(ethermint.EthAccountI)
|
ethAcct, ok := acct.(laconicd.EthAccountI)
|
||||||
if ok {
|
if ok {
|
||||||
codeHash = ethAcct.GetCodeHash().Bytes()
|
codeHash = ethAcct.GetCodeHash().Bytes()
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/encoding"
|
"github.com/cerc-io/laconicd/encoding"
|
||||||
"github.com/cerc-io/laconicd/server/config"
|
"github.com/cerc-io/laconicd/server/config"
|
||||||
"github.com/cerc-io/laconicd/tests"
|
"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/statedb"
|
||||||
"github.com/cerc-io/laconicd/x/evm/types"
|
"github.com/cerc-io/laconicd/x/evm/types"
|
||||||
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
@ -191,7 +191,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) {
|
|||||||
types.RegisterQueryServer(queryHelper, suite.app.EvmKeeper)
|
types.RegisterQueryServer(queryHelper, suite.app.EvmKeeper)
|
||||||
suite.queryClient = types.NewQueryClient(queryHelper)
|
suite.queryClient = types.NewQueryClient(queryHelper)
|
||||||
|
|
||||||
acc := ðermint.EthAccount{
|
acc := &laconicd.EthAccount{
|
||||||
BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0),
|
BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0),
|
||||||
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(),
|
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(),
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/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/statedb"
|
||||||
"github.com/cerc-io/laconicd/x/evm/types"
|
"github.com/cerc-io/laconicd/x/evm/types"
|
||||||
evm "github.com/cerc-io/laconicd/x/evm/vm"
|
evm "github.com/cerc-io/laconicd/x/evm/vm"
|
||||||
@ -84,7 +84,7 @@ func (k *Keeper) NewEVM(
|
|||||||
Transfer: core.Transfer,
|
Transfer: core.Transfer,
|
||||||
GetHash: k.GetHashFn(ctx),
|
GetHash: k.GetHashFn(ctx),
|
||||||
Coinbase: cfg.CoinBase,
|
Coinbase: cfg.CoinBase,
|
||||||
GasLimit: ethermint.BlockGasLimit(ctx),
|
GasLimit: laconicd.BlockGasLimit(ctx),
|
||||||
BlockNumber: big.NewInt(ctx.BlockHeight()),
|
BlockNumber: big.NewInt(ctx.BlockHeight()),
|
||||||
Time: big.NewInt(ctx.BlockHeader().Time.Unix()),
|
Time: big.NewInt(ctx.BlockHeader().Time.Unix()),
|
||||||
Difficulty: big.NewInt(0), // unused. Only required in PoW context
|
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
|
// 3. The requested height is from a height greater than the latest one
|
||||||
func (k Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc {
|
func (k Keeper) GetHashFn(ctx sdk.Context) vm.GetHashFunc {
|
||||||
return func(height uint64) common.Hash {
|
return func(height uint64) common.Hash {
|
||||||
h, err := ethermint.SafeInt64(height)
|
h, err := laconicd.SafeInt64(height)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
k.Logger(ctx).Error("failed to cast height to int64", "error", err)
|
k.Logger(ctx).Error("failed to cast height to int64", "error", err)
|
||||||
return common.Hash{}
|
return common.Hash{}
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
sdkmath "cosmossdk.io/math"
|
sdkmath "cosmossdk.io/math"
|
||||||
|
|
||||||
ethermint "github.com/cerc-io/laconicd/types"
|
laconicd "github.com/cerc-io/laconicd/types"
|
||||||
"github.com/cerc-io/laconicd/x/evm/statedb"
|
"github.com/cerc-io/laconicd/x/evm/statedb"
|
||||||
"github.com/cerc-io/laconicd/x/evm/types"
|
"github.com/cerc-io/laconicd/x/evm/types"
|
||||||
"github.com/cosmos/cosmos-sdk/store/prefix"
|
"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)
|
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 {
|
if err := ethAcct.SetCodeHash(codeHash); err != nil {
|
||||||
return err
|
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
|
// NOTE: only Ethereum accounts (contracts) can be selfdestructed
|
||||||
_, ok := acct.(ethermint.EthAccountI)
|
_, ok := acct.(laconicd.EthAccountI)
|
||||||
if !ok {
|
if !ok {
|
||||||
return sdkerrors.Wrapf(types.ErrInvalidAccount, "type %T, address %s", acct, addr)
|
return sdkerrors.Wrapf(types.ErrInvalidAccount, "type %T, address %s", acct, addr)
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,12 @@ package types
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
ethermint "github.com/cerc-io/laconicd/types"
|
laconicd "github.com/cerc-io/laconicd/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Validate performs a basic validation of a GenesisAccount fields.
|
// Validate performs a basic validation of a GenesisAccount fields.
|
||||||
func (ga GenesisAccount) Validate() error {
|
func (ga GenesisAccount) Validate() error {
|
||||||
if err := ethermint.ValidateAddress(ga.Address); err != nil {
|
if err := laconicd.ValidateAddress(ga.Address); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return ga.Storage.Validate()
|
return ga.Storage.Validate()
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
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.
|
// 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.
|
// Validate performs a basic validation of a GenesisAccount fields.
|
||||||
func (tx TransactionLogs) Validate() error {
|
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)
|
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.
|
// Validate performs a basic validation of an ethereum Log fields.
|
||||||
func (log *Log) Validate() error {
|
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)
|
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)
|
return fmt.Errorf("block hash cannot be the empty %s", log.BlockHash)
|
||||||
}
|
}
|
||||||
if log.BlockNumber == 0 {
|
if log.BlockNumber == 0 {
|
||||||
return errors.New("block number cannot be zero")
|
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 fmt.Errorf("tx hash cannot be the empty %s", log.TxHash)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
"github.com/cerc-io/laconicd/crypto/ethsecp256k1"
|
||||||
"github.com/cerc-io/laconicd/encoding"
|
"github.com/cerc-io/laconicd/encoding"
|
||||||
"github.com/cerc-io/laconicd/tests"
|
"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"
|
evmtypes "github.com/cerc-io/laconicd/x/evm/types"
|
||||||
"github.com/cerc-io/laconicd/x/feemarket/types"
|
"github.com/cerc-io/laconicd/x/feemarket/types"
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ func (suite *KeeperTestSuite) SetupApp(checkTx bool) {
|
|||||||
types.RegisterQueryServer(queryHelper, suite.app.FeeMarketKeeper)
|
types.RegisterQueryServer(queryHelper, suite.app.FeeMarketKeeper)
|
||||||
suite.queryClient = types.NewQueryClient(queryHelper)
|
suite.queryClient = types.NewQueryClient(queryHelper)
|
||||||
|
|
||||||
acc := ðermint.EthAccount{
|
acc := &laconicd.EthAccount{
|
||||||
BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0),
|
BaseAccount: authtypes.NewBaseAccount(sdk.AccAddress(suite.address.Bytes()), nil, 0, 0),
|
||||||
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(),
|
CodeHash: common.BytesToHash(crypto.Keccak256(nil)).String(),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user