Skip to content

Commit

Permalink
chore(deps): Bump substrate to polkadot-v1.1.0 (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
conr2d authored Oct 24, 2023
1 parent 19f44b2 commit 8c0f435
Show file tree
Hide file tree
Showing 19 changed files with 635 additions and 457 deletions.
163 changes: 83 additions & 80 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core-primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub type Signature = np_runtime::UniversalSignature;
/// to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
/// Index of a transaction in the chain.
pub type Index = u32;
pub type Nonce = u32;
/// The type for looking up accounts.
pub type AccountIndex = u128;
/// The address format for describing accounts.
Expand Down
1 change: 0 additions & 1 deletion frame/alias/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ pub mod pallet {
}

#[pallet::pallet]
#[pallet::generate_store(pub(super) trait Store)]
pub struct Pallet<T>(PhantomData<T>);

#[pallet::call]
Expand Down
8 changes: 4 additions & 4 deletions frame/alias/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,28 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: AccountIdOf (r:1 w:1), AccountNameOf (r:1 w:1)
fn create_account_name() -> Weight {
// Base fee
Weight::from_ref_time(50_000_000)
Weight::from_parts(50_000_000, 0)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
// Storage: AccountIdOf (r:1 w:2), AccountNameOf (r:1 w:1)
fn update_account_name() -> Weight {
// Base fee
Weight::from_ref_time(100_000_000 as u64)
Weight::from_parts(100_000_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
// Storage: AccountIdOf (r:1 w:1), AccountNameOf (r:1 w:1)
fn connect_aliases() -> Weight {
// Base fee
Weight::from_ref_time(50_000_000)
Weight::from_parts(50_000_000, 0)
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: AccountIdOf (r:1 w:2), AccountNameOf (r:1 w:1)
fn force_set_account_name() -> Weight {
// Base fee
Weight::from_ref_time(50_000_000)
Weight::from_parts(50_000_000, 0)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
Expand Down
Empty file added help
Empty file.
9 changes: 6 additions & 3 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ serde = { workspace = true }
serde_json = { workspace = true }

# frontier
fc-api = { workspace = true }
fc-cli = { workspace = true }
fc-consensus = { workspace = true }
fc-db = { workspace = true }
fc-mapping-sync = { workspace = true }
fc-mapping-sync = { workspace = true, features = ["rocksdb", "sql"] }
fc-rpc = { workspace = true }
fc-rpc-core = { workspace = true }
fc-storage = { workspace = true }
Expand All @@ -49,15 +50,17 @@ pallet-transaction-payment-rpc-runtime-api = { workspace = true }
prometheus-endpoint = { workspace = true }
sc-basic-authorship = { workspace = true }
sc-chain-spec = { workspace = true }
sc-consensus-grandpa = { workspace = true }
sc-consensus-manual-seal = { workspace = true }
sc-cli = { workspace = true }
sc-client-api = { workspace = true }
sc-consensus = { workspace = true }
sc-consensus-aura = { workspace = true }
sc-executor = { workspace = true }
sc-finality-grandpa = { workspace = true }
sc-keystore = { workspace = true }
sc-network = { workspace = true }
sc-network-sync = { workspace = true }
sc-offchain = { workspace = true }
sc-rpc = { workspace = true }
sc-rpc-api = { workspace = true }
sc-service = { workspace = true }
Expand All @@ -69,7 +72,7 @@ sp-block-builder = { workspace = true }
sp-blockchain = { workspace = true }
sp-core = { workspace = true }
sp-consensus-aura = { workspace = true }
sp-finality-grandpa = { workspace = true }
sp-consensus-grandpa = { workspace = true }
sp-inherents = { workspace = true }
sp-keyring = { workspace = true }
sp-offchain = { workspace = true }
Expand Down
17 changes: 10 additions & 7 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use noir_runtime::{AccountId, EnableManualSeal, GenesisConfig, Signature, WASM_BINARY};
use noir_runtime::{AccountId, EnableManualSeal, RuntimeGenesisConfig, Signature, WASM_BINARY};
use sc_chain_spec::Properties;
use sc_service::ChainType;
use serde::{Deserialize, Serialize};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_consensus_grandpa::AuthorityId as GrandpaId;
use sp_core::{sr25519, storage::Storage, Pair, Public, H160, U256};
use sp_finality_grandpa::AuthorityId as GrandpaId;
use sp_runtime::traits::{IdentifyAccount, Verify};
use sp_state_machine::BasicExternalities;
use std::{collections::BTreeMap, str::FromStr};
Expand All @@ -31,15 +31,15 @@ use std::{collections::BTreeMap, str::FromStr};
// const STAGING_TELEMETRY_URL: &str = "wss://telemetry.polkadot.io/submit/";

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;
/// Specialized `ChainSpec` for development.
pub type DevChainSpec = sc_service::GenericChainSpec<DevGenesisExt>;

/// Extension for the dev genesis config to support a custom changes to the genesis state.
#[derive(Serialize, Deserialize)]
pub struct DevGenesisExt {
/// Genesis config.
genesis_config: GenesisConfig,
genesis_config: RuntimeGenesisConfig,
/// The flag that if enable manual-seal mode.
enable_manual_seal: Option<bool>,
}
Expand Down Expand Up @@ -181,17 +181,18 @@ fn testnet_genesis(
endowed_accounts: Vec<AccountId>,
initial_authorities: Vec<(AuraId, GrandpaId)>,
chain_id: u64,
) -> GenesisConfig {
) -> RuntimeGenesisConfig {
use noir_runtime::{
AuraConfig, BalancesConfig, EVMChainIdConfig, EVMConfig, GrandpaConfig, SudoConfig,
SystemConfig,
};

GenesisConfig {
RuntimeGenesisConfig {
// System
system: SystemConfig {
// Add Wasm runtime to storage.
code: wasm_binary.to_vec(),
..Default::default()
},
sudo: SudoConfig {
// Assign network admin rights.
Expand All @@ -209,9 +210,10 @@ fn testnet_genesis(
},
grandpa: GrandpaConfig {
authorities: initial_authorities.iter().map(|x| (x.1.clone(), 1)).collect(),
..Default::default()
},
// EVM compatibility
evm_chain_id: EVMChainIdConfig { chain_id },
evm_chain_id: EVMChainIdConfig { chain_id, ..Default::default() },
evm: EVMConfig {
accounts: {
let mut map = BTreeMap::new();
Expand Down Expand Up @@ -257,6 +259,7 @@ fn testnet_genesis(
);
map
},
..Default::default()
},
ethereum: Default::default(),
dynamic_fee: Default::default(),
Expand Down
27 changes: 9 additions & 18 deletions node/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@

use crate::eth::EthCompatRuntimeApiCollection;
use noir_core_primitives::Block;
use noir_runtime::{AccountId, Balance, Index};
use noir_runtime::{AccountId, Balance, Nonce};
use sc_executor::{NativeElseWasmExecutor, NativeExecutionDispatch, NativeVersion};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_runtime::traits::BlakeTwo256;

pub type Client = FullClient<noir_runtime::RuntimeApi, TemplateRuntimeExecutor>;
/// Full backend.
Expand Down Expand Up @@ -51,20 +50,16 @@ pub trait BaseRuntimeApiCollection:
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
where
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
}

impl<Api> BaseRuntimeApiCollection for Api
where
impl<Api> BaseRuntimeApiCollection for Api where
Api: sp_api::ApiExt<Block>
+ sp_api::Metadata<Block>
+ sp_block_builder::BlockBuilder<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
+ sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
{
}

Expand All @@ -74,23 +69,19 @@ pub trait RuntimeApiCollection:
+ EthCompatRuntimeApiCollection
+ hp_rpc::ConvertTxRuntimeApi<Block>
+ sp_consensus_aura::AuraApi<Block, AuraId>
+ sp_finality_grandpa::GrandpaApi<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index>
+ sp_consensus_grandpa::GrandpaApi<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
where
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
{
}

impl<Api> RuntimeApiCollection for Api
where
impl<Api> RuntimeApiCollection for Api where
Api: BaseRuntimeApiCollection
+ EthCompatRuntimeApiCollection
+ hp_rpc::ConvertTxRuntimeApi<Block>
+ sp_consensus_aura::AuraApi<Block, AuraId>
+ sp_finality_grandpa::GrandpaApi<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>,
<Self as sp_api::ApiExt<Block>>::StateBackend: sp_api::StateBackend<BlakeTwo256>,
+ sp_consensus_grandpa::GrandpaApi<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, Balance>
{
}
14 changes: 7 additions & 7 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use crate::{
cli::{Cli, Subcommand},
service::{self, db_config_dir},
};
use fc_db::frontier_database_dir;
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
use fc_db::kv::frontier_database_dir;
use sc_cli::SubstrateCli;
use sc_service::DatabaseSource;

impl SubstrateCli for Cli {
Expand Down Expand Up @@ -61,10 +61,6 @@ impl SubstrateCli for Cli {
Box::new(chain_spec::ChainSpec::from_json_file(std::path::PathBuf::from(path))?),
})
}

fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
&noir_runtime::VERSION
}
}

/// Parse and run command line arguments
Expand Down Expand Up @@ -135,7 +131,7 @@ pub fn run() -> sc_cli::Result<()> {
let (client, backend, _, task_manager, _) =
service::new_chain_ops(&mut config, &cli.eth)?;
let aux_revert = Box::new(move |client, _, blocks| {
sc_finality_grandpa::revert(client, blocks)?;
sc_consensus_grandpa::revert(client, blocks)?;
Ok(())
});
Ok((cmd.run(client, backend, Some(aux_revert)), task_manager))
Expand All @@ -146,6 +142,10 @@ pub fn run() -> sc_cli::Result<()> {
runner.sync_run(|mut config| {
let (client, _, _, _, frontier_backend) =
service::new_chain_ops(&mut config, &cli.eth)?;
let frontier_backend = match frontier_backend {
fc_db::Backend::KeyValue(kv) => std::sync::Arc::new(kv),
_ => panic!("Only fc_db::Backend::KeyValue supported"),
};
cmd.run(client, frontier_backend)
})
},
Expand Down
Loading

0 comments on commit 8c0f435

Please sign in to comment.