diff --git a/Cargo.lock b/Cargo.lock index 262b83904..46a9c6bc1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2406,7 +2406,7 @@ dependencies = [ [[package]] name = "fp-dynamic-fee" version = "1.0.0" -source = "git+https://github.com/gztensor/frontier?branch=polkadot-v1.10.1#6b68b4321e0065adb2c1f1a41e4961e506493763" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1#6b68b4321e0065adb2c1f1a41e4961e506493763" dependencies = [ "async-trait", "sp-core", @@ -2420,28 +2420,12 @@ source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1#6b6 dependencies = [ "ethereum", "ethereum-types", - "fp-evm 3.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "frame-support", "parity-scale-codec", "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.10.1)", ] -[[package]] -name = "fp-evm" -version = "3.0.0-dev" -source = "git+https://github.com/gztensor/frontier?branch=polkadot-v1.10.1#6b68b4321e0065adb2c1f1a41e4961e506493763" -dependencies = [ - "evm", - "frame-support", - "num_enum", - "parity-scale-codec", - "scale-info", - "serde", - "sp-core", - "sp-runtime", - "sp-std 14.0.0 (git+https://github.com/paritytech/polkadot-sdk?branch=release-polkadot-v1.10.1)", -] - [[package]] name = "fp-evm" version = "3.0.0-dev" @@ -2465,7 +2449,7 @@ source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1#6b6 dependencies = [ "ethereum", "ethereum-types", - "fp-evm 3.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "parity-scale-codec", "scale-info", "sp-api", @@ -4837,7 +4821,7 @@ name = "node-subspace-runtime" version = "1.8.2" dependencies = [ "fp-account", - "fp-evm 3.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "fp-rpc", "fp-self-contained", "frame-benchmarking", @@ -5176,7 +5160,7 @@ name = "pallet-base-fee" version = "1.0.0" source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1#6b68b4321e0065adb2c1f1a41e4961e506493763" dependencies = [ - "fp-evm 3.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "frame-support", "frame-system", "parity-scale-codec", @@ -5188,10 +5172,10 @@ dependencies = [ [[package]] name = "pallet-dynamic-fee" version = "4.0.0-dev" -source = "git+https://github.com/gztensor/frontier?branch=polkadot-v1.10.1#6b68b4321e0065adb2c1f1a41e4961e506493763" +source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1#6b68b4321e0065adb2c1f1a41e4961e506493763" dependencies = [ "fp-dynamic-fee", - "fp-evm 3.0.0-dev (git+https://github.com/gztensor/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "frame-support", "frame-system", "parity-scale-codec", @@ -5211,7 +5195,7 @@ dependencies = [ "evm", "fp-consensus", "fp-ethereum", - "fp-evm 3.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "fp-rpc", "fp-storage", "frame-support", @@ -5232,7 +5216,7 @@ dependencies = [ "environmental", "evm", "fp-account", - "fp-evm 3.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "frame-benchmarking", "frame-support", "frame-system", @@ -5266,7 +5250,7 @@ name = "pallet-evm-precompile-modexp" version = "2.0.0-dev" source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1#6b68b4321e0065adb2c1f1a41e4961e506493763" dependencies = [ - "fp-evm 3.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "num", ] @@ -5275,7 +5259,7 @@ name = "pallet-evm-precompile-sha3fips" version = "2.0.0-dev" source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1#6b68b4321e0065adb2c1f1a41e4961e506493763" dependencies = [ - "fp-evm 3.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "tiny-keccak", ] @@ -5284,7 +5268,7 @@ name = "pallet-evm-precompile-simple" version = "2.0.0-dev" source = "git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1#6b68b4321e0065adb2c1f1a41e4961e506493763" dependencies = [ - "fp-evm 3.0.0-dev (git+https://github.com/paritytech/frontier?branch=polkadot-v1.10.1)", + "fp-evm", "ripemd", "sp-io", ] diff --git a/Cargo.toml b/Cargo.toml index b8c6b1ddc..b326cd0f7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,7 +67,7 @@ fp-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1 ] } # Frontier FRAME pallet-base-fee = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.10.1", default-features = false } -pallet-dynamic-fee = { git = "https://github.com/gztensor/frontier", branch = "polkadot-v1.10.1", default-features = false } +pallet-dynamic-fee = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.10.1", default-features = false } pallet-ethereum = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.10.1", default-features = false } pallet-evm = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.10.1", default-features = false } pallet-evm-chain-id = { git = "https://github.com/paritytech/frontier", branch = "polkadot-v1.10.1", default-features = false } diff --git a/pallets/faucet/src/lib.rs b/pallets/faucet/src/lib.rs index 2b5529e2b..7cfe95c89 100644 --- a/pallets/faucet/src/lib.rs +++ b/pallets/faucet/src/lib.rs @@ -72,10 +72,6 @@ pub mod pallet { .propagate(true) .build() } - - fn pre_dispatch(_: &Self::Call) -> Result<(), TransactionValidityError> { - Ok(()) - } } pub type BalanceOf = diff --git a/pallets/subspace/src/lib.rs b/pallets/subspace/src/lib.rs index 40dc70d1e..6f3620ef6 100644 --- a/pallets/subspace/src/lib.rs +++ b/pallets/subspace/src/lib.rs @@ -10,19 +10,13 @@ use sp_std::collections::btree_set::BTreeSet; pub mod migrations; use frame_support::{ - dispatch, - dispatch::{DispatchInfo, PostDispatchInfo}, - ensure, - traits::{tokens::WithdrawReasons, ConstU32, Currency, ExistenceRequirement, IsSubType}, + dispatch, ensure, + traits::{tokens::WithdrawReasons, ConstU32, Currency, ExistenceRequirement}, PalletId, }; -use frame_support::{pallet_prelude::Weight, sp_runtime::transaction_validity::ValidTransaction}; +use frame_support::pallet_prelude::Weight; use parity_scale_codec::{Decode, Encode}; -use sp_runtime::{ - traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf, SignedExtension}, - transaction_validity::{TransactionValidity, TransactionValidityError}, -}; use sp_std::marker::PhantomData; // --------------------------------- @@ -1071,186 +1065,3 @@ impl Pallet { 0 } } - -#[derive(Debug, PartialEq, Default)] -pub enum CallType { - SetWeights, - AddStake, - TransferStakeMultiple, - TransferMultiple, - TransferStake, - AddStakeMultiple, - RemoveStakeMultiple, - RemoveStake, - AddDelegate, - Register, - AddNetwork, - Update, - #[default] - Other, -} - -#[derive(Encode, Decode, Clone, Eq, PartialEq, TypeInfo)] -pub struct SubspaceSignedExtension(pub PhantomData); - -impl Default for SubspaceSignedExtension -where - T::RuntimeCall: Dispatchable, - ::RuntimeCall: IsSubType>, -{ - fn default() -> Self { - Self::new() - } -} - -impl SubspaceSignedExtension -where - T::RuntimeCall: Dispatchable, - ::RuntimeCall: IsSubType>, -{ - pub fn new() -> Self { - Self(Default::default()) - } - - pub fn get_priority_vanilla(who: &T::AccountId) -> u64 { - // Return high priority so that every extrinsic except set_weights function will - // have a higher priority than the set_weights call - // get the current block number - let current_block_number = Pallet::::get_current_block_number(); - let balance = Pallet::::get_balance_u64(who); - - // this is the current block number minus the last update block number - current_block_number.saturating_add(balance) - } - - pub fn get_priority_set_weights(who: &T::AccountId, netuid: u16) -> u64 { - // Return the non vanilla priority for a set weights call. - Pallet::::get_priority_set_weights(who, netuid) - } - - #[must_use] - pub fn u64_to_balance( - input: u64, - ) -> Option< - <::Currency as Currency<::AccountId>>::Balance, - > { - input.try_into().ok() - } -} - -impl sp_std::fmt::Debug for SubspaceSignedExtension { - fn fmt(&self, f: &mut sp_std::fmt::Formatter) -> sp_std::fmt::Result { - write!(f, "SubspaceSignedExtension") - } -} - -impl SignedExtension for SubspaceSignedExtension -where - T::RuntimeCall: Dispatchable, - ::RuntimeCall: IsSubType>, -{ - const IDENTIFIER: &'static str = "SubspaceSignedExtension"; - - type AccountId = T::AccountId; - type Call = T::RuntimeCall; - type AdditionalSigned = (); - type Pre = (CallType, u64, Self::AccountId); - - fn additional_signed(&self) -> Result { - Ok(()) - } - - fn validate( - &self, - who: &Self::AccountId, - call: &Self::Call, - _info: &DispatchInfoOf, - _len: usize, - ) -> TransactionValidity { - match call.is_sub_type() { - Some(Call::set_weights { netuid, .. }) => { - let priority: u64 = Self::get_priority_set_weights(who, *netuid); - Ok(ValidTransaction { - priority, - longevity: 1, - ..Default::default() - }) - } - _ => Ok(ValidTransaction { - priority: Self::get_priority_vanilla(who), - ..Default::default() - }), - } - } - - // NOTE: Add later when we put in a pre and post dispatch step. - fn pre_dispatch( - self, - who: &Self::AccountId, - call: &Self::Call, - _info: &DispatchInfoOf, - _len: usize, - ) -> Result { - let who = who.clone(); - match call.is_sub_type() { - Some(Call::add_stake { .. }) => Ok((CallType::AddStake, 0, who)), - Some(Call::add_stake_multiple { .. }) => Ok((CallType::AddStakeMultiple, 0, who)), - Some(Call::remove_stake { .. }) => Ok((CallType::RemoveStake, 0, who)), - Some(Call::remove_stake_multiple { .. }) => Ok((CallType::RemoveStakeMultiple, 0, who)), - Some(Call::transfer_stake { .. }) => Ok((CallType::TransferStake, 0, who)), - Some(Call::transfer_multiple { .. }) => Ok((CallType::TransferMultiple, 0, who)), - Some(Call::set_weights { .. }) => Ok((CallType::SetWeights, 0, who)), - Some(Call::register { .. }) => Ok((CallType::Register, 0, who)), - Some(Call::update_module { .. }) => Ok((CallType::Update, 0, who)), - _ => Ok((CallType::Other, 0, who)), - } - } - - fn post_dispatch( - maybe_pre: Option, - _info: &DispatchInfoOf, - _post_info: &PostDispatchInfoOf, - _len: usize, - _result: &dispatch::DispatchResult, - ) -> Result<(), TransactionValidityError> { - if let Some((call_type, _transaction_fee, _who)) = maybe_pre { - match call_type { - CallType::SetWeights => { - log::debug!("Not Implemented!"); - } - CallType::AddStake => { - log::debug!("Not Implemented! Need to add potential transaction fees here."); - } - - CallType::AddStakeMultiple => { - log::debug!("Not Implemented! Need to add potential transaction fees here."); - } - CallType::RemoveStake => { - log::debug!("Not Implemented! Need to add potential transaction fees here."); - } - CallType::RemoveStakeMultiple => { - log::debug!("Not Implemented! Need to add potential transaction fees here."); - } - CallType::TransferStake => { - log::debug!("Not Implemented! Need to add potential transaction fees here."); - } - CallType::TransferStakeMultiple => { - log::debug!("Not Implemented! Need to add potential transaction fees here."); - } - CallType::TransferMultiple => { - log::debug!("Not Implemented! Need to add potential transaction fees here."); - } - CallType::AddNetwork => { - log::debug!("Not Implemented! Need to add potential transaction fees here."); - } - CallType::Register => { - log::debug!("Not Implemented!"); - } - _ => { - log::debug!("Not Implemented!"); - } - } - } - Ok(()) - } -} diff --git a/pallets/subspace/src/module.rs b/pallets/subspace/src/module.rs index a510bafa5..d1d94d9e6 100644 --- a/pallets/subspace/src/module.rs +++ b/pallets/subspace/src/module.rs @@ -285,11 +285,6 @@ impl Pallet { Address::::remove(netuid, replace_uid); // HANDLE THE METADATA - Metadata::::insert( - netuid, - &module_key, - Metadata::::get(netuid, &replace_key).unwrap_or_default(), - ); Metadata::::remove(netuid, &replace_key); // HANDLE THE NAMES diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 5907e47bc..7863202b1 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -176,7 +176,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 122, + spec_version: 123, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,