Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add CLI command verifyValidator #4933

Closed

Conversation

chrlschwb
Copy link
Contributor

@chrlschwb chrlschwb commented Oct 15, 2023

Copy link
Member

@thesan thesan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I don't know anything about the CLI. @zeeshanakram3 could you check this PR please ?

cli/src/commands/working-groups/verifyValidator.ts Outdated Show resolved Hide resolved
cli/src/commands/working-groups/verifyValidator.ts Outdated Show resolved Hide resolved
cli/src/commands/working-groups/verifyValidator.ts Outdated Show resolved Hide resolved
cli/src/commands/working-groups/verifyValidator.ts Outdated Show resolved Hide resolved
@thesan thesan added CLI Command Line Interface Tool community-dev and removed query-node labels Nov 30, 2023
Comment on lines 8 to 19
static args = [{
name: "memberId",
required: true,
description: 'Membership ID of the validator to verify',
},
{

name: "isVerified",
required: true,
description: 'Verification state of the validator',
}
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use flags instead of args. Using flags you have to explicitly write each flag name before providing the value, so less chance of errors, as compared to args which are just order dependant positional arguments

if (!worker) {
this.error('Only membership WG lead/worker can perform this command')
} else {
this.getOriginalApi().tx.membershipWorkingGroup.workerRemark(Number(worker), message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line just only prepares the encodedtx. It actually does not sends/broadcasts it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is still not resolved, please look at any example CLI implementation (e.g. memberRemark) to see how transactions are being constructed & dispatched

if (!worker) {
this.error('Only membership WG lead/worker can perform this command')
} else {
this.getOriginalApi().tx.membershipWorkingGroup.workerRemark(Number(worker), message)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

worker is a type of GroupMember, while you are converting it to Number. Which is obviously incorrect.

Copy link
Contributor

@zeeshanakram3 zeeshanakram3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +36 to +38
const nowGroup = this.group

await this.setPreservedState({ defaultWorkingGroup: WorkingGroups.Membership })
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @zeeshanakram3 it looks to me like the code from this PR should work. I'm just wondering whether these 2 lines and the line 59 are necessary.

Could you have another look please ? This is blocking the validator dashboard QA

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, we can actually specify the working group using --group flag, so this is not necessary at all. Please remove these

description: 'Membership ID of the validator to verify',
}),
isVerified: flags.boolean({
required: true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
required: true,
default: false,

We can't specify boolean flags as isVerified=true or isVerified=false, so the only way to signal that isVerified is true/false is by presence/absence of the flag itself, i.e.

./bin/run working-groups:verifyValidator --memberId=2 --isVerified # isVerified is 'true'
./bin/run working-groups:verifyValidator --memberId=2                     # isVerified is 'false'

Since we would define the default value of isVerified false so if we omit the flag then it was be assumed false in the command.

@thesan
Copy link
Member

thesan commented Jan 24, 2024

I'm closing this one in favour of #5057

@thesan thesan closed this Jan 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Command Line Interface Tool community-dev scope:validator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants