Description
Testing improvements in the chain library
There is a lot of problem that are being reported that could be have
been discovered with better testing of the library.
Testing the blockchain property is an incredibly complex task that may
take a lot of CI time. In order to facilitate writing the testing and
not make the developer life too hard we will split the testing into
different layer of levels.
Level1
we need to be able to work on the small properties.
- Encoding then Decoding the blockchain should returns the original content;
- Addresses Discrimination should be the same as ledger (Testing Lvl1: check address discrimination in the ledger are checked #16)
- Simple property of the different components:
- transaction (inputs == outputs + fee) (add TokenTotals to the ledger #728 )
- the blockchain state's total value is constant (move Environment field from EvmConfigParams to Ledger #729);
- when building the stake distribution we need to retrieve the total value;
- for a total of
N
value in the blockchain, a stake key withM
(M < N
),
the stake distribution should be consistent.
Most of these tests can be property tests (utilising quickcheck
). This is important
as proving these properties if hold independently, the higher composition of these
properties will be easier to test.
Level 2
These tests are still property tests, but may take a bit longer to execute as they
are testing small scenarios:
- when applying a transaction to the blockchain the state needs to change
- the total value remains the same;
- the spent utxo are removed, a new one is added;
- the accounts state are updated; Added verification for account states for 'total_funds' property test #45
- the stake distribution has changed;
- we need more thorough testing on the update mechanism too;
Level 3
theses are slightly more complex tests that may takes some time to execute on the
CI. They intent to test long running properties:
- leader election through an epoch is on average consistent with the stake distribution.
if a leader as 30% of the total stake, they should be elected 30% of the time; Testing Lvl3: leader election is consistent with the stake distribution #41 - update and voting, we need to check that changes on the blockchain settings actually
changes the settings when they are voted and adopted. Testing Lvl3: ledger adopt voted setting update proposal #49