Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix to change expected of test according to build tag #528

Merged
merged 1 commit into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion crypto/vrf/vrf_coniks.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ func init() {
defaultVrf = newVrfEd25519coniks()
}

const ProofSize = coniks.ProofSize
const (
ProofSize = coniks.ProofSize
OutputSize = coniks.Size
)

func newVrfEd25519coniks() *vrfEd25519coniks {
return &vrfEd25519coniks{nil, nil}
Expand Down
5 changes: 4 additions & 1 deletion crypto/vrf/vrf_libsodium.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ func init() {
defaultVrf = newVrfEd25519libsodium()
}

const ProofSize = int(libsodium.PROOFBYTES)
const (
ProofSize = int(libsodium.PROOFBYTES)
OutputSize = int(libsodium.OUTPUTBYTES)
)

func newVrfEd25519libsodium() vrfEd25519libsodium {
return vrfEd25519libsodium{}
Expand Down
5 changes: 4 additions & 1 deletion crypto/vrf/vrf_r2ishiguro.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ func init() {
}
}

const ProofSize = 81
const (
ProofSize = 81
OutputSize = 32
)

func newVrfEd25519r2ishiguro() vrfEd25519r2ishiguro {
return vrfEd25519r2ishiguro{}
Expand Down
8 changes: 3 additions & 5 deletions test/kms/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/line/ostracon/config"
"github.com/line/ostracon/crypto"
"github.com/line/ostracon/crypto/ed25519"
"github.com/line/ostracon/crypto/vrf"
"github.com/line/ostracon/libs/log"
tmnet "github.com/line/ostracon/libs/net"
"github.com/line/ostracon/node"
Expand All @@ -30,9 +31,6 @@ var logger = log.NewOCLogger(log.NewSyncWriter(os.Stdout))
const chainID = "test-chain"
const listenAddr = "tcp://0.0.0.0:45666"

const VrfProofSize = 80
const VrfOutputSize = 64

func BenchmarkKMS(b *testing.B) {
chainID := "test-chain"
protocol, address := tmnet.ProtocolAndAddress(listenAddr)
Expand Down Expand Up @@ -177,10 +175,10 @@ func benchmarkVRFProof(b *testing.B, pv types.PrivValidator, pubKey crypto.PubKe

// evaluate execution results
require.NoError(b, err)
require.Equalf(b, len(proof), VrfProofSize, "VRFProof: proof size = %d != %d", len(proof), VrfProofSize)
require.Equalf(b, vrf.ProofSize, len(proof), "VRFProof: proof size = %d != %d", len(proof), vrf.ProofSize)
output, err := pubKey.VRFVerify(proof, message)
require.NoError(b, err)
require.Equalf(b, len(output), VrfOutputSize, "VRFProof: output size = %d != %d", len(output), VrfOutputSize)
require.Equalf(b, vrf.OutputSize, len(output), "VRFProof: output size = %d != %d", len(output), vrf.OutputSize)
}

func ping(sl *privval.SignerListenerEndpoint) {
Expand Down