Web3.swift icon indicating copy to clipboard operation
Web3.swift copied to clipboard

Update cryptoswift 1.5.1 and fix EthereumPublicKey initializer

Open DmitryBespalov opened this issue 3 years ago • 6 comments

Updated dependency and fixed bug in the public key initializer

DmitryBespalov avatar Jul 14 '22 17:07 DmitryBespalov

It would be good if there was a test to prove the public key recovery fix (the fix is good, just missing the test) :)

wainglaister avatar Aug 25 '22 09:08 wainglaister

What does not work with the public key recovery process right now? Why did you change it?

koraykoska avatar Aug 29 '22 22:08 koraykoska

@wainglaister ok, will add a test.

@koraykoska it recovers to a wrong address because it uses hash of a wrong preimage: it was hashing a signature instead of a message, which is nonsense to me 😊

I think it's a typo, but without the fix the method produces wrong values

DmitryBespalov avatar Aug 30 '22 08:08 DmitryBespalov

Relates to this issue: https://github.com/Boilertalk/Web3.swift/issues/12

wainglaister avatar Aug 30 '22 08:08 wainglaister

@DmitryBespalov Can you please add test cases from official specifications so we avoid future regressions

koraykoska avatar Sep 05 '22 11:09 koraykoska

@koraykoska sorry, I'm overloaded with the day job tasks at the moment, I won't have time to look at it till the middle of next week

DmitryBespalov avatar Sep 05 '22 12:09 DmitryBespalov

I need this in production, could someone release this please?

proggeramlug avatar Mar 08 '23 10:03 proggeramlug

@proggeramlug CryptoSwift was updated and released. I still fail to find official examples about the recovery of the public key and I think the implementation in this PR is wrong. If you can, please add test cases and link to official docs so I can get it merged.

koraykoska avatar Mar 16 '23 13:03 koraykoska

I would suggest this as a trustworthy source: https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/src/signature.ts#L53

Tests: https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/util/test/signature.spec.ts#L101

Reference: Yellow Paper, see page 26, Appendix F, line (314)

podkovyrin avatar Mar 26 '23 19:03 podkovyrin