From 0486a7ba8f40f03ebf10b7a661df56f2d99814ba Mon Sep 17 00:00:00 2001 From: cgeek <cem.moreau@gmail.com> Date: Thu, 19 Oct 2023 19:04:32 +0200 Subject: [PATCH] fix(#125): fix(e2e): tests are now passing --- end2end-tests/cucumber-features/account_creation.feature | 6 ++++-- .../cucumber-features/identity_creation.feature | 3 +++ end2end-tests/cucumber-features/monetary_mass.feature | 2 +- end2end-tests/cucumber-features/oneshot_account.feature | 6 ++++-- end2end-tests/cucumber-features/transfer_all.feature | 8 ++++---- node/src/chain_spec/gdev.rs | 2 +- node/src/chain_spec/gen_genesis_data.rs | 9 ++++++++- 7 files changed, 25 insertions(+), 11 deletions(-) diff --git a/end2end-tests/cucumber-features/account_creation.feature b/end2end-tests/cucumber-features/account_creation.feature index dd39150d7..2ea18058a 100644 --- a/end2end-tests/cucumber-features/account_creation.feature +++ b/end2end-tests/cucumber-features/account_creation.feature @@ -1,4 +1,4 @@ -Feature: Balance transfer +Feature: Account creation Scenario: Create a new account with enough funds When alice sends 5 ÄžD to dave @@ -29,8 +29,10 @@ Feature: Balance transfer @ignoreErrors Scenario: Create a new account without any funds Then eve should have 0 ÄžD + # Alice is treasury funder for 1 ÄžD + Then alice should have 9 ÄžD When eve send 0 ÄžD to alice - Then alice should have 10 ÄžD + Then alice should have 9 ÄžD When alice send 5 ÄžD to eve Then eve should have 5 ÄžD When 1 block later diff --git a/end2end-tests/cucumber-features/identity_creation.feature b/end2end-tests/cucumber-features/identity_creation.feature index 56a7404df..fa27f97d5 100644 --- a/end2end-tests/cucumber-features/identity_creation.feature +++ b/end2end-tests/cucumber-features/identity_creation.feature @@ -6,11 +6,14 @@ Feature: Identity creation # - existential deposit (2 ÄžD) # - transaction fees (below 1 ÄžD) When alice sends 7 ÄžD to dave + # Alice is treasury funder for 1 ÄžD => 10-1-7 = 2 + Then alice should have 2 ÄžD When bob sends 750 cÄžD to dave When charlie sends 6 ÄžD to eve # alice last certification is counted from block zero # then next cert can be done after cert_period, which is 15 When 15 block later +# Then alice should have 1202 cÄžD When alice creates identity for dave Then dave identity should be created Then dave should be certified by alice diff --git a/end2end-tests/cucumber-features/monetary_mass.feature b/end2end-tests/cucumber-features/monetary_mass.feature index 0b5675d8f..1a1d9468f 100644 --- a/end2end-tests/cucumber-features/monetary_mass.feature +++ b/end2end-tests/cucumber-features/monetary_mass.feature @@ -1,4 +1,4 @@ -Feature: Balance transfer +Feature: Monetary mass Scenario: After 10 blocks, the monetary mass should be 60 ÄžD Then Monetary mass should be 30.00 ÄžD diff --git a/end2end-tests/cucumber-features/oneshot_account.feature b/end2end-tests/cucumber-features/oneshot_account.feature index f3d74b790..462847fa0 100644 --- a/end2end-tests/cucumber-features/oneshot_account.feature +++ b/end2end-tests/cucumber-features/oneshot_account.feature @@ -2,7 +2,8 @@ Feature: Oneshot account Scenario: Simple oneshot consumption When alice sends 7 ÄžD to oneshot dave - Then alice should have 3 ÄžD + # Alice is treasury funder for 1 ÄžD + Then alice should have 2 ÄžD Then dave should have oneshot 7 ÄžD When oneshot dave consumes into account bob Then dave should have oneshot 0 ÄžD @@ -11,7 +12,8 @@ Feature: Oneshot account Scenario: Double oneshot consumption When alice sends 7 ÄžD to oneshot dave - Then alice should have 3 ÄžD + # Alice is treasury funder for 1 ÄžD + Then alice should have 2 ÄžD Then dave should have oneshot 7 ÄžD When oneshot dave consumes 4 ÄžD into account bob and the rest into oneshot charlie Then dave should have oneshot 0 ÄžD diff --git a/end2end-tests/cucumber-features/transfer_all.feature b/end2end-tests/cucumber-features/transfer_all.feature index 23b516ee4..c282ea0dc 100644 --- a/end2end-tests/cucumber-features/transfer_all.feature +++ b/end2end-tests/cucumber-features/transfer_all.feature @@ -5,10 +5,10 @@ Feature: Balance transfer all When bob sends all her ÄžDs to dave """ Bob is a member, as such he is not allowed to empty his account completely, - if he tries to do so, the existence deposit (2 ÄžD) must remain. + if he tries to do so, the existence deposit (1 ÄžD) must remain. """ - Then bob should have 2 ÄžD + Then bob should have 1 ÄžD """ - 10 ÄžD (initial Bob balance) - 2 ÄžD (Existential deposit) - 0.02 ÄžD (transaction fees) + 10 ÄžD (initial Bob balance) - 1 ÄžD (Existential deposit) - 0.02 ÄžD (transaction fees) """ - Then dave should have 798 cÄžD + Then dave should have 898 cÄžD diff --git a/node/src/chain_spec/gdev.rs b/node/src/chain_spec/gdev.rs index a1cf40f19..e48e27b5a 100644 --- a/node/src/chain_spec/gdev.rs +++ b/node/src/chain_spec/gdev.rs @@ -360,7 +360,7 @@ fn genesis_data_to_gdev_genesis_conf( .collect(), }, cert: CertConfig { - apply_cert_period_at_genesis: true, + apply_cert_period_at_genesis: false, certs_by_receiver, }, membership: MembershipConfig { memberships }, diff --git a/node/src/chain_spec/gen_genesis_data.rs b/node/src/chain_spec/gen_genesis_data.rs index 2ed46474a..dc2d70bef 100644 --- a/node/src/chain_spec/gen_genesis_data.rs +++ b/node/src/chain_spec/gen_genesis_data.rs @@ -442,9 +442,16 @@ where } // Forced authority gets its required certs from first "minCert" WoT identities (fake certs) let mut new_certs: HashMap<String, u32> = HashMap::new(); + let certs_of_authority = &identities_v2.get(name).unwrap().certs_received; identities_v2 .keys() - .filter(|issuer| issuer != &name) + // Identities which are not the authority and have not already certified her + .filter(|issuer| { + issuer != &name + && !certs_of_authority + .iter() + .any(|(authority_issuer, _)| issuer == &authority_issuer) + }) .take(common_parameters.min_cert as usize) .map(String::clone) .for_each(|issuer| { -- GitLab