Open cburgdorf opened 3 years ago
I can take this.
Happy to review a PR!
Hi @georgeroman, thank you very much for volunteering.
There's a bit of a holdup with this issue right now, since we do not support dynamically sized bytes (see #280). Without support for dynamically sized bytes, I'm not quite sure how this will be implemented.
There's some open discussion about bytes support, which you'll see if you follow the linked issue, but I think we can get away with handling bytes the same way we handle strings for the time being.
If you're still interested in taking this on, let me know. Otherwise, we could find something else for you.
Thank you for letting me know! In this case, I'll take https://github.com/ethereum/fe/issues/278 as it seems easier to start with. However, I would still be interested in helping out with this one.
Great! That one is alright.
Just citing from https://github.com/ethereum/fe/issues/280#issuecomment-799901764 that there might be a better way to read msg.data
using a special cbytes
type that could have read
or slice
APIs to read slices of the calldata into a fixed size array.
How about something like a decode_calldata
function, which is generic in its return type?
impl Msg:
pub fn decode_calldata<T>(offset: u256 = 0) -> T:
// magic
(x, y, z): (Array<u8, 10>, u256, address) = Msg::decode_calldata(offset: 32)
// x is Array<u8, 10, Location=Calldata> or Calldata<Array<u8, 10>>
// Get a pointer to some raw bytes (This is a bit weird, I admit. Maybe getting a pointer to raw bytes should be a different fn)
x: Array<u8, 128, Encoding=Static> = Msg::decode_calldata()
What is wrong?
We do not yet implement reading
msg.data
https://github.com/ethereum/fe/blob/177ee35ba4b12150f5cb14152e066d364b1a0161/compiler/src/yul/mappers/expressions.rs#L438
How can it be fixed
Start here:
https://github.com/ethereum/fe/blob/177ee35ba4b12150f5cb14152e066d364b1a0161/compiler/src/yul/mappers/expressions.rs#L438
Background:
https://docs.soliditylang.org/en/develop/units-and-global-variables.html#block-and-transaction-properties