The storage slots for each storage variable that is defined in storage
block, was created by hashing the storage_X
string where X was the integer value starting from 0 based on the order of the variable in the storage block.
I noticed that after upgrading from 0.60.0 to 0.63.1 this is not the case anymore.
I have this simple contract:
contract;
storage {
variable: u64 = 0,
}
abi MyContract {
fn test_function() -> bool;
}
impl MyContract for Contract {
fn test_function() -> bool {
true
}
}
and when I compile it the following slots.json gets generated:
[
{
"key": "7cee3037d9b2fdd229ca5800cdd80a341eaac931ca6d9619736c34428a54bf43",
"value": "0000000000000000000000000000000000000000000000000000000000000000"
}
]
which is not matching the sha256 value I would expect:
$ echo -n "storage_0" | shasum -a 256 -
f383b0ce51358be57daa3b725fe44acdb2d880604e367199080b4379c41bb6ed -
Could someone please provide an explanation how is the slot value calculated now, or provide a link to the relevant source code?