forked from cdump/evmole
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
141 lines (137 loc) · 4.82 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>EVMole: Benchmark Results</title>
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/vue.global.prod.js"></script>
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/[email protected]/dist/index.css" />
<script src="//cdn.jsdelivr.net/npm/[email protected]/dist/index.full.min.js"></script>
<style>
body {
font:75%/1.5em Arial, Helvetica, "DejaVu Sans", "Liberation sans", "Bitstream Vera Sans", sans-serif;
}
.good {
background-color: #ddffdd;
}
.bad {
background-color: #ffdddd;
}
#app {
max-width: 1800px;
margin: 0 auto;
}
.provider .cell {
font-weight: bold;
text-align: center;
}
.provider-stat {
word-spacing: normal !important;
}
.signatures {
word-spacing: 100vw;
}
.el-table .el-table__cell {
vertical-align: top !important;
}
</style>
</head>
<body>
<div id="app">
<el-row>
<el-form-item label="Show">
<el-radio-group v-model="filter" class="ml-4">
<el-radio label="0" size="large">all</el-radio>
<el-radio label="1" size="large">any errors</el-radio>
<el-radio :label="idx+2" size="large" v-for="(name, idx) of providers.slice(1)" :key="name">"{{name}}" errors</el-radio>
</el-radio-group>
</el-form-item>
</el-row>
<el-row>
<el-form-item label="Dataset">
<el-radio-group v-model="dataset" class="ml-4">
<el-radio :label="idx+''" size="large" v-for="(name, idx) of datasets" :key="name">{{name}}</el-radio>
</el-radio-group>
</el-form-item>
</el-row>
<el-row>
<el-table :data="tableData" header-align="center" :cell-class-name="ccn">
<el-table-column prop="addr" label="address" width="360px"></el-table-column>
<el-table-column prop="ground_truth" label="etherscan" width="100px" class-name="signatures" label-class-name="provider">
<template #default="scope">
{{ scope.row.ground_truth.sort().join('\n') }}
</template>
</el-table-column>
<el-table-column :label="name" v-for="(name, idx) of providers.slice(1)" label-class-name="provider" :key="name">
<template #header>
{{ name }}, {{ results[parseInt(dataset)].timings[idx] }}s
</template>
<el-table-column class-name="signatures" label-class-name="provider-stat">
<template #header>
False Positive<br>
Contracts: {{ tableData.reduce((a, v)=>a + (v.data[idx][0].length != 0 ? 1 : 0), 0) }}<br>
Signatures: {{ tableData.reduce((a, v)=>a + v.data[idx][0].length, 0) }}
</template>
<template #default="scope">
{{ scope.row.data[idx][0].join('\n') }}
</template>
</el-table-column>
<el-table-column class-name="signatures" label-class-name="provider-stat">
<template #header>
False Negative<br>
Contracts: {{ tableData.reduce((a, v)=>a + (v.data[idx][1].length != 0 ? 1 : 0), 0) }}<br>
Signatures: {{ tableData.reduce((a, v)=>a + v.data[idx][1].length, 0) }}
</template>
<template #default="scope">
{{ scope.row.data[idx][1].join('\n') }}
</template>
</el-table-column>
</el-table-column>
</el-table>
</el-row>
</div>
<script>
const {ref, computed, createApp, onMounted} = Vue
createApp({
setup() {
const filter = ref('1');
const dataset = ref('0');
const resp = ref({results: [], providers: []});
const providers = computed(() => resp.value.providers);
const results = computed(() => resp.value.results);
const datasets = computed(() => results.value.map((r) => r.dataset));
onMounted(async () => {
const r = await fetch('/res.json')
const x = await r.json()
resp.value = x;
});
const tableData = computed(() => {
const datasetIdx = parseInt(dataset.value);
if (results.value.length == 0) {
return [];
}
const r = results.value[datasetIdx]['results'];
if (filter.value === '0') {
return r;
}
if (filter.value === '1') {
return r.filter((v) => v.data.some((x) => x.some((y) => y.length != 0)));
}
const idx = parseInt(filter.value) - 2;
return r.filter((v) => v.data[idx].some((y) => y.length != 0));
});
const ccn = (({row, column, rowIndex, columnIndex}) => {
if (columnIndex < 2) {
return '';
}
const i = Math.floor((columnIndex - 2) / 2);
const j = (columnIndex - 2) - i * 2;
const good = row.data[i][j].length === 0;
return good ? 'good' : 'bad'
})
return {filter, dataset, results, providers, datasets, tableData, ccn}
}
}).use(ElementPlus).mount('#app')
</script>
</body>
</html>