Skip to content

update to GP 0.6.6 #334

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
merged 16 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ extension BlockchainDataProvider {
try await dataProvider.getFinalizedHead()
}

public func getKeys(prefix: Data32, count: UInt32, startKey: Data32?, blockHash: Data32?) async throws -> [String] {
public func getKeys(prefix: Data31, count: UInt32, startKey: Data31?, blockHash: Data32?) async throws -> [String] {
try await dataProvider.getKeys(prefix: prefix, count: count, startKey: startKey, blockHash: blockHash)
}

public func getStorage(key: Data32, blockHash: Data32?) async throws -> [String] {
public func getStorage(key: Data31, blockHash: Data32?) async throws -> [String] {
try await dataProvider.getStorage(key: key, blockHash: blockHash)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ public protocol BlockchainDataProviderProtocol: Sendable {

func getHeads() async throws -> Set<Data32>

func getKeys(prefix: Data32, count: UInt32, startKey: Data32?, blockHash: Data32?) async throws -> [String]
func getKeys(prefix: Data31, count: UInt32, startKey: Data31?, blockHash: Data32?) async throws -> [String]

func getStorage(key: Data32, blockHash: Data32?) async throws -> [String]
func getStorage(key: Data31, blockHash: Data32?) async throws -> [String]

/// return empty set if not found
func getBlockHash(byTimeslot timeslot: TimeslotIndex) async throws -> Set<Data32>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
guaranteedWorkReports[guaranteedWorkReport.value.workReport.hash()] = guaranteedWorkReport
}

public func getKeys(prefix: Data32, count: UInt32, startKey: Data32?, blockHash: Data32?) async throws -> [String] {
public func getKeys(prefix: Data31, count: UInt32, startKey: Data31?, blockHash: Data32?) async throws -> [String] {

Check warning on line 38 in Blockchain/Sources/Blockchain/BlockchainDataProvider/InMemoryDataProvider.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/BlockchainDataProvider/InMemoryDataProvider.swift#L38

Added line #L38 was not covered by tests
guard let stateRef = try getState(hash: blockHash ?? genesisBlockHash) else {
return []
}

return try await stateRef.value.backend.getKeys(prefix, startKey, count).map { $0.key.toHexString() }
}

public func getStorage(key: Data32, blockHash: Data32?) async throws -> [String] {
public func getStorage(key: Data31, blockHash: Data32?) async throws -> [String] {

Check warning on line 46 in Blockchain/Sources/Blockchain/BlockchainDataProvider/InMemoryDataProvider.swift

View check run for this annotation

Codecov / codecov/patch

Blockchain/Sources/Blockchain/BlockchainDataProvider/InMemoryDataProvider.swift#L46

Added line #L46 was not covered by tests
guard let stateRef = try getState(hash: blockHash ?? genesisBlockHash) else {
return []
}
Expand Down
90 changes: 60 additions & 30 deletions Blockchain/Sources/Blockchain/Config/ProtocolConfig+Preset.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 6,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -39,15 +39,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 4,
maxAuthorizationsQueueItems: 10,
coreAssignmentRotationPeriod: 6,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 3,
erasureCodedPieceSize: 2,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 6,
ticketSubmissionEndSlot: 2,
pvmDynamicAddressAlignmentFactor: 2,
Expand All @@ -67,7 +70,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 12,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -81,15 +84,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 6,
maxAuthorizationsQueueItems: 80,
coreAssignmentRotationPeriod: 10,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 6,
erasureCodedPieceSize: 684,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 6,
ticketSubmissionEndSlot: 10,
pvmDynamicAddressAlignmentFactor: 2,
Expand All @@ -108,7 +114,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 12,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -122,15 +128,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 6,
maxAuthorizationsQueueItems: 80,
coreAssignmentRotationPeriod: 4,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 6,
erasureCodedPieceSize: 4,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 1026,
ticketSubmissionEndSlot: 10,
pvmDynamicAddressAlignmentFactor: 2,
Expand All @@ -149,7 +158,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 36,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -163,15 +172,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 6,
maxAuthorizationsQueueItems: 80,
coreAssignmentRotationPeriod: 4,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 12,
erasureCodedPieceSize: 8,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 513,
ticketSubmissionEndSlot: 30,
pvmDynamicAddressAlignmentFactor: 2,
Expand All @@ -190,7 +202,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 60,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -204,15 +216,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 6,
maxAuthorizationsQueueItems: 80,
coreAssignmentRotationPeriod: 4,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 18,
erasureCodedPieceSize: 12,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 342,
ticketSubmissionEndSlot: 50,
pvmDynamicAddressAlignmentFactor: 2,
Expand All @@ -231,7 +246,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 120,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -245,15 +260,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 6,
maxAuthorizationsQueueItems: 80,
coreAssignmentRotationPeriod: 4,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 36,
erasureCodedPieceSize: 24,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 171,
ticketSubmissionEndSlot: 100,
pvmDynamicAddressAlignmentFactor: 2,
Expand All @@ -272,7 +290,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 240,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -286,15 +304,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 6,
maxAuthorizationsQueueItems: 80,
coreAssignmentRotationPeriod: 4,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 108,
erasureCodedPieceSize: 72,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 57,
ticketSubmissionEndSlot: 200,
pvmDynamicAddressAlignmentFactor: 2,
Expand All @@ -313,7 +334,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 300,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -327,15 +348,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 6,
maxAuthorizationsQueueItems: 80,
coreAssignmentRotationPeriod: 4,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 342,
erasureCodedPieceSize: 228,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 18,
ticketSubmissionEndSlot: 250,
pvmDynamicAddressAlignmentFactor: 2,
Expand All @@ -354,7 +378,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 600,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -368,15 +392,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 6,
maxAuthorizationsQueueItems: 80,
coreAssignmentRotationPeriod: 4,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 684,
erasureCodedPieceSize: 456,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 9,
ticketSubmissionEndSlot: 500,
pvmDynamicAddressAlignmentFactor: 2,
Expand All @@ -395,7 +422,7 @@ extension Ref where T == ProtocolConfig {
epochLength: 600,
auditBiasFactor: 2,
workReportAccumulationGas: Gas(10_000_000),
workPackageAuthorizerGas: Gas(50_000_000),
workPackageIsAuthorizedGas: Gas(50_000_000),
workPackageRefineGas: Gas(5_000_000_000),
totalAccumulationGas: Gas(3_500_000_000),
recentHistorySize: 8,
Expand All @@ -409,15 +436,18 @@ extension Ref where T == ProtocolConfig {
slotPeriodSeconds: 6,
maxAuthorizationsQueueItems: 80,
coreAssignmentRotationPeriod: 10,
maxAccumulationQueueItems: 1024,
maxWorkPackageExtrinsics: 128,
maxIsAuthorizedCodeSize: 64000,
maxServiceCodeSize: 4_000_000,
preimageReplacementPeriod: 5,
totalNumberOfValidators: 1023,
erasureCodedPieceSize: 684,
maxWorkPackageImportsExports: 3072,
maxWorkPackageImports: 3072,
maxWorkPackageExports: 3072,
maxEncodedWorkPackageSize: 12 * 1 << 20,
segmentSize: 4104,
maxWorkReportOutputSize: 48 * 1 << 10,
maxWorkReportBlobSize: 48 * 1 << 10,
erasureCodedSegmentSize: 6,
ticketSubmissionEndSlot: 500,
pvmDynamicAddressAlignmentFactor: 2,
Expand Down
Loading