Tuples, revert, keccak256
memory allows us to deal with data types that are larger than 32 bytes
if we want to return a struct or an array within one function, this would not be possible with a single variable, if that struct/array is larger than 32 bytes
we can do this in Yul by simply denoting the boundaries/area of memory whose values we wish to return (this is what Solidity does under the hood)
when we want to revert a statement, we also have to specify an area in memory to store the revert values, just like return
Solidity obscures the fact that in a revert case, data can still be sent so caller can debug it
Most of the time, we want to revert just so that execution stops, and not return a value. we can do this with:
revert(0, 0)
values in
abi.encode
are stored in memory in solidity:
in Yul,
keccak256
takes in the start location in memory of the variables to be hashed, and how many bytes of data (0x60
in this case)
Last updated