Skip to content

Commit b63675b

Browse files
authored
Merge pull request #109 from davxy/consistent-stf-vectors-format-for-preimages-lookup-request
Consistence between testvectors format in stf/preimages and stf/accumulate
2 parents 6ec30ac + 18036ce commit b63675b

File tree

140 files changed

+1289
-787
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1289
-787
lines changed

stf/accumulate/accumulate.asn

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ AccumulateModule DEFINITIONS ::= BEGIN
44

55
IMPORTS
66
TimeSlot, ServiceId, ServiceInfo, WorkReport, OpaqueHash, ByteSequence,
7-
Entropy, ReadyQueue, AccumulatedQueue, Privileges, ServicesStatistics
7+
Entropy, ReadyQueue, AccumulatedQueue, Privileges, ServicesStatistics, U32
88
FROM JamTypes;
99

1010
StorageMapEntry ::= SEQUENCE {
@@ -14,35 +14,42 @@ StorageMapEntry ::= SEQUENCE {
1414
value ByteSequence
1515
}
1616

17-
PreimagesMapEntry ::= SEQUENCE {
17+
PreimagesBlobMapEntry ::= SEQUENCE {
1818
-- Preimage blob full hash
1919
hash OpaqueHash,
2020
-- Preimage blob
2121
blob ByteSequence
2222
}
2323

24-
PreimagesStatusMapEntry ::= SEQUENCE {
25-
-- Preimage blob full hash
24+
PreimagesRequestsMapKey ::= SEQUENCE {
25+
-- Preimage blob hash
2626
hash OpaqueHash,
27+
-- Preimage blob length
28+
length U32
29+
}
30+
31+
PreimagesRequestsMapEntry ::= SEQUENCE {
32+
-- Preimage request key
33+
key PreimagesRequestsMapKey,
2734
-- Preimage request status
28-
status SEQUENCE (SIZE(0..3)) OF TimeSlot
35+
value SEQUENCE (SIZE(0..3)) OF TimeSlot
2936
}
3037

3138
-- Service account information relevant for this STF.
32-
Account ::= SEQUENCE {
39+
ServiceAccount ::= SEQUENCE {
3340
-- [a_c, a_b, a_g, a_m, a_o, a_i] Service metadata.
3441
service ServiceInfo,
3542
-- [a_s] Service storage.
3643
storage SEQUENCE OF StorageMapEntry,
3744
-- [a_p] Preimages blobs.
38-
preimages-blob SEQUENCE OF PreimagesMapEntry,
39-
-- [a_l] Preimages status.
40-
preimages-status SEQUENCE OF PreimagesStatusMapEntry
45+
preimage-blobs SEQUENCE OF PreimagesBlobMapEntry,
46+
-- [a_l] Preimages requests.
47+
preimage-requests SEQUENCE OF PreimagesRequestsMapEntry
4148
}
4249

4350
AccountsMapEntry ::= SEQUENCE {
4451
id ServiceId,
45-
data Account
52+
data ServiceAccount
4653
}
4754

4855
State ::= SEQUENCE {

stf/accumulate/accumulate.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@
1212
ServiceInfo,
1313
ByteSequence,
1414
Privileges,
15-
ServicesStatistics
15+
ServicesStatistics,
16+
Vec,
17+
U32
1618
)
1719
from jam_types import class_name as n
1820

@@ -22,32 +24,41 @@ class AccumulateStorageMapEntry(Struct):
2224
('value', n(ByteSequence)),
2325
]
2426

25-
class AccumulatePreimagesMapEntry(Struct):
27+
class AccumulatePreimagesBlobMapEntry(Struct):
2628
type_mapping = [
2729
('hash', n(OpaqueHash)),
2830
('blob', n(ByteSequence)),
2931
]
3032

31-
class AccumulatePreimagesStatusMapEntry(Struct):
33+
class AccumulatePreimagesRequestsMapKey(Struct):
3234
type_mapping = [
3335
('hash', n(OpaqueHash)),
34-
('status', 'Vec<TimeSlot>')
36+
('length', n(U32)),
3537
]
3638

37-
class AccumulateAccountMapData(Struct):
39+
class AccumulatePreimagesRequestsMapEntry(Struct):
40+
type_mapping = [
41+
('key', n(AccumulatePreimagesRequestsMapKey)),
42+
('value', 'Vec<TimeSlot>')
43+
]
44+
45+
class AccumulateServiceAccount(Struct):
3846
type_mapping = [
3947
('service', n(ServiceInfo)),
4048
('storage', 'Vec<AccumulateStorageMapEntry>'),
41-
('preimages_blob', 'Vec<AccumulatePreimagesMapEntry>'),
42-
('preimages_status', 'Vec<AccumulatePreimagesStatusMapEntry>')
49+
('preimage_blobs', 'Vec<AccumulatePreimagesBlobMapEntry>'),
50+
('preimage_requests', 'Vec<AccumulatePreimagesRequestsMapEntry>')
4351
]
4452

45-
class AccumulateAccountMapEntry(Struct):
53+
class AccumulateServiceAccountMapEntry(Struct):
4654
type_mapping = [
4755
('id', n(ServiceId)),
48-
('data', n(AccumulateAccountMapData))
56+
('data', n(AccumulateServiceAccount))
4957
]
5058

59+
class AccumulateServiceAccountMap(Vec):
60+
sub_type = n(AccumulateServiceAccountMapEntry)
61+
5162
class AccumulateState(Struct):
5263
type_mapping = [
5364
('slot', n(TimeSlot)),
@@ -56,7 +67,7 @@ class AccumulateState(Struct):
5667
('accumulated', n(AccumulatedQueue)),
5768
('privileges', n(Privileges)),
5869
('statistics', n(ServicesStatistics)),
59-
('accounts', 'Vec<AccumulateAccountMapEntry>'),
70+
('accounts', n(AccumulateServiceAccountMap))
6071
]
6172

6273
class AccumulateInput(Struct):
8 Bytes
Binary file not shown.

stf/accumulate/full/accumulate_ready_queued_reports-1.json

Lines changed: 14 additions & 8 deletions
Large diffs are not rendered by default.
8 Bytes
Binary file not shown.

stf/accumulate/full/enqueue_and_unlock_chain-1.json

Lines changed: 14 additions & 8 deletions
Large diffs are not rendered by default.
8 Bytes
Binary file not shown.

stf/accumulate/full/enqueue_and_unlock_chain-2.json

Lines changed: 14 additions & 8 deletions
Large diffs are not rendered by default.
8 Bytes
Binary file not shown.

stf/accumulate/full/enqueue_and_unlock_chain-3.json

Lines changed: 14 additions & 8 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)