Add testutil; Clean gov return codes

This commit is contained in:
Jae Kwon 2016-03-15 11:36:05 -07:00
parent 61c34ade0d
commit 29a6d511b4
3 changed files with 86 additions and 69 deletions

17
testutil/messages.go Normal file
View File

@ -0,0 +1,17 @@
package testutil
import (
"github.com/tendermint/go-crypto"
"github.com/tendermint/tmsp/types"
)
//----------------------------------------
// UTILITY
func Validator(secret string, power uint64) *types.Validator {
privKey := crypto.GenPrivKeyEd25519FromSecret([]byte(secret))
return &types.Validator{
PubKey: privKey.PubKey().Bytes(),
Power: power,
}
}

View File

@ -97,13 +97,13 @@ const (
// Reserved for governance, 200 ~ 299 // Reserved for governance, 200 ~ 299
CodeType_GovUnknownEntity CodeType = 201 CodeType_GovUnknownEntity CodeType = 201
CodeType_GovUnknownGroup CodeType = 202 CodeType_GovUnknownGroup CodeType = 202
CodeType_GovUnknownMember CodeType = 203 CodeType_GovUnknownProposal CodeType = 203
CodeType_GovUnknownProposal CodeType = 204 CodeType_GovDuplicateGroup CodeType = 204
CodeType_GovDuplicateEntity CodeType = 205 CodeType_GovDuplicateMember CodeType = 205
CodeType_GovDuplicateGroup CodeType = 206 CodeType_GovDuplicateProposal CodeType = 206
CodeType_GovDuplicateMember CodeType = 207 CodeType_GovDuplicateVote CodeType = 207
CodeType_GovDuplicateProposal CodeType = 208 CodeType_GovInvalidMember CodeType = 208
CodeType_GovDuplicateVote CodeType = 209 CodeType_GovInvalidVote CodeType = 209
CodeType_GovInvalidVotingPower CodeType = 210 CodeType_GovInvalidVotingPower CodeType = 210
) )
@ -123,13 +123,13 @@ var CodeType_name = map[int32]string{
106: "BaseInsufficientFees", 106: "BaseInsufficientFees",
201: "GovUnknownEntity", 201: "GovUnknownEntity",
202: "GovUnknownGroup", 202: "GovUnknownGroup",
203: "GovUnknownMember", 203: "GovUnknownProposal",
204: "GovUnknownProposal", 204: "GovDuplicateGroup",
205: "GovDuplicateEntity", 205: "GovDuplicateMember",
206: "GovDuplicateGroup", 206: "GovDuplicateProposal",
207: "GovDuplicateMember", 207: "GovDuplicateVote",
208: "GovDuplicateProposal", 208: "GovInvalidMember",
209: "GovDuplicateVote", 209: "GovInvalidVote",
210: "GovInvalidVotingPower", 210: "GovInvalidVotingPower",
} }
var CodeType_value = map[string]int32{ var CodeType_value = map[string]int32{
@ -148,13 +148,13 @@ var CodeType_value = map[string]int32{
"BaseInsufficientFees": 106, "BaseInsufficientFees": 106,
"GovUnknownEntity": 201, "GovUnknownEntity": 201,
"GovUnknownGroup": 202, "GovUnknownGroup": 202,
"GovUnknownMember": 203, "GovUnknownProposal": 203,
"GovUnknownProposal": 204, "GovDuplicateGroup": 204,
"GovDuplicateEntity": 205, "GovDuplicateMember": 205,
"GovDuplicateGroup": 206, "GovDuplicateProposal": 206,
"GovDuplicateMember": 207, "GovDuplicateVote": 207,
"GovDuplicateProposal": 208, "GovInvalidMember": 208,
"GovDuplicateVote": 209, "GovInvalidVote": 209,
"GovInvalidVotingPower": 210, "GovInvalidVotingPower": 210,
} }
@ -224,46 +224,46 @@ func init() {
} }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 649 bytes of a gzipped FileDescriptorProto // 652 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0xcb, 0x52, 0xdb, 0x4a, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0xcb, 0x52, 0xdb, 0x4a,
0x10, 0xbd, 0x63, 0xcb, 0xc6, 0x6e, 0xf3, 0x18, 0xcf, 0xb5, 0x2f, 0xba, 0x77, 0x45, 0x71, 0xab, 0x10, 0xbd, 0x63, 0xcb, 0xc6, 0x6e, 0x83, 0x19, 0x0f, 0xf6, 0xc5, 0xf7, 0xae, 0x28, 0x52, 0x95,
0x52, 0x14, 0x0b, 0x92, 0x22, 0xab, 0x2c, 0xc1, 0x31, 0x94, 0x8b, 0xe2, 0x11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 0x25, 0xbe, 0x32, 0xca, 0xd6, 0x99, 0x2f, 0xcc, 0x44, 0xbe, 0x4d, 0x4d, 0xcd, 0x4a, 0xe7, 0x5f, 0x59, 0xe1, 0x68, 0x56, 0x3a, 0x57, 0x1a, 0xf9, 0xb7, 0x29, 0x3d, 0x90, 0xd9, 0xab, 0x2d,
0x4a, 0x23, 0xff, 0xce, 0xc4, 0x7f, 0xd0, 0x25, 0x7a, 0x20, 0xf3, 0x57, 0x4e, 0x24, 0x2d, 0xfa, 0x84, 0xbe, 0x33, 0xb1, 0x02, 0xcd, 0x5b, 0x3a, 0xbb, 0xfb, 0x83, 0x89, 0xff, 0xa1, 0x73, 0x87,
0xc4, 0x3c, 0x58, 0xfe, 0x83, 0x5d, 0xd4, 0xf3, 0xbf, 0x9f, 0xc7, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xa4, 0x25, 0x9f, 0x98, 0xc7, 0xca, 0x7f, 0xb2, 0x8b, 0x6a, 0xf6, 0xd7, 0xf3, 0xe4, 0x57, 0x00,
0xff, 0x7f, 0x32, 0xc0, 0xd9, 0x93, 0x04, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x9d, 0x98, 0x5a, 0xc8, 0x8f, 0x04, 0x00, 0x00,
} }

View File

@ -48,13 +48,13 @@ enum CodeType {
// Reserved for governance, 200 ~ 299 // Reserved for governance, 200 ~ 299
GovUnknownEntity = 201; GovUnknownEntity = 201;
GovUnknownGroup = 202; GovUnknownGroup = 202;
GovUnknownMember = 203; GovUnknownProposal = 203;
GovUnknownProposal = 204; GovDuplicateGroup = 204;
GovDuplicateEntity = 205; GovDuplicateMember = 205;
GovDuplicateGroup = 206; GovDuplicateProposal = 206;
GovDuplicateMember = 207; GovDuplicateVote = 207;
GovDuplicateProposal = 208; GovInvalidMember = 208;
GovDuplicateVote = 209; GovInvalidVote = 209;
GovInvalidVotingPower = 210; GovInvalidVotingPower = 210;
} }