This commit is contained in:
alex.sharov 2023-03-16 10:38:08 +07:00
parent 8234bab3de
commit b3d75ec0c1

View File

@ -18,12 +18,10 @@ package txpool
import (
"bytes"
"container/heap"
"context"
"fmt"
"math"
"math/big"
"math/rand"
"testing"
"github.com/holiman/uint256"
@ -31,7 +29,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/ledgerwatch/erigon-lib/common"
"github.com/ledgerwatch/erigon-lib/common/cmp"
"github.com/ledgerwatch/erigon-lib/common/fixedgas"
"github.com/ledgerwatch/erigon-lib/common/u256"
"github.com/ledgerwatch/erigon-lib/gointerfaces"
@ -42,55 +39,6 @@ import (
"github.com/ledgerwatch/erigon-lib/types"
)
func BenchmarkName(b *testing.B) {
txs := make([]*metaTx, 10_000)
p := NewSubPool(BaseFeeSubPool, 1024)
for i := 0; i < len(txs); i++ {
txs[i] = &metaTx{Tx: &types.TxSlot{}}
}
for i := 0; i < len(txs); i++ {
p.Add(txs[i])
}
p.EnforceInvariants()
b.ResetTimer()
for i := 0; i < b.N; i++ {
txs[0].timestamp = 1
heap.Fix(p.best, txs[0].bestIndex)
heap.Fix(p.worst, txs[0].worstIndex)
}
}
func BenchmarkName2(b *testing.B) {
var (
a = rand.Uint64()
c = rand.Uint64()
d = rand.Uint64()
)
b.ResetTimer()
var min1 uint64
var min2 uint64
var r uint64
for i := 0; i < b.N; i++ {
min1 = cmp.Min(min1, a)
min2 = cmp.Min(min2, c)
if d <= min1 {
r = cmp.Min(min1-d, min2)
} else {
r = 0
}
//
//// 4. Dynamic fee requirement. Set to 1 if feeCap of the transaction is no less than
//// baseFee of the currently pending block. Set to 0 otherwise.
//mt.subPool &^= EnoughFeeCapBlock
//if mt.Tx.feeCap >= pendingBaseFee {
// mt.subPool |= EnoughFeeCapBlock
//}
}
_ = r
}
func TestNonceFromAddress(t *testing.T) {
assert, require := assert.New(t), require.New(t)
ch := make(chan types.Announcements, 100)