Skip to content

Commit abff9da

Browse files
committed
Update tests
1 parent ddf49e4 commit abff9da

5 files changed

Lines changed: 1 addition & 54 deletions

File tree

x/bulletin/keeper/bulletin_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ func TestGetPost(t *testing.T) {
7171
Namespace: namespaceId,
7272
CreatorDid: did,
7373
Payload: []byte("payload123"),
74-
Proof: []byte("proof123"),
7574
}
7675
k.SetPost(ctx, post)
7776

@@ -81,7 +80,6 @@ func TestGetPost(t *testing.T) {
8180
require.Equal(t, post.Namespace, gotPost.Namespace)
8281
require.Equal(t, post.CreatorDid, gotPost.CreatorDid)
8382
require.Equal(t, post.Payload, gotPost.Payload)
84-
require.Equal(t, post.Proof, gotPost.Proof)
8583
}
8684

8785
func TestGetCollaborator(t *testing.T) {
@@ -178,7 +176,6 @@ func TestMustIteratePosts(t *testing.T) {
178176
Namespace: namespaceId,
179177
CreatorDid: did,
180178
Payload: []byte("payload123"),
181-
Proof: []byte("proof123"),
182179
}
183180
k.SetPost(ctx, post1)
184181

@@ -187,7 +184,6 @@ func TestMustIteratePosts(t *testing.T) {
187184
Namespace: namespaceId,
188185
CreatorDid: did,
189186
Payload: []byte("payload456"),
190-
Proof: []byte("proof456"),
191187
}
192188
k.SetPost(ctx, post2)
193189

@@ -212,7 +208,6 @@ func TestMustIterateNamespacePosts(t *testing.T) {
212208
Namespace: namespaceId1,
213209
CreatorDid: did,
214210
Payload: []byte("payload123"),
215-
Proof: []byte("proof123"),
216211
}
217212
k.SetPost(ctx, post1)
218213

@@ -221,7 +216,6 @@ func TestMustIterateNamespacePosts(t *testing.T) {
221216
Namespace: namespaceId1,
222217
CreatorDid: did,
223218
Payload: []byte("payload456"),
224-
Proof: []byte("proof456"),
225219
}
226220
k.SetPost(ctx, post2)
227221

@@ -230,7 +224,6 @@ func TestMustIterateNamespacePosts(t *testing.T) {
230224
Namespace: namespaceId2,
231225
CreatorDid: did,
232226
Payload: []byte("payload789"),
233-
Proof: []byte("proof789"),
234227
}
235228
k.SetPost(ctx, post3)
236229

x/bulletin/keeper/grpc_query_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,7 @@ func TestNamespacePostsQuery(t *testing.T) {
197197

198198
namespace := "ns1"
199199
payload1 := []byte("post123")
200-
proof1 := []byte("proof456")
201200
payload2 := []byte("post321")
202-
proof2 := []byte("proof654")
203201

204202
postId1 := types.GeneratePostId(getNamespaceId(namespace), payload1)
205203
postId2 := types.GeneratePostId(getNamespaceId(namespace), payload2)
@@ -217,15 +215,13 @@ func TestNamespacePostsQuery(t *testing.T) {
217215
Creator: baseAcc.Address,
218216
Namespace: namespace,
219217
Payload: payload1,
220-
Proof: proof1,
221218
})
222219
require.NoError(t, err)
223220

224221
_, err = k.CreatePost(ctx, &types.MsgCreatePost{
225222
Creator: baseAcc.Address,
226223
Namespace: namespace,
227224
Payload: payload2,
228-
Proof: proof2,
229225
})
230226
require.NoError(t, err)
231227

@@ -240,14 +236,12 @@ func TestNamespacePostsQuery(t *testing.T) {
240236
Namespace: getNamespaceId(namespace),
241237
CreatorDid: ownerDID,
242238
Payload: payload1,
243-
Proof: proof1,
244239
},
245240
{
246241
Id: postId2,
247242
Namespace: getNamespaceId(namespace),
248243
CreatorDid: ownerDID,
249244
Payload: payload2,
250-
Proof: proof2,
251245
},
252246
},
253247
Pagination: &query.PageResponse{
@@ -270,9 +264,7 @@ func TestPostsQuery(t *testing.T) {
270264
namespace1 := "ns1"
271265
namespace2 := "ns2"
272266
payload1 := []byte("post123")
273-
proof1 := []byte("proof456")
274267
payload2 := []byte("post321")
275-
proof2 := []byte("proof654")
276268

277269
postId1 := types.GeneratePostId(getNamespaceId(namespace1), payload1)
278270
postId2 := types.GeneratePostId(getNamespaceId(namespace2), payload2)
@@ -296,15 +288,13 @@ func TestPostsQuery(t *testing.T) {
296288
Creator: baseAcc.Address,
297289
Namespace: namespace1,
298290
Payload: payload1,
299-
Proof: proof1,
300291
})
301292
require.NoError(t, err)
302293

303294
_, err = k.CreatePost(ctx, &types.MsgCreatePost{
304295
Creator: baseAcc.Address,
305296
Namespace: namespace2,
306297
Payload: payload2,
307-
Proof: proof2,
308298
})
309299
require.NoError(t, err)
310300

@@ -317,14 +307,12 @@ func TestPostsQuery(t *testing.T) {
317307
Namespace: getNamespaceId(namespace1),
318308
CreatorDid: ownerDID,
319309
Payload: payload1,
320-
Proof: proof1,
321310
},
322311
{
323312
Id: postId2,
324313
Namespace: getNamespaceId(namespace2),
325314
CreatorDid: ownerDID,
326315
Payload: payload2,
327-
Proof: proof2,
328316
},
329317
},
330318
Pagination: &query.PageResponse{
@@ -346,7 +334,6 @@ func TestPostQuery(t *testing.T) {
346334

347335
namespace := "ns1"
348336
payload1 := []byte("post123")
349-
proof1 := []byte("proof456")
350337
artifact := "artifact"
351338

352339
postId1 := types.GeneratePostId(getNamespaceId(namespace), payload1)
@@ -364,7 +351,6 @@ func TestPostQuery(t *testing.T) {
364351
Creator: baseAcc.Address,
365352
Namespace: namespace,
366353
Payload: payload1,
367-
Proof: proof1,
368354
Artifact: artifact,
369355
})
370356
require.NoError(t, err)
@@ -380,7 +366,6 @@ func TestPostQuery(t *testing.T) {
380366
Namespace: getNamespaceId(namespace),
381367
CreatorDid: ownerDID,
382368
Payload: payload1,
383-
Proof: proof1,
384369
},
385370
}, response)
386371
}

x/bulletin/keeper/keeper_test.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ func TestGetNamespacePosts(t *testing.T) {
129129
Namespace: namespaceId1,
130130
CreatorDid: did,
131131
Payload: []byte("payload123"),
132-
Proof: []byte("proof123"),
133132
}
134133
k.SetPost(ctx, post1)
135134

@@ -138,7 +137,6 @@ func TestGetNamespacePosts(t *testing.T) {
138137
Namespace: namespaceId1,
139138
CreatorDid: did,
140139
Payload: []byte("payload456"),
141-
Proof: []byte("proof456"),
142140
}
143141
k.SetPost(ctx, post2)
144142

@@ -147,7 +145,6 @@ func TestGetNamespacePosts(t *testing.T) {
147145
Namespace: namespaceId2,
148146
CreatorDid: did,
149147
Payload: []byte("payload789"),
150-
Proof: []byte("proof789"),
151148
}
152149
k.SetPost(ctx, post3)
153150

@@ -174,7 +171,6 @@ func TestGetAllPosts(t *testing.T) {
174171
Namespace: namespaceId1,
175172
CreatorDid: did,
176173
Payload: []byte("payload123"),
177-
Proof: []byte("proof123"),
178174
}
179175
k.SetPost(ctx, post1)
180176

@@ -183,7 +179,6 @@ func TestGetAllPosts(t *testing.T) {
183179
Namespace: namespaceId1,
184180
CreatorDid: did,
185181
Payload: []byte("payload456"),
186-
Proof: []byte("proof456"),
187182
}
188183
k.SetPost(ctx, post2)
189184

@@ -192,7 +187,6 @@ func TestGetAllPosts(t *testing.T) {
192187
Namespace: namespaceId2,
193188
CreatorDid: did,
194189
Payload: []byte("payload789"),
195-
Proof: []byte("proof789"),
196190
}
197191
k.SetPost(ctx, post3)
198192

