diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 86c34630bd7920f79614fd0db55f464cb7efb5dc..3872fd937113e72288729a440a475fc2f3ca0011 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -64,24 +64,24 @@ fmt_and_clippy: - cargo clippy -- -V - cargo clippy --all --tests -- -D warnings -run_benchmarks: - stage: tests - script: - - echo podman build --layers --tag "$IMAGE_NAME:$IMAGE_TAG" -f docker/Dockerfile $PODMAN_BUILD_OPTIONS . - - podman build --layers --tag "$IMAGE_NAME:$IMAGE_TAG" -f docker/Dockerfile $PODMAN_BUILD_OPTIONS . - rules: - - if: $CI_COMMIT_REF_NAME =~ /^wip*$/ - when: manual - - if: $CI_COMMIT_TAG - when: never - - if: '$CI_MERGE_REQUEST_ID || $CI_COMMIT_BRANCH == "master"' - - when: manual - variables: - IMAGE_NAME: "duniter/duniter-v2s-test" - IMAGE_TAG: "debug-sha-$CI_COMMIT_SHORT_SHA" - PODMAN_BUILD_OPTIONS: "--target build --build-arg benchmarks=1" - tags: - - podman +#run_benchmarks: +# stage: tests +# script: +# - echo podman build --layers --tag "$IMAGE_NAME:$IMAGE_TAG" -f docker/Dockerfile $PODMAN_BUILD_OPTIONS . +# - podman build --layers --tag "$IMAGE_NAME:$IMAGE_TAG" -f docker/Dockerfile $PODMAN_BUILD_OPTIONS . +# rules: +# - if: $CI_COMMIT_REF_NAME =~ /^wip*$/ +# when: manual +# - if: $CI_COMMIT_TAG +# when: never +# - if: '$CI_MERGE_REQUEST_ID || $CI_COMMIT_BRANCH == "master"' +# - when: manual +# variables: +# IMAGE_NAME: "duniter/duniter-v2s-test" +# IMAGE_TAG: "debug-sha-$CI_COMMIT_SHORT_SHA" +# PODMAN_BUILD_OPTIONS: "--target build --build-arg benchmarks=1" +# tags: +# - podman gdev_build: stage: build diff --git a/Cargo.lock b/Cargo.lock index 18ca3f75c6166b149d7ee6497038a784bfc4e484..0c1030846306303391e9c4a480c86ae1738c8c91 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1967,6 +1967,7 @@ dependencies = [ "sc-transaction-pool-api", "serde", "serde_json", + "serde_yaml", "sp-api", "sp-authority-discovery", "sp-block-builder", @@ -8858,18 +8859,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -8908,6 +8909,19 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_yaml" +version = "0.9.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cc7a1570e38322cfe4154732e5110f887ea57e22b76f4bfd32b5bdd3368666c" +dependencies = [ + "indexmap 2.1.0", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + [[package]] name = "sha-1" version = "0.9.8" @@ -10967,6 +10981,12 @@ dependencies = [ "void", ] +[[package]] +name = "unsafe-libyaml" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28467d3e1d3c6586d8f25fa243f544f5800fec42d97032474e17222c2b75cfa" + [[package]] name = "unsigned-varint" version = "0.7.1" diff --git a/Cargo.toml b/Cargo.toml index 139256e47c2369424903a1c404046e2157a9cbbb..9142087a3ca1c89da1b2f33ef43d2ea132f3a628 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,7 +7,7 @@ homepage = 'https://duniter.org' license = 'AGPL-3.0' name = 'duniter' repository = 'https://git.duniter.org/nodes/rust/duniter-v2s' -version = '0.3.0' +version = '0.7.0' [package.metadata.docs.rs] targets = ['x86_64-unknown-linux-gnu'] @@ -81,6 +81,7 @@ maplit = { version = '1.0.2', default-features = false } memmap2 = { version = "0.5.10", default-features = false } serde = { version = "1.0", default-features = false } serde_json = { version = "1.0.64", default-features = false } +serde_yaml = { version = "0.9.27", default-features = false } tracing-core = { version = "0.1.28", default-features = false } enum-as-inner = { version = "=0.5.1", default-features = false } #https://github.com/bluejekyll/trust-dns/issues/1946 num-format = "0.4.4" diff --git a/node/specs/gdev_client-specs.json b/node/specs/gdev_client-specs.json deleted file mode 100644 index 4b66c7d1f38beb478c741cc20f7954b7b72140ec..0000000000000000000000000000000000000000 --- a/node/specs/gdev_client-specs.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "ÄžDev", - "id": "gdev", - "chainType": "Live", - "bootNodes": [], - "telemetryEndpoints": [ - [ - "/dns/telemetry.polkadot.io/tcp/443/x-parity-wss/%2Fsubmit%2F", - 0 - ] - ], - "properties": { - "tokenDecimals": 2, - "tokenSymbol": "ÄžD" - } -} \ No newline at end of file diff --git a/node/specs/gdev_client-specs.yaml b/node/specs/gdev_client-specs.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2da813e763d54ad38fef305f74c54be092ff13a0 --- /dev/null +++ b/node/specs/gdev_client-specs.yaml @@ -0,0 +1,9 @@ +name: "ÄžDev" +id: "gdev" +chainType: "Live" +bootNodes: [] +telemetryEndpoints: + - ["/dns/telemetry.polkadot.io/tcp/443/x-parity-wss/%2Fsubmit%2F", 0] +properties: + tokenDecimals: 2 + tokenSymbol: "ÄžD" diff --git a/node/specs/gtest_client-specs.json b/node/specs/gtest_client-specs.json deleted file mode 100644 index 7cb088045e8b1f381e77674b1b4b8d35384697ed..0000000000000000000000000000000000000000 --- a/node/specs/gtest_client-specs.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "ÄžTest", - "id": "gtest", - "chainType": "Live", - "bootNodes": [], - "telemetryEndpoints": [ - [ - "/dns/telemetry.polkadot.io/tcp/443/x-parity-wss/%2Fsubmit%2F", - 0 - ] - ], - "properties": { - "tokenDecimals": 2, - "tokenSymbol": "ÄžT" - } -} \ No newline at end of file diff --git a/node/specs/gtest_client-specs.yaml b/node/specs/gtest_client-specs.yaml new file mode 100644 index 0000000000000000000000000000000000000000..093c5efa0dda31d29d4ee092713891a4b88ee700 --- /dev/null +++ b/node/specs/gtest_client-specs.yaml @@ -0,0 +1,9 @@ +name: "ÄžTest" +id: "gtest" +chainType: "Live" +bootNodes: [] +telemetryEndpoints: + - ["/dns/telemetry.polkadot.io/tcp/443/x-parity-wss/%2Fsubmit%2F", 0] +properties: + tokenDecimals: 2 + tokenSymbol: "ÄžT" diff --git a/node/src/chain_spec/gdev.rs b/node/src/chain_spec/gdev.rs index b47b97d72c39f7c447a747d815b1edc38e82998f..b45ba2b21800ed89e5a413d2dae8ed1143f1a8e8 100644 --- a/node/src/chain_spec/gdev.rs +++ b/node/src/chain_spec/gdev.rs @@ -83,7 +83,7 @@ fn get_parameters(parameters_from_file: &Option<GenesisParameters>) -> CommonPar } /// generate development chainspec with Alice validator -pub fn gdev_development_chain_spec(json_file_path: String) -> Result<ChainSpec, String> { +pub fn gdev_development_chain_spec(config_file_path: String) -> Result<ChainSpec, String> { let wasm_binary = get_wasm_binary().ok_or_else(|| "Development wasm not available".to_string())?; Ok(ChainSpec::from_genesis( @@ -97,7 +97,7 @@ pub fn gdev_development_chain_spec(json_file_path: String) -> Result<ChainSpec, move || { let genesis_data = gen_genesis_data::generate_genesis_data::<_, _, SessionKeys, GDevSKP>( - json_file_path.clone(), + config_file_path.clone(), get_parameters, Some("Alice".to_owned()), ) @@ -148,7 +148,10 @@ pub struct ClientSpec { } /// generate live network chainspecs -pub fn gen_live_conf(client_spec: ClientSpec, json_file_path: String) -> Result<ChainSpec, String> { +pub fn gen_live_conf( + client_spec: ClientSpec, + config_file_path: String, +) -> Result<ChainSpec, String> { let wasm_binary = get_wasm_binary().ok_or_else(|| "wasm not available".to_string())?; Ok(ChainSpec::from_genesis( // Name @@ -160,7 +163,7 @@ pub fn gen_live_conf(client_spec: ClientSpec, json_file_path: String) -> Result< move || { let genesis_data = gen_genesis_data::generate_genesis_data::<_, _, SessionKeys, GDevSKP>( - json_file_path.clone(), + config_file_path.clone(), get_parameters, None, ) diff --git a/node/src/chain_spec/gen_genesis_data.rs b/node/src/chain_spec/gen_genesis_data.rs index c5560d03d289616d3841fc4d62cc8448f70d7f68..642bb8afdc18e55490364ce1f043e9955ceae194 100644 --- a/node/src/chain_spec/gen_genesis_data.rs +++ b/node/src/chain_spec/gen_genesis_data.rs @@ -15,7 +15,7 @@ // along with Duniter-v2S. If not, see <https://www.gnu.org/licenses/>. use crate::chain_spec::{get_account_id_from_seed, get_from_seed, AccountPublic}; -use common_runtime::constants::DAYS; +use common_runtime::constants::{DAYS, MILLISECS_PER_BLOCK}; use common_runtime::*; use log::{error, warn}; use num_format::{Locale, ToFormattedString}; @@ -252,7 +252,7 @@ struct GenesisInfo<'a> { /// takes DUNITER_GENESIS_CONFIG env var if present or duniter-gen-conf.json by default // this function is targeting dev chainspecs, do not use in production network pub fn generate_genesis_data<P, SK, SessionKeys: Encode, SKP>( - json_file_path: String, + config_file_path: String, get_common_parameters: fn(&Option<P>) -> CommonParameters, maybe_force_authority: Option<String>, ) -> Result<GenesisData<P, SK>, String> @@ -276,7 +276,7 @@ where technical_committee, ud, } = get_genesis_input::<P>( - std::env::var("DUNITER_GENESIS_CONFIG").unwrap_or_else(|_| json_file_path.to_owned()), + std::env::var("DUNITER_GENESIS_CONFIG").unwrap_or_else(|_| config_file_path.to_owned()), )?; // Per network parameters @@ -747,37 +747,59 @@ fn dump_genesis_info(info: GenesisInfo) { info.technical_committee_members.len(), ); + let (membership_period, membership_period_unit) = + get_best_unit_and_diviser_for_blocks(info.common_parameters.membership_period); + let (cert_period, cert_period_unit) = + get_best_unit_and_diviser_for_blocks(info.common_parameters.cert_period); + let (cert_validity_period, cert_validity_period_unit) = + get_best_unit_and_diviser_for_blocks(info.common_parameters.cert_validity_period); + let (smith_membership_period, smith_membership_period_unit) = + get_best_unit_and_diviser_for_blocks(info.common_parameters.smith_membership_period); + let (smith_certs_validity_period, smith_certs_validity_period_unit) = + get_best_unit_and_diviser_for_blocks(info.common_parameters.smith_certs_validity_period); + let (ud_reeval_period, ud_reeval_period_unit) = + get_best_unit_and_diviser_for_ms(info.common_parameters.ud_reeval_period as f32); + let (ud_creation_period, ud_creation_period_unit) = + get_best_unit_and_diviser_for_ms(info.common_parameters.ud_creation_period as f32); + // give genesis info log::info!( "currency parameters: - existential deposit: {} {} - currency decimals: {} - - membership validity: {} days - - certification period: {} days - - certification validity duration: {} days - - smith membership validity: {} days - - smith certification validity: {} days + - membership validity: {} {} + - certification period: {} {} + - certification validity duration: {} {} + - smith membership validity: {} {} + - smith certification validity: {} {} - required certifications: {} - smith required certifications: {} - max certifications by issuer: {} - - money growth rate: {}% every {} days - - UD creation period: {} days + - money growth rate: {}% every {} {} + - UD creation period: {} {} - distance percent of required referees: {}% - distance max depth: {}", - info.common_parameters.existential_deposit, + info.common_parameters.existential_deposit as f64 / 100.0, info.common_parameters.currency_name, info.common_parameters.decimals, - info.common_parameters.membership_period as f32 / DAYS as f32, - info.common_parameters.cert_period as f32 / DAYS as f32, - info.common_parameters.cert_validity_period as f32 / DAYS as f32, - info.common_parameters.smith_membership_period as f32 / DAYS as f32, - info.common_parameters.smith_certs_validity_period as f32 / DAYS as f32, + membership_period, + membership_period_unit, + cert_period, + cert_period_unit, + cert_validity_period, + cert_validity_period_unit, + smith_membership_period, + smith_membership_period_unit, + smith_certs_validity_period, + smith_certs_validity_period_unit, info.common_parameters.min_cert, info.common_parameters.smith_min_cert, info.common_parameters.cert_max_by_issuer, f32::sqrt(info.common_parameters.c2.deconstruct() as f32 / 1_000_000_000f32) * 100f32, - info.common_parameters.ud_reeval_period as f32 / DAYS as f32, - info.common_parameters.ud_creation_period as f32 / DAYS as f32, + ud_reeval_period, + ud_reeval_period_unit, + ud_creation_period, + ud_creation_period_unit, info.common_parameters .distance_min_accessible_referees .deconstruct() as f32 @@ -787,6 +809,45 @@ fn dump_genesis_info(info: GenesisInfo) { ); } +fn get_best_unit_and_diviser_for_ms(duration_in_ms: f32) -> (f32, String) { + let diviser = get_best_diviser(duration_in_ms); + let qty = duration_in_ms / diviser; + let unit = diviser_to_unit(diviser, qty); + (qty, unit) +} + +fn get_best_unit_and_diviser_for_blocks(duration_in_blocks: u32) -> (f32, String) { + let duration_in_ms = duration_in_blocks as f32 * (MILLISECS_PER_BLOCK as u32) as f32; + get_best_unit_and_diviser_for_ms(duration_in_ms) +} + +fn diviser_to_unit(value_in_ms: f32, qty: f32) -> String { + let unit = if value_in_ms >= 24.0 * 3600.0 * 1000.0 { + "day".to_string() + } else if value_in_ms >= 3600.0 * 1000.0 { + "hour".to_string() + } else if value_in_ms >= 60.0 * 1000.0 { + "minute".to_string() + } else { + "second".to_string() + }; + let plural = if qty > 1f32 { "s" } else { "" }; + format!("{}{}", unit, plural) +} + +fn get_best_diviser(ms_value: f32) -> f32 { + let one_minute: f32 = 1000.0 * 60.0; + let one_hour: f32 = one_minute * 60.0; + let one_day: f32 = one_hour * 24.0; + if ms_value > one_day { + one_day + } else if ms_value > one_hour { + one_hour + } else { + one_minute + } +} + fn smiths_and_technical_committee_checks( inactive_identities: &HashMap<u32, String>, technical_committee: &Vec<String>, @@ -1640,19 +1701,19 @@ fn check_parameters_consistency( } fn get_genesis_input<P: Default + DeserializeOwned>( - json_file_path: String, + config_file_path: String, ) -> Result<GenesisInput<P>, String> { // We mmap the file into memory first, as this is *a lot* faster than using // `serde_json::from_reader`. See https://github.com/serde-rs/json/issues/160 - let file = std::fs::File::open(&json_file_path) - .map_err(|e| format!("Error opening gen conf file `{}`: {}", json_file_path, e))?; + let file = std::fs::File::open(&config_file_path) + .map_err(|e| format!("Error opening gen conf file `{}`: {}", config_file_path, e))?; // SAFETY: `mmap` is fundamentally unsafe since technically the file can change // underneath us while it is mapped; in practice it's unlikely to be a problem let bytes = unsafe { memmap2::Mmap::map(&file) - .map_err(|e| format!("Error mmaping gen conf file `{}`: {}", json_file_path, e))? + .map_err(|e| format!("Error mmaping gen conf file `{}`: {}", config_file_path, e))? }; - serde_json::from_slice::<GenesisInput<P>>(&bytes) + serde_yaml::from_slice::<GenesisInput<P>>(&bytes) .map_err(|e| format!("Error parsing gen conf file: {}", e)) } diff --git a/node/src/chain_spec/gtest.rs b/node/src/chain_spec/gtest.rs index eba09b1778f90ceae4b4c7989fbdccd617c937b7..ad6120e3cd2a6222881cbaffce7c8dc9b70852af 100644 --- a/node/src/chain_spec/gtest.rs +++ b/node/src/chain_spec/gtest.rs @@ -109,7 +109,7 @@ pub struct ClientSpec { /// generate development chainspec with Alice validator // there is some code duplication because we can not use ClientSpec -pub fn development_chainspecs(json_file_path: String) -> Result<ChainSpec, String> { +pub fn development_chainspecs(config_file_path: String) -> Result<ChainSpec, String> { let wasm_binary = get_wasm_binary().ok_or_else(|| "wasm not available".to_string())?; Ok(ChainSpec::from_genesis( // Name @@ -122,7 +122,7 @@ pub fn development_chainspecs(json_file_path: String) -> Result<ChainSpec, Strin move || { let genesis_data = gen_genesis_data::generate_genesis_data::<_, _, SessionKeys, GTestSKP>( - json_file_path.clone(), + config_file_path.clone(), get_parameters, Some("Alice".to_owned()), ) @@ -158,7 +158,7 @@ pub fn development_chainspecs(json_file_path: String) -> Result<ChainSpec, Strin // one smith must have session keys pub fn live_chainspecs( client_spec: ClientSpec, - json_file_path: String, + config_file_path: String, ) -> Result<ChainSpec, String> { let wasm_binary = get_wasm_binary().ok_or_else(|| "wasm not available".to_string())?; Ok(ChainSpec::from_genesis( @@ -172,7 +172,7 @@ pub fn live_chainspecs( move || { let genesis_data = gen_genesis_data::generate_genesis_data::<_, _, SessionKeys, GTestSKP>( - json_file_path.clone(), + config_file_path.clone(), get_parameters, None, ) diff --git a/node/src/command.rs b/node/src/command.rs index c68bc2971008bd2d5c249fc4dcaa8bdac05d8bd9..b0e012ae2df86200d2ceefdb45dca0bd1c506daf 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -99,26 +99,26 @@ impl SubstrateCli for Cli { // > optionally from DUNITER_GENESIS_CONFIG file to override default gdev configuration #[cfg(feature = "gdev")] "gdev_dev" => Box::new(chain_spec::gdev::gdev_development_chain_spec( - "resources/gdev.json".to_string(), + "resources/gdev.yaml".to_string(), )?), // chainspecs for live network with g1 data, gdev configuration (parameters & smiths) // but must have a smith with declared session keys // > optionally from DUNITER_GENESIS_CONFIG file to override default gdev configuration #[cfg(feature = "gdev")] "gdev_live" => { - const JSON_CLIENT_SPEC: &str = "./node/specs/gdev_client-specs.json"; - let client_spec: chain_spec::gdev::ClientSpec = serde_json::from_slice( + const CLIENT_SPEC: &str = "./node/specs/gdev_client-specs.yaml"; + let client_spec: chain_spec::gdev::ClientSpec = serde_yaml::from_slice( &std::fs::read( - std::env::var("DUNITER_GTEST_CLIENT_SPEC") - .unwrap_or_else(|_| JSON_CLIENT_SPEC.to_string()), + std::env::var("DUNITER_CLIENT_SPEC") + .unwrap_or_else(|_| CLIENT_SPEC.to_string()), ) - .map_err(|e| format!("failed to read {JSON_CLIENT_SPEC} {e}"))?[..], + .map_err(|e| format!("failed to read {CLIENT_SPEC} {e}"))?[..], ) .map_err(|e| format!("failed to parse {e}"))?; // rebuild chainspecs from these files Box::new(chain_spec::gdev::gen_live_conf( client_spec, - "resources/gdev.json".to_string(), + "resources/gdev.yaml".to_string(), )?) } // hardcoded previously generated raw chainspecs @@ -133,7 +133,7 @@ impl SubstrateCli for Cli { // otherwise you get a local testnet with generated genesis #[cfg(feature = "gtest")] "gtest_dev" => Box::new(chain_spec::gtest::development_chainspecs( - "resources/gtest.json".to_string(), + "resources/gtest.yaml".to_string(), )?), // chainspecs for live network // must have following files in ./node/specs folder or overwrite with env var: @@ -141,10 +141,10 @@ impl SubstrateCli for Cli { // - gtest_client-specs.json / DUNITER_GTEST_CLIENT_SPEC #[cfg(feature = "gtest")] "gtest_live" => { - const JSON_CLIENT_SPEC: &str = "./node/specs/gtest_client-specs.json"; - let client_spec: gtest::ClientSpec = serde_json::from_slice( + const JSON_CLIENT_SPEC: &str = "./node/specs/gtest_client-specs.yaml"; + let client_spec: gtest::ClientSpec = serde_yaml::from_slice( &std::fs::read( - std::env::var("DUNITER_GTEST_CLIENT_SPEC") + std::env::var("DUNITER_CLIENT_SPEC") .unwrap_or_else(|_| JSON_CLIENT_SPEC.to_string()), ) .map_err(|e| format!("failed to read {JSON_CLIENT_SPEC} {e}"))?[..], @@ -153,7 +153,7 @@ impl SubstrateCli for Cli { // rebuild chainspecs from these files Box::new(chain_spec::gtest::live_chainspecs( client_spec, - "resources/gtest.json".to_string(), + "resources/gtest.yaml".to_string(), )?) } // return hardcoded live chainspecs, only with embed feature diff --git a/resources/gdev.json b/resources/gdev.json deleted file mode 100644 index 2a8fc2dfe8fba746bf79fd8de3aa73fcca28f645..0000000000000000000000000000000000000000 --- a/resources/gdev.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "ud": 1000, - "first_ud": 6000, - "first_ud_reeval": 600000, - "parameters": { - "babe_epoch_duration": 600, - "cert_period": 14400, - "cert_max_by_issuer": 100, - "cert_min_received_cert_to_issue_cert": 3, - "cert_validity_period": 2102400, - "idty_confirm_period": 14400, - "idty_creation_period": 14400, - "membership_period": 1051200, - "pending_membership_period": 172800, - "ud_creation_period": 14400, - "ud_reeval_period": 100800, - "smith_cert_period": 14400, - "smith_cert_max_by_issuer": 15, - "smith_cert_min_received_cert_to_issue_cert": 3, - "smith_cert_validity_period": 2102400, - "smith_membership_period": 1051200, - "smith_pending_membership_period": 172800, - "smith_wot_first_cert_issuable_on": 14400, - "smith_wot_min_cert_for_membership": 3, - "wot_first_cert_issuable_on": 0, - "wot_min_cert_for_create_idty_right": 3, - "wot_min_cert_for_membership": 3 - }, - "clique_smiths": [ - { "name": "Pini" }, - { "name": "moul" }, - { "name": "HugoTrentesaux" }, - { "name": "tuxmain" }, - { "name": "1000i100" }, - { "name": "vit" }, - { "name": "cgeek", - "migration_address": "5E6q47RRGZU15LjUiBTm2DZjpqFKAjRNafYS8YV8AzTQZtLG", - "session_keys": "0xec6d7141864ca265b1c31a164d258e907e044380ac110c57502135943904137f5a172f9a6759763f59a7e0a4d170b467b744eabb3adb454f38a2e7957fb9cd285a172f9a6759763f59a7e0a4d170b467b744eabb3adb454f38a2e7957fb9cd285a172f9a6759763f59a7e0a4d170b467b744eabb3adb454f38a2e7957fb9cd28" - } - ], - "sudo_key": "5Hm8sBbwuLAU99dBezvgtnRmZCrUy9mhqmbQMFyGTaeATYg7", - "treasury_funder_address": "5E6q47RRGZU15LjUiBTm2DZjpqFKAjRNafYS8YV8AzTQZtLG", - "technical_committee": ["Pini", "moul", "HugoTrentesaux", "tuxmain", "1000i100", "vit", "cgeek"] -} \ No newline at end of file diff --git a/resources/gdev.yaml b/resources/gdev.yaml new file mode 100644 index 0000000000000000000000000000000000000000..682a03e817bf80f734f6efae7b7270c23405b201 --- /dev/null +++ b/resources/gdev.yaml @@ -0,0 +1,80 @@ +# 10,00 ÄžD per UD +ud: 1000 + +# null = block#0 + ud_creation_period waiting (ms) +first_ud: null + +# null = block#0 + ud_reeval_period waiting (ms) +first_ud_reeval: null + +parameters: + # Epoch (session) duration, in number of blocks. 1h. + babe_epoch_duration: 600 + # Time between 2 UDs, in milliseconds. 4 hours. + ud_creation_period: 14400000 + # Time between 2 UD reevaluations, in milliseconds + ud_reeval_period: 86400000 + + # ----- MAIN WOT ----- + # Duration to wait between two emitted certifications, in blocks. 1 day. + cert_period: 14400 + # Maximum quantity of currently valid certifications emitted by a same issuer. 100 certs. + cert_max_by_issuer: 100 + # Minimum quantity of received certifications to be able to certify someone else. 3 certs. + cert_min_received_cert_to_issue_cert: 3 + # Validity duration of a certification, in blocks. 146 days. + cert_validity_period: 2102400 + # Validity duration of a membership. 73 days. + membership_period: 1051200 + # Validity duration of a pending membership. 12 days. + pending_membership_period: 172800 + # Delay (in blocks) a member must observe before being able to emit a certification + wot_first_cert_issuable_on: 0 + # Number of required received certs to become a member + wot_min_cert_for_membership: 3 + # Time to wait between two creation of an identity by a same issue, in blocks. 1 day. + idty_creation_period: 14400 + # Window to confirm an identity, in blocks. 1 day. + idty_confirm_period: 14400 + # Number of required received certs to be able to create identities + wot_min_cert_for_create_idty_right: 3 + + # ----- SMITH WOT ----- + # Duration to wait between two emitted certifications, in blocks. 1 day. + smith_cert_period: 14400 + # Maximum quantity of currently valid certifications emitted by a same issuer. 15 certs. + smith_cert_max_by_issuer: 15 + # Minimum quantity of received certifications to be able to certify someone else. + smith_cert_min_received_cert_to_issue_cert: 3 + # Validity duration of a certification, in blocks. 146 days. + smith_cert_validity_period: 2102400 + # Validity duration of a membership. 73 days. + smith_membership_period: 1051200 + # Validity duration of a pending membership. 12 days. + smith_pending_membership_period: 172800 + # Delay (in blocks) a member must observe before being able to emit a certification + smith_wot_first_cert_issuable_on: 14400 + # Number of required received certs to become a member + smith_wot_min_cert_for_membership: 3 + +# Clique Smith WoT: each smith will certify by each other smith automatically on Genesis +clique_smiths: + - name: "Pini" + - name: "moul" + - name: "HugoTrentesaux" + - name: "tuxmain" + - name: "1000i100" + - name: "vit" + - name: "cgeek" + # This smith will be the first author + session_keys: "0xec6d7141864ca265b1c31a164d258e907e044380ac110c57502135943904137f5a172f9a6759763f59a7e0a4d170b467b744eabb3adb454f38a2e7957fb9cd285a172f9a6759763f59a7e0a4d170b467b744eabb3adb454f38a2e7957fb9cd285a172f9a6759763f59a7e0a4d170b467b744eabb3adb454f38a2e7957fb9cd28" + # This smith changes its key to Sr25519 wallet on startup (to be able to use Polkadot.js app right on start) + migration_address: "5E6q47RRGZU15LjUiBTm2DZjpqFKAjRNafYS8YV8AzTQZtLG" + +sudo_key: "5CyfGVTxzVZ16AKTMygqBSuxELLrQC4SEY5bKZ4MiESxvTZ9" + +# The address which will automatically transfer 1,00 ÄžD on Genesis to the Treasury +treasury_funder_address: "5E6q47RRGZU15LjUiBTm2DZjpqFKAjRNafYS8YV8AzTQZtLG" + +# The technical committee members, to act as sudo +technical_committee: ["Pini", "moul", "HugoTrentesaux", "tuxmain", "1000i100", "vit", "cgeek"] \ No newline at end of file diff --git a/resources/gtest.json b/resources/gtest.json deleted file mode 100644 index 72662a4a641b6d38651d58dfe4d352c6cf6434ed..0000000000000000000000000000000000000000 --- a/resources/gtest.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "ud": 1000, - "first_ud": 6000, - "first_ud_reeval": 600000, - "clique_smiths": [ - { "name": "Pini" }, - { "name": "moul" }, - { "name": "HugoTrentesaux" }, - { "name": "tuxmain" }, - { "name": "1000i100" }, - { "name": "vit" }, - { "name": "cgeek", - "migration_address": "5E6q47RRGZU15LjUiBTm2DZjpqFKAjRNafYS8YV8AzTQZtLG", - "session_keys": "0x3090c9a6974f1a4749038ee75eb47da7c72ba4972e4809f2f71e8730567c1c5a7acfdc6e9b470e8d2d334edc662d755aeec93d2bb140e1c9f7db724b046dd54b7acfdc6e9b470e8d2d334edc662d755aeec93d2bb140e1c9f7db724b046dd54b7acfdc6e9b470e8d2d334edc662d755aeec93d2bb140e1c9f7db724b046dd54b" - } - ], - "sudo_key": "5Hm8sBbwuLAU99dBezvgtnRmZCrUy9mhqmbQMFyGTaeATYg7", - "treasury_funder_address": "5E6q47RRGZU15LjUiBTm2DZjpqFKAjRNafYS8YV8AzTQZtLG", - "technical_committee": ["Pini", "moul", "HugoTrentesaux", "tuxmain", "1000i100", "vit", "cgeek"] -} \ No newline at end of file diff --git a/resources/gtest.yaml b/resources/gtest.yaml new file mode 100644 index 0000000000000000000000000000000000000000..06e66eace5863c5e6e34706a7464c58fe17f9df8 --- /dev/null +++ b/resources/gtest.yaml @@ -0,0 +1,31 @@ +# 10,00 ÄžT per UD +ud: 1000 + +# FIXME: explain `null` meaning +first_ud: null + +# FIXME: explain `null` meaning +first_ud_reeval: null + +# Clique Smith WoT: each smith will certify by each other smith automatically on Genesis +clique_smiths: + - name: "Pini" + - name: "moul" + - name: "HugoTrentesaux" + - name: "tuxmain" + - name: "1000i100" + - name: "vit" + - name: "cgeek" + # This smith will be the first author + session_keys: "0xec6d7141864ca265b1c31a164d258e907e044380ac110c57502135943904137f5a172f9a6759763f59a7e0a4d170b467b744eabb3adb454f38a2e7957fb9cd285a172f9a6759763f59a7e0a4d170b467b744eabb3adb454f38a2e7957fb9cd285a172f9a6759763f59a7e0a4d170b467b744eabb3adb454f38a2e7957fb9cd28" + # This smith changes its key to Sr25519 wallet on startup (to be able to use Polkadot.js app right on start) + migration_address: "5E6q47RRGZU15LjUiBTm2DZjpqFKAjRNafYS8YV8AzTQZtLG" + +# FIXME +sudo_key: "5Hm8sBbwuLAU99dBezvgtnRmZCrUy9mhqmbQMFyGTaeATYg7" + +# The address which will automatically transfer 1,00 ÄžD on Genesis to the Treasury +treasury_funder_address: "5E6q47RRGZU15LjUiBTm2DZjpqFKAjRNafYS8YV8AzTQZtLG" + +# The technical committee members, to act as sudo +technical_committee: ["Pini", "moul", "HugoTrentesaux", "tuxmain", "1000i100", "vit", "cgeek"] \ No newline at end of file diff --git a/runtime/g1/src/lib.rs b/runtime/g1/src/lib.rs index d4315c779b679648c477257a24247ccbeff928bf..d3358671cf9b7f18d1f8d85ff1f36b1e26bc76b5 100644 --- a/runtime/g1/src/lib.rs +++ b/runtime/g1/src/lib.rs @@ -92,7 +92,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 600, + spec_version: 700, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/gdev/src/lib.rs b/runtime/gdev/src/lib.rs index d7ccbcb21ed54d1698e0e1bc715842dbcb821209..6b369df1a051f6050a78c55adc4d202711d887c0 100644 --- a/runtime/gdev/src/lib.rs +++ b/runtime/gdev/src/lib.rs @@ -95,7 +95,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 600, + spec_version: 700, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1, diff --git a/runtime/gtest/src/lib.rs b/runtime/gtest/src/lib.rs index 7759470e039cb1bafe850e2f93cfc52d10f6fffe..385b9968a409e9d20cdbe9f791371908e2625077 100644 --- a/runtime/gtest/src/lib.rs +++ b/runtime/gtest/src/lib.rs @@ -92,7 +92,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // `spec_version`, and `authoring_version` are the same between Wasm and native. // This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use // the compatible custom types. - spec_version: 600, + spec_version: 700, impl_version: 1, apis: RUNTIME_API_VERSIONS, transaction_version: 1,