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

Sanity check tests #240

Merged
merged 18 commits into from
May 22, 2024
Merged

Sanity check tests #240

merged 18 commits into from
May 22, 2024

Conversation

goran-ethernal
Copy link
Collaborator

@goran-ethernal goran-ethernal commented May 16, 2024

Description

This PR adds sanity check framework to blade with some sanity check tests, that can be run on a specified network (testnet).

The PR also adds a command to blade, which can be used to run sanity check tests:

Runs a sanity check tests on a specified network

Usage:
   sanity-check [flags]

Flags:
      --epoch-size uint             epoch size on the network for which the sanity check is run (default 10)
  -h, --help                        help for sanity-check
      --jsonrpc string              the JSON-RPC interface (default "http://0.0.0.0:8545")
      --mnemonic string             the mnemonic used to fund accounts if needed for the sanity check
      --receipts-timeout duration   the timeout for waiting for transaction receipts (default 30s)
      --to-json                     saves results to JSON file
      --validator-keys strings      private keys of validators on the network for which the sanity check is run

Global Flags:
      --json   get all outputs in json format (default false)

Tests added through this PR

  1. Stake test for validator
  2. Unstake test for validator
  3. Register a new validator with stake
  4. Withdraw validator rewards test.
  5. Unstake all (remove validator) test.

To run tests locally on your machine, follow these steps:

  1. Run this command from blade repo:
./scripts/cluster polybft
  1. In blade repo, you will see folders like test-chain-1, test-chain-2, test-chain-3, test-chain-4. Inside each of them, collect private keys located in files consensus/validator.key. You will need them for the --validator-keys flag.
  2. Run sanity-check command:
./blade sanity-check --mnemonic "code code code code code code code code code code code quality" --jsonrpc "http://localhost:10002" --receipts-timeout 2m --validator-keys [list of keys from previous step separated by a coma]

Changes include

  • Bugfix (non-breaking change that solves an issue)
  • Hotfix (change that solves an urgent issue, and requires immediate attention)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (change that is not backwards-compatible and/or changes current functionality)

Checklist

  • I have assigned this PR to myself
  • I have added at least 1 reviewer
  • I have added the relevant labels
  • I have updated the official documentation
  • I have added sufficient documentation in code

Testing

  • I have tested this code with the official test suite
  • I have tested this code manually

@goran-ethernal goran-ethernal added the feature New feature label May 16, 2024
@goran-ethernal goran-ethernal self-assigned this May 16, 2024
@goran-ethernal goran-ethernal requested a review from a team May 16, 2024 12:27
@goran-ethernal goran-ethernal marked this pull request as ready for review May 16, 2024 12:27
@goran-ethernal goran-ethernal added the tests Add, update or removal of tests label May 19, 2024
txpool/txpool_test.go Show resolved Hide resolved
txpool/txpool_test.go Outdated Show resolved Hide resolved
command/sanitycheck/params.go Show resolved Hide resolved
loadtest/sanitycheck/sanity_check_runner.go Outdated Show resolved Hide resolved
@goran-ethernal goran-ethernal merged commit cac7dda into develop May 22, 2024
10 checks passed
@goran-ethernal goran-ethernal deleted the sanity-check-tests branch May 22, 2024 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature tests Add, update or removal of tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants