Repository navigation
Expand file tree
/
Copy pathchain_spec.rs
More file actions
66 lines (60 loc) · 2.35 KB
/
Copy pathchain_spec.rs
File metadata and controls
66 lines (60 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
use quip_protocol_runtime::WASM_BINARY;
use sc_service::ChainType;
/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec;
pub fn development_chain_spec() -> Result<ChainSpec, String> {
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_preset_name(sp_genesis_builder::DEV_RUNTIME_PRESET)
.build())
}
pub fn local_chain_spec() -> Result<ChainSpec, String> {
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_preset_name(sp_genesis_builder::LOCAL_TESTNET_RUNTIME_PRESET)
.build())
}
pub fn local_three_validator_chain_spec() -> Result<ChainSpec, String> {
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?,
None,
)
.with_name("Local Testnet (3 Validators)")
.with_id("local_three_validator")
.with_chain_type(ChainType::Local)
.with_genesis_config_preset_name(
quip_protocol_runtime::genesis_config_presets::LOCAL_THREE_VALIDATOR_RUNTIME_PRESET,
)
.build())
}
pub fn validator_rehearsal_chain_spec() -> Result<ChainSpec, String> {
Ok(ChainSpec::builder(
WASM_BINARY.ok_or_else(|| "Rehearsal wasm not available".to_string())?,
None,
)
.with_name("Validator Rehearsal (4 Validators)")
.with_id("validator_rehearsal")
.with_chain_type(ChainType::Local)
.with_genesis_config_preset_name(
quip_protocol_runtime::genesis_config_presets::REHEARSAL_RUNTIME_PRESET,
)
.build())
}
/// The byte-pinned public testnet artifact, including its historical runtime.
///
/// All live aliases load this file. Rebuilding a runtime preset with the current
/// WASM_BINARY cannot reproduce the published live genesis. The runtime's
/// `quip_testnet` preset remains registered for policy auditing only.
pub fn quip_testnet_chain_spec() -> Result<ChainSpec, String> {
ChainSpec::from_json_bytes(include_bytes!("../../chain-specs/quip-testnet.json").as_slice())
}