Skip to content

Commit 3c3df88

Browse files
committed
core/txpool/blobpool: remove use of assert in tests
1 parent 77efa17 commit 3c3df88

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

core/txpool/blobpool/blobpool_test.go

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ import (
4343
"github.com/ethereum/go-ethereum/rlp"
4444
"github.com/holiman/billy"
4545
"github.com/holiman/uint256"
46-
"github.com/stretchr/testify/assert"
4746
)
4847

4948
var (
@@ -1155,9 +1154,6 @@ func TestBlobCountLimit(t *testing.T) {
11551154

11561155
addr1 = crypto.PubkeyToAddress(key1.PublicKey)
11571156
addr2 = crypto.PubkeyToAddress(key2.PublicKey)
1158-
1159-
tx1 = makeMultiBlobTx(0, 1, 1000, 100, 7, key1)
1160-
tx2 = makeMultiBlobTx(0, 1, 800, 70, 8, key2)
11611157
)
11621158

11631159
statedb, _ := state.New(types.EmptyRootHash, state.NewDatabaseForTesting())
@@ -1190,11 +1186,19 @@ func TestBlobCountLimit(t *testing.T) {
11901186
t.Fatalf("failed to create blob pool: %v", err)
11911187
}
11921188

1189+
var (
1190+
tx1 = makeMultiBlobTx(0, 1, 1000, 100, 7, key1)
1191+
tx2 = makeMultiBlobTx(0, 1, 800, 70, 8, key2)
1192+
)
1193+
11931194
// Attempt to add transactions.
11941195
errs := pool.Add([]*types.Transaction{tx1, tx2}, true)
1195-
assert.Equal(t, 2, len(errs))
1196-
assert.NoError(t, errs[0])
1197-
assert.EqualError(t, errs[1], "transaction blob limit exceeded: blob count 8, limit 7")
1196+
if errs[0] != nil {
1197+
t.Fatalf("expected tx with 7 blobs to succeed")
1198+
}
1199+
if !errors.Is(errs[1], txpool.ErrTxBlobLimitExceeded) {
1200+
t.Fatalf("expected tx with 8 blobs to fail, got: %v", errs[1])
1201+
}
11981202

11991203
verifyPoolInternals(t, pool)
12001204
pool.Close()

0 commit comments

Comments
 (0)