Skip to content

Commit d7cc03f

Browse files
committed
Adapt node and runtime to changes
1 parent c5c1160 commit d7cc03f

32 files changed

+34
-3615
lines changed

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ members = [
2929
"precompiles",
3030
"primitives/*",
3131
"runtime",
32-
"common",
3332
"support/*",
3433
]
3534
resolver = "2"
@@ -48,9 +47,11 @@ pallet-collective = { default-features = false, path = "pallets/collective" }
4847
pallet-commitments = { default-features = false, path = "pallets/commitments" }
4948
pallet-registry = { default-features = false, path = "pallets/registry" }
5049
pallet-subtensor = { default-features = false, path = "pallets/subtensor" }
50+
subtensor-custom-rpc = { default-features = false, path = "pallets/subtensor/rpc" }
5151
subtensor-custom-rpc-runtime-api = { default-features = false, path = "pallets/subtensor/runtime-api" }
5252
subtensor-precompiles = { default-features = false, path = "precompiles" }
5353
subtensor-runtime-common = { default-features = false, path = "common" }
54+
node-subtensor-runtime = { default-features = false, path = "runtime" }
5455

5556
async-trait = "0.1"
5657
cargo-husky = { version = "1", default-features = false }

node/Cargo.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pallet-transaction-payment = { workspace = true }
6666
pallet-commitments = { path = "../pallets/commitments" }
6767
pallet-drand = { workspace = true }
6868
sp-crypto-ec-utils = { workspace = true }
69-
sp-keystore = { workspace = true, default-features = false }
69+
sp-keystore = { workspace = true, default-features = false }
7070

7171

7272
# These dependencies are used for the subtensor's RPCs
@@ -105,9 +105,10 @@ thiserror = { workspace = true }
105105
num-traits = { version = "0.2", features = ["std"] }
106106

107107
# Local Dependencies
108-
node-subtensor-runtime = { path = "../runtime" }
109-
subtensor-custom-rpc = { path = "../pallets/subtensor/rpc" }
110-
subtensor-custom-rpc-runtime-api = { path = "../pallets/subtensor/runtime-api" }
108+
node-subtensor-runtime = { workspace = true }
109+
subtensor-runtime-common = { workspace = true }
110+
subtensor-custom-rpc = { workspace = true }
111+
subtensor-custom-rpc-runtime-api = { workspace = true }
111112

112113
[build-dependencies]
113114
substrate-build-script-utils = { workspace = true }
@@ -133,7 +134,7 @@ runtime-benchmarks = [
133134
"sc-service/runtime-benchmarks",
134135
"sp-runtime/runtime-benchmarks",
135136
"pallet-commitments/runtime-benchmarks",
136-
"pallet-drand/runtime-benchmarks"
137+
"pallet-drand/runtime-benchmarks",
137138
]
138139
pow-faucet = []
139140

@@ -145,7 +146,7 @@ try-runtime = [
145146
"pallet-transaction-payment/try-runtime",
146147
"sp-runtime/try-runtime",
147148
"pallet-commitments/try-runtime",
148-
"pallet-drand/try-runtime"
149+
"pallet-drand/try-runtime",
149150
]
150151

151152
metadata-hash = ["node-subtensor-runtime/metadata-hash"]

node/src/benchmarking.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ use crate::client::FullClient;
77
use node_subtensor_runtime as runtime;
88
use node_subtensor_runtime::check_nonce;
99
use node_subtensor_runtime::pallet_subtensor;
10-
use runtime::{AccountId, Balance, BalancesCall, SystemCall};
10+
use runtime::{BalancesCall, SystemCall};
1111
use sc_cli::Result;
1212
use sc_client_api::BlockBackend;
1313
use sp_core::{Encode, Pair};
1414
use sp_inherents::{InherentData, InherentDataProvider};
1515
use sp_keyring::Sr25519Keyring;
1616
use sp_runtime::{OpaqueExtrinsic, SaturatedConversion};
17+
use subtensor_runtime_common::{AccountId, Balance, Signature};
1718

1819
use std::{sync::Arc, time::Duration};
1920

@@ -161,7 +162,7 @@ pub fn create_benchmark_extrinsic(
161162
runtime::UncheckedExtrinsic::new_signed(
162163
call.clone(),
163164
sp_runtime::AccountId32::from(sender.public()).into(),
164-
runtime::Signature::Sr25519(signature),
165+
Signature::Sr25519(signature),
165166
extra.clone(),
166167
)
167168
}

node/src/chain_spec/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ pub mod finney;
66
pub mod localnet;
77
pub mod testnet;
88

9-
use node_subtensor_runtime::{AccountId, Block, Signature, WASM_BINARY};
9+
use node_subtensor_runtime::{Block, WASM_BINARY};
1010
use sc_chain_spec_derive::ChainSpecExtension;
1111
use sc_service::ChainType;
1212
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
@@ -18,6 +18,7 @@ use sp_runtime::traits::{IdentifyAccount, Verify};
1818
use std::collections::HashSet;
1919
use std::env;
2020
use std::str::FromStr;
21+
use subtensor_runtime_common::{AccountId, Signature};
2122

2223
// The URL for the telemetry server.
2324
// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";

