Skip to content

All rules tested in the blockchain package TestBlockValidationRules should be done via fullblocktests #1030

Description

@davecgh

The blockchain package contains a test function named TestBlockValidationRules which tests various consensus rules in regards to block validation. This is a holdover from initial development and uses a pregenerated blockchain that is modified on the fly in order to hit the conditions. This is not ideal because, as the code changes, the pregenerated chain no longer represents a completely valid chain where only the specific condition being tested is invalid and thus ends up relying on the specific order of the checks in the code in order to pass the tests.

The fullblocktests package was written precisely to avoid this problem since it programmatically generates a fully valid chain on the fly and only munges the blocks to cause a very specific condition to be tested while ensuring the block is otherwise entirely valid. Any of the rules which are tested by TestBlockValidationRules that are not already covered by the existing fullblocktests should be ported over to the fullblocktests framework instead.

In order to ease the transition and review process, I would highly recommend this be done as a series of commits where each commit is dedicated to adding the relevant test to the fullblocktests package and simultaneously removing it from TestBlockValidationRules function. This will help ensure no tests are accidentally missed.

Activity

  1. davecgh commented on Mar 2, 2018

    @davecgh
    MemberAuthor

    As an update, @dnldd has made significant progress towards this issue via PRs #1060 and #1095.

  2. added this to the 1.3.0 milestone on Apr 30, 2018
  3. davecgh commented on May 2, 2018

    @davecgh
    MemberAuthor

    Completed by #1060, #1095 and #1141.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

non-forking consensusChanges that involve modifying consensus code without causing any forking changes.

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions