nspcc-dev / neo-go

Go Node and SDK for the Neo blockchain
MIT License
125 stars 79 forks source link

MPT-backed storage is broken #3103

Open AnnaShaleva opened 1 year ago

AnnaShaleva commented 1 year ago

MPT-backed storage (mpt.TrieStore) uses Billet for MPT traversal during Seek operations. MPT traversal strategy differs from the one that simple storage Seek assumes (probably due to the Branch node traversal in case when the last child is non-empty leaf and there are other children except the last in this Branch). The difference is that items with the key exactly matching provided prefix are being traversed after the ones that has extra data after prefix (by MPT-based storage). This affects every component that tries to use MPT-backed storage as a replacement to a simple storage, including:

It may affect the findstates RPC handler in terms that current findstates behaviour matches the C# one, and to fix this bug we have to change the traversal strategy which will affect the findstates result.

This problem needs additional investigation, we may consider adding a traversal strategy option to Billet.

roman-khimov commented 1 year ago

I think it can be fixed without an additional mode.