Skip to content

EthereumSigner is not a public key. Should it be ? #1731

@undercover-cactus

Description

@undercover-cactus

Looking at the Verify trait implementation, we can see that the Signer is EthereumSigner (see https://github.com/polkadot-evm/frontier/blob/master/primitives/account/src/lib.rs#L200).

And EthereumSigner is basically a 20 bytes struct.

However when we look at what we have in substrate the signer is MultiSigner (see https://github.com/paritytech/polkadot-sdk/blob/master/substrate/primitives/runtime/src/lib.rs#L471) and MultiSigner is a enum of public key for different signature schemes.

Shouldn't EthereumSigner be a ECDSA public key ? That would mean we change the into_account function to convert it into a AccountId20.
It would look something like this :

pub struct EthereumSigner([u8; 64]); // Uncompressed public key

impl sp_runtime::traits::IdentifyAccount for EthereumSigner {
	type AccountId = AccountId20;
	fn into_account(self) -> AccountId20 {
		let account = H160::from(H256::from(keccak_256(&self.0)));

		AccountId20(account.0)
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions