Well, the Bundle Config pr is actually a quite simple task. I spent most of the time reading the clap documents and find a custom way to parse the input integer into U256
in rust and and hex string like 0x122321....
into Address
type in rust.
The Clap-rs repo gives a very good example for how to write a custom parser for custom type.
I was also reviewing Vid's pr on generating UserOperationHash. I came accross the yul code which I don't have good understanding the yul codes. The UserOperationHash is generated by the codes below
The yul codes is operating on the stack level.Let's give a review of the codes.
ofs
is the userOp
position in the calldata. len
is the length from the userOp
head to the signature
field head.
0x40
is the default free memory pointer. Store a new free memory pointer add(ret, add(len, 32))
which is the new memory free pointer.
mstore(ret, len)
store the length of the data in the free pointer position and calldatacopy(add(ret, 32), ofs, len)
copy the userOp
up before signature
into memory.