core/rawdb: bump db version

This commit is contained in:
Gary Rong 2025-01-23 13:53:34 +08:00
parent 0d119a9b53
commit 3546df65c1
5 changed files with 9 additions and 26 deletions

View file

@ -127,7 +127,10 @@ const (
// - Version 8 // - Version 8
// The following incompatible database changes were added: // The following incompatible database changes were added:
// * New scheme for contract code in order to separate the codes and trie nodes // * New scheme for contract code in order to separate the codes and trie nodes
BlockChainVersion uint64 = 8 // - Version 9
// Total difficulty has been removed from both the key-value store and the
// ancient store, the td freezer table has been deprecated since that.
BlockChainVersion uint64 = 9
) )
// CacheConfig contains the configuration values for the trie database // CacheConfig contains the configuration values for the trie database

View file

@ -4181,7 +4181,7 @@ func TestEIP7702(t *testing.T) {
var ( var (
config = *params.MergedTestChainConfig config = *params.MergedTestChainConfig
signer = types.LatestSigner(&config) signer = types.LatestSigner(&config)
engine = beacon.NewFaker() engine = beacon.New(ethash.NewFaker())
key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
key2, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a") key2, _ = crypto.HexToECDSA("8a1f9a8f95be41cd7ccb6168179afb4504aefe388d1e14474d32c45c72ce7b7a")
addr1 = crypto.PubkeyToAddress(key1.PublicKey) addr1 = crypto.PubkeyToAddress(key1.PublicKey)

View file

@ -726,14 +726,6 @@ func writeAncientBlock(op ethdb.AncientWriteOp, block *types.Block, header *type
if err := op.Append(ChainFreezerReceiptTable, num, receipts); err != nil { if err := op.Append(ChainFreezerReceiptTable, num, receipts); err != nil {
return fmt.Errorf("can't append block %d receipts: %v", num, err) return fmt.Errorf("can't append block %d receipts: %v", num, err)
} }
// TODO (rjl493456442) TD has been deprecated and write garbage data for
// backward compatibility. See https://github.com/ethereum/go-ethereum/pull/30744/.
//
// The TD freezer table is retained for backward compatibility within this
// major version (1.14.x) and will be discarded in the next major version.
if err := op.Append(ChainFreezerDifficultyTable, num, common.Big0); err != nil {
return fmt.Errorf("can't append block %d total difficulty: %v", num, err)
}
return nil return nil
} }

View file

@ -35,19 +35,15 @@ const (
// ChainFreezerReceiptTable indicates the name of the freezer receipts table. // ChainFreezerReceiptTable indicates the name of the freezer receipts table.
ChainFreezerReceiptTable = "receipts" ChainFreezerReceiptTable = "receipts"
// ChainFreezerDifficultyTable indicates the name of the freezer total difficulty table.
ChainFreezerDifficultyTable = "diffs"
) )
// chainFreezerNoSnappy configures whether compression is disabled for the ancient-tables. // chainFreezerNoSnappy configures whether compression is disabled for the ancient-tables.
// Hashes and difficulties don't compress well. // Hashes and difficulties don't compress well.
var chainFreezerNoSnappy = map[string]bool{ var chainFreezerNoSnappy = map[string]bool{
ChainFreezerHeaderTable: false, ChainFreezerHeaderTable: false,
ChainFreezerHashTable: true, ChainFreezerHashTable: true,
ChainFreezerBodiesTable: false, ChainFreezerBodiesTable: false,
ChainFreezerReceiptTable: false, ChainFreezerReceiptTable: false,
ChainFreezerDifficultyTable: true,
} }
const ( const (

View file

@ -328,14 +328,6 @@ func (f *chainFreezer) freezeRange(nfdb *nofreezedb, number, limit uint64) (hash
if err := op.AppendRaw(ChainFreezerReceiptTable, number, receipts); err != nil { if err := op.AppendRaw(ChainFreezerReceiptTable, number, receipts); err != nil {
return fmt.Errorf("can't write receipts to Freezer: %v", err) return fmt.Errorf("can't write receipts to Freezer: %v", err)
} }
// TODO (rjl493456442) TD has been deprecated and write garbage data for
// backward compatibility. See https://github.com/ethereum/go-ethereum/pull/30744/.
//
// The TD freezer table is retained for backward compatibility within this
// major version (1.14.x) and will be discarded in the next major version.
if err := op.Append(ChainFreezerDifficultyTable, number, common.Big0); err != nil {
return fmt.Errorf("can't write td to Freezer: %v", err)
}
hashes = append(hashes, hash) hashes = append(hashes, hash)
} }
return nil return nil