@@ -32,70 +32,6 @@ func createCIS() *pb.ChaincodeInvocationSpec {
32
32
Input : & pb.ChaincodeInput {Args : [][]byte {[]byte ("arg1" ), []byte ("arg2" )}}}}
33
33
}
34
34
35
- func TestNilProposal (t * testing.T ) {
36
- // pass nil to all function which accept *peer.Proposal
37
- _ , err := protoutil .ComputeProposalBinding (nil )
38
- assert .Error (t , err , "Expected error with nil proposal" )
39
- }
40
-
41
- func TestBadProposalHeaders (t * testing.T ) {
42
- // NOTE: There is a lot of repetitive proposal validation code
43
- // in multiple functions which should be refactored in the future.
44
- // For now, simply consolidating the test cases
45
-
46
- // empty header
47
- prop := & pb.Proposal {
48
- Header : []byte {},
49
- }
50
- _ , err := protoutil .ComputeProposalBinding (prop )
51
- assert .Error (t , err , "Expected error with empty proposal header" )
52
-
53
- // empty payload
54
- prop = & pb.Proposal {
55
- Header : []byte ("header" ),
56
- }
57
-
58
- // malformed proposal header
59
- prop = & pb.Proposal {
60
- Header : []byte ("bad header" ),
61
- Payload : []byte ("payload" ),
62
- }
63
- _ , err = protoutil .UnmarshalHeader (prop .Header )
64
- assert .Error (t , err , "Expected error with malformed proposal header" )
65
- _ , err = protoutil .ComputeProposalBinding (prop )
66
- assert .Error (t , err , "Expected error with malformed proposal header" )
67
-
68
- // malformed signature header
69
- chdr , _ := proto .Marshal (& common.ChannelHeader {
70
- Type : int32 (common .HeaderType_ENDORSER_TRANSACTION ),
71
- })
72
- hdr := & common.Header {
73
- ChannelHeader : chdr ,
74
- SignatureHeader : []byte ("bad signature header" ),
75
- }
76
- _ , err = protoutil .UnmarshalSignatureHeader (hdr .SignatureHeader )
77
- assert .Error (t , err , "Expected error with malformed signature header" )
78
- hdrBytes , _ := proto .Marshal (hdr )
79
- prop .Header = hdrBytes
80
- _ , err = protoutil .ComputeProposalBinding (prop )
81
- assert .Error (t , err , "Expected error with malformed signature header" )
82
-
83
- // wrong channel header type
84
- chdr , _ = proto .Marshal (& common.ChannelHeader {
85
- Type : int32 (common .HeaderType_DELIVER_SEEK_INFO ),
86
- })
87
-
88
- // malformed channel header
89
- hdr .ChannelHeader = []byte ("bad channel header" )
90
- hdrBytes , _ = proto .Marshal (hdr )
91
- prop .Header = hdrBytes
92
- _ , err = protoutil .UnmarshalChaincodeHeaderExtension ([]byte ("bad header extension" ))
93
- assert .Error (t , err , "Expected error with malformed channel header" )
94
- _ , err = protoutil .ComputeProposalBinding (prop )
95
- assert .Error (t , err , "Expected error with malformed channel header" )
96
-
97
- }
98
-
99
35
func TestGetChaincodeDeploymentSpec (t * testing.T ) {
100
36
_ , err := protoutil .UnmarshalChaincodeDeploymentSpec ([]byte ("bad spec" ))
101
37
assert .Error (t , err , "Expected error with malformed spec" )
@@ -144,27 +80,6 @@ func TestCDSProposals(t *testing.T) {
144
80
145
81
}
146
82
147
- func TestComputeProposalBinding (t * testing.T ) {
148
- expectedDigestHex := "5093dd4f4277e964da8f4afbde0a9674d17f2a6a5961f0670fc21ae9b67f2983"
149
- expectedDigest , _ := hex .DecodeString (expectedDigestHex )
150
- chdr , _ := proto .Marshal (& common.ChannelHeader {
151
- Epoch : uint64 (10 ),
152
- })
153
- shdr , _ := proto .Marshal (& common.SignatureHeader {
154
- Nonce : []byte ("nonce" ),
155
- Creator : []byte ("creator" ),
156
- })
157
- hdr , _ := proto .Marshal (& common.Header {
158
- ChannelHeader : chdr ,
159
- SignatureHeader : shdr ,
160
- })
161
- prop := & pb.Proposal {
162
- Header : hdr ,
163
- }
164
- binding , _ := protoutil .ComputeProposalBinding (prop )
165
- assert .Equal (t , expectedDigest , binding , "Binding does not match expected digest" )
166
- }
167
-
168
83
func TestProposal (t * testing.T ) {
169
84
// create a proposal from a ChaincodeInvocationSpec
170
85
prop , _ , err := protoutil .CreateChaincodeProposalWithTransient (
0 commit comments