2015-07-07 00:54:22 +00:00
// Copyright 2015 The go-ethereum Authors
2015-07-22 16:48:40 +00:00
// This file is part of the go-ethereum library.
2015-07-07 00:54:22 +00:00
//
2015-07-23 16:35:11 +00:00
// The go-ethereum library is free software: you can redistribute it and/or modify
2015-07-07 00:54:22 +00:00
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
2015-07-22 16:48:40 +00:00
// The go-ethereum library is distributed in the hope that it will be useful,
2015-07-07 00:54:22 +00:00
// but WITHOUT ANY WARRANTY; without even the implied warranty of
2015-07-22 16:48:40 +00:00
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2015-07-07 00:54:22 +00:00
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
2015-07-22 16:48:40 +00:00
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
2015-07-07 00:54:22 +00:00
2022-05-04 03:35:59 +00:00
//go:build integration
2015-04-20 16:14:57 +00:00
package tests
import (
2021-05-20 16:46:12 +00:00
"runtime"
2015-04-20 16:14:57 +00:00
"testing"
2021-08-19 02:26:06 +00:00
2022-10-05 08:09:28 +00:00
"github.com/ledgerwatch/erigon/eth/ethconfig"
2021-08-19 02:26:06 +00:00
"github.com/ledgerwatch/log/v3"
2017-07-11 11:49:14 +00:00
)
2016-10-05 21:55:47 +00:00
2017-07-11 11:49:14 +00:00
func TestBlockchain ( t * testing . T ) {
2021-10-28 14:18:34 +00:00
defer log . Root ( ) . SetHandler ( log . Root ( ) . GetHandler ( ) )
log . Root ( ) . SetHandler ( log . LvlFilterHandler ( log . LvlError , log . StderrHandler ) )
2021-05-20 16:46:12 +00:00
if runtime . GOOS == "windows" {
t . Skip ( "fix me on win please" ) // after remove ChainReader from consensus engine - this test can be changed to create less databases, then can enable on win. now timeout after 20min
}
2017-07-11 11:49:14 +00:00
bt := new ( testMatcher )
// General state tests are 'exported' as blockchain tests, but we can run them natively.
2021-12-06 08:00:54 +00:00
// For speedier CI-runs those are skipped.
bt . skipLoad ( ` ^GeneralStateTests/ ` )
2021-02-24 16:47:01 +00:00
2022-07-26 07:35:38 +00:00
// Currently it fails because SpawnStageHeaders doesn't accept any PoW blocks after PoS transition
// TODO(yperbasis): make it work
bt . skipLoad ( ` ^TransitionTests/bcArrowGlacierToMerge/powToPosBlockRejection\.json ` )
2023-03-06 11:58:03 +00:00
bt . skipLoad ( ` ^TransitionTests/bcFrontierToHomestead/blockChainFrontierWithLargerTDvsHomesteadBlockchain\.json ` )
2022-10-05 08:09:28 +00:00
if ethconfig . EnableHistoryV3InTest {
// HistoryV3: doesn't produce receipts on execution by design
2022-10-18 04:08:14 +00:00
bt . skipLoad ( ` ^InvalidBlocks/bcInvalidHeaderTest/log1_wrongBloom\.json ` )
bt . skipLoad ( ` ^InvalidBlocks/bcInvalidHeaderTest/wrongReceiptTrie\.json ` )
bt . skipLoad ( ` ^InvalidBlocks/bcInvalidHeaderTest/wrongGasUsed\.json ` )
2022-10-05 08:09:28 +00:00
}
2022-07-26 07:35:38 +00:00
2023-08-08 13:01:35 +00:00
checkStateRoot := true
2017-07-11 11:49:14 +00:00
bt . walk ( t , blockTestDir , func ( t * testing . T , name string , test * BlockTest ) {
2021-04-21 13:03:08 +00:00
// import pre accounts & construct test genesis block & state root
2023-08-08 13:01:35 +00:00
if err := bt . checkFailure ( t , test . Run ( t , checkStateRoot ) ) ; err != nil {
2017-07-11 11:49:14 +00:00
t . Error ( err )
}
} )
2016-10-05 21:55:47 +00:00
}
2023-08-08 15:44:02 +00:00
func TestBlockchainEIP ( t * testing . T ) {
2023-08-25 07:58:13 +00:00
t . Skip ( "TODO(yperbasis): fix me" )
2023-08-08 15:44:02 +00:00
defer log . Root ( ) . SetHandler ( log . Root ( ) . GetHandler ( ) )
log . Root ( ) . SetHandler ( log . LvlFilterHandler ( log . LvlError , log . StderrHandler ) )
bt := new ( testMatcher )
// EOF is not supported yet
bt . skipLoad ( ` ^StateTests/stEOF/ ` )
2023-08-25 07:58:13 +00:00
checkStateRoot := true
2023-08-08 15:44:02 +00:00
bt . walk ( t , blockEipTestDir , func ( t * testing . T , name string , test * BlockTest ) {
if err := bt . checkFailure ( t , test . Run ( t , checkStateRoot ) ) ; err != nil {
t . Error ( err )
}
} )
}