Skip to content

Commit

Permalink
Merge pull request algorand#4071 from Algo-devops-service/relstable3.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
algojohnlee authored Jun 6, 2022
2 parents 3618b05 + e9db568 commit da603f3
Show file tree
Hide file tree
Showing 22 changed files with 207 additions and 72 deletions.
4 changes: 3 additions & 1 deletion compactcert/msgp_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion compactcert/structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (

// Params defines common parameters for the verifier and builder.
type Params struct {
Msg crypto.Hashable // Message to be cerified
Msg crypto.Hashable // Message to be certified
ProvenWeight uint64 // Weight threshold proven by the certificate
SigRound basics.Round // The round for which the ephemeral key is committed to
SecKQ uint64 // Security parameter (k+q) from analysis document
Expand Down
10 changes: 9 additions & 1 deletion hashes.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package crypto

import (
"crypto/sha256"
"crypto/sha512"
"errors"
"fmt"
Expand All @@ -41,7 +42,7 @@ func (h HashType) Validate() error {
const (
Sha512_256 HashType = iota
Sumhash

Sha256
MaxHashType
)

Expand All @@ -53,6 +54,7 @@ const MaxHashDigestSize = SumhashDigestSize
const (
Sha512_256Size = sha512.Size256
SumhashDigestSize = sumhash.Sumhash512DigestSize
Sha256Size = sha256.Size
)

// HashFactory is responsible for generating new hashes accordingly to the type it stores.
Expand All @@ -71,6 +73,8 @@ func (h HashType) String() string {
return "sha512_256"
case Sumhash:
return "sumhash"
case Sha256:
return "sha256"
default:
return ""
}
Expand All @@ -83,6 +87,8 @@ func UnmarshalHashType(s string) (HashType, error) {
return Sha512_256, nil
case "sumhash":
return Sumhash, nil
case "sha256":
return Sha256, nil
default:
return 0, fmt.Errorf("HashType not supported: %s", s)
}
Expand All @@ -96,6 +102,8 @@ func (z HashFactory) NewHash() hash.Hash {
return sha512.New512_256()
case Sumhash:
return sumhash.New512(nil)
case Sha256:
return sha256.New()
// This shouldn't be reached, when creating a new hash, one would know the type of hash they wanted,
// in addition to that, unmarshalling of the hashFactory verifies the HashType of the factory.
default:
Expand Down
3 changes: 3 additions & 0 deletions hashes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ func TestHashFactoryCreatingNewHashes(t *testing.T) {
a.NotNil(h)
a.Equal(SumhashDigestSize, h.Size())

h = HashFactory{HashType: Sha256}.NewHash()
a.NotNil(h)
a.Equal(Sha256Size, h.Size())
}

func TestHashSum(t *testing.T) {
Expand Down
221 changes: 163 additions & 58 deletions merklearray/merkle_test.go

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion merklearray/msgp_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion merklearray/msgp_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion merklesignature/msgp_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion merklesignature/msgp_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion msgp_gen_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions secp256k1/dummy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build dummy
// +build dummy

// This file is part of a workaround for `go mod vendor` which won't vendor
Expand Down
1 change: 1 addition & 0 deletions secp256k1/libsecp256k1/contrib/dummy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build dummy
// +build dummy

// Package c contains only a C file.
Expand Down
1 change: 1 addition & 0 deletions secp256k1/libsecp256k1/dummy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build dummy
// +build dummy

// Package c contains only a C file.
Expand Down
1 change: 1 addition & 0 deletions secp256k1/libsecp256k1/include/dummy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build dummy
// +build dummy

// Package c contains only a C file.
Expand Down
1 change: 1 addition & 0 deletions secp256k1/libsecp256k1/src/dummy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build dummy
// +build dummy

// Package c contains only a C file.
Expand Down
1 change: 1 addition & 0 deletions secp256k1/libsecp256k1/src/modules/dummy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build dummy
// +build dummy

// Package c contains only a C file.
Expand Down
1 change: 1 addition & 0 deletions secp256k1/libsecp256k1/src/modules/ecdh/dummy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build dummy
// +build dummy

// Package c contains only a C file.
Expand Down
1 change: 1 addition & 0 deletions secp256k1/libsecp256k1/src/modules/recovery/dummy.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
//go:build dummy
// +build dummy

// Package c contains only a C file.
Expand Down
4 changes: 2 additions & 2 deletions secp256k1/panic_cb.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be found in
// the LICENSE file.

// +build !gofuzz
// +build cgo
//go:build !gofuzz && cgo
// +build !gofuzz,cgo

package secp256k1

Expand Down
4 changes: 2 additions & 2 deletions secp256k1/scalar_mult_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be found in
// the LICENSE file.

// +build !gofuzz
// +build cgo
//go:build !gofuzz && cgo
// +build !gofuzz,cgo

package secp256k1

Expand Down
1 change: 1 addition & 0 deletions secp256k1/scalar_mult_nocgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be found in
// the LICENSE file.

//go:build gofuzz || !cgo
// +build gofuzz !cgo

package secp256k1
Expand Down
4 changes: 2 additions & 2 deletions secp256k1/secp256.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be found in
// the LICENSE file.

// +build !gofuzz
// +build cgo
//go:build !gofuzz && cgo
// +build !gofuzz,cgo

// Package secp256k1 wraps the bitcoin secp256k1 C library.
package secp256k1
Expand Down

0 comments on commit da603f3

Please sign in to comment.