Skip to content

Commit 404c664

Browse files
committed
fix unittest
1 parent 8a15836 commit 404c664

File tree

3 files changed

+22
-3
lines changed

3 files changed

+22
-3
lines changed

coordinator/internal/controller/proxy/prover_session.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (c *proverSession) GetTask(ctx context.Context, param *types.GetTaskParamet
203203

204204
newToken, err := c.maintainLogin(ctx, cliMgr, up, loginParam, token.phase)
205205
if err != nil {
206-
return nil, fmt.Errorf("update prover token fail: %V", err)
206+
return nil, fmt.Errorf("update prover token fail: %v", err)
207207
}
208208

209209
return cli.GetTask(ctx, param, newToken.Token)

coordinator/internal/logic/libzkp/lib_mock.go

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
package libzkp
44

5+
import (
6+
"encoding/json"
7+
)
8+
59
// // InitVerifier is a no-op in the mock.
610
// func InitVerifier(configJSON string) {}
711

@@ -22,7 +26,22 @@ package libzkp
2226

2327
// GenerateWrappedProof returns a fixed dummy proof string in the mock.
2428
func GenerateWrappedProof(proofJSON, metadata string, vkData []byte) string {
25-
return "mock-wrapped-proof"
29+
30+
payload := struct {
31+
Metadata json.RawMessage `json:"metadata"`
32+
Proof json.RawMessage `json:"proof"`
33+
GitVersion string `json:"git_version"`
34+
}{
35+
Metadata: json.RawMessage(metadata),
36+
Proof: json.RawMessage(proofJSON),
37+
GitVersion: "mock-git-version",
38+
}
39+
40+
out, err := json.Marshal(payload)
41+
if err != nil {
42+
panic(err)
43+
}
44+
return string(out)
2645
}
2746

2847
// DumpVk is a no-op and returns nil in the mock.

coordinator/internal/logic/submitproof/proof_receiver.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ func (m *ProofReceiverLogic) HandleZkProof(ctx *gin.Context, proofParameter coor
216216
switch message.ProofType(proofParameter.TaskType) {
217217
case message.ProofTypeChunk:
218218
chunkProof := &message.OpenVMChunkProof{}
219-
if unmarshalErr := json.Unmarshal([]byte(proofParameter.Proof), &chunkProof); unmarshalErr == nil {
219+
if unmarshalErr := json.Unmarshal([]byte(proofParameter.Proof), &chunkProof); unmarshalErr != nil {
220220
return unmarshalErr
221221
}
222222
success, verifyErr = m.verifier.VerifyChunkProof(chunkProof, hardForkName)

0 commit comments

Comments
 (0)