-
Notifications
You must be signed in to change notification settings - Fork 486
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
fp-account #1019
fp-account #1019
Conversation
3598379
to
20e7806
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM otherwise
44eec1f
to
63a4403
Compare
… directly Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
} | ||
|
||
impl From<ecdsa::Public> for AccountId20 { | ||
fn from(pk: ecdsa::Public) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this logic should not be implmented in a From. It is not a cheap convert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what would you suggest as alternative?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be okay. I don't recall any restrictions that we shouldn't use From
for expensive convert.
|
||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Default)] | ||
#[derive(Encode, Decode, MaxEncodedLen, TypeInfo)] | ||
pub struct AccountId20(pub [u8; 20]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should add more docs for these types. e.g. eth compatible address blah blah.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com>
* bootstrap fp-account * clippy * make IdentityAddressMapping support From<H160> * clippy * fix import warning * fix pallet-evm tests * fix pallet-hotfix-sufficients tests * use libsecp256k1::PublicKey::parse_compressed and sp_core::keccak_256 directly Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * simplify keccak_256 hashing Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * format derives Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * merge_derives = false * fix imports * impl Debug for AccountId20 * simplify Display for EthereumSigner Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * fmt * simplify keccak_256 hashing * simplify ecdsa path Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * format derives Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * use sp_io for keccak_256 Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * remove sha3 dependency Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * remove sha3 dependency Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * remove sha3 dependency Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * remove sha3 import * remove sha3 dependency * simplify keccak_256 hashing on tests Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * remove serde imports Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> * add account docs * remove sp-keyring from template deps --------- Co-authored-by: Qinxuan Chen <koushiro.cqx@gmail.com> Co-authored-by: Wei Tang <wei@pacna.org>
Based on Moonbeam's
AccountId20
implementation:Introduces a new
fp-account
crate intoprimitives
, as an alternative to Frontier'sH256
->H160
truncation mapping.H160
addresses live natively on the Substrate runtime, and there's no need for translation betweenH256
andH160
.