@ -173,7 +173,7 @@ func TestRangeProof(t *testing.T) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
for i := 0 ; i < 500 ; i ++ {
for i := 0 ; i < 500 ; i ++ {
start := mrand . Intn ( len ( entries ) )
start := mrand . Intn ( len ( entries ) )
end := mrand . Intn ( len ( entries ) - start ) + start + 1
end := mrand . Intn ( len ( entries ) - start ) + start + 1
@ -206,7 +206,7 @@ func TestRangeProofWithNonExistentProof(t *testing.T) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
for i := 0 ; i < 500 ; i ++ {
for i := 0 ; i < 500 ; i ++ {
start := mrand . Intn ( len ( entries ) )
start := mrand . Intn ( len ( entries ) )
end := mrand . Intn ( len ( entries ) - start ) + start + 1
end := mrand . Intn ( len ( entries ) - start ) + start + 1
@ -278,7 +278,7 @@ func TestRangeProofWithInvalidNonExistentProof(t *testing.T) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
// Case 1
// Case 1
start , end := 100 , 200
start , end := 100 , 200
@ -335,7 +335,7 @@ func TestOneElementRangeProof(t *testing.T) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
// One element with existent edge proof, both edge proofs
// One element with existent edge proof, both edge proofs
// point to the SAME key.
// point to the SAME key.
@ -422,7 +422,7 @@ func TestAllElementsProof(t *testing.T) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
var k [ ] [ ] byte
var k [ ] [ ] byte
var v [ ] [ ] byte
var v [ ] [ ] byte
@ -474,7 +474,7 @@ func TestSingleSideRangeProof(t *testing.T) {
trie . MustUpdate ( value . k , value . v )
trie . MustUpdate ( value . k , value . v )
entries = append ( entries , value )
entries = append ( entries , value )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
var cases = [ ] int { 0 , 1 , 50 , 100 , 1000 , 2000 , len ( entries ) - 1 }
var cases = [ ] int { 0 , 1 , 50 , 100 , 1000 , 2000 , len ( entries ) - 1 }
for _ , pos := range cases {
for _ , pos := range cases {
@ -509,7 +509,7 @@ func TestReverseSingleSideRangeProof(t *testing.T) {
trie . MustUpdate ( value . k , value . v )
trie . MustUpdate ( value . k , value . v )
entries = append ( entries , value )
entries = append ( entries , value )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
var cases = [ ] int { 0 , 1 , 50 , 100 , 1000 , 2000 , len ( entries ) - 1 }
var cases = [ ] int { 0 , 1 , 50 , 100 , 1000 , 2000 , len ( entries ) - 1 }
for _ , pos := range cases {
for _ , pos := range cases {
@ -543,7 +543,7 @@ func TestBadRangeProof(t *testing.T) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
for i := 0 ; i < 500 ; i ++ {
for i := 0 ; i < 500 ; i ++ {
start := mrand . Intn ( len ( entries ) )
start := mrand . Intn ( len ( entries ) )
@ -646,7 +646,7 @@ func TestSameSideProofs(t *testing.T) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
pos := 1000
pos := 1000
first := decreaseKey ( common . CopyBytes ( entries [ pos ] . k ) )
first := decreaseKey ( common . CopyBytes ( entries [ pos ] . k ) )
@ -690,7 +690,7 @@ func TestHasRightElement(t *testing.T) {
trie . MustUpdate ( value . k , value . v )
trie . MustUpdate ( value . k , value . v )
entries = append ( entries , value )
entries = append ( entries , value )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
var cases = [ ] struct {
var cases = [ ] struct {
start int
start int
@ -762,7 +762,7 @@ func TestEmptyRangeProof(t *testing.T) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
var cases = [ ] struct {
var cases = [ ] struct {
pos int
pos int
@ -797,7 +797,7 @@ func TestBloatedProof(t *testing.T) {
for _ , kv := range kvs {
for _ , kv := range kvs {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
var keys [ ] [ ] byte
var keys [ ] [ ] byte
var vals [ ] [ ] byte
var vals [ ] [ ] byte
@ -831,7 +831,7 @@ func TestEmptyValueRangeProof(t *testing.T) {
for _ , kv := range values {
for _ , kv := range values {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
// Create a new entry with a slightly modified key
// Create a new entry with a slightly modified key
mid := len ( entries ) / 2
mid := len ( entries ) / 2
@ -875,7 +875,7 @@ func TestAllElementsEmptyValueRangeProof(t *testing.T) {
for _ , kv := range values {
for _ , kv := range values {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
// Create a new entry with a slightly modified key
// Create a new entry with a slightly modified key
mid := len ( entries ) / 2
mid := len ( entries ) / 2
@ -981,7 +981,7 @@ func benchmarkVerifyRangeProof(b *testing.B, size int) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
start := 2
start := 2
end := start + size
end := start + size
@ -1018,7 +1018,7 @@ func benchmarkVerifyRangeNoProof(b *testing.B, size int) {
for _ , kv := range vals {
for _ , kv := range vals {
entries = append ( entries , kv )
entries = append ( entries , kv )
}
}
slices . SortFunc ( entries , ( * kv ) . less )
slices . SortFunc ( entries , ( * kv ) . cmp )
var keys [ ] [ ] byte
var keys [ ] [ ] byte
var values [ ] [ ] byte
var values [ ] [ ] byte