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 unit tests and cli checks for validator hotfix interaction #2340

Merged
merged 24 commits into from
Jan 14, 2020

Conversation

yorhodes
Copy link
Contributor

@yorhodes yorhodes commented Dec 26, 2019

Description

Adds unit tests and cli checks for validator hotfix interaction

Tested

  • Unit tests in packages/protocol/test/governance.ts
  • Checks added to pacakages/cli/src/commands/governance

Other changes

  • Changes overloaded authorizeValidatorSigner to authorizeValidatorSignerWithPublicKey

Related issues

@yorhodes yorhodes changed the title Add unit tests and cli checks for validator hotfix interaction [WIP] Add unit tests and cli checks for validator hotfix interaction Dec 26, 2019
@codecov
Copy link

codecov bot commented Dec 30, 2019

Codecov Report

Merging #2340 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2340   +/-   ##
=======================================
  Coverage   74.58%   74.58%           
=======================================
  Files         280      280           
  Lines        7912     7912           
  Branches     1016     1016           
=======================================
  Hits         5901     5901           
  Misses       1897     1897           
  Partials      114      114
Flag Coverage Δ
#mobile 74.58% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b2cd6a...21d4144. Read the comment docs.

@yorhodes yorhodes changed the title [WIP] Add unit tests and cli checks for validator hotfix interaction Add unit tests and cli checks for validator hotfix interaction Jan 1, 2020
Copy link
Contributor

@mcortesi mcortesi left a comment

Choose a reason for hiding this comment

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

Left some comments

const governance = await this.kit.contracts.getGovernance()

await newCheckBuilder(this)
Copy link
Contributor

Choose a reason for hiding this comment

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

you could also add the hotifixIsNotExecuted() check

packages/cli/src/commands/governance/executehotfix.ts Outdated Show resolved Hide resolved
await newCheckBuilder(this, signer)
.isVoteSignerOrAccount()
.proposalExists(id)
.proposalInStage(id, 'Referendum')
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we have an enum for proposal stages, probably we should.. and we could use it here and on the other checks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

these strings are restricted to the keyof typeof ProposalStage enum but I can import and use the properties as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the oclif input is also restricted to an enum already

packages/cli/src/commands/validator/list.ts Show resolved Hide resolved
this.addCheck(
`${this.signer!} is vote signer or registered account`,
this.withAccounts(async (accs) => {
return accs.voteSignerToAccount(this.signer!).then(() => true, () => false)
Copy link
Contributor

Choose a reason for hiding this comment

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

are we doing this this.signer! on the other checks? Looks like an easy way for a developer error.. since signer is an optional parameter on the newChecksBuilder

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, this pattern is already used in several places

packages/contractkit/src/wrappers/Accounts.ts Outdated Show resolved Hide resolved
@mcortesi mcortesi assigned yorhodes and unassigned nambrot and mcortesi Jan 3, 2020
@yorhodes yorhodes force-pushed the yorhodes/governance-cli-checks branch from 297555f to 4b2cd6a Compare January 13, 2020 18:22
@yorhodes yorhodes added the automerge Have PR merge automatically when checks pass label Jan 14, 2020
@celo-ci-bot-user celo-ci-bot-user merged commit 58a2068 into master Jan 14, 2020
@celo-ci-bot-user celo-ci-bot-user deleted the yorhodes/governance-cli-checks branch January 14, 2020 18:53
aaronmgdr added a commit that referenced this pull request Jan 15, 2020
* master: (30 commits)
  Fix coin colors  (#2441)
  Make governance CLI more usable (#2428)
  Slashing params for stake off phase 2 (#2418)
  [Wallet] Rollback zeroSync toggle in case it was not successful (#2434)
  [Wallet] Cleanup unused StateProps references (#2439)
  Add unit tests and cli checks for validator hotfix interaction (#2340)
  Add proper Spanish translations (#2427)
  Catch exceptions during polling (#2432)
  Add unfreeze-contracts command to celotool (#2433)
  Fix verify-contracts file dependency missing (#2426)
  Upload correct bootnode IP address on internal testnet (#2402)
  [Wallet]: Historic Gold prices chart (#2345)
  Fix documentation link (#2404)
  Docs nits (#2424)
  Update genesis block accounts config to be correct for phase 2 (#2416)
  Sort on correct vote amount in validator election migration (#2417)
  Make attestation opt-in (#2230)
  Adjustment to home banner / mobile menu (#2408)
  Clarify documentation on validator proxy (#2371)
  [Slashing] Adding whitelist checks for onlySlasher to Validators.sol (#2347)
  ...
aaronmgdr added a commit that referenced this pull request Jan 21, 2020
* master: (25 commits)
  Add react-testing-utils + Fix Analytics (#2437)
  collect coverage on web (#2415)
  Add callouts to serve text messages in regions (#2458)
  [Wallet] Historical currency conversions in the transaction feed (#2446)
  CLI relock fix (#2464)
  Update copyright year + inline button  (#2468)
  Voting bot for stake off (#2327)
  Change order of profile info (#2454)
  [Wallet] Fix type check regression for components wrapped by our custom `withTranslation` (#2457)
  Unfreeze rewards by default (#2452)
  Baklava and baklavastaging deploys (#2421)
  Fix coin colors  (#2441)
  Make governance CLI more usable (#2428)
  Slashing params for stake off phase 2 (#2418)
  [Wallet] Rollback zeroSync toggle in case it was not successful (#2434)
  [Wallet] Cleanup unused StateProps references (#2439)
  Add unit tests and cli checks for validator hotfix interaction (#2340)
  Add proper Spanish translations (#2427)
  Catch exceptions during polling (#2432)
  Add unfreeze-contracts command to celotool (#2433)
  ...

# Conflicts:
#	packages/web/src/brandkit/common/MobileMenu.test.tsx
#	yarn.lock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Have PR merge automatically when checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Developers should have tests for whitelisting hotfixes
4 participants