hiero-ledger / hiero-ledger/hiero-consensus-node
New state validation: check entity key and value types match
- Dominant language
- Java
- Stars
- 406
- Forks
- 226
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 210
Description
After state migration to virtual mega map, all keys and all bytes are now stored as bytes, which are protobuf bytes for `VirtualMapKey` and `VirtualMapValue` objects. These two classes are basically huge OneOf's with all key and value types available in Hedera.
It shouldn't happen at the services level, but still possible at the virtual map / data source level, when an object of one type is stored using a key for a different type. For example, an account is stored using a token ID. In this case, key OneOf's value will be different from value OneOf's one. There should be a validation in the state validator to check that.
Contributor guide
Research direction
Start by locating the state validator and reading how the virtual map and data source represent VirtualMapKey and VirtualMapValue. Trace the validation path for stored entries; done means detecting when the key and value OneOf types do not match, such as an account value paired with a token ID key.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- database
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100