anyone knows how can i get position of a function parameter in memory in yul?
Sep 18, 2022, 5:26 AM
calldataload(0) -> first 32 bytes, calldataload(1) -> next 32 bytes
i can create a full fledged example if you want ?
Sep 18, 2022, 5:52 AM
i already figuered it out but got another problem, why does my keccak not work, i am trying to get the value of proj_id_to_params mapping
i am copying the value to memory slot 0 and taking keccak256(0, 0x20) which should be the keccak of key of the mapping however it doesn’t work
Sep 18, 2022, 5:55 AM
i'll check it out
Sep 18, 2022, 5:55 AM
oh wait why are you storing map slot in memory?
when i am declaring a parameter in a function it means that it will be in calldata right?
so when i say calldatacopy(0, 4, 0x20) => i am copying my only parameter to memory at slot 0
and i already tested the thing and it works, the problem occurs only when i take the keccak, that is why i am asking why do you do keccak of key + slot of mapping
The value corresponding to a mapping key k is located at keccak256(h(k) . p) where . is concatenation and h is a function that is applied to the key depending on its type
What is concatenation
omg it worked
thanx mrt
Sep 18, 2022, 6:26 AM