diff --git a/domain/consensus/processes/ghostdagmanager/ghostdag_test.go b/domain/consensus/processes/ghostdagmanager/ghostdag_test.go index 9bc5dc8fa..f5485da2f 100644 --- a/domain/consensus/processes/ghostdagmanager/ghostdag_test.go +++ b/domain/consensus/processes/ghostdagmanager/ghostdag_test.go @@ -172,8 +172,8 @@ func TestGHOSTDAG(t *testing.T) { if err != nil { t.Fatal(err) } - if testsCounter != 3 { - t.Fatalf("Expected 3 test files, ran %d instead", testsCounter) + if testsCounter != 6 { + t.Fatalf("Expected 6 test files, ran %d instead", testsCounter) } }) } diff --git a/domain/consensus/testdata/dags/dag3.json b/domain/consensus/testdata/dags/dag3.json new file mode 100644 index 000000000..1f0b96c2d --- /dev/null +++ b/domain/consensus/testdata/dags/dag3.json @@ -0,0 +1,132 @@ +{ + "K": 3, + "GenesisID": "0", + "Blocks": [ + { + "ID": "1", + "ExpectedScore": 1, + "ExpectedSelectedParent": "0", + "ExpectedReds": [], + "ExpectedBlues": [ + "0" + ], + "Parents": [ + "0" + ] + }, + { + "ID": "2", + "ExpectedScore": 2, + "ExpectedSelectedParent": "1", + "ExpectedReds": [], + "ExpectedBlues": [ + "1" + ], + "Parents": [ + "1" + ] + }, + { + "ID": "3", + "ExpectedScore": 2, + "ExpectedSelectedParent": "1", + "ExpectedReds": [], + "ExpectedBlues": [ + "1" + ], + "Parents": [ + "1" + ] + }, + { + "ID": "4", + "ExpectedScore": 2, + "ExpectedSelectedParent": "1", + "ExpectedReds": [], + "ExpectedBlues": [ + "1" + ], + "Parents": [ + "1" + ] + }, + { + "ID": "5", + "ExpectedScore": 5, + "ExpectedSelectedParent": "4", + "ExpectedReds": [], + "ExpectedBlues": [ + "4", + "2", + "3" + ], + "Parents": [ + "4", + "2", + "3" + ] + }, + { + "ID": "6", + "ExpectedScore": 1, + "ExpectedSelectedParent": "0", + "ExpectedReds": [], + "ExpectedBlues": [ + "0" + ], + "Parents": [ + "0" + ] + }, + { + "ID": "7", + "ExpectedScore": 2, + "ExpectedSelectedParent": "6", + "ExpectedReds": [], + "ExpectedBlues": [ + "6" + ], + "Parents": [ + "6" + ] + }, + { + "ID": "8", + "ExpectedScore": 3, + "ExpectedSelectedParent": "7", + "ExpectedReds": [], + "ExpectedBlues": [ + "7" + ], + "Parents": [ + "7" + ] + }, + { + "ID": "9", + "ExpectedScore": 4, + "ExpectedSelectedParent": "8", + "ExpectedReds": [], + "ExpectedBlues": [ + "8" + ], + "Parents": [ + "8" + ] + }, + { + "ID": "10", + "ExpectedScore": 6, + "ExpectedSelectedParent": "5", + "ExpectedReds": ["6", "7", "8", "9"], + "ExpectedBlues": [ + "5" + ], + "Parents": [ + "5", + "9" + ] + } + + ] +} diff --git a/domain/consensus/testdata/dags/dag4.json b/domain/consensus/testdata/dags/dag4.json new file mode 100644 index 000000000..4ddf93a1b --- /dev/null +++ b/domain/consensus/testdata/dags/dag4.json @@ -0,0 +1,121 @@ +{ + "K": 2, + "GenesisID": "0", + "Blocks": [ + { + "ID": "1", + "ExpectedScore": 1, + "ExpectedSelectedParent": "0", + "ExpectedReds": [], + "ExpectedBlues": [ + "0" + ], + "Parents": [ + "0" + ] + }, + { + "ID": "2", + "ExpectedScore": 1, + "ExpectedSelectedParent": "0", + "ExpectedReds": [], + "ExpectedBlues": [ + "0" + ], + "Parents": [ + "0" + ] + }, + { + "ID": "3", + "ExpectedScore": 2, + "ExpectedSelectedParent": "2", + "ExpectedReds": [], + "ExpectedBlues": [ + "2" + ], + "Parents": [ + "2" + ] + }, + { + "ID": "4", + "ExpectedScore": 2, + "ExpectedSelectedParent": "2", + "ExpectedReds": [], + "ExpectedBlues": [ + "2" + ], + "Parents": [ + "2" + ] + }, + { + "ID": "5", + "ExpectedScore": 2, + "ExpectedSelectedParent": "1", + "ExpectedReds": [], + "ExpectedBlues": [ + "1" + ], + "Parents": [ + "1" + ] + }, + { + "ID": "6", + "ExpectedScore": 5, + "ExpectedSelectedParent": "5", + "ExpectedReds": [], + "ExpectedBlues": [ + "5", + "2", + "4" + ], + "Parents": [ + "4", + "5" + ] + }, + { + "ID": "7", + "ExpectedScore": 5, + "ExpectedSelectedParent": "5", + "ExpectedReds": [], + "ExpectedBlues": [ + "5", + "2", + "3" + ], + "Parents": [ + "3", + "5" + ] + }, + { + "ID": "8", + "ExpectedScore": 3, + "ExpectedSelectedParent": "3", + "ExpectedReds": [], + "ExpectedBlues": [ + "3" + ], + "Parents": [ + "3" + ] + }, + { + "ID": "9", + "ExpectedScore": 6, + "ExpectedSelectedParent": "7", + "ExpectedReds": ["4", "8", "6"], + "ExpectedBlues": [ + "7" + ], + "Parents": [ + "6","7","8" + ] + } + + ] +} diff --git a/domain/consensus/testdata/dags/dag5.json b/domain/consensus/testdata/dags/dag5.json new file mode 100644 index 000000000..a4250ee7b --- /dev/null +++ b/domain/consensus/testdata/dags/dag5.json @@ -0,0 +1,93 @@ +{ + "K": 3, + "GenesisID": "0", + "Blocks": [ + { + "ID": "1", + "ExpectedScore": 1, + "ExpectedSelectedParent": "0", + "ExpectedReds": [], + "ExpectedBlues": [ + "0" + ], + "Parents": [ + "0" + ] + }, + { + "ID": "2", + "ExpectedScore": 1, + "ExpectedSelectedParent": "0", + "ExpectedReds": [], + "ExpectedBlues": [ + "0" + ], + "Parents": [ + "0" + ] + }, + { + "ID": "3", + "ExpectedScore": 1, + "ExpectedSelectedParent": "0", + "ExpectedReds": [], + "ExpectedBlues": [ + "0" + ], + "Parents": [ + "0" + ] + }, + { + "ID": "4", + "ExpectedScore": 1, + "ExpectedSelectedParent": "0", + "ExpectedReds": [], + "ExpectedBlues": [ + "0" + ], + "Parents": [ + "0" + ] + }, + { + "ID": "5", + "ExpectedScore": 4, + "ExpectedSelectedParent": "3", + "ExpectedReds": [], + "ExpectedBlues": [ + "3", "1", "2" + ], + "Parents": [ + "1", + "2", + "3" + ] + }, + { + "ID": "6", + "ExpectedScore": 5, + "ExpectedSelectedParent": "4", + "ExpectedReds": [], + "ExpectedBlues": [ + "4", "1", "2", "3" + ], + "Parents": [ + "1", "2", "3", "4" + ] + }, + { + "ID": "7", + "ExpectedScore": 6, + "ExpectedSelectedParent": "6", + "ExpectedReds": ["5"], + "ExpectedBlues": [ + "6" + ], + "Parents": [ + "5", + "6" + ] + } + ] +}