-
Notifications
You must be signed in to change notification settings - Fork 346
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
Restore Alice and Bob accounts #195
Conversation
The issue is not with apps - as per the screenshots posted by me on a standard chain and the tests it derives edcsa aligned with Substrate, unlike the comment above. The test keyring adds sr25519 development accounts, as per the Substrate default. Any chain-specific overrides needs to be manually added. |
We should also add some js tests. Let me know if you want me to do that |
@joelamouche I'm always a fan of more tests. I would love it if you could write the ones you have in mind in a followup PR. I'd like to get this in soon as it fixes |
AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(), | ||
vec![AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap()], | ||
// Sudo Account | ||
get_account_id_from_seed::<ecdsa::Public>("Alice"), |
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.
You are using the Substrate ECDSA here which doesn't derive the seed to a Ethereum public address but to a Substrate public address. This won't be compatible with Ethereum/Moonbeam tools.
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'm not sure how to proceed. I can import these accounts into Apps via private key and use them. But I agree Apps cannot derive them from mnemonic. What should we be doing?
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.
One solution is to skip the derivation part:
We derive Alice, Bob using substrate and store those PK/Pub in the code.
We store those PK/Pub directly in polkadotJs if that is possible (@joelamouche).
I don't have a better idea so far to achieve the Alice/Bob...
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.
The way I see it there are two possible solutions:
- We want Alice and Bob to derive from Ethereum derivation and we take the addresses simply derived from "bottom drive obey lake curtain smoke basket hold race lonely fit walk" in a canonic way, like in ganache-cli. Alice the address 0, Bob address 1, etc. We use the private keys generated bellow to derive Alice and Bob in rust and in the pokkadot-js suite.
- We don't mind using non-ethereum derivation and we keep non-ethereum derivation in rust and polkadot-js to derive Alice and Bob, mapping the substrate address to an ethereum address and using the key pairs everywhere else, as suggested in @crystalin 's previous comment
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'm leaning toward the second option, or just staying away from alice and bob altogether. I see two real cons to doing ethereum-style derivation:
- We would have to figure out how to do it in Rust (maybe could copy from open ethereum?)
- We would need to figure out how to do it in Polkadot js to Jaco's liking.
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.
We would have to figure out how to do it in Rust
We would be using the private keys generated elsewhere from the mnemonic
We would need to figure out how to do it in Polkadot js to Jaco's liking
Yes that is indeed the biggest unknown... But basically either he won't let us change the dev addresses for Moonbeam or he will and those could be reused for any ethereum based parachain
I like the idea of ethereum Alice and Bob, bit will polkadotjs support
those default?
…On Thu, Jan 28, 2021, 4:47 AM Antoine Estienne ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In node/parachain/src/chain_spec.rs
<#195 (comment)>:
> @@ -53,8 +72,14 @@ pub fn get_chain_spec(para_id: ParaId) -> ChainSpec {
ChainType::Local,
move || {
testnet_genesis(
- AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap(),
- vec![AccountId::from_str("6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b").unwrap()],
+ // Sudo Account
+ get_account_id_from_seed::<ecdsa::Public>("Alice"),
The way I see it there are two possible solutions:
- We want Alice and Bob to derive from Ethereum derivation and we take
the addresses simply derived from "bottom drive obey lake curtain smoke
basket hold race lonely fit walk" in a canonic way, like in ganache-cli.
Alice the address 0, Bob address 1, etc. We use the private keys generated
bellow to derive Alice and Bob in rust and in the pokkadot-js suite.
[image: Screenshot 2021-01-28 at 10 42 27]
<https://user-images.githubusercontent.com/16758383/106119564-a26b7d80-6155-11eb-90c7-01451245945c.png>
- We don't mind using non-ethereum derivation and we keep non-ethereum
derivation in rust and polkadot-js to derive Alice and Bob, mapping the
substrate address to an ethereum address and using the key pairs everywhere
else, as suggested in @crystalin <https://github.com/crystalin> 's
previous comment
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#195 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACQMIERZNLJRJ3UHNVDFHTS4EXDJANCNFSM4WNPSFDA>
.
|
I'm going to close this. #204 is getting close and it will also fix the |
What does it do?
This PR changes the Rust-based genesis configurations to use the standard Alice and Bob accounts for sudo and prefunded accounts. This make Moonbeam more similar to other Substrate based chains. This does not remove the old "Gerald" (
0x6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b
) account from being prefunded in order to keep intergations that depend on it working.It also fixes the
--dev
,--alice
,--bob
, etc flags to work with the author inherent.Is there something left for follow-up PRs?
What alternative implementations were considered?
The part about making the
--alice
flags work could be accomplished more elegantly code-wise by patching substrate. But because maintaining a Substrate fork brings a significant overhead and because the author inherent will change when we start signing blocks, I decided to do a slightly less elegant fix here in Moonbeam.Are there relevant PRs or issues in other repositories (Substrate, Polkadot, Frontier, Cumulus)?
Apps does not currently derive the Alice Bob, etc accounts correctly. polkadot-js/apps#4467 This may make it appear that this PR is incorrect, but really the problem is with Apps.
For example the default chainspec now pre-funds the Alice account. If you go to Apps and add the Alice account by mnemonic, it will appear that Alice was not prefunded. In reality Apps is not deriving the correct account, and the incorrect account that Apps derived is not prefunded. To work around this, import accounts into Apps by private key as described in that issue.
What value does it bring to the blockchain users?
Ability to quickly spin up testnets using standard accounts.
Checklist