This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
Create a regression test that checks balances in presence of invalid bundles #1590
Description
Description
We want to ascertain that ledger state is always calculated correctly.
Even in the presence of invalid bundles being approved.
Motivation
The following fix:
#1588
Currently milestones are generated via a random walk, and we have a WalkValidator
that ensures that we will not walk on an invalid bundle. So hopefully the above regression wouldn't have been such a disaster.
Still, the LedgerService
that calculates the ledger state should be oblivious to that and ignore invalid bundles correctly.
Issues / Scenarios
A node recieves a milestone that approves invalid bundles.
How to test for this
Describe the issues/scenarios addressed by this test
- Given a node with a known ledger state.
- Then at least one valid transfer is being created that doesn't transfer funds.
Then do the following cases on a per test base
- And at least one valid transfer is being created that doesn't transfer funds. (back and forth in same bundle, https://devnet.thetangle.org/bundle/LVDFKLDYXVIRKCBOWLTOGLUSCFVXTRPVQJEKNHENABCNBIAVKHCTGVAYBHBTGONIQKEGHEIURSHLXPYUX)
- And at least double bundle as described below
- And at least one double spend case
And end all cases with the following:
- And at least one valid bundle that transfers funds.
- Then ascertain the correct ledger state
Unit tests:
- And at least one incomplete but valid bundle (missing an index) approves the former
- Already exists: BundleValidatorTest.validateSemanticsOfBundleWithMissingTransaction
- And at least one invalid bundle approves the former. (send without input)
- Already exists: BundleValidatorTest.validationModeAllWithInvalidBundle