Skip to content

Commit

Permalink
Update SDK to v1.4.0 (#151)
Browse files Browse the repository at this point in the history
Co-authored-by: Joshy Orndorff <admin@joshyorndorff.com>
  • Loading branch information
muraca and JoshOrndorff authored Apr 16, 2024
1 parent c03a33d commit a812cfa
Show file tree
Hide file tree
Showing 21 changed files with 2,148 additions and 2,760 deletions.
4,023 changes: 1,804 additions & 2,219 deletions Cargo.lock

Large diffs are not rendered by default.

135 changes: 68 additions & 67 deletions Cargo.toml

Large diffs are not rendered by default.

60 changes: 19 additions & 41 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sc_service::ChainType;
// 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<RuntimeGenesisConfig>;
pub type ChainSpec = sc_service::GenericChainSpec<()>;

// /// Generate a crypto pair from seed.
// pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand All @@ -30,47 +30,25 @@ pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;
// }

pub fn development_config() -> Result<ChainSpec, String> {
Ok(ChainSpec::from_genesis(
// Name
"Development",
// ID
"dev",
ChainType::Development,
// TuxedoGenesisConfig
development_genesis_config,
// Bootnodes
vec![],
// Telemetry
None,
// Protocol ID
None,
None,
// Properties
None,
// Extensions
None,
))
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?,
None,
)
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(development_genesis_config())
.build())
}

pub fn local_testnet_config() -> Result<ChainSpec, String> {
Ok(ChainSpec::from_genesis(
// Name
"Local Testnet",
// ID
"local_testnet",
ChainType::Local,
// TuxedoGenesisConfig
development_genesis_config,
// Bootnodes
vec![],
// Telemetry
None,
// Protocol ID
None,
// Properties
None,
None,
// Extensions
None,
))
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?,
None,
)
.with_name("Local Testnet")
.with_id("local_testnet")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(development_genesis_config())
.build())
}
63 changes: 18 additions & 45 deletions parachain-node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use sc_service::ChainType;
use serde::{Deserialize, Serialize};

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig, Extensions>;
pub type ChainSpec = sc_service::GenericChainSpec<(), Extensions>;

/// The extensions for the [`ChainSpec`].
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize, ChainSpecGroup, ChainSpecExtension)]
Expand Down Expand Up @@ -47,25 +47,9 @@ impl Extensions {
// parachain_template_runtime::SessionKeys { aura: keys }
// }

pub fn development_config() -> ChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "UNIT".into());
properties.insert("tokenDecimals".into(), 12.into());
properties.insert("ss58Format".into(), 42.into());

ChainSpec::from_genesis(
// Name
"Development",
// ID
"dev",
ChainType::Development,
development_genesis_config,
Vec::new(),
None,
None,
None,
None,
pub fn development_config() -> Result<ChainSpec, String> {
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?,
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
// CAUTION: This value is duplicated in the runtime code. The value here must match, or...
Expand All @@ -74,36 +58,25 @@ pub fn development_config() -> ChainSpec {
para_id: 2000,
},
)
.with_name("Development")
.with_id("dev")
.with_chain_type(ChainType::Development)
.with_genesis_config_patch(development_genesis_config())
.build())
}

pub fn local_testnet_config() -> ChainSpec {
// Give your base currency a unit name and decimal places
let mut properties = sc_chain_spec::Properties::new();
properties.insert("tokenSymbol".into(), "UNIT".into());
properties.insert("tokenDecimals".into(), 12.into());
properties.insert("ss58Format".into(), 42.into());

ChainSpec::from_genesis(
// Name
"Local Testnet",
// ID
"local_testnet",
ChainType::Local,
development_genesis_config,
// Bootnodes
Vec::new(),
// Telemetry
None,
// Protocol ID
Some("template-local"),
// Fork ID
None,
// Properties
Some(properties),
// Extensions
pub fn local_testnet_config() -> Result<ChainSpec, String> {
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?,
Extensions {
relay_chain: "rococo-local".into(), // You MUST set this to the correct network!
para_id: 2000,
},
)
.with_name("Local Testnet")
.with_id("local_testnet")
.with_chain_type(ChainType::Local)
.with_genesis_config_patch(development_genesis_config())
.with_protocol_id("template-local")
.build())
}
6 changes: 3 additions & 3 deletions parachain-node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use crate::{

fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
Ok(match id {
"dev" => Box::new(chain_spec::development_config()),
"template-rococo" => Box::new(chain_spec::local_testnet_config()),
"" | "local" => Box::new(chain_spec::local_testnet_config()),
"dev" => Box::new(chain_spec::development_config()?),
"template-rococo" => Box::new(chain_spec::local_testnet_config()?),
"" | "local" => Box::new(chain_spec::local_testnet_config()?),
path => Box::new(chain_spec::ChainSpec::from_json_file(
std::path::PathBuf::from(path),
)?),
Expand Down
2 changes: 2 additions & 0 deletions tuxedo-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ sc-chain-spec = { optional = true, workspace = true }
sc-client-api = { optional = true, workspace = true }
sc-executor = { optional = true, workspace = true }
sp-blockchain = { optional = true, workspace = true }
sp-genesis-builder = { default-features = false, workspace = true }

[dev-dependencies]
array-bytes = { workspace = true }
Expand All @@ -47,6 +48,7 @@ std = [
"sp-std/std",
"serde/std",
"sp-api/std",
"sp-genesis-builder/std",
"sp-inherents/std",
"sp-io/std",
"sp-runtime/std",
Expand Down
1 change: 0 additions & 1 deletion tuxedo-core/aggregator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ pub fn tuxedo_constraint_checker(_attrs: TokenStream, body: TokenStream) -> Toke
)*
}

#[cfg(feature = "std")]
fn genesis_transactions<V: tuxedo_core::Verifier>() -> Vec<tuxedo_core::types::Transaction<V, #outer_type>> {
let mut all_transactions: Vec<tuxedo_core::types::Transaction<V, #outer_type>> = Vec::new();

Expand Down
2 changes: 0 additions & 2 deletions tuxedo-core/src/constraint_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ pub trait ConstraintChecker: Debug + Encode + Decode + Clone {
);

/// Return the genesis transactions that are required for the inherents.
#[cfg(feature = "std")]
fn genesis_transactions<V: Verifier>() -> Vec<Transaction<V, Self>>;
}

Expand Down Expand Up @@ -149,7 +148,6 @@ impl<T: SimpleConstraintChecker> ConstraintChecker for T {
)
}

#[cfg(feature = "std")]
fn genesis_transactions<V>() -> Vec<Transaction<V, Self>> {
Vec::new()
}
Expand Down
Loading

0 comments on commit a812cfa

Please sign in to comment.