core-rs-albatross icon indicating copy to clipboard operation
core-rs-albatross copied to clipboard

Review the current accounts tree implementation

Open viquezclaudio opened this issue 3 years ago • 3 comments

After the last accounts tree refactor, there is some functionality that is missing (such as accounts pruning), which would helped mitigating issues like 417. The idea of this task is to do a general review of the accounts tree functionality to find holes or potential problems.

viquezclaudio avatar Nov 17 '21 15:11 viquezclaudio

If I'm not mistaken, the accounts are now pruned immediately upon a transaction. So there shouldn't be any "prunable" accounts in the Accounts Trie. The PR #430 is very weird, especially these lines https://github.com/nimiq/core-rs-albatross/pull/430/files#diff-7b33a1b9e51a684fa5c6dbe676f75ffb09387ae43273e1fa7a0b9fcf05a5a72cR173-R176 . The only way for new_balance to be zero is if total_value is also zero and the previous account balance was non-existent. So it seems we allow transactions from non-existent accounts as long as the total value of the transaction is zero.

brunoffranca avatar Nov 17 '21 23:11 brunoffranca

Ok, got it. That behavior was introduced right here a5ed6b7.

brunoffranca avatar Nov 17 '21 23:11 brunoffranca

Correct, reverting an unpark transaction fails if we don't have this fix in place, as this test shows.

viquezclaudio avatar Nov 17 '21 23:11 viquezclaudio