aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
414 stars 185 forks source link

Caching: Include the node's class in objects to hash #6321

Closed sphuber closed 3 months ago

sphuber commented 3 months ago

Fixes #6320

The current implementation did not include the class of the node in the list of objects to include in the hash calculation. This made it possible for two nodes of different types but with the same attributes to have the same hash, as long as one type was a subclass of the other.

Arguably when two nodes have a different type, even if subclasses, their hashes should never be the same. Therefore, the node's class is added to the list returned by NodeCaching._get_objects_to_hash().