laconicd/types/errors.go
Austin Abell 1b5c33cf33
EVM Transaction handler and contract creation (#96)
* WIP implementing state transition function

* Error handling and application setup fix

* Fixed error comment

* Allow creation of state objects with a BaseAccount

* Fixed parameters and finalise state after transaction

* updated transaction signing and cli signature

* Set up consistent account encoding and decoding

* Update txbuilder to get sequence before generating eth tx

* Added create functionality to the CLI command

* Remove need to copy over context for statedb interactions

* Updated account retriever

* Cleaned up handler code and updated TODO

* Make recoverEthSig private again

* Add error check for committing to kv store

* Remove commented out code

* Update evm chain config for state transition

* Add time in context for dapps
2019-09-18 09:51:18 -04:00

61 lines
1.9 KiB
Go

package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
// Ethermint error codes
const (
// DefaultCodespace reserves a Codespace for Ethermint.
DefaultCodespace sdk.CodespaceType = "ethermint"
CodeInvalidValue sdk.CodeType = 1
CodeInvalidChainID sdk.CodeType = 2
CodeInvalidSender sdk.CodeType = 3
CodeVMExecution sdk.CodeType = 4
CodeInvalidIntrinsicGas sdk.CodeType = 5
)
// CodeToDefaultMsg takes the CodeType variable and returns the error string
func CodeToDefaultMsg(code sdk.CodeType) string {
switch code {
case CodeInvalidValue:
return "invalid value"
case CodeInvalidChainID:
return "invalid chain ID"
case CodeInvalidSender:
return "could not derive sender from transaction"
case CodeVMExecution:
return "error while executing evm transaction"
case CodeInvalidIntrinsicGas:
return "invalid intrinsic gas"
default:
return sdk.CodeToDefaultMsg(code)
}
}
// ErrInvalidValue returns a standardized SDK error resulting from an invalid value.
func ErrInvalidValue(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeInvalidValue, msg)
}
// ErrInvalidChainID returns a standardized SDK error resulting from an invalid chain ID.
func ErrInvalidChainID(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeInvalidChainID, msg)
}
// ErrInvalidSender returns a standardized SDK error resulting from an invalid transaction sender.
func ErrInvalidSender(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeInvalidSender, msg)
}
// ErrVMExecution returns a standardized SDK error resulting from an error in EVM execution.
func ErrVMExecution(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeVMExecution, msg)
}
// ErrVMExecution returns a standardized SDK error resulting from an error in EVM execution.
func ErrInvalidIntrinsicGas(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeInvalidIntrinsicGas, msg)
}