Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CE 134: Work-package sharing #303

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
3defaa1
update issue 278
MacOMNI Feb 15, 2025
f2809a6
update issues 279
MacOMNI Feb 16, 2025
d1e1d16
Work-package submission
MacOMNI Feb 17, 2025
0f5c6ff
update networkmanager
MacOMNI Feb 17, 2025
a17d2b6
update more test
MacOMNI Feb 17, 2025
03baf69
Merge branch 'master' into dev-issues-278
MacOMNI Feb 17, 2025
1dbb920
update workpackage hash
MacOMNI Feb 17, 2025
4389630
update networkmanager
MacOMNI Feb 17, 2025
2cd9a24
update workpackage
MacOMNI Feb 18, 2025
7d703de
Merge branch 'master' into dev-issues-278
MacOMNI Feb 18, 2025
7876bc7
Merge branch 'master' into dev-issues-278
MacOMNI Feb 18, 2025
8bd1d43
update workpackpool
MacOMNI Feb 18, 2025
9a5d238
update NetworkManagerTest
MacOMNI Feb 19, 2025
972ed2f
Merge branch 'dev-issues-278' into dev-issues-279
MacOMNI Feb 19, 2025
a93a95b
update workpackagepoolserver
MacOMNI Feb 20, 2025
496e50a
Merge branch 'master' into dev-issues-279
MacOMNI Feb 20, 2025
9277c93
Merge branch 'master' into dev-issues-279
MacOMNI Feb 20, 2025
3c217ac
update SegmentsRootMapping
MacOMNI Feb 21, 2025
818dc23
update Guaranteeing
MacOMNI Feb 21, 2025
1843edd
udpate guaranteeing
MacOMNI Feb 24, 2025
f74d966
shareWorkPackage adjust
MacOMNI Feb 24, 2025
e997aa7
update shareWorkPackage
MacOMNI Feb 25, 2025
7fe8cf5
Merge branch 'master' into dev-issues-279
MacOMNI Feb 25, 2025
ed08b97
update local
MacOMNI Feb 25, 2025
7bd8a02
update shareWorkPackage
MacOMNI Feb 25, 2025
7f28c6b
update
MacOMNI Feb 25, 2025
cdd3ba7
update handleWorkPackage
MacOMNI Feb 26, 2025
3020b98
update ShareWorkPackage
MacOMNI Feb 26, 2025
16d01e9
update Work-package sharing
MacOMNI Feb 26, 2025
2204eff
update WorkPackageShare
MacOMNI Feb 27, 2025
8ab084a
update GuaranteeingServiceTests
MacOMNI Feb 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 38 additions & 3 deletions Blockchain/Sources/Blockchain/RuntimeProtocols/RuntimeEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,54 @@
// When a work package is recived via CE133
public struct WorkPackagesReceived: Event {
public let coreIndex: CoreIndex
public let workPackageRef: WorkPackageRef
public let workPackage: WorkPackageRef
public let extrinsics: [Data]

public init(coreIndex: CoreIndex, workPackageRef: WorkPackageRef, extrinsics: [Data]) {
public init(coreIndex: CoreIndex, workPackage: WorkPackageRef, extrinsics: [Data]) {
self.coreIndex = coreIndex
self.workPackageRef = workPackageRef
self.workPackage = workPackage
self.extrinsics = extrinsics
}
}

// When a work package bundle is ready to shared via CE134
public struct WorkPackageBundleReady: Event {
public let coreIndex: CoreIndex
public let bundle: WorkPackageBundle
public let segmentsRootMappings: SegmentsRootMappings

public init(
coreIndex: CoreIndex,
bundle: WorkPackageBundle,
segmentsRootMappings: SegmentsRootMappings
) {
self.coreIndex = coreIndex
self.bundle = bundle
self.segmentsRootMappings = segmentsRootMappings
}

Check warning on line 82 in Blockchain/Sources/Blockchain/RuntimeProtocols/RuntimeEvents.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/RuntimeProtocols/RuntimeEvents.swift#L78-L82

Added lines #L78 - L82 were not covered by tests
}

// When a work package will be shared via CE134
public struct WorkPackageShare: Event {
public let coreIndex: CoreIndex
public let workPackage: WorkPackageRef
public let extrinsics: [Data]

public init(coreIndex: CoreIndex, workPackage: WorkPackageRef, extrinsics: [Data]) {
self.coreIndex = coreIndex
self.workPackage = workPackage
self.extrinsics = extrinsics
}
}

// When a work package bundle is recived via CE134
public struct WorkPackageBundleRecived: Event {
public let workPackageHash: Data32
public let edd25519Signature: Data64
public init(workPackageHash: Data32, edd25519Signature: Data64) {
self.workPackageHash = workPackageHash
self.edd25519Signature = edd25519Signature
}

Check warning on line 105 in Blockchain/Sources/Blockchain/RuntimeProtocols/RuntimeEvents.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/RuntimeProtocols/RuntimeEvents.swift#L102-L105

Added lines #L102 - L105 were not covered by tests
}

// When a work report is generated and ready to be distrubuted via CE135
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import Foundation
import Utils

public struct SegmentsRootMapping: Sendable, Equatable, Codable {
public let workPackageHash: Data32
public let segmentsRoot: Data32
}

public typealias SegmentsRootMappings = [SegmentsRootMapping]
169 changes: 152 additions & 17 deletions Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
public enum GuaranteeingServiceError: Error {
case noAuthorizerHash
case invalidExports
case invalidWorkPackage
case invalidBundle
case segmentsRootNotFound
}

public final class GuaranteeingService: ServiceBase2, @unchecked Sendable {
Expand Down Expand Up @@ -35,9 +38,17 @@

super.init(id: "GuaranteeingService", config: config, eventBus: eventBus, scheduler: scheduler)

await subscribe(RuntimeEvents.WorkPackageShare.self, id: "GuaranteeingService.ShareWorkPackage") { [weak self] event in
try await self?.on(workPackagSharee: event)
}

Check warning on line 43 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L42-L43

Added lines #L42 - L43 were not covered by tests

await subscribe(RuntimeEvents.WorkPackagesReceived.self, id: "GuaranteeingService.WorkPackagesReceived") { [weak self] event in
try await self?.on(workPackagesReceived: event)
}

await subscribe(RuntimeEvents.WorkPackageBundleReady.self, id: "GuaranteeingService.WorkPackageBundleReady") { [weak self] event in
try await self?.on(workPackageBundleReady: event)
}

Check warning on line 51 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L50-L51

Added lines #L50 - L51 were not covered by tests
}

public func onSyncCompleted() async {
Expand Down Expand Up @@ -78,16 +89,101 @@
}
}

