From e23243d59d3d6785f2dc0315c6a017de48378a17 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Tue, 9 Jul 2024 19:20:14 +0800 Subject: [PATCH] move fixture module to reexports --- internal/statediff/reexport_geth.go | 7 +++++++ internal/statediff/reexport_plugin.go | 6 ++++++ internal/statediff/reexport_plugin_parallel.go | 6 ++++++ pkg/diff_dump.go | 3 +-- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/internal/statediff/reexport_geth.go b/internal/statediff/reexport_geth.go index ebf79b1..860f92d 100644 --- a/internal/statediff/reexport_geth.go +++ b/internal/statediff/reexport_geth.go @@ -5,8 +5,11 @@ package statediff import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" + + "github.com/cerc-io/eth-testing/chaindata/mainnet" "github.com/ethereum/go-ethereum/statediff" sdtypes "github.com/ethereum/go-ethereum/statediff/types" ) @@ -27,3 +30,7 @@ func CommitDefaultGenesis(db ethdb.Database) { func init() { log.Root().SetHandler(log.DiscardHandler()) } + +func GetMainnetBlocks() []*types.Block { + return mainnet.GetBlocks() +} diff --git a/internal/statediff/reexport_plugin.go b/internal/statediff/reexport_plugin.go index 419b26e..0285c05 100644 --- a/internal/statediff/reexport_plugin.go +++ b/internal/statediff/reexport_plugin.go @@ -5,9 +5,11 @@ package statediff import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/triedb" + "github.com/cerc-io/eth-testing/chains/mainnet" statediff "github.com/cerc-io/plugeth-statediff" "github.com/cerc-io/plugeth-statediff/adapt" "github.com/cerc-io/plugeth-statediff/test_helpers" @@ -27,6 +29,10 @@ func CommitDefaultGenesis(db ethdb.Database) { core.DefaultGenesisBlock().MustCommit(db, triedb.NewDatabase(db, nil)) } +func GetMainnetBlocks() []*types.Block { + return mainnet.GetBlocks() +} + func init() { test_helpers.QuietLogs() } diff --git a/internal/statediff/reexport_plugin_parallel.go b/internal/statediff/reexport_plugin_parallel.go index 60e5d29..408b498 100644 --- a/internal/statediff/reexport_plugin_parallel.go +++ b/internal/statediff/reexport_plugin_parallel.go @@ -5,9 +5,11 @@ package statediff import ( "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/state" + "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/triedb" + "github.com/cerc-io/eth-testing/chains/mainnet" statediff "github.com/cerc-io/plugeth-statediff" "github.com/cerc-io/plugeth-statediff/adapt" "github.com/cerc-io/plugeth-statediff/test_helpers" @@ -32,3 +34,7 @@ func CommitDefaultGenesis(db ethdb.Database) { func init() { test_helpers.QuietLogs() } + +func GetMainnetBlocks() []*types.Block { + return mainnet.GetBlocks() +} diff --git a/pkg/diff_dump.go b/pkg/diff_dump.go index ea60bf3..388f751 100644 --- a/pkg/diff_dump.go +++ b/pkg/diff_dump.go @@ -14,7 +14,6 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/cerc-io/eth-statediff-compliance/internal/statediff" - "github.com/cerc-io/eth-testing/chains/mainnet" ) var ( @@ -25,7 +24,7 @@ var ( func loadChain() { db := rawdb.NewMemoryDatabase() statediff.CommitDefaultGenesis(db) - blocks = mainnet.GetBlocks() + blocks = statediff.GetMainnetBlocks() chain, _ = core.NewBlockChain(db, nil, nil, nil, ethash.NewFaker(), vm.Config{}, nil, nil) _, err := chain.InsertChain(blocks[1:]) if err != nil {