Skip to content

Commit

Permalink
Merge pull request #62 from delta-mpc/zk
Browse files Browse the repository at this point in the history
HLR Zk
  • Loading branch information
mh739025250 authored Sep 30, 2022
2 parents 604f57f + e95d90b commit 52c6402
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 25 deletions.
2 changes: 2 additions & 0 deletions jupyter/examples/en-horizontal-logistic-regression-task.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
" max_clients=3, # Maximum nodes allowed in each round, must be greater equal than min_clients.\n",
" wait_timeout=5, # Timeout for calculation.\n",
" connection_timeout=5, # Wait timeout for each step.\n",
" verify_timeout=500, # Timeout for the final zero knownledge verification step\n",
" enable_verify=True # whether to enable final zero knownledge verification step\n",
" )\n",
"\n",
" def dataset(self):\n",
Expand Down
2 changes: 2 additions & 0 deletions jupyter/examples/zh-horizontal-logistic-regression-task.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
" max_clients=3, # 算法所支持的最大客户端数,必须大雨等于min_clients\n",
" wait_timeout=5, # 等待超时时间,用来控制一轮计算的超时时间\n",
" connection_timeout=5, # 连接超时时间,用来控制流程中每个阶段的超时时间\n",
" verify_timeout=500, # 零知识证明步骤的超时时间\n",
" enable_verify=True # 是否开启零知识证明\n",
" )\n",
"\n",
" def dataset(self):\n",
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PyYAML==6.0
jupyterlab==3.1.6
notebook==6.4.3
delta-task==0.6.0
delta-task==0.7.0rc1
oauthenticator==14.2.0
jupyterhub==1.4.2

Expand Down
15 changes: 8 additions & 7 deletions server/api/v1/task/find.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,14 @@ type Task struct {
Task_id int64 `json:"task_id"`
}
type UserTask struct {
ID int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Creator string `json:"creator"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
CreatorName string `json:"creator_name"`
ID int64 `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Creator string `json:"creator"`
Status string `json:"status"`
CreatedAt int64 `json:"created_at"`
CreatorName string `json:"creator_name"`
EnableVerify bool `json:"enable_verify"`
}

