Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for ethereum-compatible types #2499

Closed
4 tasks done
jacogr opened this issue Aug 21, 2020 · 6 comments
Closed
4 tasks done

Support for ethereum-compatible types #2499

jacogr opened this issue Aug 21, 2020 · 6 comments

Comments

@jacogr
Copy link
Member

jacogr commented Aug 21, 2020

API version of polkadot-js/common#656

This needs unpacking, but some things I can immediately think of -

  • AccountId needs to use 20-bytes, not 32
  • AccountId needs to encode to the Ethereum version (display)
  • Address needs to use the above
  • Extrinsic, probably need hashing support as per this Support for Ethereum compatible ECDSA  common#656 (comment) (However this really is config dependent, i.e. is all hashes replaced, or just this singular, i.e. for large payloads)
  • ...

There will be more, needs to be unpack actually looking at what Rust does

@jacogr
Copy link
Member Author

jacogr commented Aug 23, 2020

cc @crystalin Anyhing else you can think of off the top of your head? Atm we have -

  • [u8; 20] AccountIds (with Ethereum formatting)
  • Support for Address type of the above
  • Support for signing/hashing in extrinsics, i.e. keys should be correct in the tx (assuming non publicKey)
  • The hasher can be completely swapped out to keccak (not sure this is in-use, I know Substrate had some issues initially with full replacement, but anyway, on chains that wish to replace blake2 with something else everywhere, can be done now)

Bit frustrating this since normally I tests e2e against dev nodes to ensure it works as expected.

@crystalin
Copy link
Contributor

It looks good. I can test it tomorrow to see if there is anything missing.
My substrate implementation of the ethereum is at the moment very much a hack over current substrate ECDSA, I'll have to test it too.

For the signature of the payload, do you use the Ethereum signature (including the r,v,s) ?

@jacogr
Copy link
Member Author

jacogr commented Aug 23, 2020

It does work with the current ecdsa implementation, have tested live txs with that on Kusama, so yes, exactly as output here - https://github.com/polkadot-js/common/blob/master/packages/util-crypto/src/secp256k1/sign.ts

(For Ethereum, I'm assuming is is "edcsa", so the first byte of the MultiSignature is 2 (just the normal enum position for the impl)

@crystalin
Copy link
Contributor

Than you Jaco, great work !
I confirm it is working with a Ethereum compatible Substrate implementation.

As discussed, some further improvement (outside of this scope) could be to better support MultiSignature enums (or even single Signatures).

@jacogr
Copy link
Member Author

jacogr commented Aug 30, 2020

Closing. (Splitting out signature replacement for Extrinsics in #2536)

@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Jun 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants