0

what is the purpose of the ECDSA contract ( https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/ECDSA.sol ) ?

Contract looks like a wrapper around builtin solidity ecrecover function, without any benefits, or I've missed something?

Thank you.

alex
  • 101
  • 1

1 Answers1

1

If you read the code you will realize it provide some niceties:

  • Checking for malleable signatures
  • Support for 64 bytes compact signatures
  • Signature message manipulation, adding Ethereum signature prefix
  • Helper for EIP 712 signatures
Ismael
  • 30,570
  • 21
  • 53
  • 96
  • Thank you for your answer,

    Could you please add a bit more details to make the answer more clear

    Checking for malleable signatures

    As far as I know, malleable signatures are not possible in Geth since homestead https://ethereum.stackexchange.com/questions/3222/does-ethereum-suffer-from-transaction-malleability . Am I missing something ?

    prepending a prefix

    Prefix is prepended in Geth by default for data signing operations

    https://github.com/ethereum/go-ethereum/blob/d8ff53dfb8a516f47db37dbc7fd7ad18a1e8a125/accounts/accounts.go#L195

    – alex Sep 29 '21 at 04:27
  • Support for 64 bytes compact signatures

    What exactly do you mean? ecrecover works the same way, with 64 bytes compact signatures

    Signature message manipulation, adding signature prefix what's the difference with Checking for malleable signatures, prepending a prefix ?

    – alex Sep 29 '21 at 04:28
  • @alex For backward compatibility the EVM accepts old signatures. Ecrecover only accept 65 bytes signatures. The prefix part shouldn't have been part of the first sentence, I've updated that line. – Ismael Sep 29 '21 at 05:46