Skip to content

Commit

Permalink
#update Preimages serviceIndices
Browse files Browse the repository at this point in the history
  • Loading branch information
MacOMNI committed Aug 19, 2024
1 parent 3b6085d commit 6b78d98
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Blockchain/Sources/Blockchain/Runtime.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions Blockchain/Sources/Blockchain/Types/ExtrinsicPreimages.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions Blockchain/Sources/Blockchain/Types/primitives.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6b78d98

Please sign in to comment.