node/src/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ pub use fc_rpc::EthBlockDataCacheTask;
1313
pub use fc_rpc_core::types::{FeeHistoryCache, FeeHistoryCacheLimit, FilterPool};
1414
use fc_storage::StorageOverride;
1515
use jsonrpsee::RpcModule;
16-
use node_subtensor_runtime::Hash;
1716
use node_subtensor_runtime::opaque::Block;
1817
use sc_consensus_manual_seal::EngineCommand;
1918
use sc_network::service::traits::NetworkService;
@@ -24,6 +23,7 @@ use sc_transaction_pool_api::TransactionPool;
2423
use sp_core::H256;
2524
use sp_inherents::CreateInherentDataProviders;
2625
use sp_runtime::traits::Block as BlockT;
26+
use subtensor_runtime_common::Hash;
2727

2828
use crate::{
2929
client::{FullBackend, FullClient},

node/src/service.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ fn run_manual_seal_authorship(
796796
) -> Result<(), sp_inherents::Error> {
797797
TIMESTAMP.with(|x| {
798798
let mut x_ref = x.borrow_mut();
799-
*x_ref = x_ref.saturating_add(node_subtensor_runtime::SLOT_DURATION);
799+
*x_ref = x_ref.saturating_add(subtensor_runtime_common::time::SLOT_DURATION);
800800
inherent_data.put_data(sp_timestamp::INHERENT_IDENTIFIER, &*x.borrow())
801801
})
802802
}

precompiles/src/balance_transfer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ where
2020
+ GetDispatchInfo
2121
+ Dispatchable<PostInfo = PostDispatchInfo>,
2222
<<R as frame_system::Config>::Lookup as StaticLookup>::Source: From<R::AccountId>,
23-
<R as pallet_balances::Config>::Balance: From<U256>,
23+
<R as pallet_balances::Config>::Balance: TryFrom<U256>,
2424
{
2525
const INDEX: u64 = 2048;
2626
const ADDRESS_SS58: [u8; 32] = [
@@ -41,7 +41,7 @@ where
4141
+ GetDispatchInfo
4242
+ Dispatchable<PostInfo = PostDispatchInfo>,
4343
<<R as frame_system::Config>::Lookup as StaticLookup>::Source: From<R::AccountId>,
44-
<R as pallet_balances::Config>::Balance: From<U256>,
44+
<R as pallet_balances::Config>::Balance: TryFrom<U256>,
4545
{
4646
#[precompile::public("transfer(bytes32)")]
4747
#[precompile::payable]

precompiles/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ where
5555
+ GetDispatchInfo
5656
+ Dispatchable<PostInfo = PostDispatchInfo>,
5757
<R as pallet_evm::Config>::AddressMapping: AddressMapping<R::AccountId>,
58-
<R as pallet_balances::Config>::Balance: From<U256>,
58+
<R as pallet_balances::Config>::Balance: TryFrom<U256>,
5959
<<R as frame_system::Config>::Lookup as StaticLookup>::Source: From<R::AccountId>,
6060
{
6161
fn default() -> Self {
@@ -79,7 +79,7 @@ where
7979
+ GetDispatchInfo
8080
+ Dispatchable<PostInfo = PostDispatchInfo>,
8181
<R as pallet_evm::Config>::AddressMapping: AddressMapping<R::AccountId>,
82-
<R as pallet_balances::Config>::Balance: From<U256>,
82+
<R as pallet_balances::Config>::Balance: TryFrom<U256>,
8383
<<R as frame_system::Config>::Lookup as StaticLookup>::Source: From<R::AccountId>,
8484
{
8585
pub fn new() -> Self {
@@ -120,7 +120,7 @@ where
120120
+ GetDispatchInfo
121121
+ Dispatchable<PostInfo = PostDispatchInfo>,
122122
<R as pallet_evm::Config>::AddressMapping: AddressMapping<R::AccountId>,
123-
<R as pallet_balances::Config>::Balance: From<U256>,
123+
<R as pallet_balances::Config>::Balance: TryFrom<U256>,
124124
<<R as frame_system::Config>::Lookup as StaticLookup>::Source: From<R::AccountId>,
125125
{
126126
fn execute(&self, handle: &mut impl PrecompileHandle) -> Option<PrecompileResult> {

precompiles/src/staking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ where
5555
+ GetDispatchInfo
5656
+ Dispatchable<PostInfo = PostDispatchInfo>,
5757
<R as pallet_evm::Config>::AddressMapping: AddressMapping<R::AccountId>,
58-
<R as pallet_balances::Config>::Balance: From<U256>,
58+
<R as pallet_balances::Config>::Balance: TryFrom<U256>,
5959
<<R as frame_system::Config>::Lookup as StaticLookup>::Source: From<R::AccountId>,
6060
{
6161
const INDEX: u64 = 2049;
@@ -81,7 +81,7 @@ where
8181
+ GetDispatchInfo
8282
+ Dispatchable<PostInfo = PostDispatchInfo>,
8383
<R as pallet_evm::Config>::AddressMapping: AddressMapping<R::AccountId>,
84-
<R as pallet_balances::Config>::Balance: From<U256>,
84+
<R as pallet_balances::Config>::Balance: TryFrom<U256>,
8585
<<R as frame_system::Config>::Lookup as StaticLookup>::Source: From<R::AccountId>,
8686
{
8787
#[precompile::public("addStake(bytes32,uint256)")]

0 commit comments

Comments
 (0)