forked from cerc-io/laconicd-deprecated
crypto: refactor for stargate (#559)
* changelog * update changelog * crypto: refactor for stargate * fixes * fix keys * changelog
This commit is contained in:
+3
-3
@@ -8,14 +8,14 @@ import (
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/keeper"
|
||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||
|
||||
"github.com/cosmos/ethermint/crypto"
|
||||
"github.com/cosmos/ethermint/crypto/ethsecp256k1"
|
||||
evmtypes "github.com/cosmos/ethermint/x/evm/types"
|
||||
|
||||
tmcrypto "github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
func init() {
|
||||
crypto.RegisterCodec(types.ModuleCdc)
|
||||
ethsecp256k1.RegisterCodec(types.ModuleCdc)
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -76,7 +76,7 @@ func sigGasConsumer(
|
||||
meter sdk.GasMeter, _ []byte, pubkey tmcrypto.PubKey, _ types.Params,
|
||||
) error {
|
||||
switch pubkey.(type) {
|
||||
case crypto.PubKeySecp256k1:
|
||||
case ethsecp256k1.PubKey:
|
||||
meter.ConsumeGas(secp256k1VerifyCost, "ante verify: secp256k1")
|
||||
return nil
|
||||
case tmcrypto.PubKey:
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
|
||||
"github.com/cosmos/ethermint/app"
|
||||
ante "github.com/cosmos/ethermint/app/ante"
|
||||
"github.com/cosmos/ethermint/crypto"
|
||||
"github.com/cosmos/ethermint/crypto/ethsecp256k1"
|
||||
ethermint "github.com/cosmos/ethermint/types"
|
||||
evmtypes "github.com/cosmos/ethermint/x/evm/types"
|
||||
|
||||
@@ -60,7 +60,7 @@ func newTestStdFee() auth.StdFee {
|
||||
|
||||
// GenerateAddress generates an Ethereum address.
|
||||
func newTestAddrKey() (sdk.AccAddress, tmcrypto.PrivKey) {
|
||||
privkey, _ := crypto.GenerateKey()
|
||||
privkey, _ := ethsecp256k1.GenerateKey()
|
||||
addr := ethcrypto.PubkeyToAddress(privkey.ToECDSA().PublicKey)
|
||||
|
||||
return sdk.AccAddress(addr.Bytes()), privkey
|
||||
@@ -95,7 +95,7 @@ func newTestEthTx(ctx sdk.Context, msg evmtypes.MsgEthereumTx, priv tmcrypto.Pri
|
||||
return nil, err
|
||||
}
|
||||
|
||||
privkey, ok := priv.(crypto.PrivKeySecp256k1)
|
||||
privkey, ok := priv.(ethsecp256k1.PrivKey)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("invalid private key type: %T", priv)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user