Once we are able to encode it correctly, we should take the hash of the message and use that as the leaf that's inserted into the merkle tree
We should have tests to ensure that the message encoding is what we expect on the agent / solidity side, as well as the hash being what we expect
I'm not sure if there are any std libs that can help here - but fwiw I believe calling log with the message will implicitly perform a packed encoding of the stack variables, but not the data in the heap. Because atm the message body is a Vec<u8>, which stores the data on the heap, the message body isn't encoded properly.
abi.encodePacked
that's performed in Solidity here https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/main/solidity/contracts/libs/Message.sol#L24log
with the message will implicitly perform a packed encoding of the stack variables, but not the data in the heap. Because atm the message body is aVec<u8>
, which stores the data on the heap, the message body isn't encoded properly.