diff --git a/cmd/erigon-el-mock/main.go b/cmd/erigon-el-mock/main.go index 9cf8b5edc..be31d6307 100644 --- a/cmd/erigon-el-mock/main.go +++ b/cmd/erigon-el-mock/main.go @@ -52,15 +52,14 @@ func main() { } func blocksIO(db kv.RoDB) (services.FullBlockReader, *blockio.BlockWriter) { - var histV3, transactionsV3 bool + var histV3 bool if err := db.View(context.Background(), func(tx kv.Tx) error { - transactionsV3, _ = kvcfg.TransactionsV3.Enabled(tx) histV3, _ = kvcfg.HistoryV3.Enabled(tx) return nil }); err != nil { panic(err) } - br := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), transactionsV3) - bw := blockio.NewBlockWriter(histV3, transactionsV3) + br := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) + bw := blockio.NewBlockWriter(histV3) return br, bw } diff --git a/cmd/erigon-el/backend/backend.go b/cmd/erigon-el/backend/backend.go index b4d683911..4cdf16445 100644 --- a/cmd/erigon-el/backend/backend.go +++ b/cmd/erigon-el/backend/backend.go @@ -192,11 +192,6 @@ func NewBackend(stack *node.Node, config *ethconfig.Config, logger log.Logger) ( return err } - config.TransactionsV3, err = kvcfg.TransactionsV3.WriteOnce(tx, config.TransactionsV3) - if err != nil { - return err - } - isCorrectSync, useSnapshots, err := snap.EnsureNotChanged(tx, config.Snapshot) if err != nil { return err @@ -234,7 +229,7 @@ func NewBackend(stack *node.Node, config *ethconfig.Config, logger log.Logger) ( var ( allSnapshots *snapshotsync.RoSnapshots ) - blockReader, blockWriter, allSnapshots, agg, err := setUpBlockReader(ctx, chainKv, config.Dirs, config.Snapshot, config.HistoryV3, config.TransactionsV3, logger) + blockReader, blockWriter, allSnapshots, agg, err := setUpBlockReader(ctx, chainKv, config.Dirs, config.Snapshot, config.HistoryV3, logger) if err != nil { return nil, err } @@ -903,14 +898,14 @@ func (s *Ethereum) setUpSnapDownloader(ctx context.Context, downloaderCfg *downl return err } -func setUpBlockReader(ctx context.Context, db kv.RwDB, dirs datadir.Dirs, snConfig ethconfig.Snapshot, histV3, transactionsV3 bool, logger log.Logger) (services.FullBlockReader, *blockio.BlockWriter, *snapshotsync.RoSnapshots, *libstate.AggregatorV3, error) { +func setUpBlockReader(ctx context.Context, db kv.RwDB, dirs datadir.Dirs, snConfig ethconfig.Snapshot, histV3 bool, logger log.Logger) (services.FullBlockReader, *blockio.BlockWriter, *snapshotsync.RoSnapshots, *libstate.AggregatorV3, error) { allSnapshots := snapshotsync.NewRoSnapshots(snConfig, dirs.Snap, logger) var err error if !snConfig.NoDownloader { allSnapshots.OptimisticalyReopenWithDB(db) } - blockReader := snapshotsync.NewBlockReader(allSnapshots, transactionsV3) - blockWriter := blockio.NewBlockWriter(histV3, transactionsV3) + blockReader := snapshotsync.NewBlockReader(allSnapshots) + blockWriter := blockio.NewBlockWriter(histV3) dir.MustExist(dirs.SnapHistory) agg, err := libstate.NewAggregatorV3(ctx, dirs.SnapHistory, dirs.Tmp, ethconfig.HistoryV3AggregationStep, db, logger) diff --git a/cmd/hack/hack.go b/cmd/hack/hack.go index 9239e5c24..63c789a0c 100644 --- a/cmd/hack/hack.go +++ b/cmd/hack/hack.go @@ -131,16 +131,15 @@ func printCurrentBlockNumber(chaindata string) { } func blocksIO(db kv.RoDB) (services.FullBlockReader, *blockio.BlockWriter) { - var histV3, transactionsV3 bool + var histV3 bool if err := db.View(context.Background(), func(tx kv.Tx) error { - transactionsV3, _ = kvcfg.TransactionsV3.Enabled(tx) histV3, _ = kvcfg.HistoryV3.Enabled(tx) return nil }); err != nil { panic(err) } - br := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), transactionsV3) - bw := blockio.NewBlockWriter(histV3, transactionsV3) + br := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) + bw := blockio.NewBlockWriter(histV3) return br, bw } diff --git a/cmd/hack/tool/fromdb/tool.go b/cmd/hack/tool/fromdb/tool.go index edf18e616..32ae74e96 100644 --- a/cmd/hack/tool/fromdb/tool.go +++ b/cmd/hack/tool/fromdb/tool.go @@ -35,19 +35,6 @@ func PruneMode(db kv.RoDB) (pm prune.Mode) { } return } -func TxsV3(db kv.RoDB) (enabled bool) { - if err := db.View(context.Background(), func(tx kv.Tx) error { - var err error - enabled, err = kvcfg.TransactionsV3.Enabled(tx) - if err != nil { - return err - } - return nil - }); err != nil { - panic(err) - } - return -} func HistV3(db kv.RoDB) (enabled bool) { if err := db.View(context.Background(), func(tx kv.Tx) error { var err error diff --git a/cmd/integration/commands/reset_state.go b/cmd/integration/commands/reset_state.go index f88c617cd..ff75a7bf6 100644 --- a/cmd/integration/commands/reset_state.go +++ b/cmd/integration/commands/reset_state.go @@ -107,17 +107,13 @@ func printStages(tx kv.Tx, snapshots *snapshotsync.RoSnapshots, agg *state.Aggre if err != nil { return err } - txs3, err := kvcfg.TransactionsV3.Enabled(tx) - if err != nil { - return err - } lastK, lastV, err := rawdbv3.Last(tx, kv.MaxTxNum) if err != nil { return err } _, lastBlockInHistSnap, _ := rawdbv3.TxNums.FindBlockNum(tx, agg.EndTxNumMinimax()) - fmt.Fprintf(w, "history.v3: %t, txs.v3: %t, idx steps: %.02f, lastMaxTxNum=%d->%d, lastBlockInSnap=%d\n\n", h3, txs3, rawdbhelpers.IdxStepsCountV3(tx), u64or0(lastK), u64or0(lastV), lastBlockInHistSnap) + fmt.Fprintf(w, "history.v3: %t, idx steps: %.02f, lastMaxTxNum=%d->%d, lastBlockInSnap=%d\n\n", h3, rawdbhelpers.IdxStepsCountV3(tx), u64or0(lastK), u64or0(lastV), lastBlockInHistSnap) s1, err := tx.ReadSequence(kv.EthTx) if err != nil { return err diff --git a/cmd/integration/commands/stages.go b/cmd/integration/commands/stages.go index 4d4165344..dfdc2b8c4 100644 --- a/cmd/integration/commands/stages.go +++ b/cmd/integration/commands/stages.go @@ -1412,10 +1412,9 @@ var _blockWriterSingleton *blockio.BlockWriter func blocksIO(db kv.RoDB, logger log.Logger) (services.FullBlockReader, *blockio.BlockWriter) { openBlockReaderOnce.Do(func() { sn, _ := allSnapshots(context.Background(), db, logger) - transactionsV3 := kvcfg.TransactionsV3.FromDB(db) histV3 := kvcfg.HistoryV3.FromDB(db) - _blockReaderSingleton = snapshotsync.NewBlockReader(sn, transactionsV3) - _blockWriterSingleton = blockio.NewBlockWriter(histV3, transactionsV3) + _blockReaderSingleton = snapshotsync.NewBlockReader(sn) + _blockWriterSingleton = blockio.NewBlockWriter(histV3) }) return _blockReaderSingleton, _blockWriterSingleton } diff --git a/cmd/rpcdaemon/cli/config.go b/cmd/rpcdaemon/cli/config.go index 2ce0a40c2..c6c4ae33a 100644 --- a/cmd/rpcdaemon/cli/config.go +++ b/cmd/rpcdaemon/cli/config.go @@ -387,7 +387,7 @@ func RemoteServices(ctx context.Context, cfg httpcfg.HttpCfg, logger log.Logger, }() } onNewSnapshot() - blockReader = snapshotsync.NewBlockReader(allSnapshots, ethconfig.Defaults.TransactionsV3) + blockReader = snapshotsync.NewBlockReader(allSnapshots) var histV3Enabled bool _ = db.View(ctx, func(tx kv.Tx) error { diff --git a/cmd/state/commands/check_change_sets.go b/cmd/state/commands/check_change_sets.go index 03d8d111c..aea722fef 100644 --- a/cmd/state/commands/check_change_sets.go +++ b/cmd/state/commands/check_change_sets.go @@ -16,7 +16,6 @@ import ( "github.com/ledgerwatch/erigon-lib/kv" kv2 "github.com/ledgerwatch/erigon-lib/kv/mdbx" "github.com/ledgerwatch/erigon-lib/kv/temporal/historyv2" - "github.com/ledgerwatch/erigon/cmd/utils" "github.com/ledgerwatch/log/v3" "github.com/spf13/cobra" @@ -31,9 +30,8 @@ import ( ) var ( - historyfile string - nocheck bool - transactionsV3 bool + historyfile string + nocheck bool ) func init() { @@ -42,7 +40,6 @@ func init() { withSnapshotBlocks(checkChangeSetsCmd) checkChangeSetsCmd.Flags().StringVar(&historyfile, "historyfile", "", "path to the file where the changesets and history are expected to be. If omitted, the same as /erion/chaindata") checkChangeSetsCmd.Flags().BoolVar(&nocheck, "nocheck", false, "set to turn off the changeset checking and only execute transaction (for performance testing)") - checkChangeSetsCmd.Flags().BoolVar(&transactionsV3, utils.TransactionV3Flag.Name, utils.TransactionV3Flag.Value, utils.TransactionV3Flag.Usage) rootCmd.AddCommand(checkChangeSetsCmd) } @@ -56,13 +53,13 @@ var checkChangeSetsCmd = &cobra.Command{ logger.Error("Setting up", "error", err) return err } - return CheckChangeSets(genesis, logger, block, chaindata, historyfile, nocheck, transactionsV3) + return CheckChangeSets(genesis, logger, block, chaindata, historyfile, nocheck) }, } // CheckChangeSets re-executes historical transactions in read-only mode // and checks that their outputs match the database ChangeSets. -func CheckChangeSets(genesis *types.Genesis, logger log.Logger, blockNum uint64, chaindata string, historyfile string, nocheck bool, transactionV3 bool) error { +func CheckChangeSets(genesis *types.Genesis, logger log.Logger, blockNum uint64, chaindata string, historyfile string, nocheck bool) error { if len(historyfile) == 0 { historyfile = chaindata } @@ -86,7 +83,7 @@ func CheckChangeSets(genesis *types.Genesis, logger log.Logger, blockNum uint64, if err := allSnapshots.ReopenFolder(); err != nil { return fmt.Errorf("reopen snapshot segments: %w", err) } - blockReader := snapshotsync.NewBlockReader(allSnapshots, transactionV3) + blockReader := snapshotsync.NewBlockReader(allSnapshots) chainDb := db defer chainDb.Close() diff --git a/cmd/state/commands/erigon4.go b/cmd/state/commands/erigon4.go index 86216fa2f..90e3175be 100644 --- a/cmd/state/commands/erigon4.go +++ b/cmd/state/commands/erigon4.go @@ -241,9 +241,7 @@ func Erigon4(genesis *types.Genesis, chainConfig *chain2.Config, logger log.Logg if err := allSnapshots.ReopenFolder(); err != nil { return fmt.Errorf("reopen snapshot segments: %w", err) } - //transactionsV3 := kvcfg.TransactionsV3.FromDB(db) - transactionsV3 := false - blockReader = snapshotsync.NewBlockReader(allSnapshots, transactionsV3) + blockReader = snapshotsync.NewBlockReader(allSnapshots) engine := initConsensusEngine(chainConfig, allSnapshots, logger) getHeader := func(hash libcommon.Hash, number uint64) *types.Header { diff --git a/cmd/state/commands/opcode_tracer.go b/cmd/state/commands/opcode_tracer.go index 703b4235e..a495deced 100644 --- a/cmd/state/commands/opcode_tracer.go +++ b/cmd/state/commands/opcode_tracer.go @@ -421,19 +421,15 @@ func OpcodeTracer(genesis *types.Genesis, blockNum uint64, chaindata string, num } defer historyTx.Rollback() - var historyV3, txsV3 bool + var historyV3 bool chainDb.View(context.Background(), func(tx kv.Tx) (err error) { historyV3, err = kvcfg.HistoryV3.Enabled(tx) if err != nil { return err } - txsV3, err = kvcfg.TransactionsV3.Enabled(tx) - if err != nil { - return err - } return nil }) - blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), txsV3) + blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) chainConfig := genesis.Config vmConfig := vm.Config{Tracer: ot, Debug: true} diff --git a/cmd/state/commands/state_root.go b/cmd/state/commands/state_root.go index 17b82b92f..e3878f7f7 100644 --- a/cmd/state/commands/state_root.go +++ b/cmd/state/commands/state_root.go @@ -53,16 +53,15 @@ var stateRootCmd = &cobra.Command{ } func blocksIO(db kv.RoDB) (services.FullBlockReader, *blockio.BlockWriter) { - var histV3, transactionsV3 bool + var histV3 bool if err := db.View(context.Background(), func(tx kv.Tx) error { - transactionsV3, _ = kvcfg.TransactionsV3.Enabled(tx) histV3, _ = kvcfg.HistoryV3.Enabled(tx) return nil }); err != nil { panic(err) } - br := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), transactionsV3) - bw := blockio.NewBlockWriter(histV3, transactionsV3) + br := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) + bw := blockio.NewBlockWriter(histV3) return br, bw } diff --git a/cmd/state/verify/verify_txlookup.go b/cmd/state/verify/verify_txlookup.go index 3fe079ce5..9dd5a7607 100644 --- a/cmd/state/verify/verify_txlookup.go +++ b/cmd/state/verify/verify_txlookup.go @@ -21,16 +21,15 @@ import ( ) func blocksIO(db kv.RoDB) (services.FullBlockReader, *blockio.BlockWriter) { - var histV3, transactionsV3 bool + var histV3 bool if err := db.View(context.Background(), func(tx kv.Tx) error { - transactionsV3, _ = kvcfg.TransactionsV3.Enabled(tx) histV3, _ = kvcfg.HistoryV3.Enabled(tx) return nil }); err != nil { panic(err) } - br := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), transactionsV3) - bw := blockio.NewBlockWriter(histV3, transactionsV3) + br := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) + bw := blockio.NewBlockWriter(histV3) return br, bw } diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 5c09a3c66..52648d3b5 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -618,10 +618,6 @@ var ( Name: "experimental.history.v3", Usage: "(also known as Erigon3) Not recommended yet: Can't change this flag after node creation. New DB and Snapshots format of history allows: parallel blocks execution, get state as of given transaction without executing whole block.", } - TransactionV3Flag = cli.BoolFlag{ - Name: "experimental.transactions.v3", - Usage: "(this flag is in testing stage) Not recommended yet: Can't change this flag after node creation. New DB table for transactions allows keeping multiple branches of block bodies in the DB simultaneously", - } CliqueSnapshotCheckpointIntervalFlag = cli.UintFlag{ Name: "clique.checkpoint", @@ -1502,7 +1498,6 @@ func SetEthConfig(ctx *cli.Context, nodeConfig *nodecfg.Config, cfg *ethconfig.C cfg.Ethstats = ctx.String(EthStatsURLFlag.Name) cfg.P2PEnabled = len(nodeConfig.P2P.SentryAddr) == 0 cfg.HistoryV3 = ctx.Bool(HistoryV3Flag.Name) - cfg.TransactionsV3 = ctx.Bool(TransactionV3Flag.Name) if ctx.IsSet(NetworkIdFlag.Name) { cfg.NetworkID = ctx.Uint64(NetworkIdFlag.Name) } diff --git a/core/genesis_test.go b/core/genesis_test.go index 4e0f3761d..0402814a9 100644 --- a/core/genesis_test.go +++ b/core/genesis_test.go @@ -25,7 +25,7 @@ import ( func TestGenesisBlockHashes(t *testing.T) { logger := log.New() - _, _, db, _ := temporal.NewTestDB(t, context.Background(), datadir.New(t.TempDir()), nil, logger) + _, db, _ := temporal.NewTestDB(t, context.Background(), datadir.New(t.TempDir()), nil, logger) check := func(network string) { genesis := core.GenesisBlockByChainName(network) tx, err := db.BeginRw(context.Background()) @@ -74,7 +74,7 @@ func TestGenesisBlockRoots(t *testing.T) { func TestCommitGenesisIdempotency(t *testing.T) { logger := log.New() - _, _, db, _ := temporal.NewTestDB(t, context.Background(), datadir.New(t.TempDir()), nil, logger) + _, db, _ := temporal.NewTestDB(t, context.Background(), datadir.New(t.TempDir()), nil, logger) tx, err := db.BeginRw(context.Background()) require.NoError(t, err) defer tx.Rollback() @@ -111,7 +111,7 @@ func TestAllocConstructor(t *testing.T) { }, } - historyV3, _, db, _ := temporal.NewTestDB(t, context.Background(), datadir.New(t.TempDir()), nil, logger) + historyV3, db, _ := temporal.NewTestDB(t, context.Background(), datadir.New(t.TempDir()), nil, logger) _, _, err := core.CommitGenesisBlock(db, genSpec, "", logger) require.NoError(err) diff --git a/core/genesis_write.go b/core/genesis_write.go index cdec48d79..ef5cfc698 100644 --- a/core/genesis_write.go +++ b/core/genesis_write.go @@ -248,15 +248,11 @@ func write(tx kv.RwTx, g *types.Genesis, tmpDir string) (*types.Block, *state.In if err := config.CheckConfigForkOrder(); err != nil { return nil, nil, err } - transactionV3, err := kvcfg.TransactionsV3.Enabled(tx) - if err != nil { - return nil, nil, err - } histV3, err := kvcfg.HistoryV3.Enabled(tx) if err != nil { return nil, nil, err } - blockWriter := blockio.NewBlockWriter(histV3, transactionV3) + blockWriter := blockio.NewBlockWriter(histV3) if err := blockWriter.WriteBlock(tx, block); err != nil { return nil, nil, err diff --git a/core/rawdb/blockio/block_writer.go b/core/rawdb/blockio/block_writer.go index e683c60b3..ae55faafe 100644 --- a/core/rawdb/blockio/block_writer.go +++ b/core/rawdb/blockio/block_writer.go @@ -32,8 +32,8 @@ type BlockWriter struct { txsV3 bool } -func NewBlockWriter(historyV3, txsV3 bool) *BlockWriter { - return &BlockWriter{historyV3: historyV3, txsV3: txsV3} +func NewBlockWriter(historyV3 bool) *BlockWriter { + return &BlockWriter{historyV3: historyV3, txsV3: false} } func (w *BlockWriter) TxsV3Enabled() bool { return w.txsV3 } diff --git a/core/rlp_test.go b/core/rlp_test.go index 55336b2a6..ce5dcadc7 100644 --- a/core/rlp_test.go +++ b/core/rlp_test.go @@ -39,7 +39,7 @@ import ( func getBlock(tb testing.TB, transactions int, uncles int, dataSize int, tmpDir string) *types.Block { logger := log.New() - _, _, db, _ := temporal.NewTestDB(tb, context.Background(), datadir.New(tmpDir), nil, logger) + _, db, _ := temporal.NewTestDB(tb, context.Background(), datadir.New(tmpDir), nil, logger) var ( aa = libcommon.HexToAddress("0x000000000000000000000000000000000000aaaa") // Generate a canonical chain to act as the main dataset diff --git a/core/state/temporal/kv_temporal.go b/core/state/temporal/kv_temporal.go index f855c0f3a..911730839 100644 --- a/core/state/temporal/kv_temporal.go +++ b/core/state/temporal/kv_temporal.go @@ -490,9 +490,8 @@ func (tx *Tx) HistoryRange(name kv.History, fromTs, toTs int, asc order.By, limi } // TODO: need remove `gspec` param (move SystemContractCodeLookup feature somewhere) -func NewTestDB(tb testing.TB, ctx context.Context, dirs datadir.Dirs, gspec *types.Genesis, logger log.Logger) (histV3, txsV3 bool, db kv.RwDB, agg *state.AggregatorV3) { - HistoryV3 := ethconfig.EnableHistoryV3InTest - TxsV3 := ethconfig.EnableTxsV3InTest +func NewTestDB(tb testing.TB, ctx context.Context, dirs datadir.Dirs, gspec *types.Genesis, logger log.Logger) (histV3 bool, db kv.RwDB, agg *state.AggregatorV3) { + historyV3 := ethconfig.EnableHistoryV3InTest if tb != nil { db = memdb.NewTestDB(tb) @@ -500,12 +499,11 @@ func NewTestDB(tb testing.TB, ctx context.Context, dirs datadir.Dirs, gspec *typ db = memdb.New(dirs.DataDir) } _ = db.UpdateNosync(context.Background(), func(tx kv.RwTx) error { - _, _ = kvcfg.HistoryV3.WriteOnce(tx, HistoryV3) - _, _ = kvcfg.TransactionsV3.WriteOnce(tx, TxsV3) + _, _ = kvcfg.HistoryV3.WriteOnce(tx, historyV3) return nil }) - if HistoryV3 { + if historyV3 { var err error dir.MustExist(dirs.SnapHistory) agg, err = state.NewAggregatorV3(ctx, dirs.SnapHistory, dirs.Tmp, ethconfig.HistoryV3AggregationStep, db, logger) @@ -526,5 +524,5 @@ func NewTestDB(tb testing.TB, ctx context.Context, dirs datadir.Dirs, gspec *typ panic(err) } } - return HistoryV3, TxsV3, db, agg + return historyV3, db, agg } diff --git a/eth/backend.go b/eth/backend.go index 1f83f63c8..2478641b6 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -225,11 +225,6 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere return err } - config.TransactionsV3, err = kvcfg.TransactionsV3.WriteOnce(tx, config.TransactionsV3) - if err != nil { - return err - } - isCorrectSync, useSnapshots, err := snap.EnsureNotChanged(tx, config.Snapshot) if err != nil { return err @@ -264,7 +259,7 @@ func New(stack *node.Node, config *ethconfig.Config, logger log.Logger) (*Ethere logger: logger, } - blockReader, blockWriter, allSnapshots, agg, err := setUpBlockReader(ctx, chainKv, config.Dirs, config.Snapshot, config.HistoryV3, config.TransactionsV3, logger) + blockReader, blockWriter, allSnapshots, agg, err := setUpBlockReader(ctx, chainKv, config.Dirs, config.Snapshot, config.HistoryV3, logger) if err != nil { return nil, err } @@ -1030,14 +1025,14 @@ func (s *Ethereum) setUpSnapDownloader(ctx context.Context, downloaderCfg *downl return err } -func setUpBlockReader(ctx context.Context, db kv.RwDB, dirs datadir.Dirs, snConfig ethconfig.Snapshot, histV3, transactionsV3 bool, logger log.Logger) (services.FullBlockReader, *blockio.BlockWriter, *snapshotsync.RoSnapshots, *libstate.AggregatorV3, error) { +func setUpBlockReader(ctx context.Context, db kv.RwDB, dirs datadir.Dirs, snConfig ethconfig.Snapshot, histV3 bool, logger log.Logger) (services.FullBlockReader, *blockio.BlockWriter, *snapshotsync.RoSnapshots, *libstate.AggregatorV3, error) { allSnapshots := snapshotsync.NewRoSnapshots(snConfig, dirs.Snap, logger) var err error if !snConfig.NoDownloader { allSnapshots.OptimisticalyReopenWithDB(db) } - blockReader := snapshotsync.NewBlockReader(allSnapshots, transactionsV3) - blockWriter := blockio.NewBlockWriter(histV3, transactionsV3) + blockReader := snapshotsync.NewBlockReader(allSnapshots) + blockWriter := blockio.NewBlockWriter(histV3) dir.MustExist(dirs.SnapHistory) agg, err := libstate.NewAggregatorV3(ctx, dirs.SnapHistory, dirs.Tmp, ethconfig.HistoryV3AggregationStep, db, logger) diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index f3882fcb2..e02df54a6 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -230,9 +230,6 @@ type Config struct { // gRPC Address to connect to Heimdall node HeimdallgRPCAddress string - // New DB table for storing transactions allows: keeping multiple branches of block bodies in the DB simultaneously - TransactionsV3 bool - // URL to connect to Heimdall node HeimdallURL string diff --git a/eth/ethconfig/erigon3_test_disable.go b/eth/ethconfig/erigon3_test_disable.go index 4c255f393..77d80ace9 100644 --- a/eth/ethconfig/erigon3_test_disable.go +++ b/eth/ethconfig/erigon3_test_disable.go @@ -4,4 +4,3 @@ package ethconfig const EnableHistoryV3InTest = false const EnableHistoryV4InTest = false -const EnableTxsV3InTest = false diff --git a/eth/ethconfig/erigon3_test_enable.go b/eth/ethconfig/erigon3_test_enable.go index 27cbfa156..ae1ee98d2 100644 --- a/eth/ethconfig/erigon3_test_enable.go +++ b/eth/ethconfig/erigon3_test_enable.go @@ -4,4 +4,3 @@ package ethconfig const EnableHistoryV3InTest = true const EnableHistoryV4InTest = false -const EnableTxsV3InTest = false diff --git a/eth/ethconfig/erigon4_test_enable.go b/eth/ethconfig/erigon4_test_enable.go index 479b7b22d..15d417ed9 100644 --- a/eth/ethconfig/erigon4_test_enable.go +++ b/eth/ethconfig/erigon4_test_enable.go @@ -4,4 +4,3 @@ package ethconfig const EnableHistoryV3InTest = true const EnableHistoryV4InTest = true -const EnableTxsV3InTest = false diff --git a/eth/stagedsync/stage_bodies.go b/eth/stagedsync/stage_bodies.go index 843999832..0169c247c 100644 --- a/eth/stagedsync/stage_bodies.go +++ b/eth/stagedsync/stage_bodies.go @@ -37,7 +37,6 @@ type BodiesCfg struct { blockReader services.FullBlockReader blockWriter *blockio.BlockWriter historyV3 bool - transactionsV3 bool } func StageBodiesCfg(db kv.RwDB, bd *bodydownload.BodyDownload, diff --git a/eth/stagedsync/stage_interhashes_test.go b/eth/stagedsync/stage_interhashes_test.go index 93e94b6de..10c389b02 100644 --- a/eth/stagedsync/stage_interhashes_test.go +++ b/eth/stagedsync/stage_interhashes_test.go @@ -79,7 +79,7 @@ func TestAccountAndStorageTrie(t *testing.T) { // ---------------------------------------------------------------- historyV3 := false - blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), false) + blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) cfg := StageTrieCfg(db, false, true, false, t.TempDir(), blockReader, nil, historyV3, nil) _, err := RegenerateIntermediateHashes("IH", tx, cfg, libcommon.Hash{} /* expectedRootHash */, ctx, log.New()) assert.Nil(t, err) @@ -201,7 +201,7 @@ func TestAccountTrieAroundExtensionNode(t *testing.T) { hash6 := libcommon.HexToHash("0x3100000000000000000000000000000000000000000000000000000000000000") assert.Nil(t, tx.Put(kv.HashedAccounts, hash6[:], encoded)) - blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), false) + blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) _, err := RegenerateIntermediateHashes("IH", tx, StageTrieCfg(db, false, true, false, t.TempDir(), blockReader, nil, historyV3, nil), libcommon.Hash{} /* expectedRootHash */, ctx, log.New()) assert.Nil(t, err) @@ -264,7 +264,7 @@ func TestStorageDeletion(t *testing.T) { // Populate account & storage trie DB tables // ---------------------------------------------------------------- historyV3 := false - blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), false) + blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) cfg := StageTrieCfg(db, false, true, false, t.TempDir(), blockReader, nil, historyV3, nil) _, err = RegenerateIntermediateHashes("IH", tx, cfg, libcommon.Hash{} /* expectedRootHash */, ctx, log.New()) assert.Nil(t, err) @@ -383,7 +383,7 @@ func TestHiveTrieRoot(t *testing.T) { common.FromHex("02081bc16d674ec80000"))) historyV3 := false - blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), false) + blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) cfg := StageTrieCfg(db, false, true, false, t.TempDir(), blockReader, nil, historyV3, nil) logger := log.New() _, err := RegenerateIntermediateHashes("IH", tx, cfg, libcommon.Hash{} /* expectedRootHash */, ctx, logger) diff --git a/turbo/app/snapshots_cmd.go b/turbo/app/snapshots_cmd.go index b4e62b048..408a956a7 100644 --- a/turbo/app/snapshots_cmd.go +++ b/turbo/app/snapshots_cmd.go @@ -415,8 +415,8 @@ func doRetireCommand(cliCtx *cli.Context) error { if err := snapshots.ReopenFolder(); err != nil { return err } - blockReader := snapshotsync.NewBlockReader(snapshots, fromdb.TxsV3(db)) - blockWriter := blockio.NewBlockWriter(fromdb.HistV3(db), fromdb.TxsV3(db)) + blockReader := snapshotsync.NewBlockReader(snapshots) + blockWriter := blockio.NewBlockWriter(fromdb.HistV3(db)) br := snapshotsync.NewBlockRetire(estimate.CompressSnapshot.Workers(), dirs.Tmp, blockReader, blockWriter, db, nil, nil, logger) agg, err := libstate.NewAggregatorV3(ctx, dirs.SnapHistory, dirs.Tmp, ethconfig.HistoryV3AggregationStep, db, logger) diff --git a/turbo/cli/default_flags.go b/turbo/cli/default_flags.go index 106825217..fb3ed79ec 100644 --- a/turbo/cli/default_flags.go +++ b/turbo/cli/default_flags.go @@ -117,7 +117,6 @@ var DefaultFlags = []cli.Flag{ &utils.GpoPercentileFlag, &utils.InsecureUnlockAllowedFlag, &utils.HistoryV3Flag, - &utils.TransactionV3Flag, &utils.IdentityFlag, &utils.CliqueSnapshotCheckpointIntervalFlag, &utils.CliqueSnapshotInmemorySnapshotsFlag, diff --git a/turbo/snapshotsync/block_reader.go b/turbo/snapshotsync/block_reader.go index d468f157e..46658b414 100644 --- a/turbo/snapshotsync/block_reader.go +++ b/turbo/snapshotsync/block_reader.go @@ -196,8 +196,8 @@ type BlockReader struct { TransactionsV3 bool } -func NewBlockReader(snapshots services.BlockSnapshots, transactionsV3 bool) *BlockReader { - return &BlockReader{sn: snapshots.(*RoSnapshots), TransactionsV3: transactionsV3} +func NewBlockReader(snapshots services.BlockSnapshots) *BlockReader { + return &BlockReader{sn: snapshots.(*RoSnapshots), TransactionsV3: false} } func (r *BlockReader) Snapshots() services.BlockSnapshots { return r.sn } diff --git a/turbo/stages/genesis_test.go b/turbo/stages/genesis_test.go index 9afed1196..b35ad10fc 100644 --- a/turbo/stages/genesis_test.go +++ b/turbo/stages/genesis_test.go @@ -143,8 +143,8 @@ func TestSetupGenesis(t *testing.T) { for _, test := range tests { test := test t.Run(test.name, func(t *testing.T) { - _, _, db, _ := temporal.NewTestDB(t, context.Background(), datadir.New(tmpdir), nil, log.New()) - blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New()), ethconfig.EnableTxsV3InTest) + _, db, _ := temporal.NewTestDB(t, context.Background(), datadir.New(tmpdir), nil, log.New()) + blockReader := snapshotsync.NewBlockReader(snapshotsync.NewRoSnapshots(ethconfig.Snapshot{Enabled: false}, "", log.New())) config, genesis, err := test.fn(db) // Check the return values. if !reflect.DeepEqual(err, test.wantErr) { diff --git a/turbo/stages/mock_sentry.go b/turbo/stages/mock_sentry.go index 0b67040ff..84eb27d18 100644 --- a/turbo/stages/mock_sentry.go +++ b/turbo/stages/mock_sentry.go @@ -99,7 +99,6 @@ type MockSentry struct { txPoolDB kv.RwDB HistoryV3 bool - TransactionsV3 bool agg *libstate.AggregatorV3 BlockSnapshots *snapshotsync.RoSnapshots } @@ -234,9 +233,8 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK logger := log.New() ctx, ctxCancel := context.WithCancel(context.Background()) - histV3, txsV3, db, agg := temporal.NewTestDB(tb, ctx, dirs, gspec, logger) + histV3, db, agg := temporal.NewTestDB(tb, ctx, dirs, gspec, logger) cfg.HistoryV3 = histV3 - cfg.TransactionsV3 = txsV3 erigonGrpcServeer := remotedbserver.NewKvServer(ctx, db, nil, nil, logger) allSnapshots := snapshotsync.NewRoSnapshots(ethconfig.Defaults.Snapshot, dirs.Snap, logger) @@ -259,7 +257,6 @@ func MockWithEverything(tb testing.TB, gspec *types.Genesis, key *ecdsa.PrivateK PeerId: gointerfaces.ConvertHashToH512([64]byte{0x12, 0x34, 0x50}), // "12345" BlockSnapshots: allSnapshots, HistoryV3: cfg.HistoryV3, - TransactionsV3: cfg.TransactionsV3, } if tb != nil { tb.Cleanup(mock.Close) @@ -734,5 +731,5 @@ func (ms *MockSentry) HistoryV3Components() *libstate.AggregatorV3 { } func (ms *MockSentry) NewBlocksIO() (services.FullBlockReader, *blockio.BlockWriter) { - return snapshotsync.NewBlockReader(ms.BlockSnapshots, ms.TransactionsV3), blockio.NewBlockWriter(ms.HistoryV3, ms.TransactionsV3) + return snapshotsync.NewBlockReader(ms.BlockSnapshots), blockio.NewBlockWriter(ms.HistoryV3) } diff --git a/turbo/stages/stageloop.go b/turbo/stages/stageloop.go index 91b1471f8..4ceace400 100644 --- a/turbo/stages/stageloop.go +++ b/turbo/stages/stageloop.go @@ -405,7 +405,7 @@ func NewDefaultStages(ctx context.Context, logger log.Logger, ) []*stagedsync.Stage { dirs := cfg.Dirs - blockWriter := blockio.NewBlockWriter(cfg.HistoryV3, cfg.TransactionsV3) + blockWriter := blockio.NewBlockWriter(cfg.HistoryV3) blockRetire := snapshotsync.NewBlockRetire(1, dirs.Tmp, blockReader, blockWriter, db, snapDownloader, notifications.Events, logger) // During Import we don't want other services like header requests, body requests etc. to be running. @@ -451,7 +451,7 @@ func NewDefaultStages(ctx context.Context, func NewInMemoryExecution(ctx context.Context, db kv.RwDB, cfg *ethconfig.Config, controlServer *sentry.MultiClient, dirs datadir.Dirs, notifications *shards.Notifications, snapshots *snapshotsync.RoSnapshots, agg *state.AggregatorV3, logger log.Logger) (*stagedsync.Sync, error) { - blockReader, blockWriter := snapshotsync.NewBlockReader(snapshots, cfg.TransactionsV3), blockio.NewBlockWriter(cfg.HistoryV3, cfg.TransactionsV3) + blockReader, blockWriter := snapshotsync.NewBlockReader(snapshots), blockio.NewBlockWriter(cfg.HistoryV3) return stagedsync.New( stagedsync.StateStages(ctx,