private func on(workPackagSharee event: RuntimeEvents.WorkPackageShare) async throws {
guard try validate(workPackage: event.workPackage.value) else {
logger.error("Invalid work package: \(event.workPackage)")
throw GuaranteeingServiceError.invalidWorkPackage
}
// TODO: sometings need to do
}

Check warning on line 98 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L92-L98

Added lines #L92 - L98 were not covered by tests

private func on(workPackageBundleReady event: RuntimeEvents.WorkPackageBundleReady) async throws {
try await receiveWorkPackageBundleReady(
coreIndex: event.coreIndex,
segmentsRootMappings: event.segmentsRootMappings,
bundle: event.bundle
)
}

Check warning on line 106 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L100-L106

Added lines #L100 - L106 were not covered by tests

private func on(workPackageBundleReceived _: RuntimeEvents.WorkPackageBundleRecived) async throws {
// TODO: check somethings
}

Check warning on line 110 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L108-L110

Added lines #L108 - L110 were not covered by tests

// Method to receive a work package bundle ready
private func receiveWorkPackageBundleReady(
coreIndex _: CoreIndex,
segmentsRootMappings: SegmentsRootMappings,
bundle: WorkPackageBundle
) async throws {
// Perform basic verification
guard try validateWorkPackageBundle(bundle, segmentsRootMappings: segmentsRootMappings) else {
throw GuaranteeingServiceError.invalidBundle
}
}

Check warning on line 122 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L117-L122

Added lines #L117 - L122 were not covered by tests

private func validateWorkPackageBundle(
_ bundle: WorkPackageBundle,
segmentsRootMappings: SegmentsRootMappings
) throws -> Bool {
// Validate the work package authorization
guard try validateAuthorization(bundle.workPackage) else {
return false
}

// Validate the segments-root mappings
for mapping in segmentsRootMappings {
guard try validateSegmentsRootMapping(mapping, for: bundle.workPackage) else {
return false
}
}

return true
}

