Safety of complicated use of UnstructuredStorage pattern?

Is anyone familiar with more complicated uses of the UnstructuredStorage pattern?
e.g. for mappings or other more complicated types.
I think something like the following should be feasible, but I’m struggling to find relevant examples of it in use.
Basically whether anyone is aware of any analysis to indicate this is safe? (assuming the actual “variable names” aren’t reused)

This uses an UnstructuredStorage library defined here:
But it’s quite basic and only used for loading relevant types from a specific storage slot.

I’d suppose the more you bypass the solidity compiler’s storage layout, the greater a chance of some hash collision, but 2^256 is pretty massive.
I wouldn’t imagine the solidity compiler checks for storage collsions between mappings?

1 Like

HI @callown,

Welcome to the community :wave:

I am not familiar with more complicated uses.

There is mention of it in

1 Like

There’s also some discussion of safety in EIP 1967

Although there’s no rigorous safety analysis included, my intuition is that the risk of any hash collisions should be exceedingly low, even when the unstructured storage pattern is used more extensively.

1 Like