R4R: CheckTx AnteHandler for Ethereum Tx Messages (#505)

* Rename Ethereum tx message
* Use new tx decoder in the ethermint app
* Update ante handler to prevent spam/dos
* Update ethereum msg signing/verification logic
* Implement secp256k1 key types
* Remove pointer from To method
* Move sig check to after inartistic gas check
* Add comment on chainID parsing
* Updated validateIntrinsicGas godoc
* Implement Fee method on eth tx msg
* Add reference to spec for recoverEthSig
* Upgrade TM to v0.27.0
This commit is contained in:
Alexander Bezobchuk
2018-12-18 11:10:04 -05:00
committed by GitHub
parent a3619584f8
commit b821a85a64
20 changed files with 871 additions and 327 deletions
+8 -8
View File
@@ -9,16 +9,16 @@ const (
// DefaultCodespace reserves a Codespace for Ethermint.
DefaultCodespace sdk.CodespaceType = "ethermint"
CodeInvalidValue sdk.CodeType = 1
CodeInvalidAccountNumber sdk.CodeType = 2
CodeInvalidValue sdk.CodeType = 1
CodeInvalidChainID sdk.CodeType = 2
)
func codeToDefaultMsg(code sdk.CodeType) string {
switch code {
case CodeInvalidValue:
return "invalid value"
case CodeInvalidAccountNumber:
return "invalid account number"
case CodeInvalidChainID:
return "invalid chain ID"
default:
return sdk.CodeToDefaultMsg(code)
}
@@ -30,8 +30,8 @@ func ErrInvalidValue(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeInvalidValue, msg)
}
// ErrInvalidAccountNumber returns a standardized SDK error resulting from an
// invalid account number.
func ErrInvalidAccountNumber(msg string) sdk.Error {
return sdk.NewError(DefaultCodespace, CodeInvalidAccountNumber, 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)
}