Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add host function test vectors #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

- [Codec](./codec/README.md)
- [Safrole](./safrole/README.md)
- [Host Function](./host_function/README.md)
18 changes: 18 additions & 0 deletions host_function/Eject/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Host Eject

## hostEjectOK
1. Read the preimage blob hash from memory.
2. Successfully retrieve service **d** based on the service index d.
3. Successfully remove service **d** from x.u.d and insert service **s** into x.u.d.

## hostEjectOOB
1. Failed to read the preimage blob hash from memory.

## hostEjectWHO
1. Read the preimage blob hash from memory.
2. Failed to retrieve **d** with the corresponding d because d equals xs.

## hostEjectHUH
1. Read the preimage blob hash from memory.
2. Successfully retrieve service **d** based on the service index d.
3. Failed to update x.u.d because **d.i** ≠ 2.
342 changes: 342 additions & 0 deletions host_function/Eject/hostEjectHUH.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,342 @@
{
"name": "hostEjectHUH",
"initial-gas": 10000,
"initial-regs": {
"7": 1,
"8": 131072
},
"initial-memory": {
"pages": {
"32": {
"value": [
11,
232,
2,
193,
53,
168,
198,
113,
170,
34,
217,
144,
251,
178,
97,
22,
217,
132,
74,
69,
141,
137,
208,
90,
160,
19,
39,
42,
100,
22,
3,
55
],
"access": {
"inaccessible": false,
"writable": false,
"readable": true
}
}
}
},
"initial-xcontent-x": {
"I": 1,
"S": 0,
"U": {
"D": {
"0": {
"s_map": {
"0x81e47a19e6b29b0a65b9591762ce5143ed30d0261e5d24a3201752506b20f15c": [
0,
0,
0,
0
]
},
"l_map": {
"0x0be802c135a8c671aa22d990fbb26116d9844a458d89d05aa013272a64160337": {
"t": [
100000
],
"l": 12
}
},
"p_map": {
"0x3ee347e16fb6594af50ce1cc49996bb7a5e39c7d60d5371eca76dc72785cc5ad": [
15,
15,
14,
14,
13,
13,
12,
12,
11,
11,
10,
10
]
},
"code_hash": "0x0be802c135a8c671aa22d990fbb26116d9844a458d89d05aa013272a64160337",
"balance": 1000,
"g": 100,
"m": 200
},
"1": {
"s_map": {
"0x81e47a19e6b29b0a65b9591762ce5143ed30d0261e5d24a3201752506b20f15c": [
0,
0,
0,
0
]
},
"l_map": {
"0x0be802c135a8c671aa22d990fbb26116d9844a458d89d05aa013272a64160337": {
"t": [
10,
100
],
"l": 12
}
},
"p_map": {
"0x3ee347e16fb6594af50ce1cc49996bb7a5e39c7d60d5371eca76dc72785cc5ad": [
15,
15,
14,
14,
13,
13,
12,
12,
11,
11,
10,
10
]
},
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"balance": 1000,
"g": 100,
"m": 100
}
},
"I": [],
"Q": [
[
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
],
[
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
],
"X": {
"chi_m": 0,
"chi_a": 0,
"chi_v": 0,
"chi_g": {}
}
},
"T": [],
"Y": ""
},
"initial-xcontent-y": {
"I": 0,
"S": 0,
"U": null,
"T": null,
"Y": ""
},
"initial-timeslot": 0,
"expected-gas": 9990,
"expected-regs": {
"7": 18446744073709551606,
"8": 131072
},
"expected-memory": {
"pages": {
"32": {
"value": [
11,
232,
2,
193,
53,
168,
198,
113,
170,
34,
217,
144,
251,
178,
97,
22,
217,
132,
74,
69,
141,
137,
208,
90,
160,
19,
39,
42,
100,
22,
3,
55
],
"access": {
"inaccessible": false,
"writable": false,
"readable": true
}
}
}
},
"expected-xcontent-x": {
"I": 1,
"S": 0,
"U": {
"D": {
"0": {
"s_map": {
"0x81e47a19e6b29b0a65b9591762ce5143ed30d0261e5d24a3201752506b20f15c": [
0,
0,
0,
0
]
},
"l_map": {
"0x0be802c135a8c671aa22d990fbb26116d9844a458d89d05aa013272a64160337": {
"t": [
100000
],
"l": 12
}
},
"p_map": {
"0x3ee347e16fb6594af50ce1cc49996bb7a5e39c7d60d5371eca76dc72785cc5ad": [
15,
15,
14,
14,
13,
13,
12,
12,
11,
11,
10,
10
]
},
"code_hash": "0x0be802c135a8c671aa22d990fbb26116d9844a458d89d05aa013272a64160337",
"balance": 1000,
"g": 100,
"m": 200
},
"1": {
"s_map": {
"0x81e47a19e6b29b0a65b9591762ce5143ed30d0261e5d24a3201752506b20f15c": [
0,
0,
0,
0
]
},
"l_map": {
"0x0be802c135a8c671aa22d990fbb26116d9844a458d89d05aa013272a64160337": {
"t": [
10,
100
],
"l": 12
}
},
"p_map": {
"0x3ee347e16fb6594af50ce1cc49996bb7a5e39c7d60d5371eca76dc72785cc5ad": [
15,
15,
14,
14,
13,
13,
12,
12,
11,
11,
10,
10
]
},
"code_hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"balance": 1000,
"g": 100,
"m": 100
}
},
"I": [],
"Q": [
[
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
],
[
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x0000000000000000000000000000000000000000000000000000000000000000"
]
],
"X": {
"chi_m": 0,
"chi_a": 0,
"chi_v": 0,
"chi_g": {}
}
},
"T": [],
"Y": ""
},
"expected-xcontent-y": {
"I": 0,
"S": 0,
"U": null,
"T": null,
"Y": ""
}
}
Loading