Skip to content

Commit

Permalink
Merge pull request #11 from Cerebellum-Network/fix/wrong-version-sele…
Browse files Browse the repository at this point in the history
…ction

Temporary fix for the bucket storage version selection
  • Loading branch information
khssnv authored Aug 13, 2024
2 parents 635b47f + 60b1a26 commit b27846c
Showing 1 changed file with 16 additions and 4 deletions.
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

0 comments on commit b27846c

Please sign in to comment.