Check warning on line 141 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L127-L141

Added lines #L127 - L141 were not covered by tests

private func on(workPackagesReceived event: RuntimeEvents.WorkPackagesReceived) async throws {
try await refinePkg(package: event.workPackageRef)
try await handleWorkPackage(coreIndex: event.coreIndex, workPackage: event.workPackage, extrinsics: event.extrinsics)
}

private func refinePkg(package: WorkPackageRef) async throws {
// handle Work Package
public func handleWorkPackage(coreIndex: CoreIndex, workPackage: WorkPackageRef, extrinsics: [Data]) async throws {
// Validate the work package
guard try validate(workPackage: workPackage.value) else {
logger.error("Invalid work package: \(workPackage)")
throw GuaranteeingServiceError.invalidWorkPackage

Check warning on line 152 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L151-L152

Added lines #L151 - L152 were not covered by tests
}
guard let (validatorIndex, signingKey) = signingKey.value else {
logger.debug("not in current validator set, skipping refine")
return
}

// Share work package
let shareWorkPackageEvent = RuntimeEvents.WorkPackageShare(coreIndex: coreIndex, workPackage: workPackage, extrinsics: extrinsics)
publish(shareWorkPackageEvent)

// check & refine
let (bundle, mappings, workReport) = try await refinePkg(
validatorIndex: validatorIndex,
workPackage: workPackage,
extrinsics: extrinsics
)

// Share work bundle
let shareWorkBundleEvent = RuntimeEvents.WorkPackageBundleReady(
coreIndex: coreIndex,
bundle: bundle,
segmentsRootMappings: mappings
)
publish(shareWorkBundleEvent)
// Sign work report & work-report distribution via CE 135
let payload = SigningContext.guarantee + workReport.hash().data
let signature = try signingKey.sign(message: payload)
let workReportEvent = RuntimeEvents.WorkReportGenerated(item: workReport, signature: signature)
publish(workReportEvent)
}

Check warning on line 182 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L159-L182

Added lines #L159 - L182 were not covered by tests

private func refinePkg(validatorIndex: ValidatorIndex, workPackage: WorkPackageRef,
extrinsics: [Data]) async throws -> (WorkPackageBundle, SegmentsRootMappings, WorkReport)
{

Check warning on line 186 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L186

Added line #L186 was not covered by tests
let state = try await dataProvider.getState(hash: dataProvider.bestHead.hash)

// TODO: check for edge cases such as epoch end
Expand All @@ -96,24 +192,63 @@
randomness: state.value.entropyPool.t2,
timeslot: state.value.timeslot + 1
)
// TODO: coreIndex equal with shareWorkPackage coreIndex?

Check warning on line 195 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L195

Added line #L195 was not covered by tests
guard let coreIndex = currentCoreAssignment[safe: Int(validatorIndex)] else {
try throwUnreachable("invalid validator index/core assignment")
}

let workReport = try await createWorkReport(for: package, coreIndex: coreIndex)
let payload = SigningContext.guarantee + workReport.hash().data
let signature = try signingKey.sign(message: payload)
let event = RuntimeEvents.WorkReportGenerated(item: workReport, signature: signature)
publish(event)
// Create work report & WorkPackageBundle
return try await createWorkReport(
coreIndex: coreIndex,
workPackage: workPackage,
extrinsics: extrinsics
)
}

Check warning on line 206 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L200-L206

Added lines #L200 - L206 were not covered by tests

private func validateSegmentsRootMapping(
_: SegmentsRootMapping,
for _: WorkPackage
) throws -> Bool {
// TODO: Implement logic to validate the segments-root mapping
true // Placeholder
}

Check warning on line 214 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L211-L214

Added lines #L211 - L214 were not covered by tests

private func validateAuthorization(_: WorkPackage) throws -> Bool {
// TODO: Implement logic to validate the work package authorization
true // Placeholder
}

Check warning on line 219 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L216-L219

Added lines #L216 - L219 were not covered by tests

