Can you get a storage collision in vyper?

The HashMap value is stored at the keccack256 of the key.

So wouldn't this mean storage collisions are possible?

1 Answer 1


Yes, storage collisions are possible in Vyper, it's not about Vyper or Solidity, it's about Ethereum Virtual Machine (EVM).

Both languages use the same mechanism, keccak256 to calculate storage locations for their mappings.

Solidity computes the location for a mapping's value as:

keccak256(key, slotPosition);

while Vyper does it as:

keccak256(slotPosition, key)

Here, key is the HashMap key, and slotPosition is the storage slot for the HashMap.

Since Keccak-256 is a strong hash function, it's very unlikely for two different keys to have the same storage place.

This means storage collisions are possible but very rare.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.