Skip to content

Commit

Permalink
add coding as
Browse files Browse the repository at this point in the history
  • Loading branch information
qiweiii committed Nov 11, 2024
1 parent a539a29 commit 1043c2b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Blockchain/Sources/Blockchain/Types/RecentHistory.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Codec
import Utils

// β
Expand All @@ -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<SortedKeyValues<Data32, Data32>> public var lookup: [Data32: Data32]

public init(
headerHash: Data32,
Expand Down
6 changes: 3 additions & 3 deletions Blockchain/Sources/Blockchain/Types/RefinementContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -43,7 +43,7 @@ public struct RefinementContext: Sendable, Equatable, Codable, Hashable {
public var lookupAnchor: LookupAnchor

// p
public var prerequisiteWorkPackages: Set<Data32>
@CodingAs<SortedSet<Data32>> public var prerequisiteWorkPackages: Set<Data32>

public init(anchor: Anchor, lookupAnchor: LookupAnchor, prerequisiteWorkPackages: Set<Data32>) {
self.anchor = anchor
Expand Down
2 changes: 1 addition & 1 deletion Blockchain/Sources/Blockchain/Types/WorkReport.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<SortedKeyValues<Data32, Data32>> public var lookup: [Data32: Data32]

// r: the results of the evaluation of each of the items in the package
public var results: ConfigLimitedSizeArray<
Expand Down

0 comments on commit 1043c2b

Please sign in to comment.