marigold-dev / tzsafe-ui

TzSafe-UI frontend — to interact with multi-signatures wallets.
https://www.marigold.dev/tzsafe
10 stars 2 forks source link

[POE] Payload hash is not sent to Beacon and hash not generated in accordance to TZIP #165

Closed quentin-burg closed 3 months ago

quentin-burg commented 3 months ago

There are two problems in this issue but related:

  1. Payload Hash of PoE Challenge must be forward to Beacon to allow dApp to store it. With this hash, dApp can verify if challenge has indeed been emitted. Currently only the payload is sent.

  2. The hash sent to the contract on-chain is not generated in accordance to TZIP-27. Currently, it's only a stringToBytes hash while in TZIP-27 it's written that:

    The payloadHash should have a prefix starting with m, representing as message. It is generated by encoding, Base58CheckEncoding, the payload—resulting from the blake2b hashing with a digit size of 20 bytes—and the prefix in bytes \110.

What we want?

We need to hash the payload with the right method (described in TZIP-27) before to send it on-chain and before to send it to Beacon. Hashes need to be the same to allow dApp to retrieve it to ensure the challenge has been emitted.

rueshyna commented 3 months ago

about the 2, the tzip indicates it should be payload in bytes in contract on-chain, not hash.

EMIT %proof_of_event (bytes %payload)
quentin-burg commented 3 months ago

Closed with https://github.com/marigold-dev/tzsafe-ui/pull/166