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

Remove v0 parachains runtime #1501

Merged
merged 28 commits into from
Aug 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
35e4cb5
remove v0 parachains modules and switch to v1 primitives
rphmeier Jul 30, 2020
7ec0e79
get tests compiling for runtime-common
rphmeier Jul 30, 2020
25de026
remove registrar module
rphmeier Jul 30, 2020
0798117
Add a dummy module
rphmeier Jul 30, 2020
721bd09
remove runtime-parachains
rphmeier Jul 30, 2020
ea76293
mostly remove old parachains code from polkadot-runtime
rphmeier Jul 30, 2020
bb2ddff
remove slots::Trait implementation
rphmeier Jul 30, 2020
edfe078
remove sp_std prelude import
rphmeier Jul 30, 2020
933903b
Merge branch 'master' into rh-remove-v0-runtime
rphmeier Jul 30, 2020
96e8b8a
add a ZeroSizedTypeDifferentiator to dummy
rphmeier Jul 30, 2020
5bbb31e
finish porting over polkadot runtime
rphmeier Jul 30, 2020
03d1452
ZeroSizedTypeDifferentiator was actually unnecessary
rphmeier Jul 30, 2020
c532a8f
westend
rphmeier Jul 31, 2020
19fca5a
kusama
rphmeier Jul 31, 2020
5c98706
Merge branch 'master' into rh-remove-v0-runtime
rphmeier Jul 31, 2020
60fd854
test-runtime (no dummy modules)
rphmeier Jul 31, 2020
5fd65f6
fix warning
rphmeier Jul 31, 2020
0f69588
fix chain-specs
rphmeier Jul 31, 2020
c2e1630
fix test-service
rphmeier Jul 31, 2020
5ec4bb7
test-client
rphmeier Aug 1, 2020
f7cec7d
remove dead import
rphmeier Aug 2, 2020
96ae647
remove unused needed_extrinsics parameter
rphmeier Aug 2, 2020
3d0db7a
Merge branch 'master' into rh-remove-v0-runtime
rphmeier Aug 12, 2020
ef2bc6a
runtimes compile
rphmeier Aug 12, 2020
c1b1ab4
remove rococo-v0
rphmeier Aug 12, 2020
dbcabb3
remove remaining references to Rococo
rphmeier Aug 12, 2020
32c035d
bump versions
rphmeier Aug 12, 2020
fb51b40
Merge branch 'master' into rh-remove-v0-runtime
rphmeier Aug 13, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 0 additions & 76 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ members = [
"runtime/kusama",
"runtime/rococo-v1",
"runtime/westend",
"runtime/rococo",
"runtime/test-runtime",
"runtime/test-runtime/client",
"service",
Expand Down
4 changes: 0 additions & 4 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ pub struct RunCmd {
#[structopt(long = "force-westend")]
pub force_westend: bool,

/// Force using Rococo native runtime.
#[structopt(long)]
pub force_rococo: bool,

/// Enable the authority discovery module on validator or sentry nodes.
///
/// When enabled:
Expand Down
11 changes: 2 additions & 9 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl SubstrateCli for Cli {
fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
let id = if id == "" {
let n = get_exec_name().unwrap_or_default();
["polkadot", "kusama", "westend", "rococo"].iter()
["polkadot", "kusama", "westend"].iter()
.cloned()
.find(|&chain| n.starts_with(chain))
.unwrap_or("polkadot")
Expand All @@ -65,9 +65,6 @@ impl SubstrateCli for Cli {
"westend-dev" => Box::new(service::chain_spec::westend_development_config()?),
"westend-local" => Box::new(service::chain_spec::westend_local_testnet_config()?),
"westend-staging" => Box::new(service::chain_spec::westend_staging_testnet_config()?),
"rococo-staging" => Box::new(service::chain_spec::rococo_staging_testnet_config()?),
"rococo-local" => Box::new(service::chain_spec::rococo_local_testnet_config()?),
"rococo" => Box::new(service::chain_spec::rococo_config()?),
path => {
let path = std::path::PathBuf::from(path);

Expand All @@ -77,9 +74,7 @@ impl SubstrateCli for Cli {

// When `force_*` is given or the file name starts with the name of one of the known chains,
// we use the chain spec for the specific chain.
if self.run.force_rococo || starts_with("rococo") {
Box::new(service::RococoChainSpec::from_json_file(path)?)
} else if self.run.force_kusama || starts_with("kusama") {
if self.run.force_kusama || starts_with("kusama") {
Box::new(service::KusamaChainSpec::from_json_file(path)?)
} else if self.run.force_westend || starts_with("westend") {
Box::new(service::WestendChainSpec::from_json_file(path)?)
Expand All @@ -95,8 +90,6 @@ impl SubstrateCli for Cli {
&service::kusama_runtime::VERSION
} else if spec.is_westend() {
&service::westend_runtime::VERSION
} else if spec.is_rococo() {
&service::rococo_runtime::VERSION
} else {
&service::polkadot_runtime::VERSION
}
Expand Down
2 changes: 1 addition & 1 deletion network/test/src/block_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn prepare_good_block() -> (TestClient, Hash, u64, PeerId, IncomingBlock<Block>)
let mut client = polkadot_test_runtime_client::new();
let mut builder = client.new_block(Default::default()).unwrap();

let extrinsics = polkadot_test_runtime_client::needed_extrinsics(vec![], 0);
let extrinsics = polkadot_test_runtime_client::needed_extrinsics(0);

for extrinsic in &extrinsics {
builder.push(extrinsic.clone()).unwrap();
Expand Down
42 changes: 0 additions & 42 deletions node/service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,13 +180,6 @@ fn polkadot_staging_testnet_config_genesis(wasm_binary: &[u8]) -> polkadot::Gene
pallet_authority_discovery: Some(polkadot::AuthorityDiscoveryConfig {
keys: vec![],
}),
parachains: Some(polkadot::ParachainsConfig {
authorities: vec![],
}),
registrar: Some(polkadot::RegistrarConfig {
parachains: vec![],
_phdata: Default::default(),
}),
claims: Some(polkadot::ClaimsConfig {
claims: vec![],
vesting: vec![],
Expand Down Expand Up @@ -321,13 +314,6 @@ fn westend_staging_testnet_config_genesis(wasm_binary: &[u8]) -> westend::Genesi
pallet_authority_discovery: Some(westend::AuthorityDiscoveryConfig {
keys: vec![],
}),
parachains: Some(westend::ParachainsConfig {
authorities: vec![],
}),
registrar: Some(westend::RegistrarConfig {
parachains: vec![],
_phdata: Default::default(),
}),
pallet_vesting: Some(westend::VestingConfig {
vesting: vec![],
}),
Expand Down Expand Up @@ -472,13 +458,6 @@ fn kusama_staging_testnet_config_genesis(wasm_binary: &[u8]) -> kusama::GenesisC
pallet_authority_discovery: Some(kusama::AuthorityDiscoveryConfig {
keys: vec![],
}),
parachains: Some(kusama::ParachainsConfig {
authorities: vec![],
}),
registrar: Some(kusama::RegistrarConfig {
parachains: vec![],
_phdata: Default::default(),
}),
claims: Some(kusama::ClaimsConfig {
claims: vec![],
vesting: vec![],
Expand Down Expand Up @@ -657,13 +636,6 @@ pub fn polkadot_testnet_genesis(
pallet_authority_discovery: Some(polkadot::AuthorityDiscoveryConfig {
keys: vec![],
}),
parachains: Some(polkadot::ParachainsConfig {
authorities: vec![],
}),
registrar: Some(polkadot::RegistrarConfig{
parachains: vec![],
_phdata: Default::default(),
}),
claims: Some(polkadot::ClaimsConfig {
claims: vec![],
vesting: vec![],
Expand Down Expand Up @@ -732,13 +704,6 @@ pub fn kusama_testnet_genesis(
pallet_authority_discovery: Some(kusama::AuthorityDiscoveryConfig {
keys: vec![],
}),
parachains: Some(kusama::ParachainsConfig {
authorities: vec![],
}),
registrar: Some(kusama::RegistrarConfig{
parachains: vec![],
_phdata: Default::default(),
}),
claims: Some(kusama::ClaimsConfig {
claims: vec![],
vesting: vec![],
Expand Down Expand Up @@ -796,13 +761,6 @@ pub fn westend_testnet_genesis(
pallet_authority_discovery: Some(westend::AuthorityDiscoveryConfig {
keys: vec![],
}),
parachains: Some(westend::ParachainsConfig {
authorities: vec![],
}),
registrar: Some(westend::RegistrarConfig{
parachains: vec![],
_phdata: Default::default(),
}),
pallet_vesting: Some(westend::VestingConfig {
vesting: vec![],
}),
Expand Down
2 changes: 1 addition & 1 deletion node/service/src/grandpa_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ mod tests {
for i in 0..n {
let mut builder = client.new_block(Default::default()).unwrap();

for extrinsic in polkadot_test_runtime_client::needed_extrinsics(vec![], base + i) {
for extrinsic in polkadot_test_runtime_client::needed_extrinsics(base + i) {
builder.push(extrinsic).unwrap()
}

Expand Down
7 changes: 0 additions & 7 deletions node/test-service/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,6 @@ fn polkadot_testnet_genesis(
pallet_babe: Some(Default::default()),
pallet_grandpa: Some(Default::default()),
pallet_authority_discovery: Some(polkadot::AuthorityDiscoveryConfig { keys: vec![] }),
parachains: Some(polkadot::ParachainsConfig {
authorities: vec![],
}),
registrar: Some(polkadot::RegistrarConfig {
parachains: vec![],
_phdata: Default::default(),
}),
claims: Some(polkadot::ClaimsConfig {
claims: vec![],
vesting: vec![],
Expand Down
14 changes: 5 additions & 9 deletions node/test-service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ use futures::future::Future;
use polkadot_primitives::v0::{
Block, Hash, CollatorId, Id as ParaId,
};
use polkadot_runtime_common::{parachains, registrar, BlockHashCount};
use polkadot_service::{new_full, FullNodeHandles, AbstractClient, ClientHandle, ExecuteWithClient};
use polkadot_test_runtime::{RestrictFunctionality, Runtime, SignedExtra, SignedPayload, VERSION};
use polkadot_runtime_common::BlockHashCount;
use polkadot_service::{
new_full, FullNodeHandles, AbstractClient, ClientHandle, ExecuteWithClient,
};
use polkadot_test_runtime::{Runtime, SignedExtra, SignedPayload, VERSION};
use sc_chain_spec::ChainSpec;
use sc_client_api::{execution_extensions::ExecutionStrategies, BlockchainEvents};
use sc_executor::native_executor_instance;
Expand Down Expand Up @@ -258,31 +260,25 @@ where
.unwrap_or(2) as u64;
let tip = 0;
let extra: SignedExtra = (
RestrictFunctionality,
frame_system::CheckSpecVersion::<Runtime>::new(),
frame_system::CheckTxVersion::<Runtime>::new(),
frame_system::CheckGenesis::<Runtime>::new(),
frame_system::CheckEra::<Runtime>::from(generic::Era::mortal(period, current_block)),
frame_system::CheckNonce::<Runtime>::from(nonce),
frame_system::CheckWeight::<Runtime>::new(),
pallet_transaction_payment::ChargeTransactionPayment::<Runtime>::from(tip),
registrar::LimitParathreadCommits::<Runtime>::new(),
parachains::ValidateDoubleVoteReports::<Runtime>::new(),
);
let raw_payload = SignedPayload::from_raw(
function.clone(),
extra.clone(),
(
(),
VERSION.spec_version,
VERSION.transaction_version,
genesis_block,
current_block_hash,
(),
(),
(),
(),
(),
),
);
let signature = raw_payload.using_encoded(|e| caller.sign(e));
Expand Down
19 changes: 19 additions & 0 deletions primitives/src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,25 @@ sp_api::decl_runtime_apis! {
}
}

/// Custom validity errors used in Polkadot while validating transactions.
#[repr(u8)]
pub enum ValidityError {
/// The Ethereum signature is invalid.
InvalidEthereumSignature = 0,
/// The signer has no claim.
SignerHasNoClaim = 1,
/// No permission to execute the call.
NoPermission = 2,
/// An invalid statement was made for a claim.
InvalidStatement = 3,
}

impl From<ValidityError> for u8 {
fn from(err: ValidityError) -> Self {
err as u8
}
}

#[cfg(test)]
mod tests {
use super::*;
Expand Down
Loading