Skip to content

Commit

Permalink
fix: revert operatorsWereChanged logic
Browse files Browse the repository at this point in the history
  • Loading branch information
eddort committed Dec 19, 2023
1 parent 2471e3f commit 92ecf44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
19 changes: 3 additions & 16 deletions src/common/registry/main/abstract-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { RegistryOperator } from '../storage/operator.entity';

import { compareOperators } from '../utils/operator.utils';

import { BLOCKS_OVERLAP, REGISTRY_GLOBAL_OPTIONS_TOKEN } from './constants';
import { REGISTRY_GLOBAL_OPTIONS_TOKEN } from './constants';
import { RegistryOptions } from './interfaces/module.interface';
import { chunk } from '@lido-nestjs/utils';
import { RegistryKeyBatchFetchService } from '../fetch/key-batch.fetch';
Expand Down Expand Up @@ -72,22 +72,9 @@ export abstract class AbstractRegistryService {
*/
public async operatorsWereChanged(
moduleAddress: string,
{
fromBlockNumber,
toBlockNumber,
}: {
fromBlockNumber?: number;
toBlockNumber: number;
},
fromBlockNumber: number,
toBlockNumber: number,
): Promise<boolean> {
if (fromBlockNumber === undefined) return true;

if (fromBlockNumber > toBlockNumber) {
throw new Error(`invalid blocks range: ${fromBlockNumber} (fromBlockNumber) > ${toBlockNumber} (toBlockNumber)`);
}
// check how big the difference between the blocks is, if it exceeds, we should update the state anyway
if (toBlockNumber - fromBlockNumber > BLOCKS_OVERLAP) return true;
// rename
return await this.operatorFetch.operatorsWereChanged(moduleAddress, fromBlockNumber, toBlockNumber);
}

Expand Down
1 change: 0 additions & 1 deletion src/common/registry/main/constants.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export const REGISTRY_GLOBAL_OPTIONS_TOKEN = Symbol('registryGlobalOptions');
export const BLOCKS_OVERLAP = 120;

0 comments on commit 92ecf44

Please sign in to comment.