From 1043c2befd6f83ba076b5a7cab69ba18ae8b05fc Mon Sep 17 00:00:00 2001 From: Qiwei Yang Date: Mon, 11 Nov 2024 14:44:39 +0800 Subject: [PATCH] add coding as --- Blockchain/Sources/Blockchain/Types/RecentHistory.swift | 5 +++-- Blockchain/Sources/Blockchain/Types/RefinementContext.swift | 6 +++--- Blockchain/Sources/Blockchain/Types/WorkReport.swift | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Blockchain/Sources/Blockchain/Types/RecentHistory.swift b/Blockchain/Sources/Blockchain/Types/RecentHistory.swift index 574a5311..dfe456be 100644 --- a/Blockchain/Sources/Blockchain/Types/RecentHistory.swift +++ b/Blockchain/Sources/Blockchain/Types/RecentHistory.swift @@ -1,3 +1,4 @@ +import Codec import Utils // β @@ -12,8 +13,8 @@ public struct RecentHistory: Sendable, Equatable, Codable { // s public var stateRoot: Data32 - // p: work report: segment root lookup - public var lookup: [Data32: Data32] + // p: work report hahs -> segment root lookup + @CodingAs> public var lookup: [Data32: Data32] public init( headerHash: Data32, diff --git a/Blockchain/Sources/Blockchain/Types/RefinementContext.swift b/Blockchain/Sources/Blockchain/Types/RefinementContext.swift index 84587da2..3fc97553 100644 --- a/Blockchain/Sources/Blockchain/Types/RefinementContext.swift +++ b/Blockchain/Sources/Blockchain/Types/RefinementContext.swift @@ -3,8 +3,8 @@ import Utils // A refinement context, denoted by the set X, describes the context of the chain // at the point that the report’s corresponding work-package was evaluated. -public struct RefinementContext: Sendable, Equatable, Codable, Hashable { - public struct Anchor: Sendable, Equatable, Codable, Hashable { +public struct RefinementContext: Sendable, Equatable, Codable { + public struct Anchor: Sendable, Equatable, Codable { // a public var headerHash: Data32 // s @@ -43,7 +43,7 @@ public struct RefinementContext: Sendable, Equatable, Codable, Hashable { public var lookupAnchor: LookupAnchor // p - public var prerequisiteWorkPackages: Set + @CodingAs> public var prerequisiteWorkPackages: Set public init(anchor: Anchor, lookupAnchor: LookupAnchor, prerequisiteWorkPackages: Set) { self.anchor = anchor diff --git a/Blockchain/Sources/Blockchain/Types/WorkReport.swift b/Blockchain/Sources/Blockchain/Types/WorkReport.swift index c554633a..0b5d6054 100644 --- a/Blockchain/Sources/Blockchain/Types/WorkReport.swift +++ b/Blockchain/Sources/Blockchain/Types/WorkReport.swift @@ -19,7 +19,7 @@ public struct WorkReport: Sendable, Equatable, Codable { public var authorizationOutput: Data // l: segment-root lookup dictionary - public var lookup: [Data32: Data32] + @CodingAs> public var lookup: [Data32: Data32] // r: the results of the evaluation of each of the items in the package public var results: ConfigLimitedSizeArray<