Skip to content

Commit

Permalink
Merge pull request #227 from lidofinance/feat/new-updater-refactoring
Browse files Browse the repository at this point in the history
Feat/new updater refactoring
  • Loading branch information
eddort authored Dec 21, 2023
2 parents 7b018f3 + 0c649a1 commit 9906c1e
Show file tree
Hide file tree
Showing 25 changed files with 815 additions and 201 deletions.
8 changes: 4 additions & 4 deletions src/app/simple-dvt-deploy.e2e-chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { RegistryKeyStorageService } from '../common/registry';
import { ElMetaStorageService } from '../storage/el-meta.storage';
import { SRModuleStorageService } from '../storage/sr-module.storage';
import { KeysUpdateService } from '../jobs/keys-update';
import { ExecutionProvider, ExecutionProviderService } from '../common/execution-provider';
import { ExecutionProvider } from '../common/execution-provider';
import { ConfigService } from '../common/config';
import { PrometheusService } from '../common/prometheus';
import { StakingRouterService } from '../staking-router-modules/staking-router.service';
Expand Down Expand Up @@ -64,8 +64,6 @@ describe('Simple DVT deploy', () => {
});

moduleRef = await Test.createTestingModule({ imports: [AppModule] })
.overrideProvider(ExecutionProviderService)
.useValue(session.provider)
.overrideProvider(SimpleFallbackJsonRpcBatchProvider)
.useValue(session.provider)
.overrideProvider(ExecutionProvider)
Expand All @@ -89,7 +87,9 @@ describe('Simple DVT deploy', () => {
.overrideProvider(ConfigService)
.useValue({
get(path) {
const conf = { LIDO_LOCATOR_ADDRESS: '0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb' };
const conf = {
LIDO_LOCATOR_ADDRESS: '0xC1d0b3DE6792Bf6b4b37EccdcC24e45978Cfd2Eb',
};
return conf[path];
},
})
Expand Down
23 changes: 19 additions & 4 deletions src/common/registry/fetch/operator.fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,27 @@ export class RegistryOperatorFetchService {
return false;
}

/** return blockTag for finalized block, it need for testing purposes */
public getFinalizedBlockTag() {
return 'finalized';
}

/** fetches number of operators */
public async count(moduleAddress: string, overrides: CallOverrides = {}): Promise<number> {
const bigNumber = await this.getContract(moduleAddress).getNodeOperatorsCount(overrides as any);
return bigNumber.toNumber();
}

/** fetches finalized operator */
public async getFinalizedNodeOperator(moduleAddress: string, operatorIndex: number) {
const fullInfo = true;
const contract = this.getContract(moduleAddress);
const finalizedOperator = await contract.getNodeOperator(operatorIndex, fullInfo, {
blockTag: this.getFinalizedBlockTag(),
});
return finalizedOperator;
}

/** fetches one operator */
public async fetchOne(
moduleAddress: string,
Expand All @@ -75,9 +90,6 @@ export class RegistryOperatorFetchService {
const contract = this.getContract(moduleAddress);

const operator = await contract.getNodeOperator(operatorIndex, fullInfo, overrides as any);
const finalizedOperator = await contract.getNodeOperator(operatorIndex, fullInfo, {
blockTag: 'finalized',
});

const {
name,
Expand All @@ -89,7 +101,10 @@ export class RegistryOperatorFetchService {
totalDepositedValidators,
} = operator;

const { totalDepositedValidators: finalizedUsedSigningKeys } = finalizedOperator;
const { totalDepositedValidators: finalizedUsedSigningKeys } = await this.getFinalizedNodeOperator(
moduleAddress,
operatorIndex,
);

return {
index: operatorIndex,
Expand Down
Loading

0 comments on commit 9906c1e

Please sign in to comment.