// TODO: Add validate func
private func validate(workPackage _: WorkPackage) throws -> Bool {
// 1. Check if it is possible to generate a work-report
// 2. Check all import segments have been retrieved
true
}

private func retrieveImportSegments(for _: WorkPackage) async throws -> [Data4104] {
// TODO: Implement retrieveImportSegments
// Implement logic to retrieve imported data segments
// For example, fetch from the data availability layer
[] // Placeholder
}

Check warning on line 233 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L228-L233

Added lines #L228 - L233 were not covered by tests

private func retrieveJustifications(for _: WorkPackage) async throws -> [Data] {
// TODO: Implement retrieveJustifications
// Implement logic to retrieve justifications for the imported segments
// For example, fetch proofs from the data availability layer
[] // Placeholder

Check warning on line 239 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L235-L239

Added lines #L235 - L239 were not covered by tests
}

// workpackage -> workresult -> workreport
private func createWorkReport(for workPackage: WorkPackageRef, coreIndex: CoreIndex) async throws -> WorkReport {
private func createWorkReport(coreIndex: CoreIndex, workPackage: WorkPackageRef,
extrinsics: [Data]) async throws -> (WorkPackageBundle, SegmentsRootMappings, WorkReport)
{

Check warning on line 245 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L245

Added line #L245 was not covered by tests
let state = try await dataProvider.getState(hash: dataProvider.bestHead.hash)
let packageHash = workPackage.hash
let corePool = state.value.coreAuthorizationPool[coreIndex]
let authorizerHash = try corePool.array.first.unwrap(orError: GuaranteeingServiceError.noAuthorizerHash)
var exportSegmentOffset: UInt16 = 0
var mappings: SegmentsRootMappings = []

Check warning on line 251 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L251

Added line #L251 was not covered by tests
// B.2. the authorization output, the result of the Is-Authorized function
// TODO: waiting for authorizationFunction done Mock a result
// let res = try await authorizationFunction.invoke(config: config, serviceAccounts: state.value, package: workPackage, coreIndex:
Expand Down Expand Up @@ -160,16 +295,16 @@

exportSegments.append(contentsOf: refineRes.exports)
}

let (erasureRoot, length) = try await dataAvailability.exportWorkpackageBundle(bundle: WorkPackageBundle(
let bundle = try await WorkPackageBundle(

Check warning on line 298 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L298

Added line #L298 was not covered by tests
workPackage: workPackage.value,
extrinsic: [], // TODO: get extrinsic data
importSegments: [],
justifications: []
))
extrinsic: extrinsics,
importSegments: retrieveImportSegments(for: workPackage.value),
justifications: retrieveJustifications(for: workPackage.value)
)
let (erasureRoot, length) = try await dataAvailability.exportWorkpackageBundle(bundle: bundle)

Check warning on line 304 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L300-L304

Added lines #L300 - L304 were not covered by tests

let segmentRoot = try await dataAvailability.exportSegments(data: exportSegments, erasureRoot: erasureRoot)

mappings.append(SegmentsRootMapping(workPackageHash: packageHash, segmentsRoot: segmentRoot))

Check warning on line 307 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L307

Added line #L307 was not covered by tests
// TODO: generate or find AvailabilitySpecifications 14.4.1 work-package bundle
let packageSpecification = AvailabilitySpecifications(
workPackageHash: packageHash,
Expand All @@ -183,15 +318,15 @@
for item in state.value.recentHistory.items {
oldLookups.merge(item.lookup, uniquingKeysWith: { _, new in new })
}
return try WorkReport(
return try (bundle, mappings, WorkReport(

Check warning on line 321 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L321

Added line #L321 was not covered by tests
authorizerHash: authorizerHash,
coreIndex: coreIndex,
authorizationOutput: authorizationOutput,
refinementContext: workPackage.value.context,
packageSpecification: packageSpecification,
lookup: oldLookups,
results: ConfigLimitedSizeArray(config: config, array: workResults)
)
))

Check warning on line 329 in Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/Validator/GuaranteeingService.swift#L329

Added line #L329 was not covered by tests

case let .failure(error):
logger.error("Authorization failed with error: \(error)")
Expand Down
10 changes: 10 additions & 0 deletions Blockchain/Tests/BlockchainTests/GuaranteeingServiceTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ struct GuaranteeingServiceTests {
#expect(signingKey.0 == 0)
#expect(signingKey.1.publicKey == publicKey)
}

@Test func workPackagesReceived() async throws {
let (services, guaranteeingService) = try await setup(keysCount: 0)

await guaranteeingService.onSyncCompleted()

let workpackage = WorkPackage.dummy(config: services.config)
await services.eventBus
.publish(RuntimeEvents.WorkPackagesReceived(coreIndex: 0, workPackage: workpackage.asRef(), extrinsics: []))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
case safroleTicket1(SafroleTicketMessage)
case safroleTicket2(SafroleTicketMessage)
case workPackageSubmission(WorkPackageMessage)
case workPackageSharing(WorkPackageMessage)
}

extension CERequest: RequestProtocol {
Expand All @@ -23,6 +24,8 @@
try JamEncoder.encode(message)
case let .workPackageSubmission(message):
try JamEncoder.encode(message)
case let .workPackageSharing(message):
try JamEncoder.encode(message)

Check warning on line 28 in Node/Sources/Node/NetworkingProtocol/CommonEphemeral/CERequest.swift

View check run for this annotation

Codecov / codecov/patch

Node/Sources/Node/NetworkingProtocol/CommonEphemeral/CERequest.swift#L28

Added line #L28 was not covered by tests
}
}

Expand All @@ -36,6 +39,8 @@
.safroleTicket2
case .workPackageSubmission:
.workPackageSubmission
case .workPackageSharing:
.workPackageSharing

Check warning on line 43 in Node/Sources/Node/NetworkingProtocol/CommonEphemeral/CERequest.swift

View check run for this annotation

Codecov / codecov/patch

Node/Sources/Node/NetworkingProtocol/CommonEphemeral/CERequest.swift#L43

Added line #L43 was not covered by tests
}
}

