Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit ce4b91e

Browse files
committed
Merge remote-tracking branch 'origin/1912-lisk-service-does-work-against-the-migrated-mainnet1' into 1912-lisk-service-does-work-against-the-migrated-mainnet
2 parents b5bdbe1 + d025d7b commit ce4b91e

File tree

5 files changed

+27
-6
lines changed

5 files changed

+27
-6
lines changed

services/blockchain-connector/shared/sdk/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ const init = async () => {
121121
await cacheRegisteredRewardModule();
122122
await cacheFeeConstants();
123123
await updateTokenInfo();
124+
await getTokenInitializationFees();
125+
await getRewardTokenID();
126+
await getPosConstants();
124127

125128
// Download the genesis block, if applicable
126129
await getGenesisBlock();

services/blockchain-connector/shared/sdk/token.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const logger = Logger();
2424
let escrowedAmounts;
2525
let supportedTokens;
2626
let totalSupply;
27+
let initializationFees;;
2728

2829
const getTokenBalances = async address => {
2930
try {
@@ -98,9 +99,12 @@ const getTotalSupply = async (isForceUpdate = false) => {
9899

99100
const getTokenInitializationFees = async () => {
100101
try {
101-
const response = await invokeEndpoint('token_getInitializationFees');
102-
if (response.error) throw new Error(response.error);
103-
return response;
102+
if (!initializationFees) {
103+
const response = await invokeEndpoint('token_getInitializationFees');
104+
if (response.error) throw new Error(response.error);
105+
initializationFees = response;
106+
}
107+
return initializationFees;
104108
} catch (err) {
105109
if (err.message.includes(timeoutMessage)) {
106110
throw new TimeoutException("Request timed out when calling 'getTokenInitializationFees'.");

services/blockchain-indexer/shared/dataService/knownAccounts.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ const reloadAccountKnowledge = async () => {
6262
}
6363
} else {
6464
logger.warn('Lisk static URL did not respond with valid data.');
65-
logger.debug(`Recieved: ${util.inspect(res)}.`);
65+
logger.debug(`Received: ${util.inspect(res)}.`);
6666
}
6767
} else {
68-
logger.warn(`Static information anavailable for the current chainID: ${chainID}.`);
68+
logger.warn(`Static information unavailable for the current chainID: ${chainID}.`);
6969
}
7070
} catch (err) {
7171
logger.error(`Could not reload known accounts: ${err.message}.`);

services/blockchain-indexer/shared/indexer/genesisBlock.js

+14
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const allAccountsAddresses = [];
4444
let isTokensBalanceIndexed = false;
4545

4646
const indexTokenModuleAssets = async dbTrx => {
47+
logger.info('Starting to index the genesis assets from the Token module.');
4748
const genesisBlockAssetsLength = await requestConnector('getGenesisAssetsLength', {
4849
module: MODULE.TOKEN,
4950
subStore: MODULE_SUB_STORE.TOKEN.USER,
@@ -75,9 +76,13 @@ const indexTokenModuleAssets = async dbTrx => {
7576
}
7677

7778
await updateTotalLockedAmounts(tokenIDLockedAmountChangeMap, dbTrx);
79+
logger.info('Finished indexing all the genesis assets from the Token module.');
7880
};
7981

8082
const indexPosValidatorsInfo = async (numValidators, dbTrx) => {
83+
logger.debug(
84+
'Starting to index the PoS Validators information from the genesis PoS module assets.',
85+
);
8186
if (numValidators > 0) {
8287
const commissionsTable = await getCommissionsTable();
8388

@@ -99,9 +104,13 @@ const indexPosValidatorsInfo = async (numValidators, dbTrx) => {
99104

100105
await commissionsTable.upsert(commissionEntries, dbTrx);
101106
}
107+
logger.debug(
108+
'Finished indexing the PoS Validators information from the genesis PoS module assets.',
109+
);
102110
};
103111

104112
const indexPosStakesInfo = async (numStakers, dbTrx) => {
113+
logger.debug('Starting to index the PoS stakes information from the genesis PoS module assets.');
105114
let totalStake = BigInt(0);
106115
let totalSelfStake = BigInt(0);
107116

@@ -144,9 +153,11 @@ const indexPosStakesInfo = async (numStakers, dbTrx) => {
144153

145154
await updateTotalSelfStake(totalSelfStake, dbTrx);
146155
logger.info(`Updated total self-stakes information at genesis: ${totalSelfStake.toString()}.`);
156+
logger.debug('Finished indexing the PoS stakes information from the genesis PoS module assets.');
147157
};
148158

149159
const indexPosModuleAssets = async dbTrx => {
160+
logger.info('Starting to index the genesis assets from the PoS module.');
150161
const genesisBlockAssetsLength = await requestConnector('getGenesisAssetsLength', {
151162
module: MODULE.POS,
152163
});
@@ -155,11 +166,14 @@ const indexPosModuleAssets = async dbTrx => {
155166

156167
await indexPosValidatorsInfo(numValidators, dbTrx);
157168
await indexPosStakesInfo(numStakers, dbTrx);
169+
logger.info('Finished indexing all the genesis assets from the PoS module.');
158170
};
159171

160172
const indexGenesisBlockAssets = async dbTrx => {
173+
logger.info('Starting to index the genesis assets.');
161174
await indexTokenModuleAssets(dbTrx);
162175
await indexPosModuleAssets(dbTrx);
176+
logger.info('Finished indexing all the genesis assets.');
163177
};
164178

165179
const indexTokenBalances = async () => {

services/blockchain-indexer/tests/unit/shared/dataservice/knownAccounts.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ describe('reloadAccountKnowledge', () => {
149149
info: jest.fn(),
150150
warn: async data =>
151151
expect(data).toEqual(
152-
'Static information anavailable for the current chainID: invalidChainID.',
152+
'Static information unavailable for the current chainID: invalidChainID.',
153153
),
154154
error: jest.fn(),
155155
}),

0 commit comments

Comments
 (0)