Skip to content
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

Open
GalRogozinski opened this issue Sep 1, 2019 · 5 comments · May be fixed by #1784 or #1807
Open

Create a regression test that checks balances in presence of invalid bundles #1590

GalRogozinski opened this issue Sep 1, 2019 · 5 comments · May be fixed by #1784 or #1807

Comments

@GalRogozinski
Copy link
Contributor

GalRogozinski commented Sep 1, 2019

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

  1. Given a node with a known ledger state.
  2. Then at least one valid transfer is being created that doesn't transfer funds.

Then do the following cases on a per test base

  1. 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)
  2. And at least double bundle as described below
  3. And at least one double spend case

And end all cases with the following:

  1. And at least one valid bundle that transfers funds.
  2. Then ascertain the correct ledger state

Unit tests:

  1. And at least one incomplete but valid bundle (missing an index) approves the former
  • Already exists: BundleValidatorTest.validateSemanticsOfBundleWithMissingTransaction
  1. And at least one invalid bundle approves the former. (send without input)
  • Already exists: BundleValidatorTest.validationModeAllWithInvalidBundle
@GalRogozinski
Copy link
Contributor Author

We should also create a simple scenario without the invalid bundles and ascertain that the ledger state changed

@GalRogozinski
Copy link
Contributor Author

Correction: #1588 was a dangerous regression

@GalRogozinski GalRogozinski added L-Groom This issue needs to be groomed and removed L-Groom This issue needs to be groomed labels Dec 16, 2019
@GalRogozinski
Copy link
Contributor Author

Check for bundles that have transactions in common:
image

@kwek20
Copy link
Contributor

kwek20 commented Dec 30, 2019

This test will be added to machine2 tests, which include "2_transaction_tests"

@GalRogozinski
Copy link
Contributor Author

@kwek20 added also a double spend test while writing this

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
2 participants