Fix/4823 validator profile#4849
Conversation
thesan
left a comment
There was a problem hiding this comment.
The mapping looks good. Please reset the changes to the .yarnrc.yml and query-node/schemas/content.graphql
Also please test the mapping in tests/network-tests/src/flows/membership/updatingProfile.ts
| "Social media handles, email address..." | ||
| externalResources: [MembershipExternalResource] @derivedFrom(field: "memberMetadata") | ||
|
|
||
| isVerified: Boolean! |
There was a problem hiding this comment.
Since this is not in a separate entity anymore. Please rename it to something more explicit like isVerifiedValidator
| if (typeof metadata?.validatorAccount === 'string') { | ||
| member.metadata.validatorAccount = (metadata.validatorAccount || null) as string |
There was a problem hiding this comment.
This could be:
| if (typeof metadata?.validatorAccount === 'string') { | |
| member.metadata.validatorAccount = (metadata.validatorAccount || null) as string | |
| if (typeof metadata?.validatorAccount === 'string' && metadata.validatorAccount !== member.metadata.validatorAccount) { | |
| member.metadata.validatorAccount = metadata.validatorAccount || undefined |
To prevent resetting the verification by mistake when the same account is passed and to allow removing the validator account by passing an empty string.
There was a problem hiding this comment.
removing null creates error during membership update test where validatorAccount should be set to null
There was a problem hiding this comment.
Nice catch ! I'm not sure of this but maybe null actually unset the value on hydra while undefined is ignored (I think I read an issue about something like that a while ago).
thesan
left a comment
There was a problem hiding this comment.
The mappings and schema are great now but as I mentioned in the last review please add a test to the membership updating profile flow.
To run the tests locally you can follow the query node README:
- In
.envuncommentJOYSTREAM_NODE_TAGand set it to the latest testing image, currently it's:44832c0fe83c518779d52b5b3a2dcce94ae2d805(do not commit this change. - Run the
./query-node/build.shscript to build the schema and mappings locally. - Try running
DEBUG=true ./query-node/run-tests.sh memberships. Hopefully it works otherwise you will have to run the full scenario all the time withDEBUG=true ./query-node/run-tests.sh(which is more time consuming). - After running the tests once in (1) you might to modify them and re-run the a lot faster with
REUSE_KEYS=true yarn workspace network-tests run-test-scenario memberships
If you change the mappings or the schema, you will have to redo (2) and (3).
You can check this commit for more details and ask me if you get stuck.
thesan
left a comment
There was a problem hiding this comment.
You can reset the yarn.lock by running git checkout master -- yarn.lock and committing the changes.
|
|
||
| repeated ExternalResource externalResources = 5; | ||
|
|
||
| optional bool isVerifiedValidator = 6; |
There was a problem hiding this comment.
I just realized there shouldn't be any isVerifiedValidator here. The MembershipMetadata can only define a validatorAccount but not whether or not it's verified.
| about?: string | null | ||
| avatarUri?: string | null | ||
| externalResources?: MembershipMetadata.IExternalResource[] | null | ||
| isVerifiedValidator?: boolean |
There was a problem hiding this comment.
Same here
| isVerifiedValidator?: boolean |
tests/network-tests/src/fixtures/membership/UpdateProfileHappyCaseFixture.ts
Show resolved
Hide resolved
| isVerifiedValidator: isSet(this.newValues.isVerifiedValidator) | ||
| ? this.newValues.isVerifiedValidator | ||
| : this.oldValues.isVerifiedValidator, |
There was a problem hiding this comment.
So I don't think this is needed
| isVerifiedValidator: isSet(this.newValues.isVerifiedValidator) | |
| ? this.newValues.isVerifiedValidator | |
| : this.oldValues.isVerifiedValidator, |
| isVerifiedValidator: false, | ||
| validatorAccount: 'validator address', |
There was a problem hiding this comment.
So it actually test something:
| isVerifiedValidator: false, | |
| validatorAccount: 'validator address', | |
| validatorAccount: 'validator address 2', |
| isVerifiedValidator: false, | ||
| validatorAccount: 'validator address', |
There was a problem hiding this comment.
Then you could try not to pass it to check it remains:
| isVerifiedValidator: false, | |
| validatorAccount: 'validator address', |
| isVerifiedValidator: false, | ||
| validatorAccount: 'validator address', |
There was a problem hiding this comment.
Finally based on the mappings it should be removable:
| isVerifiedValidator: false, | |
| validatorAccount: 'validator address', | |
| validatorAccount: '', |
| { | ||
| handle: 'New handle 1', | ||
| name: 'New name', | ||
| isVerifiedValidator: false, |
There was a problem hiding this comment.
| isVerifiedValidator: false, |
| ? this.newValues.isVerifiedValidator | ||
| : this.oldValues.isVerifiedValidator, | ||
| validatorAccount: isSet(this.newValues.validatorAccount) | ||
| ? this.newValues.validatorAccount |
There was a problem hiding this comment.
We expect the validatorAccount to be null (i.e removed) when an empty string was passed:
| ? this.newValues.validatorAccount | |
| ? this.newValues.validatorAccount || null |
…stream into fix/4823-validator
thesan
left a comment
There was a problem hiding this comment.
Good job just a few last minor changes
tests/network-tests/src/Api.ts
Outdated
| constructor(api: ApiPromise, treasuryAccountUri: string, miniSecret: string) { | ||
| this.api = api | ||
| this.keyring = new Keyring({ type: 'sr25519', ss58Format: JOYSTREAM_ADDRESS_PREFIX }) | ||
| this.keyring = new Keyring({ |
There was a problem hiding this comment.
Please use git to remove the changes on this file to reduce potential conflicts later
Co-authored-by: Theophile Sandoz <theophile.sandoz@gmail.com>
Co-authored-by: Theophile Sandoz <theophile.sandoz@gmail.com>
zeeshanakram3
left a comment
There was a problem hiding this comment.
Looks good overall. Please revert the changes in query-node/chain-metadata/*.json files. These are auto-generated files that should be edited.
…stream into fix/4823-validator
fix #4823