x/bulletin/keeper/msg_server_test.go

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ func TestMsgCreatePost(t *testing.T) {
216216
input: &types.MsgCreatePost{
217217
Creator: baseAcc.Address,
218218
Payload: []byte("post123"),
219-
Proof: []byte("proof456"),
220219
},
221220
setup: func() {},
222221
expErr: true,
@@ -227,30 +226,17 @@ func TestMsgCreatePost(t *testing.T) {
227226
input: &types.MsgCreatePost{
228227
Creator: baseAcc.Address,
229228
Namespace: namespace,
230-
Proof: []byte("proof456"),
231229
},
232230
setup: func() {},
233231
expErr: true,
234232
expErrMsg: "invalid post payload",
235233
},
236-
{
237-
name: "create post (error: no proof)",
238-
input: &types.MsgCreatePost{
239-
Creator: baseAcc.Address,
240-
Namespace: namespace,
241-
Payload: []byte("post123"),
242-
},
243-
setup: func() {},
244-
expErr: true,
245-
expErrMsg: "invalid post proof",
246-
},
247234
{
248235
name: "create post (error: no policy)",
249236
input: &types.MsgCreatePost{
250237
Creator: baseAcc.Address,
251238
Namespace: namespace,
252239
Payload: []byte("post123"),
253-
Proof: []byte("proof456"),
254240
},
255241
setup: func() {},
256242
expErr: true,
@@ -262,7 +248,6 @@ func TestMsgCreatePost(t *testing.T) {
262248
Creator: baseAcc.Address,
263249
Namespace: namespace,
264250
Payload: []byte("post123"),
265-
Proof: []byte("proof456"),
266251
},
267252
setup: func() {
268253
k.SetPolicyId(ctx, "policy1")
@@ -276,7 +261,6 @@ func TestMsgCreatePost(t *testing.T) {
276261
Creator: baseAcc.Address,
277262
Namespace: namespace,
278263
Payload: []byte("post123"),
279-
Proof: []byte("proof456"),
280264
},
281265
setup: func() {
282266
setupTestPolicy(t, ctx, k)
@@ -295,7 +279,6 @@ func TestMsgCreatePost(t *testing.T) {
295279
Creator: baseAcc.Address,
296280
Namespace: namespace,
297281
Payload: []byte("post123"),
298-
Proof: []byte("proof456"),
299282
},
300283
setup: func() {},
301284
expErr: true,
@@ -307,7 +290,6 @@ func TestMsgCreatePost(t *testing.T) {
307290
Creator: baseAcc2.Address,
308291
Namespace: namespace,
309292
Payload: []byte("post1234"),
310-
Proof: []byte("proof4567"),
311293
},
312294
setup: func() {},
313295
expErr: true,
@@ -319,7 +301,6 @@ func TestMsgCreatePost(t *testing.T) {
319301
Creator: baseAcc2.Address,
320302
Namespace: namespace,
321303
Payload: []byte("post1234"),
322-
Proof: []byte("proof4567"),
323304
},
324305
setup: func() {
325306
_, err := k.AddCollaborator(ctx, &types.MsgAddCollaborator{
@@ -380,7 +361,6 @@ func TestMsgCreatePost_EmitsArtifactInEvent(t *testing.T) {
380361
Creator: baseAcc.Address,
381362
Namespace: "ns1",
382363
Payload: []byte("some payload"),
383-
Proof: []byte("some proof"),
384364
Artifact: "session-id",
385365
}
386366
_, err = k.CreatePost(ctx, &post)

x/bulletin/types/message_create_post.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@ import (
88

99
var _ sdk.Msg = &MsgCreatePost{}
1010

11-
func NewMsgCreatePost(creator string, namespace string, payload []byte, proof []byte) *MsgCreatePost {
11+
func NewMsgCreatePost(creator string, namespace string, payload []byte) *MsgCreatePost {
1212
return &MsgCreatePost{
1313
Creator: creator,
1414
Namespace: namespace,
1515
Payload: payload,
16-
Proof: proof,
1716
}
1817
}
1918

@@ -31,9 +30,5 @@ func (msg *MsgCreatePost) ValidateBasic() error {
3130
return ErrInvalidPostPayload
3231
}
3332

34-
if len(msg.Proof) == 0 {
35-
return ErrInvalidPostProof
36-
}
37-
3833
return nil
3934
}

0 commit comments

Comments
 (0)