Skip to content

Commit

Permalink
work package bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
xlc committed Dec 18, 2024
1 parent 79d30fb commit 504373d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Blockchain/Sources/Blockchain/Types/WorkPackageBundle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import Foundation
import Utils

// All the necessary data to audit a work package. Stored in audits DA
public struct WorkPackageBundle: Sendable, Equatable, Codable {
public var workPackage: WorkPackage
public var extrinsic: [Data]
public var importSegments: [[Data]]
public var justifications: [[Data]]
}
20 changes: 20 additions & 0 deletions Blockchain/Sources/Blockchain/Validator/DataAvailability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,25 @@ public final class DataAvailability: ServiceBase2, @unchecked Sendable {

public func purge(epoch _: EpochIndex) async {
// TODO: purge data
// GP 14.3.1
// Guarantors are required to erasure-code and distribute two data sets: one blob, the auditable work-package containing
// the encoded work-package, extrinsic data and self-justifying imported segments which is placed in the short-term Audit
// da store and a second set of exported-segments data together with the Paged-Proofs metadata. Items in the first store
// are short-lived; assurers are expected to keep them only until finality of the block in which the availability of the work-
// result’s work-package is assured. Items in the second, meanwhile, are long-lived and expected to be kept for a minimum
// of 28 days (672 complete epochs) following the reporting of the work-report.
}

public func fetchSegment(root _: Data32, index _: UInt16) async throws -> Data? {
// TODO: fetch segment
nil
}

public func exportSegments(data _: [Data]) async throws {
// TODO: export segments
}

public func distributeWorkpackageBundle(bundle _: WorkPackageBundle) async throws {
// TODO: distribute workpackage bundle to audits DA
}
}

0 comments on commit 504373d

Please sign in to comment.