Skip to content

Commit 36a46c3

Browse files
authored
fix receipt error code out-of-date (#271)
1 parent c4c094b commit 36a46c3

File tree

1 file changed

+79
-57
lines changed

1 file changed

+79
-57
lines changed

v3/types/receipt.go

Lines changed: 79 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -26,33 +26,41 @@ type Receipt struct {
2626
}
2727

2828
const (
29-
Success = iota
30-
Unknown
31-
BadRLP
32-
InvalidFormat
33-
OutOfGasIntrinsic
34-
InvalidSignature
35-
InvalidNonce
36-
NotEnoughCash
37-
OutOfGasBase
38-
BlockGasLimitReached
39-
BadInstruction
40-
BadJumpDestination
41-
OutOfGas
42-
OutOfStack
43-
StackUnderflow
44-
NonceCheckFail
45-
BlockLimitCheckFail
46-
FilterCheckFail
47-
NoDeployPermission
48-
NoCallPermission
49-
NoTxPermission
50-
PrecompiledError
51-
RevertInstruction
52-
InvalidZeroSignatureFormat
53-
AddressAlreadyUsed
54-
PermissionDenied
55-
CallAddressError
29+
Success = iota
30+
Unknown = 1
31+
OutOfGasLimit = 2 ///< Too little gas to pay for the base transaction cost.
32+
NotEnoughCash = 7
33+
BadInstruction = 10
34+
BadJumpDestination = 11
35+
OutOfGas = 12 ///< Ran out of gas executing code of the transaction.
36+
OutOfStack = 13 ///< Ran out of stack executing code of the transaction.
37+
StackUnderflow = 14
38+
PrecompiledError = 15
39+
RevertInstruction = 16
40+
ContractAddressAlreadyUsed = 17
41+
PermissionDenied = 18
42+
CallAddressError = 19
43+
GasOverflow = 20
44+
ContractFrozen = 21
45+
AccountFrozen = 22
46+
AccountAbolished = 23
47+
ContractAbolished = 24
48+
WASMValidationFailure = 32
49+
WASMArgumentOutOfRange = 33
50+
WASMUnreachableInstruction = 34
51+
WASMTrap = 35
52+
NonceCheckFail = 10000 /// txPool related errors
53+
BlockLimitCheckFail = 10001
54+
TxPoolIsFull = 10002
55+
Malformed = 10003
56+
AlreadyInTxPool = 10004
57+
TxAlreadyInChain = 10005
58+
InvalidChainId = 10006
59+
InvalidGroupId = 10007
60+
InvalidSignature = 10008
61+
RequestNotBelongToTheGroup = 10009
62+
TransactionPoolTimeout = 10010
63+
AlreadyInTxPoolAndAccept = 10011
5664
)
5765

5866
// GetStatusMessage returns the status message
@@ -63,22 +71,8 @@ func getStatusMessage(status int) string {
6371
message = "success"
6472
case Unknown:
6573
message = "unknown"
66-
case BadRLP:
67-
message = "bad RLP"
68-
case InvalidFormat:
69-
message = "invalid format"
70-
case OutOfGasIntrinsic:
71-
message = "out of gas intrinsic"
72-
case InvalidSignature:
73-
message = "invalid signature"
74-
case InvalidNonce:
75-
message = "invalid nonce"
7674
case NotEnoughCash:
7775
message = "not enough cash"
78-
case OutOfGasBase:
79-
message = "out of gas base"
80-
case BlockGasLimitReached:
81-
message = "block gas limit reached"
8276
case BadInstruction:
8377
message = "bad instruction"
8478
case BadJumpDestination:
@@ -89,30 +83,58 @@ func getStatusMessage(status int) string {
8983
message = "out of stack"
9084
case StackUnderflow:
9185
message = "stack underflow"
92-
case NonceCheckFail:
93-
message = "nonce check fail"
94-
case BlockLimitCheckFail:
95-
message = "block limit check fail"
96-
case FilterCheckFail:
97-
message = "filter check fail"
98-
case NoDeployPermission:
99-
message = "no deploy permission"
100-
case NoCallPermission:
101-
message = "no call permission"
102-
case NoTxPermission:
103-
message = "no tx permission"
10486
case PrecompiledError:
10587
message = "precompiled error"
10688
case RevertInstruction:
10789
message = "revert instruction"
108-
case InvalidZeroSignatureFormat:
109-
message = "invalid zero signature format"
110-
case AddressAlreadyUsed:
111-
message = "address already used"
90+
case ContractAddressAlreadyUsed:
91+
message = "contract address already used"
11292
case PermissionDenied:
11393
message = "permission denied"
11494
case CallAddressError:
11595
message = "call address error"
96+
case GasOverflow:
97+
message = "gas overflow"
98+
case ContractFrozen:
99+
message = "contract frozen"
100+
case AccountFrozen:
101+
message = "account frozen"
102+
case AccountAbolished:
103+
message = "account abolished"
104+
case ContractAbolished:
105+
message = "contract abolished"
106+
case WASMValidationFailure:
107+
message = "WASM validation failure"
108+
case WASMArgumentOutOfRange:
109+
message = "WASM argument out of range"
110+
case WASMUnreachableInstruction:
111+
message = "WASM unreachable instruction"
112+
case WASMTrap:
113+
message = "WASM trap"
114+
case NonceCheckFail:
115+
message = "nonce check fail"
116+
case BlockLimitCheckFail:
117+
message = "block limit check fail"
118+
case TxPoolIsFull:
119+
message = "tx pool is full"
120+
case Malformed:
121+
message = "malformed"
122+
case AlreadyInTxPool:
123+
message = "already in tx pool"
124+
case TxAlreadyInChain:
125+
message = "tx already in chain"
126+
case InvalidChainId:
127+
message = "invalid chain id"
128+
case InvalidGroupId:
129+
message = "invalid group id"
130+
case InvalidSignature:
131+
message = "invalid signature"
132+
case RequestNotBelongToTheGroup:
133+
message = "request not belong to the group"
134+
case TransactionPoolTimeout:
135+
message = "transaction pool timeout"
136+
case AlreadyInTxPoolAndAccept:
137+
message = "already in tx pool and accept"
116138
default:
117139
message = strconv.Itoa(status)
118140
}

0 commit comments

Comments
 (0)