aionnetwork / AVM

Enabling Java code to run in a blockchain environment
https://theoan.com/
MIT License
49 stars 25 forks source link

Implement KeyValueObjectGraph.getConsensusHashForRepresentation() correct hash #374

Closed jeff-aion closed 5 years ago

jeff-aion commented 5 years ago

The current implementation of KeyValueObjectGraph.getConsensusHashForRepresentation()uses Arrays.hashCode as a stop-gap until we decided which cryptographic function to use, and where the responsibility for calculating the hash should lie (there is an argument that it should be moved out of the critical path). This item is to track the changes to account for the correct hash function. Unless we change our mind for some specific [documented] reason, I currently propose that we run the raw binary of the SerializedRepresentation through keccak256 (since Ethereum uses that function, just operating on RLP-encoded data). For now, we will consider changes to where this is done to be beyond the scope of this item and will not change it.