summaryrefslogtreecommitdiff
path: root/data/transactions/logic/evalBench_test.go
blob: b9f61f0fa7705708b49394db7940d177fa5097d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright (C) 2019-2023 Algorand, Inc.
// This file is part of go-algorand
//
// go-algorand is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// go-algorand is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with go-algorand.  If not, see <https://www.gnu.org/licenses/>.

package logic_test

import (
	"testing"

	"github.com/algorand/go-algorand/config"
	"github.com/algorand/go-algorand/data/transactions"
	"github.com/algorand/go-algorand/data/transactions/logic"
	"github.com/algorand/go-algorand/data/txntest"
	"github.com/algorand/go-algorand/protocol"
	"github.com/stretchr/testify/require"
)

func BenchmarkCheckSignature(b *testing.B) {
	proto := config.Consensus[protocol.ConsensusCurrentVersion]
	txns := txntest.CreateTinyManTxGroup(b, true)
	ops, err := logic.AssembleString(txntest.TmLsig)
	require.NoError(b, err)
	stxns := []transactions.SignedTxn{{Txn: txns[3].Txn(), Lsig: transactions.LogicSig{Logic: ops.Program}}}
	ep := logic.NewSigEvalParams(stxns, &proto, &logic.NoHeaderLedger{})
	b.ResetTimer()

	for i := 0; i < b.N; i++ {
		err = logic.CheckSignature(0, ep)
		require.NoError(b, err)
	}
}