-
Notifications
You must be signed in to change notification settings - Fork 0
Work-report distribution & Work-report request #328
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
Merged
Changes from all commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
1235013
update Work-report distribution
MacOMNI b94eaa1
update workReportRequest
MacOMNI daa2f98
update WorkReportRef
MacOMNI 3a55564
update blockchain
MacOMNI c61f810
update workreport
MacOMNI abf31c4
update swift testing
MacOMNI 64e90d0
update package
MacOMNI 8f2ed97
fix xcode udpate issues
MacOMNI 032e49f
update tests
MacOMNI fccdc11
update guaranteedWorkReport
MacOMNI b187b97
update work report
MacOMNI 8d6087c
update db
MacOMNI 876bc86
update OnSyncCompleted
MacOMNI b50d929
update networkmanager
MacOMNI 3925ab0
update block request
MacOMNI 0212d13
update more tests
MacOMNI fa89824
update open rpc
MacOMNI 413d107
fix some unstable tests
MacOMNI bfb8164
fix some issues
MacOMNI 4ff9b78
fix open rpc
MacOMNI 2694049
update OpenRPC
MacOMNI 96c0969
update OpenRPC
MacOMNI 6cba5ef
update open rpc
MacOMNI 645fc48
Merge branch 'master' into dev-JAMNP
MacOMNI 223b7e7
update swiftlint
MacOMNI 2a6476b
update OpenRPC
MacOMNI d9c93bc
update OpenRPC
MacOMNI 81c2cd9
update vapor
MacOMNI 438a454
update vapor
MacOMNI c1a3f6c
fix unstable tests
MacOMNI 8b8a7f5
fix unstable tests
MacOMNI 812a01b
fix unstable tests
MacOMNI 6198b3e
update some issues
MacOMNI de831e8
update networkmanager
MacOMNI 805bde6
update vapor
MacOMNI b4e1e6b
update vapor
MacOMNI 2456272
update rpc package
MacOMNI 0ed4dbb
update swift test
MacOMNI c1f6769
update swift pm
MacOMNI b32f842
update package
MacOMNI 54be471
update swift testing
MacOMNI 38f70df
update more tests
MacOMNI d3d277a
update swift testing
MacOMNI File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
Blockchain/Sources/Blockchain/Types/GuaranteedWorkReport.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import Codec | ||
import Foundation | ||
import Utils | ||
|
||
public struct GuaranteedWorkReport: Sendable, Equatable, Codable, Hashable { | ||
public let workReport: WorkReport | ||
public let slot: UInt32 | ||
public let signatures: [ValidatorSignature] | ||
|
||
public init( | ||
workReport: WorkReport, | ||
slot: UInt32, | ||
signatures: [ValidatorSignature] | ||
) { | ||
self.workReport = workReport | ||
self.slot = slot | ||
self.signatures = signatures | ||
} | ||
} | ||
|
||
extension GuaranteedWorkReport: Hashable32 { | ||
public func hash() -> Data32 { | ||
try! JamEncoder.encode(self).blake2b256hash() | ||
} | ||
} | ||
|
||
extension GuaranteedWorkReport: Dummy { | ||
public typealias Config = ProtocolConfigRef | ||
public static func dummy(config: Config) -> GuaranteedWorkReport { | ||
GuaranteedWorkReport( | ||
workReport: WorkReport.dummy(config: config), | ||
slot: 0, | ||
signatures: [] | ||
) | ||
} | ||
} | ||
|
||
extension GuaranteedWorkReport { | ||
public func asRef() -> GuaranteedWorkReportRef { | ||
GuaranteedWorkReportRef(self) | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Blockchain/Sources/Blockchain/Types/GuaranteedWorkReportRef.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Codec | ||
import Foundation | ||
import Utils | ||
|
||
public final class GuaranteedWorkReportRef: RefWithHash<GuaranteedWorkReport>, @unchecked Sendable { | ||
public var workReport: WorkReport { value.workReport } | ||
public var slot: UInt32 { value.slot } | ||
public var signatures: [ValidatorSignature] { value.signatures } | ||
override public var description: String { | ||
"GuaranteedWorkReport(hash: \(workReport.hash()), timeslot: \(slot))" | ||
} | ||
} | ||
|
||
extension GuaranteedWorkReportRef: Codable { | ||
public convenience init(from decoder: Decoder) throws { | ||
try self.init(.init(from: decoder)) | ||
} | ||
|
||
public func encode(to encoder: Encoder) throws { | ||
try value.encode(to: encoder) | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
best to have a
remove(blockHash: Data32)
and aremove(workReportHash: Data32)
to ensure we don't mix different kinds of hashes