forked from cerc-io/laconicd-deprecated
Updates SDK and implement application genaccounts (#143)
* Transition to updated sdk with modular ante handler and new genaccounts setup * Update genesis account type to be an Ethermint account * Change default keybase and tidy modules * Fix lint
This commit is contained in:
parent
42227a1b8c
commit
97f73063a5
256
app/ante.go
256
app/ante.go
@ -5,8 +5,9 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth/exported"
|
"github.com/cosmos/cosmos-sdk/x/auth/ante"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
|
|
||||||
"github.com/cosmos/ethermint/crypto"
|
"github.com/cosmos/ethermint/crypto"
|
||||||
@ -19,164 +20,60 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
memoCostPerByte sdk.Gas = 3
|
// TODO: Use this cost per byte through parameter or overriding NewConsumeGasForTxSizeDecorator
|
||||||
secp256k1VerifyCost uint64 = 21000
|
// which currently defaults at 10, if intended
|
||||||
|
// memoCostPerByte sdk.Gas = 3
|
||||||
|
secp256k1VerifyCost uint64 = 21000
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewAnteHandler returns an ante handler responsible for attempting to route an
|
// NewAnteHandler returns an ante handler responsible for attempting to route an
|
||||||
// Ethereum or SDK transaction to an internal ante handler for performing
|
// Ethereum or SDK transaction to an internal ante handler for performing
|
||||||
// transaction-level processing (e.g. fee payment, signature verification) before
|
// transaction-level processing (e.g. fee payment, signature verification) before
|
||||||
// being passed onto it's respective handler.
|
// being passed onto it's respective handler.
|
||||||
//
|
|
||||||
// NOTE: The EVM will already consume (intrinsic) gas for signature verification
|
|
||||||
// and covering input size as well as handling nonce incrementing.
|
|
||||||
func NewAnteHandler(ak auth.AccountKeeper, sk types.SupplyKeeper) sdk.AnteHandler {
|
func NewAnteHandler(ak auth.AccountKeeper, sk types.SupplyKeeper) sdk.AnteHandler {
|
||||||
return func(
|
return func(
|
||||||
ctx sdk.Context, tx sdk.Tx, sim bool,
|
ctx sdk.Context, tx sdk.Tx, sim bool,
|
||||||
) (newCtx sdk.Context, res sdk.Result, abort bool) {
|
) (newCtx sdk.Context, err error) {
|
||||||
|
|
||||||
switch castTx := tx.(type) {
|
switch castTx := tx.(type) {
|
||||||
case auth.StdTx:
|
case auth.StdTx:
|
||||||
return sdkAnteHandler(ctx, ak, sk, castTx, sim)
|
stdAnte := sdk.ChainAnteDecorators(
|
||||||
|
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
|
||||||
|
ante.NewMempoolFeeDecorator(),
|
||||||
|
ante.NewValidateBasicDecorator(),
|
||||||
|
ante.NewValidateMemoDecorator(ak),
|
||||||
|
ante.NewConsumeGasForTxSizeDecorator(ak),
|
||||||
|
ante.NewSetPubKeyDecorator(ak), // SetPubKeyDecorator must be called before all signature verification decorators
|
||||||
|
ante.NewValidateSigCountDecorator(ak),
|
||||||
|
ante.NewDeductFeeDecorator(ak, sk),
|
||||||
|
ante.NewSigGasConsumeDecorator(ak, consumeSigGas),
|
||||||
|
ante.NewSigVerificationDecorator(ak),
|
||||||
|
ante.NewIncrementSequenceDecorator(ak), // innermost AnteDecorator
|
||||||
|
)
|
||||||
|
|
||||||
|
return stdAnte(ctx, tx, sim)
|
||||||
|
|
||||||
case *evmtypes.EthereumTxMsg:
|
case *evmtypes.EthereumTxMsg:
|
||||||
return ethAnteHandler(ctx, ak, sk, castTx, sim)
|
return ethAnteHandler(ctx, ak, sk, castTx, sim)
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return ctx, sdk.ErrInternal(fmt.Sprintf("transaction type invalid: %T", tx)).Result(), true
|
return ctx, sdk.ErrInternal(fmt.Sprintf("transaction type invalid: %T", tx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
func consumeSigGas(
|
||||||
// SDK Ante Handler
|
meter sdk.GasMeter, sig []byte, pubkey tmcrypto.PubKey, params types.Params,
|
||||||
|
) error {
|
||||||
func sdkAnteHandler(
|
|
||||||
ctx sdk.Context, ak auth.AccountKeeper, sk types.SupplyKeeper, stdTx auth.StdTx, sim bool,
|
|
||||||
) (newCtx sdk.Context, res sdk.Result, abort bool) {
|
|
||||||
// Ensure that the provided fees meet a minimum threshold for the validator,
|
|
||||||
// if this is a CheckTx. This is only for local mempool purposes, and thus
|
|
||||||
// is only ran on check tx.
|
|
||||||
if ctx.IsCheckTx() && !sim {
|
|
||||||
res := auth.EnsureSufficientMempoolFees(ctx, stdTx.Fee)
|
|
||||||
if !res.IsOK() {
|
|
||||||
return newCtx, res, true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
newCtx = auth.SetGasMeter(sim, ctx, stdTx.Fee.Gas)
|
|
||||||
|
|
||||||
// AnteHandlers must have their own defer/recover in order for the BaseApp
|
|
||||||
// to know how much gas was used! This is because the GasMeter is created in
|
|
||||||
// the AnteHandler, but if it panics the context won't be set properly in
|
|
||||||
// runTx's recover call.
|
|
||||||
defer func() {
|
|
||||||
if r := recover(); r != nil {
|
|
||||||
switch rType := r.(type) {
|
|
||||||
case sdk.ErrorOutOfGas:
|
|
||||||
log := fmt.Sprintf("out of gas in location: %v", rType.Descriptor)
|
|
||||||
res = sdk.ErrOutOfGas(log).Result()
|
|
||||||
res.GasWanted = stdTx.Fee.Gas
|
|
||||||
res.GasUsed = newCtx.GasMeter().GasConsumed()
|
|
||||||
abort = true
|
|
||||||
default:
|
|
||||||
panic(r)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
if err := stdTx.ValidateBasic(); err != nil {
|
|
||||||
return newCtx, err.Result(), true
|
|
||||||
}
|
|
||||||
|
|
||||||
newCtx.GasMeter().ConsumeGas(memoCostPerByte*sdk.Gas(len(stdTx.GetMemo())), "memo")
|
|
||||||
|
|
||||||
// stdSigs contains the sequence number, account number, and signatures.
|
|
||||||
// When simulating, this would just be a 0-length slice.
|
|
||||||
signerAddrs := stdTx.GetSigners()
|
|
||||||
signerAccs := make([]exported.Account, len(signerAddrs))
|
|
||||||
isGenesis := ctx.BlockHeight() == 0
|
|
||||||
|
|
||||||
// fetch first signer, who's going to pay the fees
|
|
||||||
signerAccs[0], res = auth.GetSignerAcc(newCtx, ak, signerAddrs[0])
|
|
||||||
if !res.IsOK() {
|
|
||||||
return newCtx, res, true
|
|
||||||
}
|
|
||||||
|
|
||||||
// the first signer pays the transaction fees
|
|
||||||
if !stdTx.Fee.Amount.IsZero() {
|
|
||||||
res = auth.DeductFees(sk, newCtx, signerAccs[0], stdTx.Fee.Amount)
|
|
||||||
if !res.IsOK() {
|
|
||||||
return newCtx, res, true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reload account after fees deducted
|
|
||||||
signerAccs[0] = ak.GetAccount(newCtx, signerAccs[0].GetAddress())
|
|
||||||
}
|
|
||||||
|
|
||||||
stdSigs := stdTx.GetSignatures()
|
|
||||||
|
|
||||||
for i := 0; i < len(stdSigs); i++ {
|
|
||||||
// skip the fee payer, account is cached and fees were deducted already
|
|
||||||
if i != 0 {
|
|
||||||
signerAccs[i], res = auth.GetSignerAcc(newCtx, ak, signerAddrs[i])
|
|
||||||
if !res.IsOK() {
|
|
||||||
return newCtx, res, true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// check signature, return account with incremented nonce
|
|
||||||
signBytes := auth.GetSignBytes(newCtx.ChainID(), stdTx, signerAccs[i], isGenesis)
|
|
||||||
signerAccs[i], res = processSig(newCtx, signerAccs[i], stdSigs[i], signBytes, sim)
|
|
||||||
if !res.IsOK() {
|
|
||||||
return newCtx, res, true
|
|
||||||
}
|
|
||||||
|
|
||||||
ak.SetAccount(newCtx, signerAccs[i])
|
|
||||||
}
|
|
||||||
|
|
||||||
return newCtx, sdk.Result{GasWanted: stdTx.Fee.Gas}, false
|
|
||||||
}
|
|
||||||
|
|
||||||
// processSig verifies the signature and increments the nonce. If the account
|
|
||||||
// doesn't have a pubkey, set it.
|
|
||||||
func processSig(
|
|
||||||
ctx sdk.Context, acc auth.Account, sig auth.StdSignature, signBytes []byte, sim bool,
|
|
||||||
) (updatedAcc auth.Account, res sdk.Result) {
|
|
||||||
|
|
||||||
pubKey, res := auth.ProcessPubKey(acc, sig, sim)
|
|
||||||
if !res.IsOK() {
|
|
||||||
return nil, res
|
|
||||||
}
|
|
||||||
|
|
||||||
err := acc.SetPubKey(pubKey)
|
|
||||||
if err != nil {
|
|
||||||
return nil, sdk.ErrInternal("failed to set PubKey on signer account").Result()
|
|
||||||
}
|
|
||||||
|
|
||||||
consumeSigGas(ctx.GasMeter(), pubKey)
|
|
||||||
if !sim && !pubKey.VerifyBytes(signBytes, sig.Signature) {
|
|
||||||
return nil, sdk.ErrUnauthorized("signature verification failed").Result()
|
|
||||||
}
|
|
||||||
|
|
||||||
err = acc.SetSequence(acc.GetSequence() + 1)
|
|
||||||
if err != nil {
|
|
||||||
return nil, sdk.ErrInternal("failed to set account nonce").Result()
|
|
||||||
}
|
|
||||||
|
|
||||||
return acc, res
|
|
||||||
}
|
|
||||||
|
|
||||||
func consumeSigGas(meter sdk.GasMeter, pubkey tmcrypto.PubKey) {
|
|
||||||
switch pubkey.(type) {
|
switch pubkey.(type) {
|
||||||
case crypto.PubKeySecp256k1:
|
case crypto.PubKeySecp256k1:
|
||||||
meter.ConsumeGas(secp256k1VerifyCost, "ante verify: secp256k1")
|
meter.ConsumeGas(secp256k1VerifyCost, "ante verify: secp256k1")
|
||||||
// TODO: Remove allowing tm Pub key to sign transactions (if intended in final release)
|
return nil
|
||||||
// or until genesis utils are built into the evm or as their own module
|
|
||||||
case tmcrypto.PubKey:
|
case tmcrypto.PubKey:
|
||||||
meter.ConsumeGas(secp256k1VerifyCost, "ante verify: tendermint secp256k1")
|
meter.ConsumeGas(secp256k1VerifyCost, "ante verify: tendermint secp256k1")
|
||||||
|
return nil
|
||||||
default:
|
default:
|
||||||
panic("Unrecognized signature type")
|
return sdkerrors.Wrapf(sdkerrors.ErrInvalidPubKey, "unrecognized public key type: %T", pubkey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +90,7 @@ func consumeSigGas(meter sdk.GasMeter, pubkey tmcrypto.PubKey) {
|
|||||||
func ethAnteHandler(
|
func ethAnteHandler(
|
||||||
ctx sdk.Context, ak auth.AccountKeeper, sk types.SupplyKeeper,
|
ctx sdk.Context, ak auth.AccountKeeper, sk types.SupplyKeeper,
|
||||||
ethTxMsg *evmtypes.EthereumTxMsg, sim bool,
|
ethTxMsg *evmtypes.EthereumTxMsg, sim bool,
|
||||||
) (newCtx sdk.Context, res sdk.Result, abort bool) {
|
) (newCtx sdk.Context, err error) {
|
||||||
|
|
||||||
var senderAddr sdk.AccAddress
|
var senderAddr sdk.AccAddress
|
||||||
|
|
||||||
@ -203,18 +100,18 @@ func ethAnteHandler(
|
|||||||
if ctx.IsCheckTx() {
|
if ctx.IsCheckTx() {
|
||||||
// Only perform pre-message (Ethereum transaction) execution validation
|
// Only perform pre-message (Ethereum transaction) execution validation
|
||||||
// during CheckTx. Otherwise, during DeliverTx the EVM will handle them.
|
// during CheckTx. Otherwise, during DeliverTx the EVM will handle them.
|
||||||
if senderAddr, res = validateEthTxCheckTx(ctx, ak, ethTxMsg); !res.IsOK() {
|
if senderAddr, err = validateEthTxCheckTx(ctx, ak, ethTxMsg); err != nil {
|
||||||
return ctx, res, true
|
return ctx, err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// This is still currently needed to retrieve the sender address
|
// This is still currently needed to retrieve the sender address
|
||||||
if senderAddr, res = validateSignature(ctx, ethTxMsg); !res.IsOK() {
|
if senderAddr, err = validateSignature(ctx, ethTxMsg); err != nil {
|
||||||
return ctx, res, true
|
return ctx, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Explicit nonce check is also needed in case of multiple txs with same nonce not being handled
|
// Explicit nonce check is also needed in case of multiple txs with same nonce not being handled
|
||||||
if res := checkNonce(ctx, ak, ethTxMsg, senderAddr); !res.IsOK() {
|
if err := checkNonce(ctx, ak, ethTxMsg, senderAddr); err != nil {
|
||||||
return ctx, res, true
|
return ctx, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,10 +121,7 @@ func ethAnteHandler(
|
|||||||
switch rType := r.(type) {
|
switch rType := r.(type) {
|
||||||
case sdk.ErrorOutOfGas:
|
case sdk.ErrorOutOfGas:
|
||||||
log := fmt.Sprintf("out of gas in location: %v", rType.Descriptor)
|
log := fmt.Sprintf("out of gas in location: %v", rType.Descriptor)
|
||||||
res = sdk.ErrOutOfGas(log).Result()
|
err = sdk.ErrOutOfGas(log)
|
||||||
res.GasWanted = ethTxMsg.Data.GasLimit
|
|
||||||
res.GasUsed = ctx.GasMeter().GasConsumed()
|
|
||||||
abort = true
|
|
||||||
default:
|
default:
|
||||||
panic(r)
|
panic(r)
|
||||||
}
|
}
|
||||||
@ -235,9 +129,9 @@ func ethAnteHandler(
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
// Fetch sender account from signature
|
// Fetch sender account from signature
|
||||||
senderAcc, res := auth.GetSignerAcc(ctx, ak, senderAddr)
|
senderAcc, err := auth.GetSignerAcc(ctx, ak, senderAddr)
|
||||||
if !res.IsOK() {
|
if err != nil {
|
||||||
return ctx, res, true
|
return ctx, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Charge sender for gas up to limit
|
// Charge sender for gas up to limit
|
||||||
@ -245,12 +139,12 @@ func ethAnteHandler(
|
|||||||
// Cost calculates the fees paid to validators based on gas limit and price
|
// Cost calculates the fees paid to validators based on gas limit and price
|
||||||
cost := new(big.Int).Mul(ethTxMsg.Data.Price, new(big.Int).SetUint64(ethTxMsg.Data.GasLimit))
|
cost := new(big.Int).Mul(ethTxMsg.Data.Price, new(big.Int).SetUint64(ethTxMsg.Data.GasLimit))
|
||||||
|
|
||||||
res = auth.DeductFees(sk, ctx, senderAcc, sdk.Coins{
|
err = auth.DeductFees(sk, ctx, senderAcc, sdk.Coins{
|
||||||
sdk.NewCoin(emint.DenomDefault, sdk.NewIntFromBigInt(cost)),
|
sdk.NewCoin(emint.DenomDefault, sdk.NewIntFromBigInt(cost)),
|
||||||
})
|
})
|
||||||
|
|
||||||
if !res.IsOK() {
|
if err != nil {
|
||||||
return ctx, res, true
|
return ctx, err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,51 +154,51 @@ func ethAnteHandler(
|
|||||||
gas, _ := ethcore.IntrinsicGas(ethTxMsg.Data.Payload, ethTxMsg.To() == nil, true)
|
gas, _ := ethcore.IntrinsicGas(ethTxMsg.Data.Payload, ethTxMsg.To() == nil, true)
|
||||||
newCtx.GasMeter().ConsumeGas(gas, "eth intrinsic gas")
|
newCtx.GasMeter().ConsumeGas(gas, "eth intrinsic gas")
|
||||||
|
|
||||||
return newCtx, sdk.Result{}, false
|
return newCtx, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func validateEthTxCheckTx(
|
func validateEthTxCheckTx(
|
||||||
ctx sdk.Context, ak auth.AccountKeeper, ethTxMsg *evmtypes.EthereumTxMsg,
|
ctx sdk.Context, ak auth.AccountKeeper, ethTxMsg *evmtypes.EthereumTxMsg,
|
||||||
) (sdk.AccAddress, sdk.Result) {
|
) (sdk.AccAddress, error) {
|
||||||
// Validate sufficient fees have been provided that meet a minimum threshold
|
// Validate sufficient fees have been provided that meet a minimum threshold
|
||||||
// defined by the proposer (for mempool purposes during CheckTx).
|
// defined by the proposer (for mempool purposes during CheckTx).
|
||||||
if res := ensureSufficientMempoolFees(ctx, ethTxMsg); !res.IsOK() {
|
if err := ensureSufficientMempoolFees(ctx, ethTxMsg); err != nil {
|
||||||
return nil, res
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate enough intrinsic gas
|
// validate enough intrinsic gas
|
||||||
if res := validateIntrinsicGas(ethTxMsg); !res.IsOK() {
|
if err := validateIntrinsicGas(ethTxMsg); err != nil {
|
||||||
return nil, res
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
signer, res := validateSignature(ctx, ethTxMsg)
|
signer, err := validateSignature(ctx, ethTxMsg)
|
||||||
if !res.IsOK() {
|
if err != nil {
|
||||||
return nil, res
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate account (nonce and balance checks)
|
// validate account (nonce and balance checks)
|
||||||
if res := validateAccount(ctx, ak, ethTxMsg, signer); !res.IsOK() {
|
if err := validateAccount(ctx, ak, ethTxMsg, signer); err != nil {
|
||||||
return nil, res
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdk.AccAddress(signer.Bytes()), sdk.Result{}
|
return sdk.AccAddress(signer.Bytes()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validates signature and returns sender address
|
// Validates signature and returns sender address
|
||||||
func validateSignature(ctx sdk.Context, ethTxMsg *evmtypes.EthereumTxMsg) (sdk.AccAddress, sdk.Result) {
|
func validateSignature(ctx sdk.Context, ethTxMsg *evmtypes.EthereumTxMsg) (sdk.AccAddress, error) {
|
||||||
// parse the chainID from a string to a base-10 integer
|
// parse the chainID from a string to a base-10 integer
|
||||||
chainID, ok := new(big.Int).SetString(ctx.ChainID(), 10)
|
chainID, ok := new(big.Int).SetString(ctx.ChainID(), 10)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, emint.ErrInvalidChainID(fmt.Sprintf("invalid chainID: %s", ctx.ChainID())).Result()
|
return nil, emint.ErrInvalidChainID(fmt.Sprintf("invalid chainID: %s", ctx.ChainID()))
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate sender/signature
|
// validate sender/signature
|
||||||
signer, err := ethTxMsg.VerifySig(chainID)
|
signer, err := ethTxMsg.VerifySig(chainID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, sdk.ErrUnauthorized(fmt.Sprintf("signature verification failed: %s", err)).Result()
|
return nil, sdk.ErrUnauthorized(fmt.Sprintf("signature verification failed: %s", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdk.AccAddress(signer.Bytes()), sdk.Result{}
|
return sdk.AccAddress(signer.Bytes()), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// validateIntrinsicGas validates that the Ethereum tx message has enough to
|
// validateIntrinsicGas validates that the Ethereum tx message has enough to
|
||||||
@ -312,26 +206,26 @@ func validateSignature(ctx sdk.Context, ethTxMsg *evmtypes.EthereumTxMsg) (sdk.A
|
|||||||
// that the transaction uses before the transaction is executed. The gas is a
|
// that the transaction uses before the transaction is executed. The gas is a
|
||||||
// constant value of 21000 plus any cost inccured by additional bytes of data
|
// constant value of 21000 plus any cost inccured by additional bytes of data
|
||||||
// supplied with the transaction.
|
// supplied with the transaction.
|
||||||
func validateIntrinsicGas(ethTxMsg *evmtypes.EthereumTxMsg) sdk.Result {
|
func validateIntrinsicGas(ethTxMsg *evmtypes.EthereumTxMsg) error {
|
||||||
gas, err := ethcore.IntrinsicGas(ethTxMsg.Data.Payload, ethTxMsg.To() == nil, true)
|
gas, err := ethcore.IntrinsicGas(ethTxMsg.Data.Payload, ethTxMsg.To() == nil, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sdk.ErrInternal(fmt.Sprintf("failed to compute intrinsic gas cost: %s", err)).Result()
|
return sdk.ErrInternal(fmt.Sprintf("failed to compute intrinsic gas cost: %s", err))
|
||||||
}
|
}
|
||||||
|
|
||||||
if ethTxMsg.Data.GasLimit < gas {
|
if ethTxMsg.Data.GasLimit < gas {
|
||||||
return sdk.ErrInternal(
|
return sdk.ErrInternal(
|
||||||
fmt.Sprintf("intrinsic gas too low; %d < %d", ethTxMsg.Data.GasLimit, gas),
|
fmt.Sprintf("intrinsic gas too low; %d < %d", ethTxMsg.Data.GasLimit, gas),
|
||||||
).Result()
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdk.Result{}
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// validateAccount validates the account nonce and that the account has enough
|
// validateAccount validates the account nonce and that the account has enough
|
||||||
// funds to cover the tx cost.
|
// funds to cover the tx cost.
|
||||||
func validateAccount(
|
func validateAccount(
|
||||||
ctx sdk.Context, ak auth.AccountKeeper, ethTxMsg *evmtypes.EthereumTxMsg, signer sdk.AccAddress,
|
ctx sdk.Context, ak auth.AccountKeeper, ethTxMsg *evmtypes.EthereumTxMsg, signer sdk.AccAddress,
|
||||||
) sdk.Result {
|
) error {
|
||||||
|
|
||||||
acc := ak.GetAccount(ctx, signer)
|
acc := ak.GetAccount(ctx, signer)
|
||||||
|
|
||||||
@ -340,12 +234,12 @@ func validateAccount(
|
|||||||
return sdk.ErrInternal(
|
return sdk.ErrInternal(
|
||||||
fmt.Sprintf(
|
fmt.Sprintf(
|
||||||
"invalid account number for height zero; got %d, expected 0", acc.GetAccountNumber(),
|
"invalid account number for height zero; got %d, expected 0", acc.GetAccountNumber(),
|
||||||
)).Result()
|
))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate nonce is correct
|
// Validate nonce is correct
|
||||||
if res := checkNonce(ctx, ak, ethTxMsg, signer); !res.IsOK() {
|
if err := checkNonce(ctx, ak, ethTxMsg, signer); err != nil {
|
||||||
return res
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// validate sender has enough funds
|
// validate sender has enough funds
|
||||||
@ -353,25 +247,25 @@ func validateAccount(
|
|||||||
if balance.BigInt().Cmp(ethTxMsg.Cost()) < 0 {
|
if balance.BigInt().Cmp(ethTxMsg.Cost()) < 0 {
|
||||||
return sdk.ErrInsufficientFunds(
|
return sdk.ErrInsufficientFunds(
|
||||||
fmt.Sprintf("insufficient funds: %s < %s", balance, ethTxMsg.Cost()),
|
fmt.Sprintf("insufficient funds: %s < %s", balance, ethTxMsg.Cost()),
|
||||||
).Result()
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdk.Result{}
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func checkNonce(
|
func checkNonce(
|
||||||
ctx sdk.Context, ak auth.AccountKeeper, ethTxMsg *evmtypes.EthereumTxMsg, signer sdk.AccAddress,
|
ctx sdk.Context, ak auth.AccountKeeper, ethTxMsg *evmtypes.EthereumTxMsg, signer sdk.AccAddress,
|
||||||
) sdk.Result {
|
) error {
|
||||||
acc := ak.GetAccount(ctx, signer)
|
acc := ak.GetAccount(ctx, signer)
|
||||||
// Validate the transaction nonce is valid (equivalent to the sender account’s
|
// Validate the transaction nonce is valid (equivalent to the sender account’s
|
||||||
// current nonce).
|
// current nonce).
|
||||||
seq := acc.GetSequence()
|
seq := acc.GetSequence()
|
||||||
if ethTxMsg.Data.AccountNonce != seq {
|
if ethTxMsg.Data.AccountNonce != seq {
|
||||||
return sdk.ErrInvalidSequence(
|
return sdk.ErrInvalidSequence(
|
||||||
fmt.Sprintf("invalid nonce; got %d, expected %d", ethTxMsg.Data.AccountNonce, seq)).Result()
|
fmt.Sprintf("invalid nonce; got %d, expected %d", ethTxMsg.Data.AccountNonce, seq))
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdk.Result{}
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ensureSufficientMempoolFees verifies that enough fees have been provided by the
|
// ensureSufficientMempoolFees verifies that enough fees have been provided by the
|
||||||
@ -379,7 +273,7 @@ func checkNonce(
|
|||||||
// proposer.
|
// proposer.
|
||||||
//
|
//
|
||||||
// NOTE: This should only be ran during a CheckTx mode.
|
// NOTE: This should only be ran during a CheckTx mode.
|
||||||
func ensureSufficientMempoolFees(ctx sdk.Context, ethTxMsg *evmtypes.EthereumTxMsg) sdk.Result {
|
func ensureSufficientMempoolFees(ctx sdk.Context, ethTxMsg *evmtypes.EthereumTxMsg) error {
|
||||||
// fee = GP * GL
|
// fee = GP * GL
|
||||||
fee := sdk.NewDecCoinFromCoin(sdk.NewInt64Coin(emint.DenomDefault, ethTxMsg.Fee().Int64()))
|
fee := sdk.NewDecCoinFromCoin(sdk.NewInt64Coin(emint.DenomDefault, ethTxMsg.Fee().Int64()))
|
||||||
|
|
||||||
@ -396,8 +290,8 @@ func ensureSufficientMempoolFees(ctx sdk.Context, ethTxMsg *evmtypes.EthereumTxM
|
|||||||
// reject the transaction that does not meet the minimum fee
|
// reject the transaction that does not meet the minimum fee
|
||||||
return sdk.ErrInsufficientFee(
|
return sdk.ErrInsufficientFee(
|
||||||
fmt.Sprintf("insufficient fee, got: %q required: %q", fee, ctx.MinGasPrices()),
|
fmt.Sprintf("insufficient fee, got: %q required: %q", fee, ctx.MinGasPrices()),
|
||||||
).Result()
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sdk.Result{}
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package app
|
package app
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@ -18,11 +17,8 @@ import (
|
|||||||
func requireValidTx(
|
func requireValidTx(
|
||||||
t *testing.T, anteHandler sdk.AnteHandler, ctx sdk.Context, tx sdk.Tx, sim bool,
|
t *testing.T, anteHandler sdk.AnteHandler, ctx sdk.Context, tx sdk.Tx, sim bool,
|
||||||
) {
|
) {
|
||||||
|
_, err := anteHandler(ctx, tx, sim)
|
||||||
_, result, abort := anteHandler(ctx, tx, sim)
|
require.True(t, err == nil)
|
||||||
require.Equal(t, sdk.CodeOK, result.Code, result.Log)
|
|
||||||
require.False(t, abort)
|
|
||||||
require.True(t, result.IsOK())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func requireInvalidTx(
|
func requireInvalidTx(
|
||||||
@ -30,20 +26,13 @@ func requireInvalidTx(
|
|||||||
tx sdk.Tx, sim bool, code sdk.CodeType,
|
tx sdk.Tx, sim bool, code sdk.CodeType,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
newCtx, result, abort := anteHandler(ctx, tx, sim)
|
_, err := anteHandler(ctx, tx, sim)
|
||||||
require.True(t, abort)
|
// require.Equal(t, code, err, fmt.Sprintf("invalid result: %v", err))
|
||||||
require.Equal(t, code, result.Code, fmt.Sprintf("invalid result: %v", result))
|
require.Error(t, err)
|
||||||
|
|
||||||
if code == sdk.CodeOutOfGas {
|
if code == sdk.CodeOutOfGas {
|
||||||
stdTx, ok := tx.(auth.StdTx)
|
_, ok := tx.(auth.StdTx)
|
||||||
require.True(t, ok, "tx must be in form auth.StdTx")
|
require.True(t, ok, "tx must be in form auth.StdTx")
|
||||||
|
|
||||||
// require GasWanted is set correctly
|
|
||||||
require.Equal(t, stdTx.Fee.Gas, result.GasWanted, "'GasWanted' wanted not set correctly")
|
|
||||||
require.True(t, result.GasUsed > result.GasWanted, "'GasUsed' not greater than GasWanted")
|
|
||||||
|
|
||||||
// require that context is set correctly
|
|
||||||
require.Equal(t, result.GasUsed, newCtx.GasMeter().GasConsumed(), "Context not updated correctly")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,13 +90,8 @@ func TestValidTx(t *testing.T) {
|
|||||||
accSeqs := []uint64{acc1.GetSequence(), acc2.GetSequence()}
|
accSeqs := []uint64{acc1.GetSequence(), acc2.GetSequence()}
|
||||||
|
|
||||||
tx := newTestSDKTx(input.ctx, msgs, privKeys, accNums, accSeqs, fee)
|
tx := newTestSDKTx(input.ctx, msgs, privKeys, accNums, accSeqs, fee)
|
||||||
requireValidTx(t, input.anteHandler, input.ctx, tx, false)
|
|
||||||
|
|
||||||
// require accounts to update
|
requireValidTx(t, input.anteHandler, input.ctx, tx, false)
|
||||||
acc1 = input.accKeeper.GetAccount(input.ctx, addr1)
|
|
||||||
acc2 = input.accKeeper.GetAccount(input.ctx, addr2)
|
|
||||||
require.Equal(t, accSeqs[0]+1, acc1.GetSequence())
|
|
||||||
require.Equal(t, accSeqs[1]+1, acc2.GetSequence())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSDKInvalidSigs(t *testing.T) {
|
func TestSDKInvalidSigs(t *testing.T) {
|
||||||
|
@ -15,7 +15,6 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/x/bank"
|
"github.com/cosmos/cosmos-sdk/x/bank"
|
||||||
"github.com/cosmos/cosmos-sdk/x/crisis"
|
"github.com/cosmos/cosmos-sdk/x/crisis"
|
||||||
distr "github.com/cosmos/cosmos-sdk/x/distribution"
|
distr "github.com/cosmos/cosmos-sdk/x/distribution"
|
||||||
"github.com/cosmos/cosmos-sdk/x/genaccounts"
|
|
||||||
"github.com/cosmos/cosmos-sdk/x/genutil"
|
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||||
"github.com/cosmos/cosmos-sdk/x/gov"
|
"github.com/cosmos/cosmos-sdk/x/gov"
|
||||||
"github.com/cosmos/cosmos-sdk/x/mint"
|
"github.com/cosmos/cosmos-sdk/x/mint"
|
||||||
@ -47,7 +46,6 @@ var (
|
|||||||
// non-dependant module elements, such as codec registration
|
// non-dependant module elements, such as codec registration
|
||||||
// and genesis verification.
|
// and genesis verification.
|
||||||
ModuleBasics = module.NewBasicManager(
|
ModuleBasics = module.NewBasicManager(
|
||||||
genaccounts.AppModuleBasic{},
|
|
||||||
genutil.AppModuleBasic{},
|
genutil.AppModuleBasic{},
|
||||||
auth.AppModuleBasic{},
|
auth.AppModuleBasic{},
|
||||||
bank.AppModuleBasic{},
|
bank.AppModuleBasic{},
|
||||||
@ -151,14 +149,14 @@ func NewEthermintApp(
|
|||||||
mintSubspace := app.paramsKeeper.Subspace(mint.DefaultParamspace)
|
mintSubspace := app.paramsKeeper.Subspace(mint.DefaultParamspace)
|
||||||
distrSubspace := app.paramsKeeper.Subspace(distr.DefaultParamspace)
|
distrSubspace := app.paramsKeeper.Subspace(distr.DefaultParamspace)
|
||||||
slashingSubspace := app.paramsKeeper.Subspace(slashing.DefaultParamspace)
|
slashingSubspace := app.paramsKeeper.Subspace(slashing.DefaultParamspace)
|
||||||
govSubspace := app.paramsKeeper.Subspace(gov.DefaultParamspace)
|
govSubspace := app.paramsKeeper.Subspace(gov.DefaultParamspace).WithKeyTable(gov.ParamKeyTable())
|
||||||
crisisSubspace := app.paramsKeeper.Subspace(crisis.DefaultParamspace)
|
crisisSubspace := app.paramsKeeper.Subspace(crisis.DefaultParamspace)
|
||||||
|
|
||||||
// add keepers
|
// add keepers
|
||||||
app.accountKeeper = auth.NewAccountKeeper(app.cdc, keys[auth.StoreKey], authSubspace, eminttypes.ProtoBaseAccount)
|
app.accountKeeper = auth.NewAccountKeeper(app.cdc, keys[auth.StoreKey], authSubspace, eminttypes.ProtoBaseAccount)
|
||||||
app.bankKeeper = bank.NewBaseKeeper(app.accountKeeper, bankSubspace, bank.DefaultCodespace, app.ModuleAccountAddrs())
|
app.bankKeeper = bank.NewBaseKeeper(app.accountKeeper, bankSubspace, bank.DefaultCodespace, app.ModuleAccountAddrs())
|
||||||
app.supplyKeeper = supply.NewKeeper(app.cdc, keys[supply.StoreKey], app.accountKeeper, app.bankKeeper, maccPerms)
|
app.supplyKeeper = supply.NewKeeper(app.cdc, keys[supply.StoreKey], app.accountKeeper, app.bankKeeper, maccPerms)
|
||||||
stakingKeeper := staking.NewKeeper(app.cdc, keys[staking.StoreKey], tkeys[staking.TStoreKey],
|
stakingKeeper := staking.NewKeeper(app.cdc, keys[staking.StoreKey],
|
||||||
app.supplyKeeper, stakingSubspace, staking.DefaultCodespace)
|
app.supplyKeeper, stakingSubspace, staking.DefaultCodespace)
|
||||||
app.mintKeeper = mint.NewKeeper(app.cdc, keys[mint.StoreKey], mintSubspace, &stakingKeeper, app.supplyKeeper, auth.FeeCollectorName)
|
app.mintKeeper = mint.NewKeeper(app.cdc, keys[mint.StoreKey], mintSubspace, &stakingKeeper, app.supplyKeeper, auth.FeeCollectorName)
|
||||||
app.distrKeeper = distr.NewKeeper(app.cdc, keys[distr.StoreKey], distrSubspace, &stakingKeeper,
|
app.distrKeeper = distr.NewKeeper(app.cdc, keys[distr.StoreKey], distrSubspace, &stakingKeeper,
|
||||||
@ -173,7 +171,7 @@ func NewEthermintApp(
|
|||||||
govRouter.AddRoute(gov.RouterKey, gov.ProposalHandler).
|
govRouter.AddRoute(gov.RouterKey, gov.ProposalHandler).
|
||||||
AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
|
AddRoute(params.RouterKey, params.NewParamChangeProposalHandler(app.paramsKeeper)).
|
||||||
AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper))
|
AddRoute(distr.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.distrKeeper))
|
||||||
app.govKeeper = gov.NewKeeper(app.cdc, keys[gov.StoreKey], app.paramsKeeper, govSubspace,
|
app.govKeeper = gov.NewKeeper(app.cdc, keys[gov.StoreKey], govSubspace,
|
||||||
app.supplyKeeper, &stakingKeeper, gov.DefaultCodespace, govRouter)
|
app.supplyKeeper, &stakingKeeper, gov.DefaultCodespace, govRouter)
|
||||||
|
|
||||||
// register the staking hooks
|
// register the staking hooks
|
||||||
@ -183,7 +181,6 @@ func NewEthermintApp(
|
|||||||
)
|
)
|
||||||
|
|
||||||
app.mm = module.NewManager(
|
app.mm = module.NewManager(
|
||||||
genaccounts.NewAppModule(app.accountKeeper),
|
|
||||||
genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx),
|
genutil.NewAppModule(app.accountKeeper, app.stakingKeeper, app.BaseApp.DeliverTx),
|
||||||
auth.NewAppModule(app.accountKeeper),
|
auth.NewAppModule(app.accountKeeper),
|
||||||
bank.NewAppModule(app.bankKeeper, app.accountKeeper),
|
bank.NewAppModule(app.bankKeeper, app.accountKeeper),
|
||||||
@ -193,7 +190,7 @@ func NewEthermintApp(
|
|||||||
gov.NewAppModule(app.govKeeper, app.supplyKeeper),
|
gov.NewAppModule(app.govKeeper, app.supplyKeeper),
|
||||||
mint.NewAppModule(app.mintKeeper),
|
mint.NewAppModule(app.mintKeeper),
|
||||||
slashing.NewAppModule(app.slashingKeeper, app.stakingKeeper),
|
slashing.NewAppModule(app.slashingKeeper, app.stakingKeeper),
|
||||||
staking.NewAppModule(app.stakingKeeper, app.distrKeeper, app.accountKeeper, app.supplyKeeper),
|
staking.NewAppModule(app.stakingKeeper, app.accountKeeper, app.supplyKeeper),
|
||||||
evm.NewAppModule(app.evmKeeper),
|
evm.NewAppModule(app.evmKeeper),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -207,7 +204,7 @@ func NewEthermintApp(
|
|||||||
// NOTE: The genutils module must occur after staking so that pools are
|
// NOTE: The genutils module must occur after staking so that pools are
|
||||||
// properly initialized with tokens from genesis accounts.
|
// properly initialized with tokens from genesis accounts.
|
||||||
app.mm.SetOrderInitGenesis(
|
app.mm.SetOrderInitGenesis(
|
||||||
genaccounts.ModuleName, distr.ModuleName, staking.ModuleName,
|
distr.ModuleName, staking.ModuleName,
|
||||||
auth.ModuleName, bank.ModuleName, slashing.ModuleName, gov.ModuleName,
|
auth.ModuleName, bank.ModuleName, slashing.ModuleName, gov.ModuleName,
|
||||||
mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName, evmtypes.ModuleName,
|
mint.ModuleName, supply.ModuleName, crisis.ModuleName, genutil.ModuleName, evmtypes.ModuleName,
|
||||||
)
|
)
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
"github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/mock"
|
||||||
"github.com/cosmos/cosmos-sdk/x/params"
|
"github.com/cosmos/cosmos-sdk/x/params"
|
||||||
|
|
||||||
"github.com/cosmos/ethermint/crypto"
|
"github.com/cosmos/ethermint/crypto"
|
||||||
@ -56,11 +57,6 @@ func newTestSetup() testSetup {
|
|||||||
paramsKeeper := params.NewKeeper(cdc, keyParams, tkeyParams, params.DefaultCodespace)
|
paramsKeeper := params.NewKeeper(cdc, keyParams, tkeyParams, params.DefaultCodespace)
|
||||||
authSubspace := paramsKeeper.Subspace(auth.DefaultParamspace)
|
authSubspace := paramsKeeper.Subspace(auth.DefaultParamspace)
|
||||||
|
|
||||||
// Add keepers
|
|
||||||
accKeeper := auth.NewAccountKeeper(cdc, authCapKey, authSubspace, auth.ProtoBaseAccount)
|
|
||||||
supplyKeeper := auth.NewDummySupplyKeeper(accKeeper)
|
|
||||||
anteHandler := NewAnteHandler(accKeeper, supplyKeeper)
|
|
||||||
|
|
||||||
ctx := sdk.NewContext(
|
ctx := sdk.NewContext(
|
||||||
ms,
|
ms,
|
||||||
abci.Header{ChainID: "3", Time: time.Now().UTC()},
|
abci.Header{ChainID: "3", Time: time.Now().UTC()},
|
||||||
@ -68,6 +64,12 @@ func newTestSetup() testSetup {
|
|||||||
log.NewNopLogger(),
|
log.NewNopLogger(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Add keepers
|
||||||
|
accKeeper := auth.NewAccountKeeper(cdc, authCapKey, authSubspace, auth.ProtoBaseAccount)
|
||||||
|
accKeeper.SetParams(ctx, types.DefaultParams())
|
||||||
|
supplyKeeper := mock.NewDummySupplyKeeper(accKeeper)
|
||||||
|
anteHandler := NewAnteHandler(accKeeper, supplyKeeper)
|
||||||
|
|
||||||
return testSetup{
|
return testSetup{
|
||||||
ctx: ctx,
|
ctx: ctx,
|
||||||
cdc: cdc,
|
cdc: cdc,
|
||||||
|
147
cmd/emintd/genaccounts.go
Normal file
147
cmd/emintd/genaccounts.go
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
|
"github.com/tendermint/tendermint/libs/cli"
|
||||||
|
|
||||||
|
"github.com/cosmos/cosmos-sdk/codec"
|
||||||
|
"github.com/cosmos/cosmos-sdk/server"
|
||||||
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||||
|
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
|
||||||
|
authvesting "github.com/cosmos/cosmos-sdk/x/auth/vesting"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/genutil"
|
||||||
|
"github.com/cosmos/ethermint/keys"
|
||||||
|
|
||||||
|
ethermint "github.com/cosmos/ethermint/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
flagClientHome = "home-client"
|
||||||
|
flagVestingStart = "vesting-start-time"
|
||||||
|
flagVestingEnd = "vesting-end-time"
|
||||||
|
flagVestingAmt = "vesting-amount"
|
||||||
|
)
|
||||||
|
|
||||||
|
// AddGenesisAccountCmd returns add-genesis-account cobra Command.
|
||||||
|
func AddGenesisAccountCmd(
|
||||||
|
ctx *server.Context, cdc *codec.Codec, defaultNodeHome, defaultClientHome string,
|
||||||
|
) *cobra.Command {
|
||||||
|
|
||||||
|
cmd := &cobra.Command{
|
||||||
|
Use: "add-genesis-account [address_or_key_name] [coin][,[coin]]",
|
||||||
|
Short: "Add a genesis account to genesis.json",
|
||||||
|
Long: `Add a genesis account to genesis.json. The provided account must specify
|
||||||
|
the account address or key name and a list of initial coins. If a key name is given,
|
||||||
|
the address will be looked up in the local Keybase. The list of initial tokens must
|
||||||
|
contain valid denominations. Accounts may optionally be supplied with vesting parameters.
|
||||||
|
`,
|
||||||
|
Args: cobra.ExactArgs(2),
|
||||||
|
RunE: func(_ *cobra.Command, args []string) error {
|
||||||
|
config := ctx.Config
|
||||||
|
config.SetRoot(viper.GetString(cli.HomeFlag))
|
||||||
|
|
||||||
|
addr, err := sdk.AccAddressFromBech32(args[0])
|
||||||
|
if err != nil {
|
||||||
|
// attempt to lookup address from Keybase if no address was provided
|
||||||
|
kb, err := keys.NewKeyBaseFromDir(viper.GetString(flagClientHome))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
info, err := kb.Get(args[0])
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get address from Keybase: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
addr = info.GetAddress()
|
||||||
|
}
|
||||||
|
|
||||||
|
coins, err := sdk.ParseCoins(args[1])
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to parse coins: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
vestingStart := viper.GetInt64(flagVestingStart)
|
||||||
|
vestingEnd := viper.GetInt64(flagVestingEnd)
|
||||||
|
vestingAmt, err := sdk.ParseCoins(viper.GetString(flagVestingAmt))
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to parse vesting amount: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// create concrete account type based on input parameters
|
||||||
|
var genAccount authexported.GenesisAccount
|
||||||
|
|
||||||
|
baseAcc := auth.NewBaseAccount(addr, coins.Sort(), nil, 0, 0)
|
||||||
|
if !vestingAmt.IsZero() {
|
||||||
|
baseVestingAccount, err := authvesting.NewBaseVestingAccount(baseAcc, vestingAmt.Sort(), vestingEnd)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to create base vesting account: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch {
|
||||||
|
case vestingStart != 0 && vestingEnd != 0:
|
||||||
|
genAccount = authvesting.NewContinuousVestingAccountRaw(baseVestingAccount, vestingStart)
|
||||||
|
|
||||||
|
case vestingEnd != 0:
|
||||||
|
genAccount = authvesting.NewDelayedVestingAccountRaw(baseVestingAccount)
|
||||||
|
|
||||||
|
default:
|
||||||
|
return errors.New("invalid vesting parameters; must supply start and end time or end time")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Genesis account is created with Ethermint account type
|
||||||
|
genAccount = ðermint.Account{BaseAccount: baseAcc}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := genAccount.Validate(); err != nil {
|
||||||
|
return fmt.Errorf("failed to validate new genesis account: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
genFile := config.GenesisFile()
|
||||||
|
appState, genDoc, err := genutil.GenesisStateFromGenFile(cdc, genFile)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to unmarshal genesis state: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
authGenState := auth.GetGenesisStateFromAppState(cdc, appState)
|
||||||
|
|
||||||
|
if authGenState.Accounts.Contains(addr) {
|
||||||
|
return fmt.Errorf("cannot add account at existing address %s", addr)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the new account to the set of genesis accounts and sanitize the
|
||||||
|
// accounts afterwards.
|
||||||
|
authGenState.Accounts = append(authGenState.Accounts, genAccount)
|
||||||
|
authGenState.Accounts = auth.SanitizeGenesisAccounts(authGenState.Accounts)
|
||||||
|
|
||||||
|
authGenStateBz, err := cdc.MarshalJSON(authGenState)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to marshal auth genesis state: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
appState[auth.ModuleName] = authGenStateBz
|
||||||
|
|
||||||
|
appStateJSON, err := cdc.MarshalJSON(appState)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to marshal application genesis state: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
genDoc.AppState = appStateJSON
|
||||||
|
return genutil.ExportGenesisFile(genDoc, genFile)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
cmd.Flags().String(cli.HomeFlag, defaultNodeHome, "node's home directory")
|
||||||
|
cmd.Flags().String(flagClientHome, defaultClientHome, "client's home directory")
|
||||||
|
cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts")
|
||||||
|
cmd.Flags().Uint64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts")
|
||||||
|
cmd.Flags().Uint64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts")
|
||||||
|
|
||||||
|
return cmd
|
||||||
|
}
|
@ -11,14 +11,16 @@ import (
|
|||||||
"github.com/cosmos/cosmos-sdk/server"
|
"github.com/cosmos/cosmos-sdk/server"
|
||||||
"github.com/cosmos/cosmos-sdk/store"
|
"github.com/cosmos/cosmos-sdk/store"
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/genaccounts"
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||||
genaccscli "github.com/cosmos/cosmos-sdk/x/genaccounts/client/cli"
|
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
|
||||||
|
genutil "github.com/cosmos/cosmos-sdk/x/genutil"
|
||||||
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli"
|
||||||
"github.com/cosmos/cosmos-sdk/x/staking"
|
"github.com/cosmos/cosmos-sdk/x/staking"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
|
"github.com/cosmos/ethermint/app"
|
||||||
emintapp "github.com/cosmos/ethermint/app"
|
emintapp "github.com/cosmos/ethermint/app"
|
||||||
|
|
||||||
abci "github.com/tendermint/tendermint/abci/types"
|
abci "github.com/tendermint/tendermint/abci/types"
|
||||||
@ -33,6 +35,9 @@ func main() {
|
|||||||
|
|
||||||
cdc := emintapp.MakeCodec()
|
cdc := emintapp.MakeCodec()
|
||||||
|
|
||||||
|
genutil.ModuleCdc = cdc
|
||||||
|
authtypes.ModuleCdc = cdc
|
||||||
|
|
||||||
config := sdk.GetConfig()
|
config := sdk.GetConfig()
|
||||||
// TODO: Remove or change prefix if usable to generate Ethereum address
|
// TODO: Remove or change prefix if usable to generate Ethereum address
|
||||||
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
|
config.SetBech32PrefixForAccount(sdk.Bech32PrefixAccAddr, sdk.Bech32PrefixAccPub)
|
||||||
@ -50,12 +55,14 @@ func main() {
|
|||||||
// CLI commands to initialize the chain
|
// CLI commands to initialize the chain
|
||||||
rootCmd.AddCommand(
|
rootCmd.AddCommand(
|
||||||
withChainIDValidation(genutilcli.InitCmd(ctx, cdc, emintapp.ModuleBasics, emintapp.DefaultNodeHome)),
|
withChainIDValidation(genutilcli.InitCmd(ctx, cdc, emintapp.ModuleBasics, emintapp.DefaultNodeHome)),
|
||||||
genutilcli.CollectGenTxsCmd(ctx, cdc, genaccounts.AppModuleBasic{}, emintapp.DefaultNodeHome),
|
genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, emintapp.DefaultNodeHome),
|
||||||
genutilcli.GenTxCmd(ctx, cdc, emintapp.ModuleBasics, staking.AppModuleBasic{}, genaccounts.AppModuleBasic{}, emintapp.DefaultNodeHome, emintapp.DefaultCLIHome),
|
genutilcli.GenTxCmd(
|
||||||
|
ctx, cdc, emintapp.ModuleBasics, staking.AppModuleBasic{}, auth.GenesisAccountIterator{}, emintapp.DefaultNodeHome, emintapp.DefaultCLIHome,
|
||||||
|
),
|
||||||
genutilcli.ValidateGenesisCmd(ctx, cdc, emintapp.ModuleBasics),
|
genutilcli.ValidateGenesisCmd(ctx, cdc, emintapp.ModuleBasics),
|
||||||
|
|
||||||
// AddGenesisAccountCmd allows users to add accounts to the genesis file
|
// AddGenesisAccountCmd allows users to add accounts to the genesis file
|
||||||
genaccscli.AddGenesisAccountCmd(ctx, cdc, emintapp.DefaultNodeHome, emintapp.DefaultCLIHome),
|
AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome),
|
||||||
)
|
)
|
||||||
|
|
||||||
// Tendermint node base commands
|
// Tendermint node base commands
|
||||||
|
16
go.mod
16
go.mod
@ -7,7 +7,7 @@ require (
|
|||||||
github.com/aristanetworks/goarista v0.0.0-20181101003910-5bb443fba8e0 // indirect
|
github.com/aristanetworks/goarista v0.0.0-20181101003910-5bb443fba8e0 // indirect
|
||||||
github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8 // indirect
|
github.com/btcsuite/btcd v0.0.0-20190629003639-c26ffa870fd8 // indirect
|
||||||
github.com/cespare/cp v1.1.1 // indirect
|
github.com/cespare/cp v1.1.1 // indirect
|
||||||
github.com/cosmos/cosmos-sdk v0.37.3
|
github.com/cosmos/cosmos-sdk v0.34.4-0.20191031200835-02c6c9fafd58
|
||||||
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d
|
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d
|
||||||
github.com/deckarep/golang-set v1.7.1 // indirect
|
github.com/deckarep/golang-set v1.7.1 // indirect
|
||||||
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect
|
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 // indirect
|
||||||
@ -15,40 +15,34 @@ require (
|
|||||||
github.com/ethereum/go-ethereum v1.9.0
|
github.com/ethereum/go-ethereum v1.9.0
|
||||||
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
|
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
|
||||||
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
|
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect
|
||||||
github.com/gogo/protobuf v1.3.1 // indirect
|
|
||||||
github.com/golang/mock v1.3.1 // indirect
|
github.com/golang/mock v1.3.1 // indirect
|
||||||
github.com/google/uuid v1.0.0 // indirect
|
github.com/google/uuid v1.0.0 // indirect
|
||||||
github.com/gorilla/mux v1.7.0
|
github.com/gorilla/mux v1.7.3
|
||||||
github.com/hashicorp/golang-lru v0.5.0 // indirect
|
|
||||||
github.com/huin/goupnp v1.0.0 // indirect
|
github.com/huin/goupnp v1.0.0 // indirect
|
||||||
github.com/jackpal/go-nat-pmp v1.0.1 // indirect
|
github.com/jackpal/go-nat-pmp v1.0.1 // indirect
|
||||||
github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0 // indirect
|
github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0 // indirect
|
||||||
github.com/mattn/go-colorable v0.1.4 // indirect
|
github.com/mattn/go-colorable v0.1.4 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.10 // indirect
|
|
||||||
github.com/mattn/go-runewidth v0.0.4 // indirect
|
github.com/mattn/go-runewidth v0.0.4 // indirect
|
||||||
github.com/olekukonko/tablewriter v0.0.1 // indirect
|
github.com/olekukonko/tablewriter v0.0.1 // indirect
|
||||||
github.com/onsi/ginkgo v1.10.1 // indirect
|
github.com/onsi/ginkgo v1.10.1 // indirect
|
||||||
github.com/onsi/gomega v1.7.0 // indirect
|
github.com/onsi/gomega v1.7.0 // indirect
|
||||||
github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709 // indirect
|
github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709 // indirect
|
||||||
github.com/pelletier/go-toml v1.5.0 // indirect
|
|
||||||
github.com/pkg/errors v0.8.1
|
github.com/pkg/errors v0.8.1
|
||||||
github.com/prometheus/common v0.6.0 // indirect
|
github.com/prometheus/common v0.6.0 // indirect
|
||||||
github.com/prometheus/procfs v0.0.3 // indirect
|
github.com/prometheus/procfs v0.0.3 // indirect
|
||||||
github.com/prometheus/tsdb v0.9.1 // indirect
|
github.com/prometheus/tsdb v0.9.1 // indirect
|
||||||
github.com/rakyll/statik v0.1.6 // indirect
|
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 // indirect
|
github.com/rcrowley/go-metrics v0.0.0-20190706150252-9beb055b7962 // indirect
|
||||||
github.com/rjeczalik/notify v0.9.2 // indirect
|
github.com/rjeczalik/notify v0.9.2 // indirect
|
||||||
github.com/spf13/afero v1.2.2 // indirect
|
github.com/spf13/afero v1.2.2 // indirect
|
||||||
github.com/spf13/cobra v0.0.5
|
github.com/spf13/cobra v0.0.5
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
|
||||||
github.com/spf13/viper v1.4.0
|
github.com/spf13/viper v1.4.0
|
||||||
github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 // indirect
|
github.com/status-im/keycard-go v0.0.0-20190424133014-d95853db0f48 // indirect
|
||||||
github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 // indirect
|
github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 // indirect
|
||||||
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 // indirect
|
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 // indirect
|
||||||
github.com/stretchr/testify v1.4.0
|
github.com/stretchr/testify v1.4.0
|
||||||
github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5
|
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
|
||||||
github.com/tendermint/go-amino v0.15.0
|
github.com/tendermint/go-amino v0.15.1
|
||||||
github.com/tendermint/tendermint v0.32.6
|
github.com/tendermint/tendermint v0.32.7
|
||||||
github.com/tendermint/tm-db v0.2.0
|
github.com/tendermint/tm-db v0.2.0
|
||||||
github.com/tyler-smith/go-bip39 v1.0.0 // indirect
|
github.com/tyler-smith/go-bip39 v1.0.0 // indirect
|
||||||
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 // indirect
|
github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208 // indirect
|
||||||
|
51
go.sum
51
go.sum
@ -1,4 +1,6 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||||
|
github.com/99designs/keyring v1.1.3 h1:mEV3iyZWjkxQ7R8ia8GcG97vCX5zQQ7n4o8R2BylwQY=
|
||||||
|
github.com/99designs/keyring v1.1.3/go.mod h1:657DQuMrBZRtuL/voxVyiyb6zpMehlm5vLB9Qwrv904=
|
||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||||
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
|
||||||
@ -46,17 +48,19 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz
|
|||||||
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
||||||
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
|
||||||
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
|
||||||
github.com/cosmos/cosmos-sdk v0.37.3 h1:v4IQIPq3zFB95ibAS7zqsnkZ/8SE3er16Og45EGHggo=
|
github.com/cosmos/cosmos-sdk v0.34.4-0.20191031200835-02c6c9fafd58 h1:B3fXc6Y9ztj9glE2ANU0+NQJ0M1BXaG5LpnyKFwHW4M=
|
||||||
github.com/cosmos/cosmos-sdk v0.37.3/go.mod h1:dAwYeOJ5ybRZg/OdRfiDy8q/cZq/GXQp9ZHAtz0E74I=
|
github.com/cosmos/cosmos-sdk v0.34.4-0.20191031200835-02c6c9fafd58/go.mod h1:PuN72vbZxlorpnHmoIl6RjzVMXEOMejmwORJlZ74K7Q=
|
||||||
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI=
|
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 h1:Iwin12wRQtyZhH6FV3ykFcdGNlYEzoeR0jN8Vn+JWsI=
|
||||||
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
|
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
|
||||||
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU=
|
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU=
|
||||||
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
|
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
|
||||||
github.com/cosmos/ledger-cosmos-go v0.10.3 h1:Qhi5yTR5Pg1CaTpd00pxlGwNl4sFRdtK1J96OTjeFFc=
|
github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4=
|
||||||
github.com/cosmos/ledger-cosmos-go v0.10.3/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY=
|
github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY=
|
||||||
github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI=
|
github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI=
|
||||||
github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
|
github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI=
|
||||||
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||||
|
github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU=
|
||||||
|
github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U=
|
||||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
@ -65,6 +69,8 @@ github.com/deckarep/golang-set v1.7.1 h1:SCQV0S6gTtp6itiFrTqI+pfmJ4LN85S1YzhDf9r
|
|||||||
github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
|
github.com/deckarep/golang-set v1.7.1/go.mod h1:93vsz/8Wt4joVM7c2AVqh+YRMiUSc14yDtF28KmMOgQ=
|
||||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||||
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
|
||||||
|
github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a h1:mq+R6XEM6lJX5VlLyZIrUSP8tSuJp82xTK89hvBwJbU=
|
||||||
|
github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM=
|
||||||
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 h1:aaQcKT9WumO6JEJcRyTqFVq4XUZiUcKR2/GI31TOcz8=
|
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712 h1:aaQcKT9WumO6JEJcRyTqFVq4XUZiUcKR2/GI31TOcz8=
|
||||||
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
github.com/edsrzf/mmap-go v0.0.0-20170320065105-0bce6a688712/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M=
|
||||||
github.com/elastic/gosigar v0.10.3 h1:xA7TJmJgaVgqEnQpYAijMI4J9V1ZM2a9z8+5gAc5FMs=
|
github.com/elastic/gosigar v0.10.3 h1:xA7TJmJgaVgqEnQpYAijMI4J9V1ZM2a9z8+5gAc5FMs=
|
||||||
@ -103,6 +109,8 @@ github.com/go-logfmt/logfmt v0.4.0 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80n
|
|||||||
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
|
||||||
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
|
||||||
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
|
||||||
|
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
|
||||||
|
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4=
|
||||||
github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo=
|
github.com/gogo/protobuf v1.1.1 h1:72R+M5VuhED/KujmZVcIquuo8mBgX4oVda//DQb3PXo=
|
||||||
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
|
||||||
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
|
github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE=
|
||||||
@ -136,8 +144,8 @@ github.com/google/gofuzz v1.0.0 h1:A8PeW59pxE9IoFRqBp37U+mSNaQoZ46F1f0f863XSXw=
|
|||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
|
github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA=
|
||||||
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
github.com/gorilla/mux v1.7.0 h1:tOSd0UKHQd6urX6ApfOn4XdBMY6Sh1MfxV3kmaazO+U=
|
github.com/gorilla/mux v1.7.3 h1:gnP5JzjVOuiZD07fKKToCAOjS0yOpj/qPETTXCCS6hw=
|
||||||
github.com/gorilla/mux v1.7.0/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
|
||||||
github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ=
|
github.com/gorilla/websocket v1.2.0 h1:VJtLvh6VQym50czpZzx07z/kw9EgAxI3x1ZB8taTMQQ=
|
||||||
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
github.com/gorilla/websocket v1.2.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||||
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||||
@ -147,8 +155,10 @@ github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
|
|||||||
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
|
||||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
|
||||||
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||||
github.com/hashicorp/golang-lru v0.5.0 h1:CL2msUPvZTLb5O648aiLNJw3hnBxN2+1Jq8rCOH9wdo=
|
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
|
||||||
github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||||
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||||
@ -169,6 +179,8 @@ github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCV
|
|||||||
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
|
||||||
github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0 h1:S8kWZLXHpcOq3nGAvIs0oDgd4CXxkxE3hkDVRjTu7ro=
|
github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0 h1:S8kWZLXHpcOq3nGAvIs0oDgd4CXxkxE3hkDVRjTu7ro=
|
||||||
github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
|
github.com/karalabe/usb v0.0.0-20190703133951-9be757f914c0/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
|
||||||
|
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM=
|
||||||
|
github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc=
|
||||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
||||||
github.com/kisielk/errcheck v1.2.0 h1:reN85Pxc5larApoH1keMBiu2GWtPqXQ1nc9gx+jOU+E=
|
github.com/kisielk/errcheck v1.2.0 h1:reN85Pxc5larApoH1keMBiu2GWtPqXQ1nc9gx+jOU+E=
|
||||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
||||||
@ -192,7 +204,6 @@ github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzR
|
|||||||
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
|
||||||
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
||||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||||
github.com/mattn/go-isatty v0.0.6/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
|
||||||
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
|
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
|
||||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||||
github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10=
|
github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10=
|
||||||
@ -222,8 +233,8 @@ github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709 h1:zNBQb37RGLmJybyMcs
|
|||||||
github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
|
github.com/pborman/uuid v0.0.0-20180906182336-adf5a7427709/go.mod h1:VyrYX9gd7irzKovcSS6BIIEwPRkP2Wm2m9ufcdFSJ34=
|
||||||
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
github.com/pelletier/go-toml v1.2.0 h1:T5zMGML61Wp+FlcbWjRDT7yAxhJNAiPPLOFECq181zc=
|
||||||
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
|
||||||
github.com/pelletier/go-toml v1.5.0 h1:5BakdOZdtKJ1FFk6QdL8iSGrMWsXgchNJcrnarjbmJQ=
|
github.com/pelletier/go-toml v1.6.0 h1:aetoXYr0Tv7xRU/V4B4IZJ2QcbtMUFoNb3ORp7TzIK4=
|
||||||
github.com/pelletier/go-toml v1.5.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
|
github.com/pelletier/go-toml v1.6.0/go.mod h1:5N711Q9dKgbdkxHL+MEfF31hpT7l0S0s/t2kKREewys=
|
||||||
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
github.com/pkg/errors v0.8.0 h1:WdK/asTD0HN+q6hsWO3/vpuAkAr+tw6aNJNDFFf0+qw=
|
||||||
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||||
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||||
@ -254,7 +265,6 @@ github.com/prometheus/procfs v0.0.3/go.mod h1:4A/X28fw3Fc593LaREMrKMqOKvUAntwMDa
|
|||||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||||
github.com/prometheus/tsdb v0.9.1 h1:IWaAmWkYlgG7/S4iw4IpAQt5Y35QaZM6/GsZ7GsjAuk=
|
github.com/prometheus/tsdb v0.9.1 h1:IWaAmWkYlgG7/S4iw4IpAQt5Y35QaZM6/GsZ7GsjAuk=
|
||||||
github.com/prometheus/tsdb v0.9.1/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4=
|
github.com/prometheus/tsdb v0.9.1/go.mod h1:oi49uRhEe9dPUTlS3JRZOwJuVi6tmh10QSgwXEyGCt4=
|
||||||
github.com/rakyll/statik v0.1.5/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs=
|
|
||||||
github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs=
|
github.com/rakyll/statik v0.1.6 h1:uICcfUXpgqtw2VopbIncslhAmE5hwc4g20TEyEENBNs=
|
||||||
github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs=
|
github.com/rakyll/statik v0.1.6/go.mod h1:OEi9wJV/fMUAGx1eNjq75DKDsJVuEv1U0oYdX6GX8Zs=
|
||||||
github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk=
|
github.com/rcrowley/go-metrics v0.0.0-20180503174638-e2704e165165 h1:nkcn14uNmFEuGCb2mBZbBb24RdNRL08b/wb+xBOYpuk=
|
||||||
@ -308,6 +318,8 @@ github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3 h1:njlZPzLwU639
|
|||||||
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU=
|
github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3/go.mod h1:hpGUWaI9xL8pRQCTXQgocU38Qw1g0Us7n5PxxTwTCYU=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
|
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
|
||||||
|
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||||
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||||
@ -320,17 +332,17 @@ github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965 h1:1oFLiOyVl+W7
|
|||||||
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
|
github.com/syndtr/goleveldb v1.0.1-0.20190318030020-c3a204f8e965/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA=
|
||||||
github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s=
|
github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s=
|
||||||
github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U=
|
github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U=
|
||||||
github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5 h1:u8i49c+BxloX3XQ55cvzFNXplizZP/q00i+IlttUjAU=
|
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI=
|
||||||
github.com/tendermint/crypto v0.0.0-20180820045704-3764759f34a5/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk=
|
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk=
|
||||||
github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6offJMk=
|
github.com/tendermint/go-amino v0.14.1 h1:o2WudxNfdLNBwMyl2dqOJxiro5rfrEaU0Ugs6offJMk=
|
||||||
github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso=
|
github.com/tendermint/go-amino v0.14.1/go.mod h1:i/UKE5Uocn+argJJBb12qTZsCDBcAYMbR92AaJVmKso=
|
||||||
github.com/tendermint/go-amino v0.15.0 h1:TC4e66P59W7ML9+bxio17CPKnxW3nKIRAYskntMAoRk=
|
github.com/tendermint/go-amino v0.15.1 h1:D2uk35eT4iTsvJd9jWIetzthE5C0/k2QmMFkCN+4JgQ=
|
||||||
github.com/tendermint/go-amino v0.15.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME=
|
github.com/tendermint/go-amino v0.15.1/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME=
|
||||||
github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8=
|
github.com/tendermint/iavl v0.12.4 h1:hd1woxUGISKkfUWBA4mmmTwOua6PQZTJM/F0FDrmMV8=
|
||||||
github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o=
|
github.com/tendermint/iavl v0.12.4/go.mod h1:8LHakzt8/0G3/I8FUU0ReNx98S/EP6eyPJkAUvEXT/o=
|
||||||
github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU=
|
github.com/tendermint/tendermint v0.32.1/go.mod h1:jmPDAKuNkev9793/ivn/fTBnfpA9mGBww8MPRNPNxnU=
|
||||||
github.com/tendermint/tendermint v0.32.6 h1:HozXi0USWvKrWuEh5ratnJV10ykkTy4nwXUi0UvPVzg=
|
github.com/tendermint/tendermint v0.32.7 h1:Szu5Fm1L3pvn3t4uQxPAcP+7ndZEQKgLie/yokM56rU=
|
||||||
github.com/tendermint/tendermint v0.32.6/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE=
|
github.com/tendermint/tendermint v0.32.7/go.mod h1:D2+A3pNjY+Po72X0mTfaXorFhiVI8dh/Zg640FGyGtE=
|
||||||
github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0=
|
github.com/tendermint/tm-db v0.1.1 h1:G3Xezy3sOk9+ekhjZ/kjArYIs1SmwV+1OUgNkj7RgV0=
|
||||||
github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw=
|
github.com/tendermint/tm-db v0.1.1/go.mod h1:0cPKWu2Mou3IlxecH+MEUSYc1Ch537alLe6CpFrKzgw=
|
||||||
github.com/tendermint/tm-db v0.2.0 h1:rJxgdqn6fIiVJZy4zLpY1qVlyD0TU6vhkT4kEf71TQQ=
|
github.com/tendermint/tm-db v0.2.0 h1:rJxgdqn6fIiVJZy4zLpY1qVlyD0TU6vhkT4kEf71TQQ=
|
||||||
@ -360,6 +372,7 @@ golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnf
|
|||||||
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190228161510-8dd112bcdc25/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392 h1:ACG4HJsFiNMf47Y4PeRoebLNy/2lXT9EtprMuTFWt1M=
|
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392 h1:ACG4HJsFiNMf47Y4PeRoebLNy/2lXT9EtprMuTFWt1M=
|
||||||
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
|
golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
@ -399,6 +412,8 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h
|
|||||||
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 h1:rOhMmluY6kLMhdnrivzec6lLgaVbMHMn2ISQXJeJ5EM=
|
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69 h1:rOhMmluY6kLMhdnrivzec6lLgaVbMHMn2ISQXJeJ5EM=
|
||||||
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||||
|
@ -5,11 +5,13 @@ import (
|
|||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
"github.com/cosmos/cosmos-sdk/x/auth"
|
"github.com/cosmos/cosmos-sdk/x/auth"
|
||||||
|
"github.com/cosmos/cosmos-sdk/x/auth/exported"
|
||||||
|
|
||||||
ethcmn "github.com/ethereum/go-ethereum/common"
|
ethcmn "github.com/ethereum/go-ethereum/common"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ auth.Account = (*Account)(nil)
|
var _ exported.Account = (*Account)(nil)
|
||||||
|
var _ exported.GenesisAccount = (*Account)(nil)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// DenomDefault defines the single coin type/denomination supported in
|
// DenomDefault defines the single coin type/denomination supported in
|
||||||
@ -36,7 +38,7 @@ type Account struct {
|
|||||||
|
|
||||||
// ProtoBaseAccount defines the prototype function for BaseAccount used for an
|
// ProtoBaseAccount defines the prototype function for BaseAccount used for an
|
||||||
// account mapper.
|
// account mapper.
|
||||||
func ProtoBaseAccount() auth.Account {
|
func ProtoBaseAccount() exported.Account {
|
||||||
return &Account{BaseAccount: &auth.BaseAccount{}}
|
return &Account{BaseAccount: &auth.BaseAccount{}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import (
|
|||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
sdk "github.com/cosmos/cosmos-sdk/types"
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
||||||
auth "github.com/cosmos/cosmos-sdk/x/auth"
|
authexported "github.com/cosmos/cosmos-sdk/x/auth/exported"
|
||||||
|
|
||||||
"github.com/cosmos/ethermint/types"
|
"github.com/cosmos/ethermint/types"
|
||||||
ethcmn "github.com/ethereum/go-ethereum/common"
|
ethcmn "github.com/ethereum/go-ethereum/common"
|
||||||
@ -77,15 +77,10 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func newObject(db *CommitStateDB, accProto auth.Account) *stateObject {
|
func newObject(db *CommitStateDB, accProto authexported.Account) *stateObject {
|
||||||
acc, ok := accProto.(*types.Account)
|
acc, ok := accProto.(*types.Account)
|
||||||
if !ok {
|
if !ok {
|
||||||
// State object can be created from a baseAccount
|
panic(fmt.Sprintf("invalid account type for state object: %T", accProto))
|
||||||
baseAccount, ok := accProto.(*auth.BaseAccount)
|
|
||||||
if !ok {
|
|
||||||
panic(fmt.Sprintf("invalid account type for state object: %T", accProto))
|
|
||||||
}
|
|
||||||
acc = &types.Account{BaseAccount: baseAccount}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if acc.CodeHash == nil {
|
if acc.CodeHash == nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user