diff --git a/domain/consensus/processes/dagtraversalmanager/window_test.go b/domain/consensus/processes/dagtraversalmanager/window_test.go index 1b1f481..be6b2ed 100644 --- a/domain/consensus/processes/dagtraversalmanager/window_test.go +++ b/domain/consensus/processes/dagtraversalmanager/window_test.go @@ -112,12 +112,12 @@ func TestBlockWindow(t *testing.T) { { parents: []string{"C", "D"}, id: "E", - expectedWindow: []string{"C", "D", "B"}, + expectedWindow: []string{"D", "C", "B"}, }, { parents: []string{"C", "D"}, id: "F", - expectedWindow: []string{"C", "D", "B"}, + expectedWindow: []string{"D", "C", "B"}, }, { parents: []string{"A"}, @@ -132,37 +132,37 @@ func TestBlockWindow(t *testing.T) { { parents: []string{"H", "F"}, id: "I", - expectedWindow: []string{"F", "C", "H", "D", "B", "G"}, + expectedWindow: []string{"F", "D", "H", "C", "B", "G"}, }, { parents: []string{"I"}, id: "J", - expectedWindow: []string{"I", "F", "C", "H", "D", "B", "G"}, + expectedWindow: []string{"I", "F", "D", "H", "C", "B", "G"}, }, { parents: []string{"J"}, id: "K", - expectedWindow: []string{"J", "I", "F", "C", "H", "D", "B", "G"}, + expectedWindow: []string{"J", "I", "F", "D", "H", "C", "B", "G"}, }, { parents: []string{"K"}, id: "L", - expectedWindow: []string{"K", "J", "I", "F", "C", "H", "D", "B", "G"}, + expectedWindow: []string{"K", "J", "I", "F", "D", "H", "C", "B", "G"}, }, { parents: []string{"L"}, id: "M", - expectedWindow: []string{"L", "K", "J", "I", "F", "C", "H", "D", "B", "G"}, + expectedWindow: []string{"L", "K", "J", "I", "F", "D", "H", "C", "B", "G"}, }, { parents: []string{"M"}, id: "N", - expectedWindow: []string{"M", "L", "K", "J", "I", "F", "C", "H", "D", "B"}, + expectedWindow: []string{"M", "L", "K", "J", "I", "F", "D", "H", "C", "B"}, }, { parents: []string{"N"}, id: "O", - expectedWindow: []string{"N", "M", "L", "K", "J", "I", "F", "C", "H", "D"}, + expectedWindow: []string{"N", "M", "L", "K", "J", "I", "F", "D", "H", "C"}, }, }, dagconfig.DevnetParams.Name: { @@ -276,37 +276,37 @@ func TestBlockWindow(t *testing.T) { { parents: []string{"H", "F"}, id: "I", - expectedWindow: []string{"F", "C", "D", "H", "B", "G"}, + expectedWindow: []string{"F", "H", "C", "D", "B", "G"}, }, { parents: []string{"I"}, id: "J", - expectedWindow: []string{"I", "F", "C", "D", "H", "B", "G"}, + expectedWindow: []string{"I", "F", "H", "C", "D", "B", "G"}, }, { parents: []string{"J"}, id: "K", - expectedWindow: []string{"J", "I", "F", "C", "D", "H", "B", "G"}, + expectedWindow: []string{"J", "I", "F", "H", "C", "D", "B", "G"}, }, { parents: []string{"K"}, id: "L", - expectedWindow: []string{"K", "J", "I", "F", "C", "D", "H", "B", "G"}, + expectedWindow: []string{"K", "J", "I", "F", "H", "C", "D", "B", "G"}, }, { parents: []string{"L"}, id: "M", - expectedWindow: []string{"L", "K", "J", "I", "F", "C", "D", "H", "B", "G"}, + expectedWindow: []string{"L", "K", "J", "I", "F", "H", "C", "D", "B", "G"}, }, { parents: []string{"M"}, id: "N", - expectedWindow: []string{"M", "L", "K", "J", "I", "F", "C", "D", "H", "B"}, + expectedWindow: []string{"M", "L", "K", "J", "I", "F", "H", "C", "D", "B"}, }, { parents: []string{"N"}, id: "O", - expectedWindow: []string{"N", "M", "L", "K", "J", "I", "F", "C", "D", "H"}, + expectedWindow: []string{"N", "M", "L", "K", "J", "I", "F", "H", "C", "D"}, }, }, } diff --git a/domain/consensus/utils/pow/heavyhash.go b/domain/consensus/utils/pow/heavyhash.go index dd6cf1d..fa6df84 100644 --- a/domain/consensus/utils/pow/heavyhash.go +++ b/domain/consensus/utils/pow/heavyhash.go @@ -77,7 +77,7 @@ func (mat *matrix) HeavyHash(hash *externalapi.DomainHash) *externalapi.DomainHa for j := 0; j < 64; j++ { sum += mat[i][j] * vector[j] } - product[i] = sum >> 10 + product[i] = (sum & 0xF) ^ ((sum >> 4) & 0xF) ^ ((sum >> 8) & 0xF) } // Concatenate 4 LSBs back to 8 bit xor with sum1 diff --git a/domain/consensus/utils/pow/heavyhash_test.go b/domain/consensus/utils/pow/heavyhash_test.go index 08dd8e7..7d2e033 100644 --- a/domain/consensus/utils/pow/heavyhash_test.go +++ b/domain/consensus/utils/pow/heavyhash_test.go @@ -151,7 +151,7 @@ func TestGenerateMatrix(t *testing.T) { } func TestMatrix_HeavyHash(t *testing.T) { - expected, err := hex.DecodeString("87689f379943eaf9b7475ca95325687772bfcc68fc7899caeb4409ec4590c325") + expected, err := hex.DecodeString("84ba22913277b1488ac94d45ba94cd802f5eb3fc19dd88bb522fda3857a84ba4") if err != nil { t.Fatal(err) } diff --git a/version/version.go b/version/version.go index 41ce587..ed633ff 100644 --- a/version/version.go +++ b/version/version.go @@ -11,7 +11,7 @@ const validCharacters = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrs const ( appMajor uint = 0 appMinor uint = 3 - appPatch uint = 16 + appPatch uint = 17 ) // appBuild is defined as a variable so it can be overridden during the build