cucumber test for identity creation
Add a cucumber test for identity creation scenario.
Merge request reports
Activity
assigned to @HugoTrentesaux
added RN-silent label
In my scenario, the line
When alice creates identity for ferdie
executes the code
common::identity::create_identity(world.api(), world.client(), from, to).await
which does not fail and should create an identity for ferdie
but the line
Then ferdie identity should be created
fails at
let receiver_index = world .api() .storage() .identity() .identity_index_of(receiver_account, None) .await? .ok_or_else(|| anyhow::anyhow!("identity {} has no associated index", receiver)) .unwrap();
I don't understand why (but did not spend much time on trying understand yet).
Edited by Hugo TrentesauxThe problem must be in the
create_identity
method. I tried with another scenario:Feature: Identity creation Scenario: alice invites a new member to join the web of trust ✔ When alice creates identity for ferdie ✔ When alice creates identity for ferdie ✘ Then ferdie should be certified by alice
Alice should not be able to create identity twice for Ferdie because of the delay between two certifications. So the second line should fail.
The content of
create_identity
is:let _events = create_block_with_extrinsic( client, api.tx() .identity() .create_identity(to) .create_signed(&from, ()) .await?, ) .await?;
I thought it would return an error if the identity can't be created but apparently not.
added 33 commits
-
1674073e...fe298c11 - 32 commits from branch
master
- d21e159c - wip
-
1674073e...fe298c11 - 32 commits from branch
J'ai mis à jour cette branche sur la nouvelle version de l'API. Je reproduis le même comportement qu'avant.
hugo@CELL200026:~/dev/duniter-v2s/end2end-tests$ cargo cucumber -i identity* warning: profile package spec `librocksdb-sys` in profile `dev` did not match any packages Finished test [unoptimized + debuginfo] target(s) in 0.36s Running tests/cucumber_tests.rs (/home/hugo/dev/duniter-v2s/target/debug/deps/cucumber_tests-d47b5e4011c14d05) maybe_genesis_conf_file=Some("cucumber-genesis/default.json") Feature: Identity creation Scenario: alice invites a new member to join the web of trust When alice creates identity for ferdie extrinsic encoded: 21028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d0160ce1768cf5def7e8446d6274432d2ce6ebc1812c456d5c14ac0a8ca8280d452d ✔ When alice creates identity for ferdie When alice creates identity for ferdie extrinsic encoded: 21028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01380fad9230e20cbaea36198a5e788fda860bad3ddc5c6810068ee0e402953a492 ✔ When alice creates identity for ferdie ✔ When 2 block later ✘ Then ferdie identity should be created Step failed: ./cucumber-features/identity_creation.feature:7:5 Captured output: Step panicked. Captured output: called `Result::unwrap()` on an `Err` value: identity ferdie has no associated index
Reste à débugger...
Je crois me souvenir qu'avec les tests cucumber on ne souhaitait pas intercepter l'échec d'un extrinsic, donc finalement je ne fais pas ça.
La seule raison possible pour
CreatorNotAllowedToCreateIdty
c'est le délai de certification. J'ai donc ajouté une ligneWhen 15 block later
pour respecter ce délai, mais j'ai toujours
CreatorNotAllowedToCreateIdty
.added 1 commit
- 6242ae33 - wip fix typo MinCertForCreateIdtyRigh -> MinCertForCreateIdtyRight
Est-ce que c'est pertinent de faire un ticket pour distinguer les trois différentes raisons qui rendent impossible la création d'identité ?
- nombre de certifications reçues trop faible
- délai non respecté
- nombre de certification émises trop grand
Pour l'instant la seule réponse est
CreatorNotAllowedToCreateIdty
alors qu'on pourrait imaginer trois erreurs :NotEnoughReceivedCertsToCreateIdty
IdtyCreationPeriodNotRespected
MaxEmitedCertsReached
Si j'attends 30 blocs au lieu de 15, j'ai maintenant l'erreur suivante :
hugo@CELL200026:~/dev/duniter-v2s/end2end-tests$ cargo cucumber -i identity* warning: profile package spec `librocksdb-sys` in profile `dev` did not match any packages Finished test [unoptimized + debuginfo] target(s) in 0.38s Running tests/cucumber_tests.rs (/home/hugo/dev/duniter-v2s/target/debug/deps/cucumber_tests-d47b5e4011c14d05) maybe_genesis_conf_file=Some("cucumber-genesis/default.json") Feature: Identity creation Scenario: alice invites a new member to join the web of trust ✔ When 30 block later When alice creates identity for ferdie extrinsic encoded: 21028400d43593c715fdd31c61141abd04a99fd6822c8558854ccde39a5684e7a56da27d01b4ea971294a483d4c7e8bfeeb7e1bfc88ce08f349527ebf3bf2cd84bc96fcb1943 ✘ When alice creates identity for ferdie Step failed: ./cucumber-features/identity_creation.feature:5:5 Captured output: Step panicked. Captured output: RPC call failed: ErrorObject { code: ServerError(20000), message: "proposal.block.extrinsics().len() < inherents_len", data: None }
Ça correspond au changement d'epoch.
Edited by Hugo TrentesauxJ'ai ajouté du logging dans le runtime, et je vois ceci:
next_issuable_on = 99015 block_number = 24
Donc c'est bien le délai qui pose problème.
Il me reste à comprendre d'où vient cette valeur 99015.
Le "15" vient de
cert_period
.Reste à comprendre d'où vient le 99000.
Réponse :
genesis_certs_expire_on (100000) - cert_validity_period (1000) + cert_period (15) ------------------ = 99015
Edited by Hugo Trentesauxadded T-end2endtests label
added 8 commits
-
5fa6ca94...386e4d84 - 6 commits from branch
master
- d5967be0 - fix(wot): typo MinCertForCreateIdtyRigh -> MinCertForCreateIdtyRight
- 9449d7d6 - tests(cucumber): add identity creation scenario
-
5fa6ca94...386e4d84 - 6 commits from branch