diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 8db594dfe1..11638a3154 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -10,7 +10,6 @@ on: branches: - master - develop - - blobtx jobs: unit-test: diff --git a/.github/workflows/commit-lint.yml b/.github/workflows/commit-lint.yml index 073d44195f..4d16ac7fb2 100644 --- a/.github/workflows/commit-lint.yml +++ b/.github/workflows/commit-lint.yml @@ -10,7 +10,6 @@ on: branches: - master - develop - - blobtx jobs: commitlint: diff --git a/.github/workflows/evm-tests.yml b/.github/workflows/evm-tests.yml index 80d3ac4685..a7a025d8c1 100644 --- a/.github/workflows/evm-tests.yml +++ b/.github/workflows/evm-tests.yml @@ -10,7 +10,6 @@ on: branches: - master - develop - - blobtx jobs: evm-test: diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 02b79f2759..ff12eb4bec 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -10,7 +10,6 @@ on: branches: - master - develop - - blobtx jobs: truffle-test: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 78d71f3acc..8d55c7780d 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,6 @@ on: branches: - master - develop - - blobtx jobs: golang-lint: diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index ff9ae642fa..a7d3304d6a 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -10,7 +10,6 @@ on: branches: - master - develop - - blobtx jobs: unit-test: diff --git a/core/rawdb/ancient_scheme.go b/core/rawdb/ancient_scheme.go index 4980eef84e..ee71dc7cd6 100644 --- a/core/rawdb/ancient_scheme.go +++ b/core/rawdb/ancient_scheme.go @@ -50,6 +50,8 @@ var chainFreezerNoSnappy = map[string]bool{ ChainFreezerBlobSidecarTable: false, } +var additionTables = []string{ChainFreezerBlobSidecarTable} + const ( // stateHistoryTableSize defines the maximum size of freezer data files. stateHistoryTableSize = 2 * 1000 * 1000 * 1000 diff --git a/core/rawdb/chain_freezer.go b/core/rawdb/chain_freezer.go index 3dee5c491f..2da59a3960 100644 --- a/core/rawdb/chain_freezer.go +++ b/core/rawdb/chain_freezer.go @@ -418,15 +418,6 @@ func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hash return hashes, err } -// EmptyBlobAncient check if empty in blob ancient, it is used to init blob ancient -func EmptyBlobAncient(f *chainFreezer) (bool, error) { - frozen, err := f.TableAncients(ChainFreezerBlobSidecarTable) - if err != nil { - return false, err - } - return frozen == 0, nil -} - func (f *chainFreezer) SetupFreezerEnv(env *ethdb.FreezerEnv) error { f.freezeEnv.Store(env) return nil diff --git a/core/rawdb/database.go b/core/rawdb/database.go index dee1cce02d..5214a8ac6f 100644 --- a/core/rawdb/database.go +++ b/core/rawdb/database.go @@ -263,7 +263,7 @@ func NewDatabase(db ethdb.KeyValueStore) ethdb.Database { // NewFreezerDb only create a freezer without statedb. func NewFreezerDb(db ethdb.KeyValueStore, frz, namespace string, readonly bool, newOffSet uint64) (*Freezer, error) { // Create the idle freezer instance, this operation should be atomic to avoid mismatch between offset and acientDB. - frdb, err := NewFreezer(frz, namespace, readonly, newOffSet, freezerTableSize, chainFreezerNoSnappy, ChainFreezerBlobSidecarTable) + frdb, err := NewFreezer(frz, namespace, readonly, newOffSet, freezerTableSize, chainFreezerNoSnappy) if err != nil { return nil, err } diff --git a/core/rawdb/freezer.go b/core/rawdb/freezer.go index e29d8b1e1f..33603b973f 100644 --- a/core/rawdb/freezer.go +++ b/core/rawdb/freezer.go @@ -77,14 +77,12 @@ type Freezer struct { instanceLock *flock.Flock // File-system lock to prevent double opens closeOnce sync.Once offset uint64 // Starting BlockNumber in current freezer - - additionTableKinds []string // additionTableKinds are post-filled tables that start as empty } // NewChainFreezer is a small utility method around NewFreezer that sets the // default parameters for the chain storage. func NewChainFreezer(datadir string, namespace string, readonly bool, offset uint64) (*Freezer, error) { - return NewFreezer(datadir, namespace, readonly, offset, freezerTableSize, chainFreezerNoSnappy, ChainFreezerBlobSidecarTable) + return NewFreezer(datadir, namespace, readonly, offset, freezerTableSize, chainFreezerNoSnappy) } // NewFreezer creates a freezer instance for maintaining immutable ordered @@ -93,7 +91,7 @@ func NewChainFreezer(datadir string, namespace string, readonly bool, offset uin // The 'tables' argument defines the data tables. If the value of a map // entry is true, snappy compression is disabled for the table. // additionTables indicates the new add tables for freezerDB, it has some special rules. -func NewFreezer(datadir string, namespace string, readonly bool, offset uint64, maxTableSize uint32, tables map[string]bool, additionTables ...string) (*Freezer, error) { +func NewFreezer(datadir string, namespace string, readonly bool, offset uint64, maxTableSize uint32, tables map[string]bool) (*Freezer, error) { // Create the initial freezer object var ( readMeter = metrics.NewRegisteredMeter(namespace+"ancient/read", nil) @@ -125,11 +123,10 @@ func NewFreezer(datadir string, namespace string, readonly bool, offset uint64, } // Open all the supported data tables freezer := &Freezer{ - readonly: readonly, - tables: make(map[string]*freezerTable), - instanceLock: lock, - offset: offset, - additionTableKinds: additionTables, + readonly: readonly, + tables: make(map[string]*freezerTable), + instanceLock: lock, + offset: offset, } // Create the tables. @@ -415,7 +412,7 @@ func (f *Freezer) validate() error { // Hack to get boundary of any table for kind, table := range f.tables { // addition tables is special cases - if slices.Contains(f.additionTableKinds, kind) { + if slices.Contains(additionTables, kind) { continue } head = table.items.Load() @@ -426,7 +423,7 @@ func (f *Freezer) validate() error { // Now check every table against those boundaries. for kind, table := range f.tables { // check addition tables, try to align with exist tables - if slices.Contains(f.additionTableKinds, kind) { + if slices.Contains(additionTables, kind) { // if the table is empty, just skip if EmptyTable(table) { continue @@ -460,7 +457,7 @@ func (f *Freezer) repair() error { ) for kind, table := range f.tables { // addition tables only align head - if slices.Contains(f.additionTableKinds, kind) { + if slices.Contains(additionTables, kind) { if EmptyTable(table) { continue } @@ -481,7 +478,7 @@ func (f *Freezer) repair() error { } for kind, table := range f.tables { // try to align with exist tables, skip empty table - if slices.Contains(f.additionTableKinds, kind) && EmptyTable(table) { + if slices.Contains(additionTables, kind) && EmptyTable(table) { continue } err := table.truncateHead(head) @@ -701,6 +698,7 @@ func (f *Freezer) MigrateTable(kind string, convert convertLegacyFn) error { return nil } +// only used for ChainFreezerBlobSidecarTable now func (f *Freezer) ResetTable(kind string, tail, head uint64, onlyEmpty bool) error { if f.readonly { return errReadOnly diff --git a/core/rawdb/freezer_batch.go b/core/rawdb/freezer_batch.go index bef9c70b33..9a5cf538e1 100644 --- a/core/rawdb/freezer_batch.go +++ b/core/rawdb/freezer_batch.go @@ -33,14 +33,12 @@ const freezerBatchBufferLimit = 2 * 1024 * 1024 // freezerBatch is a write operation of multiple items on a freezer. type freezerBatch struct { - tables map[string]*freezerTableBatch - additionTableKinds []string // additionTableKinds are post-filled tables that start as empty + tables map[string]*freezerTableBatch } func newFreezerBatch(f *Freezer) *freezerBatch { batch := &freezerBatch{ - tables: make(map[string]*freezerTableBatch, len(f.tables)), - additionTableKinds: f.additionTableKinds, + tables: make(map[string]*freezerTableBatch, len(f.tables)), } for kind, table := range f.tables { batch.tables[kind] = table.newBatch(f.offset) @@ -72,7 +70,7 @@ func (batch *freezerBatch) commit() (item uint64, writeSize int64, err error) { item = uint64(math.MaxUint64) for name, tb := range batch.tables { // skip empty addition tables - if slices.Contains(batch.additionTableKinds, name) && EmptyTable(tb.t) { + if slices.Contains(additionTables, name) && EmptyTable(tb.t) { continue } if item < math.MaxUint64 && tb.curItem != item { diff --git a/core/rawdb/freezer_table.go b/core/rawdb/freezer_table.go index b59cd95606..8dd99d4f49 100644 --- a/core/rawdb/freezer_table.go +++ b/core/rawdb/freezer_table.go @@ -1030,6 +1030,7 @@ func (t *freezerTable) ResetItemsOffset(virtualTail uint64) error { } // resetItems reset freezer table head & tail +// only used for ChainFreezerBlobSidecarTable now func (t *freezerTable) resetItems(tail, head uint64) (*freezerTable, error) { if t.readonly { return nil, errors.New("resetItems in readonly mode") diff --git a/core/rawdb/freezer_test.go b/core/rawdb/freezer_test.go index 5f68fff527..60103ab675 100644 --- a/core/rawdb/freezer_test.go +++ b/core/rawdb/freezer_test.go @@ -363,11 +363,12 @@ func TestFreezer_AdditionTables(t *testing.T) { require.NoError(t, f.Close()) // check read only - f, err = NewFreezer(dir, "", true, 0, 2049, map[string]bool{"o1": true, "o2": true, "a1": true}, "a1") + additionTables = []string{"a1"} + f, err = NewFreezer(dir, "", true, 0, 2049, map[string]bool{"o1": true, "o2": true, "a1": true}) require.NoError(t, err) require.NoError(t, f.Close()) - f, err = NewFreezer(dir, "", false, 0, 2049, map[string]bool{"o1": true, "o2": true, "a1": true}, "a1") + f, err = NewFreezer(dir, "", false, 0, 2049, map[string]bool{"o1": true, "o2": true, "a1": true}) require.NoError(t, err) frozen, _ := f.Ancients() f.ResetTable("a1", frozen, frozen, true) @@ -392,7 +393,7 @@ func TestFreezer_AdditionTables(t *testing.T) { require.NoError(t, f.Close()) // reopen and read - f, err = NewFreezer(dir, "", true, 0, 2049, map[string]bool{"o1": true, "o2": true, "a1": true}, "a1") + f, err = NewFreezer(dir, "", true, 0, 2049, map[string]bool{"o1": true, "o2": true, "a1": true}) require.NoError(t, err) actual, err = f.Ancient("a1", 2) require.NoError(t, err) diff --git a/miner/bid_simulator.go b/miner/bid_simulator.go index 1aec70738e..31aefccf01 100644 --- a/miner/bid_simulator.go +++ b/miner/bid_simulator.go @@ -674,6 +674,7 @@ func (r *BidRuntime) commitTransaction(chain *core.BlockChain, chainConfig *para } if tx.Type() == types.BlobTxType { + sc.TxIndex = uint64(len(env.txs)) env.txs = append(env.txs, tx.WithoutBlobTxSidecar()) env.receipts = append(env.receipts, receipt) env.sidecars = append(env.sidecars, sc)