Skip to content

Commit

Permalink
Dedicated AccountId20 type (#926)
Browse files Browse the repository at this point in the history
* initial draft installed in moonbase

* fix cli-opt

* comment about better Display impl

* `Copy`, `FromStr`, and make it build

* rename to AccountId20

* Same FromStr error as AccountId32

* more comment ideas

* Do Moonriver and Moonbeam runtimes

* simplify asset_id_to_account

* start on moonbase tests

* moonbase tests pass

* river and beam

* proper blanket impl

* Be generic over the destination type too 🤷

I'll let @nanocryk tell me how generic it is really appropriate to be here.

* fix account tests

* Fix tests

* update @PolkaDot dependencies in types bundle

* update @PolkaDot dependencies in tests

* update @PolkaDot dependencies in tools

* unused imports

* update deps and fix tests (#975)

* Joshy moonbeam account : remove toLowercase (#977)

* remove tolowercase

* wip fixing tests

* fix tests

* finish fixing tests

* remove todos

* remove more todos

* update package-lock

* Fix recently-merged integration tests

* fix crossed dependencies in runtime-common

* fix package-lock

* downgrade polkadot/types because its broken

* update deps

* update deps

* Joshy moonbeam account downgrade attempt (#1019)

* tried downgrading

* update types

Co-authored-by: gorka <gorka.irazoki@gmail.com>
Co-authored-by: Antoine Estienne <antoine@purestake.com>
Co-authored-by: estienne.antoine@gmail.com <estienne.antoine@gmail.com>
  • Loading branch information
4 people authored Nov 23, 2021
1 parent 461625e commit c555f1b
Show file tree
Hide file tree
Showing 40 changed files with 872 additions and 690 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

183 changes: 87 additions & 96 deletions moonbeam-types-bundle/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions node/cli-opt/src/account_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use bip39::{Language, Mnemonic, MnemonicType, Seed};
use libsecp256k1::{PublicKey, SecretKey};
use primitive_types::{H160, H256};
use primitive_types::H256;
use sp_runtime::traits::IdentifyAccount;
use structopt::StructOpt;
use tiny_hderive::bip32::ExtendedPrivKey;
Expand Down Expand Up @@ -61,9 +61,9 @@ impl GenerateAccountKey {
// Retrieves the public key
let public_key = PublicKey::from_secret_key(&private_key);

// Convert into H160 address.
// Convert into Ethereum-style address.
let signer: account::EthereumSigner = public_key.into();
let address: H160 = signer.into_account();
let address = signer.into_account();

println!("Address: {:?}", address);
println!("Mnemonic: {}", mnemonic.phrase());
Expand Down
4 changes: 1 addition & 3 deletions node/service/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ pub fn get_account_id_from_pair<TPublic: Public>(pair: TPublic::Pair) -> Option<
BlakeTwo256::hash_of(&test_message).as_fixed_bytes(),
)
.ok()?;
Some(H160::from(H256::from_slice(
Keccak256::digest(&pubkey).as_slice(),
)))
Some(H160::from(H256::from_slice(Keccak256::digest(&pubkey).as_slice())).into())
}

/// Function to generate accounts given a mnemonic and a number of child accounts to be generated
Expand Down
2 changes: 1 addition & 1 deletion node/service/src/chain_spec/moonbase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ pub fn testnet_genesis(
accounts: Precompiles::used_addresses()
.map(|addr| {
(
addr,
addr.into(),
GenesisAccount {
nonce: Default::default(),
balance: Default::default(),
Expand Down
2 changes: 1 addition & 1 deletion node/service/src/chain_spec/moonbeam.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub fn testnet_genesis(
accounts: Precompiles::used_addresses()
.map(|addr| {
(
addr,
addr.into(),
GenesisAccount {
nonce: Default::default(),
balance: Default::default(),
Expand Down
2 changes: 1 addition & 1 deletion node/service/src/chain_spec/moonriver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub fn testnet_genesis(
accounts: Precompiles::used_addresses()
.map(|addr| {
(
addr,
addr.into(),
GenesisAccount {
nonce: Default::default(),
balance: Default::default(),
Expand Down
Loading

0 comments on commit c555f1b

Please sign in to comment.