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

Commit

Permalink
Fix transaction history report (#2021)
Browse files Browse the repository at this point in the history
* 🔨 Refactor code

* 🐛 Fix history export logic

* 🔨 Cache and reuse publicKeys

* 🐛 Display all opening token balances

* 🔨 Add failsafe to avoid infinite auto-rescheduling

* 🐛 Flatten metadata entries list

* 🐛 Fix normalizeTransactionFee method invocation

* 🐛 Remove cyclic dependency

* 📝 Add logs

* 🐛 Ensure no duplicate entries

* 🐛 No transaction fee entries for shared reward entries

* 🔨 Add handling for legacy:reclaimLSK transaction

* 🔨 Refactor code

* ✅ Add unit tests

* 🐛 Add fallback to fetch necessary missing events

* ⬆️ Bump framework to v1.6.12

* ⚡ Update lisk-service-framework dependency

* 🐛 Serialize BigInt to base 10

* ⚡ Add handling for pos:reportMisbehavior transactions

* 🐛 Fix broken test

* ✅ Add/fix unit tests

* 🔨 Update test

* ✅ Add tests

* 🔨 Refactor code

* 🐛 Set proper param format

* 🔧 Increase broker timeout to 10sec

* 👌 Apply review recommendations

---------

Co-authored-by: nagdahimanshu <himanshu.nagda@lightcurve.io>
  • Loading branch information
sameersubudhi and nagdahimanshu authored Feb 8, 2024
1 parent 65e1f43 commit d566d68
Show file tree
Hide file tree
Showing 61 changed files with 4,953 additions and 3,022 deletions.
Binary file added framework/dist/lisk-service-framework-1.6.12.tgz
Binary file not shown.
2 changes: 1 addition & 1 deletion framework/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lisk-service-framework",
"version": "1.6.11",
"version": "1.6.12",
"description": "Lisk Service Framework",
"keywords": [
"lisk",
Expand Down
6 changes: 5 additions & 1 deletion framework/src/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ const queueInstance = (
});

queue.on('failed', (job, err) => {
logger.warn(`${job.name} job failed with error: ${err.message}`);
const validationMessageString =
err.message === 'Parameters validation error!'
? String('\n\t- ').concat(err.data.map(e => e.message).join('\n\t- '))
: '';
logger.warn(`${job.name} job failed with error: ${err.message}${validationMessageString}`);
logger.debug(`${job.name} job failed with error:\n${err.stack}`);
});

Expand Down
260 changes: 135 additions & 125 deletions framework/yarn.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion services/blockchain-app-registry/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const config = {};

// Moleculer broker config
config.transporter = process.env.SERVICE_BROKER || 'redis://lisk:password@127.0.0.1:6379/0';
config.brokerTimeout = Number(process.env.SERVICE_BROKER_TIMEOUT) || 5; // in seconds
config.brokerTimeout = Number(process.env.SERVICE_BROKER_TIMEOUT) || 10; // in seconds

/**
* External endpoints
Expand Down
2 changes: 1 addition & 1 deletion services/blockchain-app-registry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"dependencies": {
"bluebird": "^3.7.2",
"ioredis": "^5.3.2",
"lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/5cb6fc8e9b9798595d1a4652b9148afcbfaaed1f/framework/dist/lisk-service-framework-1.6.11.tgz",
"lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/8859790842fc7a1a937d25b59d1b6286c5e1176d/framework/dist/lisk-service-framework-1.6.12.tgz",
"lodash": "^4.17.21",
"node-fetch": "^2.6.1",
"octokit": "^3.1.2",
Expand Down
289 changes: 150 additions & 139 deletions services/blockchain-app-registry/yarn.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions services/blockchain-connector/methods/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const {
getTokenBalances,
getTokenInitializationFees,
tokenHasEscrowAccount,
getTokenBalanceAtGenesis,
getTokenBalancesAtGenesis,
} = require('../shared/sdk');

module.exports = [
Expand Down Expand Up @@ -86,8 +86,8 @@ module.exports = [
params: {},
},
{
name: 'getTokenBalanceAtGenesis',
controller: async ({ address }) => getTokenBalanceAtGenesis(address),
name: 'getTokenBalancesAtGenesis',
controller: async ({ address }) => getTokenBalancesAtGenesis(address),
params: {
address: { optional: false, type: 'string' },
},
Expand Down
2 changes: 1 addition & 1 deletion services/blockchain-connector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"bluebird": "^3.7.2",
"ioredis": "^5.3.2",
"knex": "^2.4.0",
"lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/5cb6fc8e9b9798595d1a4652b9148afcbfaaed1f/framework/dist/lisk-service-framework-1.6.11.tgz",
"lisk-service-framework": "https://github.com/LiskHQ/lisk-service/raw/8859790842fc7a1a937d25b59d1b6286c5e1176d/framework/dist/lisk-service-framework-1.6.12.tgz",
"moment": "^2.29.4",
"signals": "^1.0.0",
"tar": "^6.1.11"
Expand Down
4 changes: 2 additions & 2 deletions services/blockchain-connector/shared/sdk/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const {
getTotalSupply,
getTokenInitializationFees,
updateTokenInfo,
getTokenBalanceAtGenesis,
getTokenBalancesAtGenesis,
} = require('./token');

const {
Expand Down Expand Up @@ -188,7 +188,7 @@ module.exports = {
getSupportedTokens,
getTotalSupply,
getTokenInitializationFees,
getTokenBalanceAtGenesis,
getTokenBalancesAtGenesis,

// PoS
getAllPosValidators,
Expand Down
6 changes: 3 additions & 3 deletions services/blockchain-connector/shared/sdk/token.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ const updateTokenInfo = async () => {
totalSupply = await getTotalSupply(true);
};

const getTokenBalanceAtGenesis = async address => {
const getTokenBalancesAtGenesis = async address => {
const MODULE_TOKEN_SUBSTORE_USER = 'userSubstore';

const tokenModuleGenesisAssets = await getGenesisAssetByModule({
Expand All @@ -84,7 +84,7 @@ const getTokenBalanceAtGenesis = async address => {
});

const balancesAtGenesis = tokenModuleGenesisAssets[MODULE_TOKEN_SUBSTORE_USER];
const balancesByAddress = balancesAtGenesis.find(e => e.address === address);
const balancesByAddress = balancesAtGenesis.filter(e => e.address === address);

return balancesByAddress;
};
Expand All @@ -99,5 +99,5 @@ module.exports = {
getTotalSupply,
getTokenInitializationFees,
updateTokenInfo,
getTokenBalanceAtGenesis,
getTokenBalancesAtGenesis,
};
Loading

0 comments on commit d566d68

Please sign in to comment.