Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
rename: to dvm_ethereum
Browse files Browse the repository at this point in the history
  • Loading branch information
aurexav authored and boundless-forest committed Oct 26, 2020
1 parent 4d5fa58 commit 9345548
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 27 deletions.
3 changes: 1 addition & 2 deletions bin/node-template/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,9 @@ fn testnet_genesis(
backed_ring: 1 << 56,
backed_kton: 1 << 56,
}),
// dvm
pallet_evm: Some(EVMConfig {
accounts: evm_accounts,
}),
frame_ethereum: Some(EthereumConfig {}),
dvm_ethereum: Some(Default::default()),
}
}
17 changes: 7 additions & 10 deletions bin/node-template/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ darwinia-support = { default-features = false, path = "../../
darwinia-treasury = { default-features = false, path = "../../../frame/treasury" }
darwinia-tron-backing = { default-features = false, path = "../../../frame/bridge/tron/backing" }
darwinia-vesting = { default-features = false, path = "../../../frame/vesting" }
dvm-ethereum = { default-features = false, path = "../../../frame/dvm/ethereum" }
dvm-rpc-primitives = { default-features = false, path = "../../../frame/dvm/rpc/primitives" }
ethereum-primitives = { default-features = false, path = "../../../primitives/ethereum-primitives" }
# substrate
frame-executive = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
Expand All @@ -46,6 +48,7 @@ pallet-authority-discovery = { default-features = false, git = "
pallet-authorship = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
pallet-babe = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
pallet-collective = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
pallet-evm = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
pallet-finality-tracker = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
pallet-grandpa = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
pallet-im-online = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
Expand Down Expand Up @@ -74,19 +77,14 @@ sp-staking = { default-features = false, git = "
sp-std = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
sp-transaction-pool = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
sp-version = { default-features = false, git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }
# dvm
dvm-rpc-primitives = { default-features = false, path = "../../../frame/dvm/rpc/primitives" }
frame-ethereum = { version = "0.1.0", default-features = false, package = "dvm-ethereum", path = "../../../frame/dvm/ethereum" }
pallet-evm = { default-features = false, package = "pallet-evm", git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }

[build-dependencies]
# substrate
wasm-builder-runner = { package = "substrate-wasm-builder-runner", git = "https://github.com/darwinia-network/substrate.git", branch = "common-library" }

[features]
default = ["std"]

std = [
std = [
"codec/std",
"serde",
"darwinia-balances/std",
Expand All @@ -108,6 +106,8 @@ std = [
"darwinia-treasury/std",
"darwinia-tron-backing/std",
"darwinia-vesting/std",
"dvm-ethereum/std",
"dvm-rpc-primitives/std",
"ethereum-primitives/std",
"frame-executive/std",
"frame-support/std",
Expand All @@ -117,6 +117,7 @@ std = [
"pallet-authorship/std",
"pallet-babe/std",
"pallet-collective/std",
"pallet-evm/std",
"pallet-finality-tracker/std",
"pallet-grandpa/std",
"pallet-im-online/std",
Expand Down Expand Up @@ -145,10 +146,6 @@ std = [
"sp-std/std",
"sp-transaction-pool/std",
"sp-version/std",
# dvm
"dvm-rpc-primitives/std",
"pallet-evm/std",
"frame-ethereum/std",
]

with-tracing = ["frame-executive/with-tracing"]
30 changes: 15 additions & 15 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,8 @@ use darwinia_staking_rpc_runtime_api::RuntimeDispatchInfo as StakingRuntimeDispa
use impls::*;

// dvm
use dvm_ethereum::precompiles::{ConcatAddressMapping, NativeTransfer};
use dvm_rpc_primitives::TransactionStatus;
use frame_ethereum::precompiles::{ConcatAddressMapping, NativeTransfer};
use pallet_evm::{Account as EVMAccount, EnsureAddressTruncated, FeeCalculator};

/// This runtime version.
Expand Down Expand Up @@ -1172,7 +1172,7 @@ impl<F: FindAuthor<u32>> FindAuthor<H160> for EthereumFindAuthor<F> {
}
}

impl frame_ethereum::Trait for Runtime {
impl dvm_ethereum::Trait for Runtime {
type Event = Event;
type FindAuthor = EthereumFindAuthor<Babe>;
type AddressMapping = ConcatAddressMapping;
Expand All @@ -1182,20 +1182,20 @@ impl frame_ethereum::Trait for Runtime {
pub struct TransactionConverter;

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

impl dvm_rpc_primitives::ConvertTransaction<opaque::UncheckedExtrinsic> for TransactionConverter {
fn convert_transaction(
&self,
transaction: frame_ethereum::Transaction,
transaction: dvm_ethereum::Transaction,
) -> opaque::UncheckedExtrinsic {
let extrinsic = UncheckedExtrinsic::new_unsigned(
frame_ethereum::Call::<Runtime>::transact(transaction).into(),
dvm_ethereum::Call::<Runtime>::transact(transaction).into(),
);
let encoded = extrinsic.encode();
opaque::UncheckedExtrinsic::decode(&mut &encoded[..])
Expand Down Expand Up @@ -1267,7 +1267,7 @@ construct_runtime!(
HeaderMMR: darwinia_header_mmr::{Module, Call, Storage},

// dvm related
Ethereum: frame_ethereum::{Module, Call, Storage, Event, Config, ValidateUnsigned},
Ethereum: dvm_ethereum::{Module, Call, Storage, Event, Config, ValidateUnsigned},
EVM: pallet_evm::{Module, Config, Call, Storage, Event<T>},
}
);
Expand Down Expand Up @@ -1540,7 +1540,7 @@ impl_runtime_apis! {
}

fn author() -> H160 {
<frame_ethereum::Module<Runtime>>::find_author()
<dvm_ethereum::Module<Runtime>>::find_author()
}

fn storage_at(address: H160, index: U256) -> H256 {
Expand All @@ -1556,7 +1556,7 @@ impl_runtime_apis! {
gas_limit: U256,
gas_price: Option<U256>,
nonce: Option<U256>,
action: frame_ethereum::TransactionAction,
action: dvm_ethereum::TransactionAction,
) -> Result<(Vec<u8>, U256), sp_runtime::DispatchError> {
// ensure that the gas_limit fits within a u32; otherwise the wrong value will be passed
use sp_runtime::traits::UniqueSaturatedInto;
Expand All @@ -1568,7 +1568,7 @@ impl_runtime_apis! {
(gas_limit: {:?})", gas_limit);
}
match action {
frame_ethereum::TransactionAction::Call(to) =>
dvm_ethereum::TransactionAction::Call(to) =>
EVM::execute_call(
from,
to,
Expand All @@ -1581,7 +1581,7 @@ impl_runtime_apis! {
)
.map(|(_, ret, gas, _)| (ret, gas))
.map_err(|err| err.into()),
frame_ethereum::TransactionAction::Create =>
dvm_ethereum::TransactionAction::Create =>
EVM::execute_create(
from,
data,
Expand All @@ -1600,17 +1600,17 @@ impl_runtime_apis! {
Ethereum::current_transaction_statuses()
}

fn current_block() -> Option<frame_ethereum::Block> {
fn current_block() -> Option<dvm_ethereum::Block> {
Ethereum::current_block()
}

fn current_receipts() -> Option<Vec<frame_ethereum::Receipt>> {
fn current_receipts() -> Option<Vec<dvm_ethereum::Receipt>> {
Ethereum::current_receipts()
}

fn current_all() -> (
Option<frame_ethereum::Block>,
Option<Vec<frame_ethereum::Receipt>>,
Option<dvm_ethereum::Block>,
Option<Vec<dvm_ethereum::Receipt>>,
Option<Vec<TransactionStatus>>
) {
(
Expand Down

0 comments on commit 9345548

Please sign in to comment.