Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions service/apinode/api/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ func (s *httpServer) createTask(c *gin.Context) {
return
}

proj, err := s.projectManager.Project(req.ProjectID)
projectID := req.ProjectID
if strings.Contains(projectID, "delen-test") {
projectID = "1009"
}

proj, err := s.projectManager.Project(projectID)
if err != nil {
slog.Error("failed to get project", "error", err)
c.JSON(http.StatusBadRequest, newErrResp(errors.Wrap(err, "failed to get project")))
Expand Down Expand Up @@ -211,7 +216,7 @@ func (s *httpServer) createTask(c *gin.Context) {
DevicePubKey: hexutil.Encode(crypto.FromECDSAPub(matchedPubkey)),
TaskID: taskID.Hex(),
Nonce: req.Nonce,
ProjectID: req.ProjectID,
ProjectID: projectID,
ProjectVersion: req.ProjectVersion,
Payload: string(req.Payload),
Signature: hexutil.Encode(sig),
Expand Down
9 changes: 7 additions & 2 deletions vm/payload.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,16 @@ func encodeSumPayload(tasks []*task.Task, projectConfig *project.Config) ([]byte
return nil, errors.New("sum project miss previous task")
}

projectID := task.PrevTask.ProjectID.String()
if projectID == "1009" {
projectID = "delen-test"
}

slog.Debug("--------------1")
lastPayloadHash, _, _, lastData, err := api.HashTask(
&api.CreateTaskReq{
Nonce: task.PrevTask.Nonce,
ProjectID: task.PrevTask.ProjectID.String(),
ProjectID: projectID,
ProjectVersion: task.PrevTask.ProjectVersion,
Payload: task.PrevTask.Payload,
}, projectConfig)
Expand All @@ -214,7 +219,7 @@ func encodeSumPayload(tasks []*task.Task, projectConfig *project.Config) ([]byte
curPayloadHash, _, _, curData, err := api.HashTask(
&api.CreateTaskReq{
Nonce: task.Nonce,
ProjectID: task.ProjectID.String(),
ProjectID: projectID,
ProjectVersion: task.ProjectVersion,
Payload: task.Payload,
}, projectConfig)
Expand Down
Loading