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

Commit

Permalink
Merge pull request #1796 from LiskHQ/1788-incorrect-totalCommision-value
Browse files Browse the repository at this point in the history
Incorrect totalCommision value
  • Loading branch information
nagdahimanshu authored Aug 16, 2023
2 parents dc9da15 + 52580dd commit cfe5cfe
Show file tree
Hide file tree
Showing 17 changed files with 196 additions and 122 deletions.
8 changes: 4 additions & 4 deletions docker/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ EXCHANGERATESAPI_IO_API_KEY=
# EXPORT_S3_BUCKET_NAME_EXPORTS='exports'
# SERVICE_BROKER_TIMEOUT=10
# SERVICE_LOG_LEVEL='info'
# SERVICE_LOG_CONSOLE='false'
# SERVICE_LOG_STDOUT='true'
# SERVICE_LOG_GELF='false'
# SERVICE_LOG_FILE='false'
# SERVICE_LOG_CONSOLE=false
# SERVICE_LOG_STDOUT=true
# SERVICE_LOG_GELF=false
# SERVICE_LOG_FILE=false
# DOCKER_HOST='local'
# EXPORT_S3_ENDPOINT='s3.amazonaws.com'
# EXPORT_S3_ACCESS_KEY=
Expand Down
112 changes: 56 additions & 56 deletions ecosystem.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,37 +29,37 @@ module.exports = {
max_memory_restart: '300M',
autorestart: true,
env: {
PORT: '9901',
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://localhost:6379/0',
SERVICE_GATEWAY_REDIS_VOLATILE: 'redis://localhost:6379/5',
ENABLE_HTTP_API: 'http-status,http-version3,http-exports',
ENABLE_WS_API: 'blockchain,rpc-v3',
GATEWAY_DEPENDENCIES: 'indexer,connector',
WS_RATE_LIMIT_ENABLE: 'false',
WS_RATE_LIMIT_ENABLE: false,
WS_RATE_LIMIT_CONNECTIONS: 5,
WS_RATE_LIMIT_DURATION: 1, // in seconds
ENABLE_REQUEST_CACHING: 'true',
JSON_RPC_STRICT_MODE: 'false',
HTTP_RATE_LIMIT_ENABLE: 'false',
ENABLE_REQUEST_CACHING: true,
JSON_RPC_STRICT_MODE: false,
HTTP_RATE_LIMIT_ENABLE: false,
HTTP_RATE_LIMIT_CONNECTIONS: 200,
HTTP_RATE_LIMIT_WINDOW: 10, // in seconds
HTTP_CACHE_CONTROL_DIRECTIVES: 'public, max-age=10',
ENABLE_HTTP_CACHE_CONTROL: 'true',
HTTP_RATE_LIMIT_ENABLE_X_FORWARDED_FOR: 'false',
ENABLE_HTTP_CACHE_CONTROL: true,
HTTP_RATE_LIMIT_ENABLE_X_FORWARDED_FOR: false,
HTTP_RATE_LIMIT_NUM_KNOWN_PROXIES: 0,
// ENABLE_REVERSE_PROXY_TIMEOUT_SETTINGS: 'true'
// ENABLE_REVERSE_PROXY_TIMEOUT_SETTINGS: true,
// HTTP_KEEP_ALIVE_TIMEOUT: 65000,
// HTTP_HEADERS_TIMEOUT: 66000,
// CORS_ALLOWED_ORIGIN: '*',
// PORT: 9901,
// HOST: '0.0.0.0',
// SERVICE_BROKER_TIMEOUT: 10,
// HOST: '0.0.0.0',
// PORT: 9901,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// JOB_INTERVAL_UPDATE_READINESS_STATUS: 0,
// JOB_SCHEDULE_UPDATE_READINESS_STATUS: '* * * * *',
Expand All @@ -81,13 +81,13 @@ module.exports = {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://localhost:6379/0',
SERVICE_APP_REGISTRY_MYSQL: 'mysql://lisk:password@127.0.0.1:3306/lisk',
ENABLE_REBUILD_INDEX_AT_INIT: 'false',
ENABLE_REBUILD_INDEX_AT_INIT: false,
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// GITHUB_APP_REGISTRY_REPO: 'https://github.com/LiskHQ/app-registry',
// GITHUB_APP_REGISTRY_REPO_BRANCH: 'main',
Expand Down Expand Up @@ -116,15 +116,15 @@ module.exports = {
GEOIP_JSON: 'https://geoip.lisk.com/json',
// ENABLE_BLOCK_CACHING: true,
// EXPIRY_IN_HOURS: 12,
// USE_LISK_IPC_CLIENT: 'true',
// USE_LISK_IPC_CLIENT: true,
// LISK_APP_DATA_PATH: '~/.lisk/lisk-core',
// ENABLE_TESTING_MODE: 'false',
// ENABLE_TESTING_MODE: false,
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// GENESIS_BLOCK_URL: 'https://downloads.lisk.com/lisk/mainnet/genesis_block.json.tar.gz',
// JOB_INTERVAL_CACHE_CLEANUP: 0,
Expand Down Expand Up @@ -152,19 +152,19 @@ module.exports = {
SERVICE_INDEXER_REDIS_VOLATILE: 'redis://localhost:6379/2',
SERVICE_MESSAGE_QUEUE_REDIS: 'redis://localhost:6379/3',
SERVICE_INDEXER_MYSQL: 'mysql://lisk:password@127.0.0.1:3306/lisk',
ENABLE_DATA_RETRIEVAL_MODE: 'true',
ENABLE_INDEXING_MODE: 'true',
ENABLE_PERSIST_EVENTS: 'false',
// ENABLE_APPLY_SNAPSHOT: 'false',
ENABLE_DATA_RETRIEVAL_MODE: true,
ENABLE_INDEXING_MODE: true,
ENABLE_PERSIST_EVENTS: false,
// ENABLE_APPLY_SNAPSHOT: false,
// INDEX_SNAPSHOT_URL: '',
// ENABLE_SNAPSHOT_ALLOW_INSECURE_HTTP: 'true',
// ENABLE_SNAPSHOT_ALLOW_INSECURE_HTTP: true,
// SERVICE_INDEXER_MYSQL_READ_REPLICA: 'mysql://lisk:password@127.0.0.1:3306/lisk',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// MAINCHAIN_SERVICE_URL: 'https://service.lisk.com',
// LISK_STATIC: 'https://static-data.lisk.com',
Expand Down Expand Up @@ -206,10 +206,10 @@ module.exports = {
SERVICE_MESSAGE_QUEUE_REDIS: 'redis://localhost:6379/3',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// JOB_INTERVAL_INDEX_MISSING_BLOCKS: 0,
// JOB_SCHEDULE_INDEX_MISSING_BLOCKS: '*/15 * * * *',
Expand All @@ -231,19 +231,19 @@ module.exports = {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://localhost:6379/0',
SERVICE_FEE_ESTIMATOR_CACHE: 'redis://localhost:6379/1',
ENABLE_FEE_ESTIMATOR_QUICK: 'true',
ENABLE_FEE_ESTIMATOR_FULL: 'false',
ENABLE_FEE_ESTIMATOR_QUICK: true,
ENABLE_FEE_ESTIMATOR_FULL: false,
// FEE_EST_COLD_START_BATCH_SIZE: 1,
// FEE_EST_DEFAULT_START_BLOCK_HEIGHT: 1,
// FEE_EST_EMA_BATCH_SIZE: 20,
// FEE_EST_EMA_DECAY_RATE: 0.5,
// FEE_EST_WAVG_DECAY_PERCENTAGE: 10,
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',

},
Expand All @@ -265,14 +265,14 @@ module.exports = {
SERVICE_BROKER: 'redis://localhost:6379/0',
SERVICE_STATISTICS_REDIS: 'redis://localhost:6379/1',
SERVICE_STATISTICS_MYSQL: 'mysql://lisk:password@127.0.0.1:3306/lisk',
TRANSACTION_STATS_HISTORY_LENGTH_DAYS: '366',
TRANSACTION_STATS_HISTORY_LENGTH_DAYS: 366,
// SERVICE_STATISTICS_MYSQL_READ_REPLICA: 'mysql://reader:password@127.0.0.1:3307/lisk',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// JOB_INTERVAL_REFRESH_TRANSACTION_STATS: 0,
// JOB_SCHEDULE_REFRESH_TRANSACTION_STATS: '*/30 * * * *',
Expand Down Expand Up @@ -301,10 +301,10 @@ module.exports = {
// EXCHANGERATESAPI_IO_API_KEY: ''
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// JOB_INTERVAL_REFRESH_PRICES_BINANCE: 0,
// JOB_SCHEDULE_REFRESH_PRICES_BINANCE: '* * * * *',
Expand Down Expand Up @@ -340,10 +340,10 @@ module.exports = {
// EXPORT_S3_BUCKET_NAME_EXPORTS: 'exports',
// SERVICE_BROKER_TIMEOUT: 10,
// SERVICE_LOG_LEVEL: 'info',
// SERVICE_LOG_CONSOLE: 'false',
// SERVICE_LOG_STDOUT: 'true',
// SERVICE_LOG_GELF: 'false',
// SERVICE_LOG_FILE: 'false',
// SERVICE_LOG_CONSOLE: false,
// SERVICE_LOG_STDOUT: true,
// SERVICE_LOG_GELF: false,
// SERVICE_LOG_FILE: false,
// DOCKER_HOST: 'local',
// EXPORT_S3_ENDPOINT: 's3.amazonaws.com',
// EXPORT_S3_ACCESS_KEY: '',
Expand Down
30 changes: 15 additions & 15 deletions ecosystem.jenkins.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ module.exports = {
max_memory_restart: '300M',
autorestart: true,
env: {
PORT: '9901',
PORT: 9901,
SERVICE_BROKER: 'redis://localhost:6379/0',
SERVICE_GATEWAY_REDIS_VOLATILE: 'redis://localhost:6379/3',
ENABLE_HTTP_API: 'http-status,http-version3,http-exports',
ENABLE_WS_API: 'blockchain,rpc-v3',
GATEWAY_DEPENDENCIES: 'indexer,connector',
WS_RATE_LIMIT_ENABLE: 'false',
WS_RATE_LIMIT_ENABLE: false,
WS_RATE_LIMIT_CONNECTIONS: 5,
WS_RATE_LIMIT_DURATION: 1, // in seconds
ENABLE_REQUEST_CACHING: 'true',
JSON_RPC_STRICT_MODE: 'false',
HTTP_RATE_LIMIT_ENABLE: 'false',
ENABLE_REQUEST_CACHING: true,
JSON_RPC_STRICT_MODE: false,
HTTP_RATE_LIMIT_ENABLE: false,
HTTP_RATE_LIMIT_CONNECTIONS: 200,
HTTP_RATE_LIMIT_WINDOW: 10, // in seconds
HTTP_CACHE_CONTROL_DIRECTIVES: 'public, max-age=10',
ENABLE_HTTP_CACHE_CONTROL: 'true',
ENABLE_HTTP_CACHE_CONTROL: true,
},
},
{
Expand All @@ -63,7 +63,7 @@ module.exports = {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://localhost:6379/0',
SERVICE_APP_REGISTRY_MYSQL: 'mysql://lisk:password@127.0.0.1:3306/lisk',
ENABLE_REBUILD_INDEX_AT_INIT: 'false',
ENABLE_REBUILD_INDEX_AT_INIT: false,
},
},
{
Expand All @@ -83,9 +83,9 @@ module.exports = {
SERVICE_BROKER: 'redis://localhost:6379/0',
LISK_APP_WS: 'ws://localhost:7887',
GEOIP_JSON: 'https://geoip.lisk.com/json',
// USE_LISK_IPC_CLIENT: 'true',
// USE_LISK_IPC_CLIENT: true,
// LISK_APP_DATA_PATH: '~/.lisk/lisk-core',
ENABLE_TESTING_MODE: 'true',
ENABLE_TESTING_MODE: true,
},
},
{
Expand All @@ -107,9 +107,9 @@ module.exports = {
SERVICE_INDEXER_REDIS_VOLATILE: 'redis://localhost:6379/2',
SERVICE_MESSAGE_QUEUE_REDIS: 'redis://localhost:6379/3',
SERVICE_INDEXER_MYSQL: 'mysql://lisk:password@127.0.0.1:3306/lisk',
ENABLE_DATA_RETRIEVAL_MODE: 'true',
ENABLE_INDEXING_MODE: 'true',
ENABLE_PERSIST_EVENTS: 'false',
ENABLE_DATA_RETRIEVAL_MODE: true,
ENABLE_INDEXING_MODE: true,
ENABLE_PERSIST_EVENTS: false,
},
},
{
Expand Down Expand Up @@ -146,8 +146,8 @@ module.exports = {
// --- Remember to set the properties below
SERVICE_BROKER: 'redis://localhost:6379/0',
SERVICE_FEE_ESTIMATOR_CACHE: 'redis://localhost:6379/1',
ENABLE_FEE_ESTIMATOR_QUICK: 'true',
ENABLE_FEE_ESTIMATOR_FULL: 'false',
ENABLE_FEE_ESTIMATOR_QUICK: true,
ENABLE_FEE_ESTIMATOR_FULL: false,
},
},
{
Expand All @@ -167,7 +167,7 @@ module.exports = {
SERVICE_BROKER: 'redis://localhost:6379/0',
SERVICE_STATISTICS_REDIS: 'redis://localhost:6379/1',
SERVICE_STATISTICS_MYSQL: 'mysql://lisk:password@127.0.0.1:3306/lisk',
TRANSACTION_STATS_HISTORY_LENGTH_DAYS: '366',
TRANSACTION_STATS_HISTORY_LENGTH_DAYS: 366,
},
},
{
Expand Down
12 changes: 4 additions & 8 deletions services/blockchain-connector/methods/pos.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,12 @@ module.exports = [
},
{
name: 'getPoSGenesisStakers',
controller: async ({ height }) => getPoSGenesisStakers(height),
params: {
height: { optional: false, type: 'number' },
},
controller: async () => getPoSGenesisStakers(),
params: {},
},
{
name: 'getPoSGenesisValidators',
controller: async ({ height }) => getPoSGenesisValidators(height),
params: {
height: { optional: false, type: 'number' },
},
controller: async () => getPoSGenesisValidators(),
params: {},
},
];
11 changes: 7 additions & 4 deletions services/blockchain-connector/shared/sdk/pos.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const { timeoutMessage, invokeEndpoint } = require('./client');
const { MODULE_NAME_POS } = require('./constants/names');
const { getBlockByHeight } = require('./blocks');
const regex = require('../utils/regex');
const { getGenesisHeight } = require('./genesisBlock');

const logger = Logger();

Expand Down Expand Up @@ -138,9 +139,10 @@ const getPosLockedReward = async ({ address, tokenID }) => {
}
};

const getPoSGenesisStakers = async (height) => {
const getPoSGenesisStakers = async () => {
try {
const block = await getBlockByHeight(height, true);
const genesisHeight = await getGenesisHeight();
const block = await getBlockByHeight(genesisHeight, true);
const { stakers = [] } = (block.assets
.find(asset => asset.module === MODULE_NAME_POS)).data;
return stakers;
Expand All @@ -152,9 +154,10 @@ const getPoSGenesisStakers = async (height) => {
}
};

const getPoSGenesisValidators = async (height) => {
const getPoSGenesisValidators = async () => {
try {
const block = await getBlockByHeight(height, true);
const genesisHeight = await getGenesisHeight();
const block = await getBlockByHeight(genesisHeight, true);
const { validators = [] } = (block.assets
.find(asset => asset.module === MODULE_NAME_POS)).data;
return validators;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
schema: {
address: { type: 'string', null: false },
tokenID: { type: 'string', null: false },
balance: { type: 'bigInteger', null: false, default: BigInt('0') },
balance: { type: 'bigInteger', null: false, defaultValue: BigInt('0') },
},
indexes: {
address: { type: 'key' },
Expand Down
4 changes: 2 additions & 2 deletions services/blockchain-indexer/shared/database/schema/blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ module.exports = {
size: { type: 'integer' },
isFinal: { type: 'boolean', defaultValue: false },
assetsModules: { type: 'json' },
numberOfEvents: { type: 'integer' },
reward: { type: 'bigInteger' },
numberOfEvents: { type: 'integer', defaultValue: 0 },
reward: { type: 'bigInteger', defaultValue: BigInt('0') },
},
indexes: {
id: { type: 'key' },
Expand Down
2 changes: 1 addition & 1 deletion services/blockchain-indexer/shared/database/schema/ccu.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module.exports = {
schema: {
transactionID: { type: 'string', null: false },
height: { type: 'integer', null: false },
sendingChainID: { type: 'string', null: true, default: null },
sendingChainID: { type: 'string', null: true, defaultValue: null },
},
indexes: {
height: { type: 'range' },
Expand Down
Loading

0 comments on commit cfe5cfe

Please sign in to comment.