don't log a message when an rpc error code is ignored due to being from pruned history

This commit is contained in:
Jared Wasinger 2025-03-12 17:31:28 +01:00 committed by Felix Lange
parent bcd5a64382
commit 04ca215ddd
2 changed files with 2 additions and 14 deletions

View file

@ -110,9 +110,7 @@ func (s *filterTestSuite) filterFullRange(t *utesting.T) {
func (s *filterTestSuite) queryAndCheck(t *utesting.T, query *filterQuery) { func (s *filterTestSuite) queryAndCheck(t *utesting.T, query *filterQuery) {
query.run(s.cfg.client) query.run(s.cfg.client)
if query.Err != nil { if query.Err != nil {
if errIsPrunedHistory(query.Err) { if !errIsPrunedHistory(query.Err) {
t.Logf("test case accessed pruned history")
} else {
t.Errorf("Filter query failed (fromBlock: %d toBlock: %d addresses: %v topics: %v error: %v)", query.FromBlock, query.ToBlock, query.Address, query.Topics, query.Err) t.Errorf("Filter query failed (fromBlock: %d toBlock: %d addresses: %v topics: %v error: %v)", query.FromBlock, query.ToBlock, query.Address, query.Topics, query.Err)
} }
return return
@ -131,9 +129,7 @@ func (s *filterTestSuite) fullRangeQueryAndCheck(t *utesting.T, query *filterQue
} }
frQuery.run(s.cfg.client) frQuery.run(s.cfg.client)
if frQuery.Err != nil { if frQuery.Err != nil {
if errIsPrunedHistory(frQuery.Err) { if !errIsPrunedHistory(frQuery.Err) {
t.Logf("test case accessed pruned history")
} else {
t.Errorf("Full range filter query failed (addresses: %v topics: %v error: %v)", frQuery.Address, frQuery.Topics, frQuery.Err) t.Errorf("Full range filter query failed (addresses: %v topics: %v error: %v)", frQuery.Address, frQuery.Topics, frQuery.Err)
} }
return return

View file

@ -122,7 +122,6 @@ func (s *historyTestSuite) testGetBlockByHash(t *utesting.T) {
b, err := s.cfg.client.getBlockByHash(ctx, bhash, false) b, err := s.cfg.client.getBlockByHash(ctx, bhash, false)
if err != nil { if err != nil {
if errIsPrunedHistory(err) { if errIsPrunedHistory(err) {
t.Logf("test case accessed pruned history")
continue continue
} }
t.Fatalf("block %d (hash %v): error %v", num, bhash, err) t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
@ -145,7 +144,6 @@ func (s *historyTestSuite) testGetBlockByNumber(t *utesting.T) {
b, err := s.cfg.client.getBlockByNumber(ctx, num, false) b, err := s.cfg.client.getBlockByNumber(ctx, num, false)
if err != nil { if err != nil {
if errIsPrunedHistory(err) { if errIsPrunedHistory(err) {
t.Logf("test case accessed pruned history")
continue continue
} }
t.Fatalf("block %d (hash %v): error %v", num, bhash, err) t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
@ -168,7 +166,6 @@ func (s *historyTestSuite) testGetBlockTransactionCountByHash(t *utesting.T) {
count, err := s.cfg.client.getBlockTransactionCountByHash(ctx, bhash) count, err := s.cfg.client.getBlockTransactionCountByHash(ctx, bhash)
if err != nil { if err != nil {
if errIsPrunedHistory(err) { if errIsPrunedHistory(err) {
t.Logf("test case accessed pruned history")
continue continue
} }
t.Fatalf("block %d (hash %v): error %v", num, bhash, err) t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
@ -188,7 +185,6 @@ func (s *historyTestSuite) testGetBlockTransactionCountByNumber(t *utesting.T) {
count, err := s.cfg.client.getBlockTransactionCountByNumber(ctx, num) count, err := s.cfg.client.getBlockTransactionCountByNumber(ctx, num)
if err != nil { if err != nil {
if errIsPrunedHistory(err) { if errIsPrunedHistory(err) {
t.Logf("test case accessed pruned history")
continue continue
} }
t.Fatalf("block %d (hash %v): error %v", num, bhash, err) t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
@ -208,7 +204,6 @@ func (s *historyTestSuite) testGetBlockReceiptsByHash(t *utesting.T) {
receipts, err := s.cfg.client.getBlockReceipts(ctx, bhash) receipts, err := s.cfg.client.getBlockReceipts(ctx, bhash)
if err != nil { if err != nil {
if errIsPrunedHistory(err) { if errIsPrunedHistory(err) {
t.Logf("test case accessed pruned history")
continue continue
} }
t.Fatalf("block %d (hash %v): error %v", num, bhash, err) t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
@ -229,7 +224,6 @@ func (s *historyTestSuite) testGetBlockReceiptsByNumber(t *utesting.T) {
receipts, err := s.cfg.client.getBlockReceipts(ctx, hexutil.Uint64(num)) receipts, err := s.cfg.client.getBlockReceipts(ctx, hexutil.Uint64(num))
if err != nil { if err != nil {
if errIsPrunedHistory(err) { if errIsPrunedHistory(err) {
t.Logf("test case accessed pruned history")
continue continue
} }
t.Fatalf("block %d (hash %v): error %v", num, bhash, err) t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
@ -256,7 +250,6 @@ func (s *historyTestSuite) testGetTransactionByBlockHashAndIndex(t *utesting.T)
tx, err := s.cfg.client.getTransactionByBlockHashAndIndex(ctx, bhash, uint64(txIndex)) tx, err := s.cfg.client.getTransactionByBlockHashAndIndex(ctx, bhash, uint64(txIndex))
if err != nil { if err != nil {
if errIsPrunedHistory(err) { if errIsPrunedHistory(err) {
t.Logf("test case accessed pruned history")
continue continue
} }
t.Fatalf("block %d (hash %v): error %v", num, bhash, err) t.Fatalf("block %d (hash %v): error %v", num, bhash, err)
@ -285,7 +278,6 @@ func (s *historyTestSuite) testGetTransactionByBlockNumberAndIndex(t *utesting.T
tx, err := s.cfg.client.getTransactionByBlockNumberAndIndex(ctx, num, uint64(txIndex)) tx, err := s.cfg.client.getTransactionByBlockNumberAndIndex(ctx, num, uint64(txIndex))
if err != nil { if err != nil {
if errIsPrunedHistory(err) { if errIsPrunedHistory(err) {
t.Logf("test case accessed pruned history")
continue continue
} }
t.Fatalf("block %d (hash %v): error %v", num, bhash, err) t.Fatalf("block %d (hash %v): error %v", num, bhash, err)