Skip to content

Add Ethereum components from Frontier#9

Merged
JoshOrndorff merged 35 commits into
mainfrom
notlesh-add-frontier
Jul 11, 2023
Merged

Add Ethereum components from Frontier#9
JoshOrndorff merged 35 commits into
mainfrom
notlesh-add-frontier

Conversation

@notlesh
Copy link
Copy Markdown
Contributor

@notlesh notlesh commented Jun 7, 2023

This PR adds Ethereum compatibility components from Frontier. Solves #4.

TODO:

  • Add EVM and Ethereum to runtime
  • Implement AccountMapping scheme
  • Add very basic RPC client
  • Implement pallet_evm::FindAuthor
  • Add tests, examples, documentation, etc. as needed
  • Precompiles
  • Move ManagedAddressMapping to runtime/src with other pallets
  • Merge main

Comment thread runtime/src/lib.rs Outdated
Comment thread node/src/chain_spec.rs Outdated
@notlesh notlesh mentioned this pull request Jun 12, 2023
@notlesh

This comment was marked as resolved.

@JoshOrndorff

This comment was marked as resolved.

@notlesh

This comment was marked as resolved.

@fbielejec

This comment was marked as resolved.

Comment thread pallets/managed_address_mapping/src/lib.rs Outdated
@notlesh

This comment was marked as outdated.

@JoshOrndorff
Copy link
Copy Markdown
Collaborator

I'm testing this manually trying to get it merged soon. I want to be able to deploy and execute some contract in the evm, and I can't yet do that.

I'm trying with remix and also with polkadot js apps. Trying the node in instant seal and pow. It seems like I'm having fee related issues. Is there some particular gas price you have in mind, or other tips?

@JoshOrndorff
Copy link
Copy Markdown
Collaborator

JoshOrndorff commented Jun 24, 2023

I've messed with the address mapping a little bit. One bug I noticed is that both Alice and Bob can map the same ethereum H160 address, let's call it Gerald. This is trouble because if Gerald sends an eth transaction to pallet ethereum, only one of Alice or Bob will be charged fees.

It might be nice to make a similar check to the one you make for Native addresses first.

On a related note, I've got a start installing unified accounts which I think would be really nice in #20. What do you think about using that and eliminating the manual mapping?

One thing we have to check is whether tolls that were built for pallet contracts are smart enough to support that.

@JoshOrndorff
Copy link
Copy Markdown
Collaborator

I've disabled fees, and I'm now able to deploy and call a contract using polkadot js. That's a good start! Now to Metamask.

I can see my balance (with a funny number of decimals). But when I try to send tokens the transactions fail.

@JoshOrndorff JoshOrndorff mentioned this pull request Jun 24, 2023
Comment thread runtime/src/lib.rs
Comment on lines +473 to +497
#[derive(Clone)]
pub struct TransactionConverter;

impl fp_rpc::ConvertTransaction<UncheckedExtrinsic> for TransactionConverter {
fn convert_transaction(&self, transaction: pallet_ethereum::Transaction) -> UncheckedExtrinsic {
UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
)
}
}

impl fp_rpc::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {
fn convert_transaction(
&self,
transaction: pallet_ethereum::Transaction,
) -> opaque::UncheckedExtrinsic {
let extrinsic = UncheckedExtrinsic::new_unsigned(
pallet_ethereum::Call::<Runtime>::transact { transaction }.into(),
);
let encoded = extrinsic.encode();
opaque::UncheckedExtrinsic::decode(&mut &encoded[..])
.expect("Encoded extrinsic is always valid")
}
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I believe this is no longer necessary. See issue polkadot-evm/frontier#508 and PR polkadot-evm/frontier#559 for context.

@notlesh notlesh mentioned this pull request Jul 6, 2023
@JoshOrndorff JoshOrndorff merged commit 025dec5 into main Jul 11, 2023
@JoshOrndorff JoshOrndorff deleted the notlesh-add-frontier branch July 11, 2023 06:33
@JoshOrndorff JoshOrndorff mentioned this pull request Jul 11, 2023
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.

3 participants