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

Temporary fix for the bucket storage version selection #11

Merged
merged 1 commit into from
Aug 13, 2024
Merged
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
20 changes: 16 additions & 4 deletions src/processors/ddcBucketsProcessor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,17 @@ export class DdcBucketsProcessor extends BaseProcessor<State> {
bucketId: bigint,
block: BlockHeader,
) {
// TODO(khssnv)
// The `blockSpecVersion` is added because previously the following
// `storage.ddcCustomers.buckets.v48013.is(block)` returned `true` when `v54100` is
// expected. Remove it and return back to the `.is(block)` version selector when
// the problem is fixed. With `blockSpecVersion` we can't detect if incoming block has an
// unsupported future version of the storage.
const blockSpecVersion = block._runtime.specVersion

let bucketInfo: DdcBucketInfo | undefined
if (storage.ddcCustomers.buckets.v48013.is(block)) {
// if (storage.ddcCustomers.buckets.v48013.is(block)) {
if (blockSpecVersion >= 48013 && blockSpecVersion < 48017) {
const bucket = await storage.ddcCustomers.buckets.v48013.get(
block,
bucketId,
Expand All @@ -50,7 +59,8 @@ export class DdcBucketsProcessor extends BaseProcessor<State> {
numberOfGets: 0n,
}
}
} else if (storage.ddcCustomers.buckets.v48017.is(block)) {
// } else if (storage.ddcCustomers.buckets.v48017.is(block)) {
} else if (blockSpecVersion <= 48017 && blockSpecVersion < 50000) {
const bucket = await storage.ddcCustomers.buckets.v48017.get(
block,
bucketId,
Expand All @@ -68,7 +78,8 @@ export class DdcBucketsProcessor extends BaseProcessor<State> {
numberOfGets: 0n,
}
}
} else if (storage.ddcCustomers.buckets.v50000.is(block)) {
// } else if (storage.ddcCustomers.buckets.v50000.is(block)) {
} else if (blockSpecVersion >= 50000 && blockSpecVersion < 54100) {
const bucket = await storage.ddcCustomers.buckets.v50000.get(
block,
bucketId,
Expand All @@ -86,7 +97,8 @@ export class DdcBucketsProcessor extends BaseProcessor<State> {
numberOfGets: 0n,
}
}
} else if (storage.ddcCustomers.buckets.v54100.is(block)) {
// } else if (storage.ddcCustomers.buckets.v54100.is(block)) {
} else if (blockSpecVersion >= 54100) {
const bucket = await storage.ddcCustomers.buckets.v54100.get(
block,
bucketId,
Expand Down