diff --git a/Blockchain/Sources/Blockchain/Runtime.swift b/Blockchain/Sources/Blockchain/Runtime.swift index ded76a5f..537370da 100644 --- a/Blockchain/Sources/Blockchain/Runtime.swift +++ b/Blockchain/Sources/Blockchain/Runtime.swift @@ -129,8 +129,8 @@ public final class Runtime { item.blocks += 1 item.tickets += UInt32(block.extrinsic.tickets.tickets.count) item.preimages += UInt32(block.extrinsic.preimages.preimages.count) - // try to change preimage size to preimage data or serviceIndices - item.preimagesBytes += UInt32(block.extrinsic.preimages.preimages.count*ConstInt32.value) + // try to change preimage size to serviceIndices + item.preimagesBytes += UInt32(block.extrinsic.preimages.preimages.reduce(into: 0) { $0 += $1.serviceIndices }) acc[block.header.authorIndex] = item for report in block.extrinsic.reports.guarantees { diff --git a/Blockchain/Sources/Blockchain/Types/ExtrinsicPreimages.swift b/Blockchain/Sources/Blockchain/Types/ExtrinsicPreimages.swift index 311bef0d..c7cd5a3f 100644 --- a/Blockchain/Sources/Blockchain/Types/ExtrinsicPreimages.swift +++ b/Blockchain/Sources/Blockchain/Types/ExtrinsicPreimages.swift @@ -4,10 +4,10 @@ import Utils public struct ExtrinsicPreimages: Sendable, Equatable { public struct SizeAndData: Sendable, Equatable { - public var serviceIndices: ServiceIdentifier + public var serviceIndices: ServiceIndices public var data: Data - public init(serviceIndices: ServiceIdentifier, data: Data) { + public init(serviceIndices: ServiceIndices, data: Data) { self.serviceIndices = serviceIndices self.data = data } diff --git a/Blockchain/Sources/Blockchain/Types/primitives.swift b/Blockchain/Sources/Blockchain/Types/primitives.swift index 4f81431c..6880a6da 100644 --- a/Blockchain/Sources/Blockchain/Types/primitives.swift +++ b/Blockchain/Sources/Blockchain/Types/primitives.swift @@ -4,7 +4,9 @@ public typealias Balances = UInt64 public typealias ServiceIdentifier = Data32 public typealias TimeslotIndex = UInt32 public typealias Gas = UInt64 +public typealias ServiceIndices = UInt32 public typealias DataLength = UInt32 + public typealias ValidatorIndex = UInt32 // TODO: confirm this public typealias CoreIndex = UInt32 // TODO: confirm this public typealias TicketIndex = UInt8