Skip to content
Snippets Groups Projects
Commit cd38ad02 authored by Hans Moog's avatar Hans Moog
Browse files

Feat: added benchmark for signature verification

parent 37f53165
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"github.com/iotaledger/goshimmer/packages/node" "github.com/iotaledger/goshimmer/packages/node"
"github.com/iotaledger/goshimmer/plugins/analysis" "github.com/iotaledger/goshimmer/plugins/analysis"
"github.com/iotaledger/goshimmer/plugins/autopeering" "github.com/iotaledger/goshimmer/plugins/autopeering"
"github.com/iotaledger/goshimmer/plugins/bundleprocessor"
"github.com/iotaledger/goshimmer/plugins/cli" "github.com/iotaledger/goshimmer/plugins/cli"
"github.com/iotaledger/goshimmer/plugins/gossip" "github.com/iotaledger/goshimmer/plugins/gossip"
"github.com/iotaledger/goshimmer/plugins/gracefulshutdown" "github.com/iotaledger/goshimmer/plugins/gracefulshutdown"
...@@ -25,7 +26,7 @@ func main() { ...@@ -25,7 +26,7 @@ func main() {
gossip.PLUGIN, gossip.PLUGIN,
//gossip_on_solidification.PLUGIN, //gossip_on_solidification.PLUGIN,
tangle.PLUGIN, tangle.PLUGIN,
//bundleprocessor.PLUGIN, bundleprocessor.PLUGIN,
analysis.PLUGIN, analysis.PLUGIN,
gracefulshutdown.PLUGIN, gracefulshutdown.PLUGIN,
tipselection.PLUGIN, tipselection.PLUGIN,
......
...@@ -44,6 +44,8 @@ func Start(tps uint) { ...@@ -44,6 +44,8 @@ func Start(tps uint) {
totalSentCounter++ totalSentCounter++
tx := value_transaction.New() tx := value_transaction.New()
tx.SetHead(true)
tx.SetTail(true)
tx.SetValue(totalSentCounter) tx.SetValue(totalSentCounter)
tx.SetBranchTransactionHash(tipselection.GetRandomTip()) tx.SetBranchTransactionHash(tipselection.GetRandomTip())
tx.SetTrunkTransactionHash(tipselection.GetRandomTip()) tx.SetTrunkTransactionHash(tipselection.GetRandomTip())
......
...@@ -21,6 +21,31 @@ import ( ...@@ -21,6 +21,31 @@ import (
var seed = client.NewSeed("YFHQWAUPCXC9S9DSHP9NDF9RLNPMZVCMSJKUKQP9SWUSUCPRQXCMDVDVZ9SHHESHIQNCXWBJF9UJSWE9Z", consts.SecurityLevelMedium) var seed = client.NewSeed("YFHQWAUPCXC9S9DSHP9NDF9RLNPMZVCMSJKUKQP9SWUSUCPRQXCMDVDVZ9SHHESHIQNCXWBJF9UJSWE9Z", consts.SecurityLevelMedium)
func Benchmark(b *testing.B) {
bundleFactory := client.NewBundleFactory()
bundleFactory.AddInput(seed.GetAddress(0), -400)
bundleFactory.AddOutput(seed.GetAddress(1), 400, "Testmessage")
bundleFactory.AddOutput(client.NewAddress("SJKUKQP9SWUSUCPRQXCMDVDVZ9SHHESHIQNCXWBJF9UJSWE9ZYFHQWAUPCXC9S9DSHP9NDF9RLNPMZVCM"), 400, "Testmessage")
generatedBundle := bundleFactory.GenerateBundle(tipselection.GetRandomTip(), tipselection.GetRandomTip())
b.ResetTimer()
var wg sync.WaitGroup
for i := 0; i < b.N; i++ {
wg.Add(1)
go func() {
ValidateSignatures(generatedBundle.GetEssenceHash(), generatedBundle.GetTransactions())
wg.Done()
}()
}
wg.Wait()
}
func TestValidateSignatures(t *testing.T) { func TestValidateSignatures(t *testing.T) {
bundleFactory := client.NewBundleFactory() bundleFactory := client.NewBundleFactory()
bundleFactory.AddInput(seed.GetAddress(0), -400) bundleFactory.AddInput(seed.GetAddress(0), -400)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment