tests: fix tests to use new statedb constructor

This commit is contained in:
Martin Holst Swende 2019-12-06 10:33:57 +01:00
parent 73582c4a6e
commit a92cba5619
No known key found for this signature in database
GPG key ID: 683B438C05A5DDF0

View file

@ -18,6 +18,8 @@ package state
import ( import (
"bytes" "bytes"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/rlp"
"testing" "testing"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
@ -44,3 +46,19 @@ func BenchmarkCutCustomTrim(b *testing.B) {
common.TrimLeftZeroes(value[:]) common.TrimLeftZeroes(value[:])
} }
} }
// BenchmarkHashKey-6 1221526 975 ns/op
func BenchmarkHashKey(b *testing.B) {
key := common.HexToHash("0x01")
for i := 0; i < b.N; i++ {
crypto.Keccak256Hash(key[:])
}
}
//BenchmarkEncodeValue-6 4843382 219 ns/op
func BenchmarkEncodeValue(b *testing.B) {
value := common.HexToHash("0x01")
for i := 0; i < b.N; i++ {
rlp.EncodeToBytes(common.TrimLeftZeroes(value[:]))
}
}