safe-wallet-web icon indicating copy to clipboard operation
safe-wallet-web copied to clipboard

Why do we show domain and message hash not associated with what we sign?

Open PatrickAlphaC opened this issue 6 months ago • 6 comments

In this code:

            <AccordionDetails>
              <MessageHashField label="SafeMessage" hashValue={safeMessageMessage} />
              <MessageHashField label="SafeMessage hash" hashValue={safeMessageHash} />
              <MessageHashField label="Domain hash" hashValue={domainHash} />
              <MessageHashField label="Message hash" hashValue={messageHash} />
            </AccordionDetails>

https://github.com/safe-global/safe-wallet-monorepo/blob/dd825111cf0ede9b53d42f53feb63ed24a11b33c/apps/web/src/components/tx-flow/flows/SignMessage/SignMessage.tsx#L354

However, what appears on our wallet is the safeMessageMessage for signing. However, the domainHash and messageHash are used to calculate the safeMessageHash:

keccak256(abi.encode(
    keccak256("SafeMessage(bytes message)"), 
    keccak256(abi.encode(
hex"safeMessageMessage"),
))
# This returns the safeMessageHash

My question:

Why are we not showing the domain hash and message hash of the safeMessageMessage when that is what shows up on our wallets?

PatrickAlphaC avatar May 19 '25 15:05 PatrickAlphaC