Lisk-sdk: Inconsistencies in mem_accounts table management

Created on 14 Feb 2018  路  7Comments  路  Source: LiskHQ/lisk-sdk

Expected behavior

Table mem_accounts should be maintained same way as on master branch.

Actual behavior

There are some differences, for example:

After genesis block insertion:

  • for delegates field u_username is set to NULL istead of delegate name
  • for delegates field u_isDelegate is set to 0 instead of 1
  • after forging a block field producedblocks is not updated for delegate that forged that block

These are only brief observations, there can be more.

Steps to reproduce

Run app, wait for genesis block insertion, wait for some blocks, check mem_accounts

Which version(s) does this affect? (Environment, OS, etc...)

1.0.0

bug

Most helpful comment

Verified the behavior. The root cause of the problem is in applying confirmed state of delegate type transaction;

https://github.com/LiskHQ/lisk/blob/b4f91e0312d71a7b39e7ac0d4214cdba81d33ec0/logic/delegate.js#L278-L286

This issue is fixed in 0.9.12 with the commit https://github.com/LiskHQ/lisk/commit/1d8e9c3980ed1a686fd2d31e7a6ccb4ba86b67e4

All 7 comments

Issue with u_username and u_isDelegate is fixed with 0.9.12, thanks @nazarhussain for your research on it. 馃憤

Verified the behavior. The root cause of the problem is in applying confirmed state of delegate type transaction;

https://github.com/LiskHQ/lisk/blob/b4f91e0312d71a7b39e7ac0d4214cdba81d33ec0/logic/delegate.js#L278-L286

This issue is fixed in 0.9.12 with the commit https://github.com/LiskHQ/lisk/commit/1d8e9c3980ed1a686fd2d31e7a6ccb4ba86b67e4

Thanks @nazarhussain @4miners

Wait @karmacoma , there is still issue with producedblocks.

The problem with produced blocks the inconsistency of the attribute name case in code and in model definition.

https://github.com/LiskHQ/lisk/blob/b4f91e0312d71a7b39e7ac0d4214cdba81d33ec0/logic/round.js#L99

https://github.com/LiskHQ/lisk/blob/b4f91e0312d71a7b39e7ac0d4214cdba81d33ec0/logic/account.js#L805

Since we are incrementing these attributes with a static sql, which don't convert the name cases. If we do general update for account that handles the case conversion. Same applies to missed blocks as well.

Better approach to fix it permanently is to write a migration to change column names as what is specified mostly around the code. Also catch and throw the error here.

https://github.com/LiskHQ/lisk/blob/b4f91e0312d71a7b39e7ac0d4214cdba81d33ec0/logic/account.js#L482-L484

@MaciejBaj Probably we should add this test scenario in integration tests. To check if the delegate who had forged the block, should have increment producedBlocks count.

@nazarhussain Test for that will come with https://github.com/LiskHQ/lisk/issues/1303, already have them.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ManuGowda picture ManuGowda  路  3Comments

toschdev picture toschdev  路  3Comments

Tschakki picture Tschakki  路  4Comments

slaweet picture slaweet  路  3Comments

karek314 picture karek314  路  3Comments