Expand All @@ -49,6 +54,8 @@
SafroleTicketMessage.self
case .workPackageSubmission:
WorkPackageMessage.self
case .workPackageSharing:
WorkPackageMessage.self

Check warning on line 58 in Node/Sources/Node/NetworkingProtocol/CommonEphemeral/CERequest.swift

View check run for this annotation

Codecov / codecov/patch

Node/Sources/Node/NetworkingProtocol/CommonEphemeral/CERequest.swift#L58

Added line #L58 was not covered by tests
default:
fatalError("unimplemented")
}
Expand All @@ -74,6 +81,9 @@
case .workPackageSubmission:
guard let message = data as? WorkPackageMessage else { return nil }
return .workPackageSubmission(message)
case .workPackageSharing:
guard let message = data as? WorkPackageMessage else { return nil }
return .workPackageSharing(message)

Check warning on line 86 in Node/Sources/Node/NetworkingProtocol/CommonEphemeral/CERequest.swift

View check run for this annotation

Codecov / codecov/patch

Node/Sources/Node/NetworkingProtocol/CommonEphemeral/CERequest.swift#L85-L86

Added lines #L85 - L86 were not covered by tests
default:
fatalError("unimplemented")
}
Expand Down
13 changes: 12 additions & 1 deletion Node/Sources/Node/NetworkingProtocol/NetworkManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,18 @@
event: RuntimeEvents
.WorkPackagesReceived(
coreIndex: message.coreIndex,
workPackageRef: message.workPackage.asRef(),
workPackage: message.workPackage.asRef(),
extrinsics: message.extrinsics
)
)
return []

Check warning on line 239 in Node/Sources/Node/NetworkingProtocol/NetworkManager.swift

View check run for this annotation

Codecov / codecov/patch

Node/Sources/Node/NetworkingProtocol/NetworkManager.swift#L235-L239

Added lines #L235 - L239 were not covered by tests
case let .workPackageSharing(message):
blockchain
.publish(
event: RuntimeEvents
.WorkPackageShare(
coreIndex: message.coreIndex,
workPackage: message.workPackage.asRef(),

Check warning on line 246 in Node/Sources/Node/NetworkingProtocol/NetworkManager.swift

View check run for this annotation

Codecov / codecov/patch

Node/Sources/Node/NetworkingProtocol/NetworkManager.swift#L241-L246

Added lines #L241 - L246 were not covered by tests
extrinsics: message.extrinsics
)
)
Expand Down
Loading