Skip to content

Commit bb2e865

Browse files
authored
GP 0.7.0 (#359)
* refactor to reduce a few force unwrap * update tiny config changes * update submodule * update submodule * update jamtestvectors * 0.7.0
1 parent 816493f commit bb2e865

File tree

22 files changed

+310
-113
lines changed

22 files changed

+310
-113
lines changed

Blockchain/Sources/Blockchain/Config/ProtocolConfig+Preset.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,13 +110,13 @@ extension Ref where T == ProtocolConfig {
110110
additionalMinBalancePerStateByte: 1,
111111
serviceMinBalance: 100,
112112
totalNumberOfCores: 2,
113-
preimagePurgePeriod: 19200,
113+
preimagePurgePeriod: 32,
114114
epochLength: 12,
115115
auditBiasFactor: 2,
116116
workReportAccumulationGas: Gas(10_000_000),
117117
workPackageIsAuthorizedGas: Gas(50_000_000),
118-
workPackageRefineGas: Gas(5_000_000_000),
119-
totalAccumulationGas: Gas(3_500_000_000),
118+
workPackageRefineGas: Gas(1_000_000_000),
119+
totalAccumulationGas: Gas(20_000_000),
120120
recentHistorySize: 8,
121121
maxWorkItems: 16,
122122
maxDepsInWorkReport: 8,

Blockchain/Sources/Blockchain/RuntimeProtocols/AccumulateFunction.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Utils
44

55
// wrangled operand tuple
66
public struct OperandTuple: Codable {
7-
/// h
7+
/// p
88
public var packageHash: Data32
99
/// e
1010
public var segmentRoot: Data32
@@ -14,9 +14,9 @@ public struct OperandTuple: Codable {
1414
public var payloadHash: Data32
1515
/// g
1616
@CodingAs<Compact<Gas>> public var gasLimit: Gas
17-
/// d
17+
/// l
1818
public var workResult: WorkResult
19-
/// o
19+
/// t
2020
public var authorizerTrace: Data
2121
}
2222

@@ -83,7 +83,6 @@ public struct AccumulateState {
8383
}
8484
}
8585

86-
/// X
8786
public class AccumlateResultContext {
8887
/// s: the accumulating service account index
8988
public var serviceIndex: ServiceIndex

Blockchain/Sources/Blockchain/RuntimeProtocols/Accumulation.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ public struct ServicePreimagePair: Hashable {
6464
}
6565

6666
public struct AccumulationResult {
67-
// o
67+
// e
6868
public var state: AccumulateState
6969
// t
7070
public var transfers: [DeferredTransfers]
71-
// b
71+
// y
7272
public var commitment: Data32?
7373
// u
7474
public var gasUsed: Gas

Blockchain/Sources/Blockchain/State/State.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public struct State: Sendable {
2626
}
2727
}
2828

29-
// φ: The authorization queue.
29+
// ϕ: The authorization queue.
3030
public var authorizationQueue: StateKeys.AuthorizationQueueKey.Value {
3131
get {
3232
layer.authorizationQueue
@@ -146,7 +146,7 @@ public struct State: Sendable {
146146
}
147147
}
148148

149-
// ϑ: The accumulation queue.
149+
// ω: The accumulation queue.
150150
public var accumulationQueue: StateKeys.AccumulationQueueKey.Value {
151151
get {
152152
layer.accumulationQueue

Blockchain/Sources/Blockchain/Types/Header.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ public struct Header: Sendable, Equatable {
3434
ProtocolConfig.EpochLength
3535
>?
3636

37-
// Ho: The offenders markers must contain exactly the sequence of keys of all new offenders.
38-
public var offendersMarkers: [Ed25519PublicKey]
39-
4037
// Hi: block author index
4138
public var authorIndex: ValidatorIndex
4239

4340
// Hv: the entropy-yielding vrf signature
4441
public var vrfSignature: BandersnatchSignature
4542

43+
// Ho: The offenders markers must contain exactly the sequence of keys of all new offenders.
44+
public var offendersMarkers: [Ed25519PublicKey]
45+
4646
public init(
4747
parentHash: Data32,
4848
priorStateRoot: Data32,
@@ -53,9 +53,9 @@ public struct Header: Sendable, Equatable {
5353
Ticket,
5454
ProtocolConfig.EpochLength
5555
>?,
56-
offendersMarkers: [Ed25519PublicKey],
5756
authorIndex: ValidatorIndex,
58-
vrfSignature: BandersnatchSignature
57+
vrfSignature: BandersnatchSignature,
58+
offendersMarkers: [Ed25519PublicKey]
5959
) {
6060
self.parentHash = parentHash
6161
self.priorStateRoot = priorStateRoot
@@ -107,9 +107,9 @@ extension Header: Codable {
107107
ConfigFixedSizeArray<Ticket, ProtocolConfig.EpochLength>.self,
108108
forKey: .winningTickets
109109
),
110-
offendersMarkers: container.decode([Ed25519PublicKey].self, forKey: .offendersMarkers),
111110
authorIndex: container.decode(ValidatorIndex.self, forKey: .authorIndex),
112-
vrfSignature: container.decode(BandersnatchSignature.self, forKey: .vrfSignature)
111+
vrfSignature: container.decode(BandersnatchSignature.self, forKey: .vrfSignature),
112+
offendersMarkers: container.decode([Ed25519PublicKey].self, forKey: .offendersMarkers),
113113
),
114114
seal: container.decode(BandersnatchSignature.self, forKey: .seal)
115115
)
@@ -123,9 +123,9 @@ extension Header: Codable {
123123
try container.encode(unsigned.timeslot, forKey: .timeslot)
124124
try container.encodeIfPresent(unsigned.epoch, forKey: .epoch)
125125
try container.encodeIfPresent(unsigned.winningTickets, forKey: .winningTickets)
126-
try container.encode(unsigned.offendersMarkers, forKey: .offendersMarkers)
127126
try container.encode(unsigned.authorIndex, forKey: .authorIndex)
128127
try container.encode(unsigned.vrfSignature, forKey: .vrfSignature)
128+
try container.encode(unsigned.offendersMarkers, forKey: .offendersMarkers)
129129
try container.encode(seal, forKey: .seal)
130130
}
131131
}
@@ -157,9 +157,9 @@ extension Header.Unsigned: Dummy {
157157
timeslot: 0,
158158
epoch: EpochMarker.dummy(config: config),
159159
winningTickets: nil,
160-
offendersMarkers: [],
161160
authorIndex: 0,
162-
vrfSignature: BandersnatchSignature()
161+
vrfSignature: BandersnatchSignature(),
162+
offendersMarkers: []
163163
)
164164
}
165165
}

Blockchain/Sources/Blockchain/Types/Statistics.swift

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,14 @@ public struct Statistics: Sendable, Equatable, Codable {
4343
// i: total number of segments imported from the Segments DA
4444
public var importsCount: UInt
4545

46-
// e: total number of segments exported into the Segments DA
47-
public var exportsCount: UInt
46+
// x: total number of the extrinsics used in computing the workload
47+
public var extrinsicsCount: UInt
4848

4949
// z: total size in octets of the extrinsics used in computing the workload
5050
public var extrinsicsSize: UInt
5151

52-
// x: total number of the extrinsics used in computing the workload
53-
public var extrinsicsCount: UInt
52+
// e: total number of segments exported into the Segments DA
53+
public var exportsCount: UInt
5454

5555
// b: total package data length
5656
public var packageSize: UInt
@@ -79,14 +79,14 @@ public struct Statistics: Sendable, Equatable, Codable {
7979
// i: total number of segments imported from the Segments DA
8080
public var importsCount: UInt
8181

82-
// e: total number of segments exported into the Segments DA
83-
public var exportsCount: UInt
82+
// x: total number of the extrinsics used in computing the workload
83+
public var extrinsicsCount: UInt
8484

8585
// z: total size in octets of the extrinsics used in computing the workload
8686
public var extrinsicsSize: UInt
8787

88-
// x: total number of the extrinsics used in computing the workload
89-
public var extrinsicsCount: UInt
88+
// e: total number of segments exported into the Segments DA
89+
public var exportsCount: UInt
9090

9191
// a: accumulate count and gas used
9292
public var accumulates: CountAndGas
@@ -145,9 +145,9 @@ extension Statistics.Core: Dummy {
145145
dataSize: 0,
146146
assuranceCount: 0,
147147
importsCount: 0,
148-
exportsCount: 0,
149-
extrinsicsSize: 0,
150148
extrinsicsCount: 0,
149+
extrinsicsSize: 0,
150+
exportsCount: 0,
151151
packageSize: 0,
152152
gasUsed: 0
153153
)
@@ -161,9 +161,9 @@ extension Statistics.Service: Dummy {
161161
preimages: .init(count: 0, size: 0),
162162
refines: .init(count: 0, gasUsed: 0),
163163
importsCount: 0,
164-
exportsCount: 0,
165-
extrinsicsSize: 0,
166164
extrinsicsCount: 0,
165+
extrinsicsSize: 0,
166+
exportsCount: 0,
167167
accumulates: .init(count: 0, gasUsed: 0),
168168
transfers: .init(count: 0, gasUsed: 0)
169169
)

Blockchain/Sources/Blockchain/Types/WorkDigest.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Codec
22
import Foundation
33
import Utils
44

5-
// L
65
public struct WorkDigest: Sendable, Equatable, Codable {
76
// s: the index of the service whose state is to be altered and thus whose refine code was already executed
87
public var serviceIndex: ServiceIndex
@@ -16,7 +15,7 @@ public struct WorkDigest: Sendable, Equatable, Codable {
1615
// g: the gas limit for executing this item's accumulate
1716
public var gasLimit: Gas
1817

19-
// d: the work result
18+
// l: the work result
2019
public var result: WorkResult
2120

2221
// u: the actual amount of gas used during refinement

Blockchain/Sources/Blockchain/Types/WorkItem.swift

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Foundation
22
import Utils
33

4-
// I
54
public struct WorkItem: Sendable, Equatable, Codable, Hashable {
65
public struct ImportedDataSegment: Sendable, Equatable, Codable, Hashable {
76
public enum DataSegmentRootKind: Sendable, Equatable, Hashable {
@@ -66,27 +65,27 @@ public struct WorkItem: Sendable, Equatable, Codable, Hashable {
6665
// s
6766
public var serviceIndex: ServiceIndex
6867

69-
// h
68+
// c
7069
public var codeHash: Data32
7170

72-
// y
73-
public var payloadBlob: Data
74-
7571
// g
7672
public var refineGasLimit: Gas
7773

7874
// a
7975
public var accumulateGasLimit: Gas
8076

77+
// e: the number of data segments exported by this work item
78+
public var exportsCount: UInt16
79+
80+
// y
81+
public var payloadBlob: Data
82+
8183
// i: a sequence of imported data segments which identify a prior exported segment through an index
8284
public var inputs: [ImportedDataSegment]
8385

8486
// x: a sequence of hashed of blob hashes and lengths to be introduced in this block
8587
public var outputs: [HashAndLength]
8688

87-
// e: the number of data segments exported by this work item
88-
public var exportsCount: UInt16
89-
9089
public init(
9190
serviceIndex: ServiceIndex,
9291
codeHash: Data32,

Blockchain/Sources/Blockchain/Types/WorkPackage.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ import Utils
44

55
// P
66
public struct WorkPackage: Comparable, Sendable, Equatable, Codable, Hashable {
7-
// j
8-
public var authorizationToken: Data
9-
107
// h
118
public var authorizationServiceIndex: ServiceIndex
129

1310
// u
1411
public var authorizationCodeHash: Data32
1512

16-
// p
17-
public var configurationBlob: Data
18-
19-
// x
13+
// c
2014
public var context: RefinementContext
2115

16+
// j
17+
public var authorizationToken: Data
18+
19+
// f
20+
public var configurationBlob: Data
21+
2222
// w
2323
public var workItems: ConfigLimitedSizeArray<
2424
WorkItem,

Blockchain/Sources/Blockchain/Types/WorkReport.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public struct WorkReport: Sendable, Equatable, Codable, Hashable {
66
// s: package specification
77
public var packageSpecification: AvailabilitySpecifications
88

9-
// x: refinement context
9+
// **c**: refinement context
1010
public var refinementContext: RefinementContext
1111

1212
// c: the core-index
@@ -15,22 +15,22 @@ public struct WorkReport: Sendable, Equatable, Codable, Hashable {
1515
// a: authorizer hash
1616
public var authorizerHash: Data32
1717

18-
// o: authorizer trace
18+
// g
19+
public var authGasUsed: UInt
20+
21+
// t: authorizer trace
1922
public var authorizerTrace: Data
2023

2124
// l: segment-root lookup dictionary
2225
@CodingAs<SortedKeyValues<Data32, Data32>> public var lookup: [Data32: Data32]
2326

24-
// r: the results of the evaluation of each of the items in the package
27+
// d: the results of the evaluation of each of the items in the package
2528
public var digests: ConfigLimitedSizeArray<
2629
WorkDigest,
2730
ProtocolConfig.Int1,
2831
ProtocolConfig.MaxWorkItems
2932
>
3033

31-
// g
32-
public var authGasUsed: UInt
33-
3434
public init(
3535
authorizerHash: Data32,
3636
coreIndex: UInt,

0 commit comments

Comments
 (0)