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

I126 secp ext #138

Merged
merged 15 commits into from
Apr 19, 2023
Merged

I126 secp ext #138

merged 15 commits into from
Apr 19, 2023

Conversation

PopcornPaws
Copy link
Contributor

Description

Aims to close #126 and #134

Bit rough around the edges, but id gets the job done. What job? Well, we wanted end users to be able to interact with the network using just their metamask wallet. For this to work, we cloned the Multisignature implementation from sp-runtime and modified the ECDSA part to verify EVM-specific ECDSA instead of a generic one that used blake2 for hashing the message.

  • the EIP-155 normalization is handled by a simple recovery id check
  • in order to keep ristretto and edwards signature schemes working, the account id has to be 32 bytes, so the address $a$ is hashed via blake2_256 with a prefix evm: $p$

$$H_{blake2_{256}}(p||a)$$

PS. polkadot.js does the same

@PopcornPaws PopcornPaws self-assigned this Apr 18, 2023
@PopcornPaws PopcornPaws marked this pull request as draft April 18, 2023 11:58
@PopcornPaws PopcornPaws marked this pull request as ready for review April 18, 2023 13:44
Copy link
Contributor

@OnyxSkyscape OnyxSkyscape left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@PopcornPaws
Copy link
Contributor Author

I just realized that hashing the evm address is not a good idea because it's a one-way operation. However, the oracle needs to query the evm addresses for evm token checks which it cannot do if we store the addresses as hashes. Therefore, I think we should just pad the addresses with zeros to get 32 byte account ids. Then, the oracle will be able to query addresses from the chain and just strip the padding zeros to recover the 20 byte evm addresses.

@PopcornPaws PopcornPaws marked this pull request as draft April 19, 2023 06:52
@PopcornPaws PopcornPaws marked this pull request as ready for review April 19, 2023 08:24
@OnyxSkyscape
Copy link
Contributor

Runtime upgrade v104 tested and successfully rolled out into prod today 2:10 pm CEST at commit 5e03a8c, ready to merge.

@PopcornPaws PopcornPaws merged commit dee3b32 into main Apr 19, 2023
@PopcornPaws PopcornPaws deleted the I126-secp-ext branch April 19, 2023 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Guild-related extrinsics should work with ecdsa signatures on secp256k1
2 participants