difftreelog
refactor drop TransactionConverter support
in: master
4 files changed
primitives/common/src/types.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sp_runtime::{18 generic,19 traits::{Verify, IdentifyAccount},20 MultiSignature,21};2223/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know24/// the specifics of the runtime. They can then be made to be agnostic over specific formats25/// of data like extrinsics, allowing for them to continue syncing the network through upgrades26/// to even the core data structures.27pub mod opaque {28 pub use sp_runtime::{generic, traits::BlakeTwo256, OpaqueExtrinsic as UncheckedExtrinsic};2930 pub use super::{BlockNumber, Signature, AccountId, Balance, Index, Hash, AuraId};3132 #[derive(Debug, Clone)]33 pub enum RuntimeId {34 Unique,35 Quartz,36 Opal,37 Unknown(sp_std::vec::Vec<u8>),38 }3940 /// Opaque block header type.41 pub type Header = generic::Header<BlockNumber, BlakeTwo256>;4243 /// Opaque block type.44 pub type Block = generic::Block<Header, UncheckedExtrinsic>;4546 pub trait RuntimeInstance {47 type CrossAccountId: pallet_evm::account::CrossAccountId<sp_runtime::AccountId32>48 + Send49 + Sync50 + 'static;5152 type TransactionConverter: fp_rpc::ConvertTransaction<UncheckedExtrinsic>53 + Send54 + Sync55 + 'static;5657 fn get_transaction_converter() -> Self::TransactionConverter;58 }59}6061pub type SessionHandlers = ();6263/// An index to a block.64pub type BlockNumber = u32;6566/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.67pub type Signature = MultiSignature;6869/// Some way of identifying an account on the chain. We intentionally make it equivalent70/// to the public key of our transaction signing scheme.71pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;7273/// The type for looking up accounts. We don't expect more than 4 billion of them, but you74/// never know...75pub type AccountIndex = u32;7677/// Balance of an account.78pub type Balance = u128;7980/// Index of a transaction in the chain.81pub type Index = u32;8283/// A hash of some data used by the chain.84pub type Hash = sp_core::H256;8586/// Digest item type.87pub type DigestItem = generic::DigestItem;8889pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use sp_runtime::{18 generic,19 traits::{Verify, IdentifyAccount},20 MultiSignature,21};2223/// Opaque types. These are used by the CLI to instantiate machinery that don't need to know24/// the specifics of the runtime. They can then be made to be agnostic over specific formats25/// of data like extrinsics, allowing for them to continue syncing the network through upgrades26/// to even the core data structures.27pub mod opaque {28 pub use sp_runtime::{generic, traits::BlakeTwo256, OpaqueExtrinsic as UncheckedExtrinsic};2930 pub use super::{BlockNumber, Signature, AccountId, Balance, Index, Hash, AuraId};3132 #[derive(Debug, Clone)]33 pub enum RuntimeId {34 Unique,35 Quartz,36 Opal,37 Unknown(sp_std::vec::Vec<u8>),38 }3940 /// Opaque block header type.41 pub type Header = generic::Header<BlockNumber, BlakeTwo256>;4243 /// Opaque block type.44 pub type Block = generic::Block<Header, UncheckedExtrinsic>;4546 pub trait RuntimeInstance {47 type CrossAccountId: pallet_evm::account::CrossAccountId<sp_runtime::AccountId32>48 + Send49 + Sync50 + 'static;51 }52}5354pub type SessionHandlers = ();5556/// An index to a block.57pub type BlockNumber = u32;5859/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.60pub type Signature = MultiSignature;6162/// Some way of identifying an account on the chain. We intentionally make it equivalent63/// to the public key of our transaction signing scheme.64pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;6566/// The type for looking up accounts. We don't expect more than 4 billion of them, but you67/// never know...68pub type AccountIndex = u32;6970/// Balance of an account.71pub type Balance = u128;7273/// Index of a transaction in the chain.74pub type Index = u32;7576/// A hash of some data used by the chain.77pub type Hash = sp_core::H256;7879/// Digest item type.80pub type DigestItem = generic::DigestItem;8182pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;runtime/common/ethereum/mod.rsdiffbeforeafterboth--- a/runtime/common/ethereum/mod.rs
+++ b/runtime/common/ethereum/mod.rs
@@ -17,4 +17,3 @@
pub mod precompiles;
pub mod self_contained_call;
pub mod sponsoring;
-pub mod transaction_converter;
runtime/common/ethereum/transaction_converter.rsdiffbeforeafterboth--- a/runtime/common/ethereum/transaction_converter.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.
-// This file is part of Unique Network.
-
-// Unique Network is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-
-// Unique Network is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-
-// You should have received a copy of the GNU General Public License
-// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.
-
-use codec::{Encode, Decode};
-use crate::{opaque, Runtime, UncheckedExtrinsic};
-
-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")
- }
-}
runtime/common/instance.rsdiffbeforeafterboth--- a/runtime/common/instance.rs
+++ b/runtime/common/instance.rs
@@ -1,6 +1,6 @@
use crate::{
runtime_common::{
- config::ethereum::CrossAccountId, ethereum::transaction_converter::TransactionConverter,
+ config::ethereum::CrossAccountId,
},
Runtime,
};
@@ -8,9 +8,4 @@
impl RuntimeInstance for Runtime {
type CrossAccountId = CrossAccountId;
- type TransactionConverter = TransactionConverter;
-
- fn get_transaction_converter() -> TransactionConverter {
- TransactionConverter
- }
}