mana
mana copied to clipboard
Inconsistent state on storage clearing in sstore operation
When clearing values in any account's storage, it affects other accounts.
The problem is in Trie.remove/2
method
The problem was found while fixing the refund_CallA
test. It clears storage in the call message that leaves another account's storage in a wrong state. https://github.com/poanetwork/mana/pull/230
So now we're not removing trees - https://github.com/poanetwork/mana/blob/7c9ac5385df6b8d1b1ecaf77177861f894bbe84b/apps/merkle_patricia_tree/lib/merkle_patricia_tree/trie.ex#L176. We should why state becomes inconsistent
@ayrat555 Was this addressed / fixed by #435?
@hayesgm nope. Currently, we don't remove anything from the storage https://github.com/poanetwork/mana/blob/7c9ac5385df6b8d1b1ecaf77177861f894bbe84b/apps/merkle_patricia_tree/lib/merkle_patricia_tree/trie.ex#L176
What's the right solution here? What should we do?
@hayesgm I think the problem is caused by the fact that we're storing all account storages in the same db so collisions occur when storage tries share the same nodes. Maybe we somehow can store them in a way that won't cause collisions.