diff --git a/src/processors/ddcBucketsProcessor.ts b/src/processors/ddcBucketsProcessor.ts index 3fdced5..ff05c10 100644 --- a/src/processors/ddcBucketsProcessor.ts +++ b/src/processors/ddcBucketsProcessor.ts @@ -31,8 +31,17 @@ export class DdcBucketsProcessor extends BaseProcessor { 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, @@ -50,7 +59,8 @@ export class DdcBucketsProcessor extends BaseProcessor { 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, @@ -68,7 +78,8 @@ export class DdcBucketsProcessor extends BaseProcessor { 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, @@ -86,7 +97,8 @@ export class DdcBucketsProcessor extends BaseProcessor { 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,