type AllTasks struct {
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "deltaboard-web",
"version": "0.1.0",
"version": "0.7.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
Expand Down
1 change: 1 addition & 0 deletions web/src/i18n/en/dashboard/tasklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export default {
'dashboard.tasklist.pending':'Pending',
'dashboard.tasklist.running':'Running',
'dashboard.tasklist.finished':'Finished',
'dashboard.tasklist.confirmed':'Confirmed',
'dashboard.tasklist.error':'Error'
}
1 change: 1 addition & 0 deletions web/src/i18n/zh/dashboard/tasklist.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ export default {
'dashboard.tasklist.pending':'等待运行',
'dashboard.tasklist.running':'运行中',
'dashboard.tasklist.finished':'完成',
'dashboard.tasklist.confirmed':'已确认',
'dashboard.tasklist.error':'异常'
}
1 change: 1 addition & 0 deletions web/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ Vue.prototype.$appGlobal = {
TASK_STATUS_RUNNING:'RUNNING',
TASK_STATUS_FINISHED:'FINISHED',
TASK_STATUS_ERROR:'ERROR',
TASK_STATUS_CONFIRMED: 'CONFIRMED',
USER_APPROVE_STATUS_REGISTED:1,
USER_APPROV_STATUS_APPROVED:2
}
Expand Down
5 changes: 4 additions & 1 deletion web/src/views/dashboard/content/myTasks/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
<el-tag type="danger" v-else-if="row.status == $appGlobal.constants.TASK_STATUS_ERROR">
{{$t('dashboard.tasklist.error')}}
</el-tag>
<el-tag type="info" v-else>
<el-tag type="info" v-else-if="row.status == $appGlobal.constants.TASK_STATUS_FINISHED">
{{$t('dashboard.tasklist.finished')}}
</el-tag>
<el-tag type="info" v-else-if="row.status == $appGlobal.constants.TASK_STATUS_CONFIRMED">
{{$t('dashboard.tasklist.confirmed')}}
</el-tag>
</template>
</el-table-column>
<el-table-column prop="created_at" :label="$t('common.created_at')">{{ }}
Expand Down
49 changes: 34 additions & 15 deletions web/src/views/dashboard/content/taskdetail/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<el-descriptions-item
:label="$t('common.created_at')"
:labelStyle="labelStyle"
>{{ (taskLogMetaData.created_at / 1000) || 0 | second2Date }}
>{{ taskLogMetaData.created_at / 1000 || 0 | second2Date }}
</el-descriptions-item>
<el-descriptions-item
:label="$t('dashboard.taskdetail.creator')"
Expand Down Expand Up @@ -55,9 +55,18 @@
>
{{ $t("dashboard.taskdetail.error") }}
</el-tag>
<el-tag type="info" v-else>
<el-tag
type="info"
v-else-if="$appGlobal.constants.TASK_STATUS_FINISHED"
>
{{ $t("dashboard.taskdetail.finished") }}
</el-tag>
<el-tag
type="info"
v-else-if="$appGlobal.constants.TASK_STATUS_CONFIRMED"
>
{{ $t("dashboard.taskdetail.confirmed") }}
</el-tag>
</el-descriptions-item>
<el-descriptions-item
:label="$t('dashboard.tasklist.task_type')"
Expand All @@ -68,7 +77,7 @@
<el-button
size="medium"
type="primary"
v-if="taskLogMetaData.status == 'FINISHED'"
v-if="resultReady"
@click.stop="downloadWeights"
>
{{ $t("dashboard.taskdetail.download_result") }}
Expand All @@ -83,10 +92,11 @@
>
<div v-for="(itm, index) in taskLogData" :key="index">
<div class="content">
{{ (itm.created_at / 1000) | second2Date }} &nbsp;&nbsp; {{ itm.message }}
{{ (itm.created_at / 1000) | second2Date }} &nbsp;&nbsp;
{{ itm.message }}
</div>
<div class="content" v-if="itm.tx_hash"
>tx hash:
<div class="content" v-if="itm.tx_hash">
tx hash:
<a target="_blank" :href="txUrl(itm.tx_hash)">{{ itm.tx_hash }}</a>
</div>
</div>
Expand All @@ -108,6 +118,13 @@ export default {
currentTaskId() {
return this.$route.params.task_id;
},
resultReady() {
if (this.taskLogMetaData.enableVerify) {
return this.taskLogMetaData.status == this.$appGlobal.constants.TASK_STATUS_CONFIRMED;
} else {
return this.taskLogMetaData.status == this.$appGlobal.constants.TASK_STATUS_FINISHED;
}
},
},
data() {
return {
Expand Down Expand Up @@ -140,14 +157,16 @@ export default {
},
loadTaskLog() {
console.log(`load task log page ${this.page}`);
V1TaskAPI.getTaskLogs(this.currentTaskId, this.logStart, this.logLimit).then(
(res) => {
this.taskLogData = this.taskLogData.concat(res);
let finalLogData = res[res.length - 1];
this.logStart = finalLogData.id + 1;
console.log(`load task log complete, page increase to ${this.page}`);
}
);
V1TaskAPI.getTaskLogs(
this.currentTaskId,
this.logStart,
this.logLimit
).then((res) => {
this.taskLogData = this.taskLogData.concat(res);
let finalLogData = res[res.length - 1];
this.logStart = finalLogData.id + 1;
console.log(`load task log complete, page increase to ${this.page}`);
});
},
txUrl(txHash) {
return `https://explorer.deltampc.com/tx/${txHash}/internal-transactions`;
Expand Down Expand Up @@ -230,4 +249,4 @@ export default {
.drawer-wrapper {
padding: 30px 0px;
}
</style>
</style>

0 comments on commit 52c6402

Please sign in to comment.