diff --git a/core/preimages.go b/core/preimages.go index 8605271a7..5034cc0e9 100644 --- a/core/preimages.go +++ b/core/preimages.go @@ -17,6 +17,7 @@ import ( "github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/internal/utils" "github.com/pkg/errors" + "github.com/syndtr/goleveldb/leveldb" ) // ImportPreimages is public so `main.go` can call it directly` @@ -42,7 +43,9 @@ func ImportPreimages(chain BlockChain, path string) error { // set this value in database, and prometheus, if needed prev, err := rawdb.ReadPreimageImportBlock(dbReader) if err != nil { - return fmt.Errorf("no prior value found, overwriting: %s", err) + if !errors.Is(err, leveldb.ErrNotFound) { + return fmt.Errorf("no prior value found, overwriting: %s", err) + } } if blockNumber > prev { if rawdb.WritePreimageImportBlock(dbReader, blockNumber) != nil { @@ -230,7 +233,7 @@ func GeneratePreimages(chain BlockChain, start, end uint64) error { if stateAt != nil { if root, err := endingState.Commit(false); err != nil { - return fmt.Errorf("unabe to commit state for block '%d': %w", i, err) + return fmt.Errorf("unable to commit state for block '%d': %w", i, err) } else if root.Hex() != block.Root().Hex() { return fmt.Errorf("block root hashes different after commit commitRoot='%s' blockRoot='%s'", root.Hex(), block.Root().Hex()) } @@ -245,10 +248,11 @@ func GeneratePreimages(chain BlockChain, start, end uint64) error { } // force any pre-images in memory so far to go to disk, if they haven't already fmt.Println("committing images") - if _, err := endingState.Commit(false); err != nil { - return fmt.Errorf("unabe to commit state for block: %w", err) + if endingState != nil { + if _, err := endingState.Commit(false); err != nil { + return fmt.Errorf("unable to commit state for block: %w", err) + } } - if err := chain.CommitPreimages(); err != nil { return fmt.Errorf("error committing preimages %s", err) } diff --git a/core/state_processor.go b/core/state_processor.go index d6ac005f9..6bc808c45 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -574,10 +574,12 @@ func MayBalanceMigration( } } } + // for testing balance migration on testnet + isTestnet := nodeconfig.GetDefaultConfig().GetNetworkType() == nodeconfig.Testnet // for testing balance migration on devnet - isDevnet := nodeconfig.GetDefaultConfig().GetNetworkType() == nodeconfig.Devnet + isDevnet := nodeconfig.GetDefaultConfig().GetNetworkType() == nodeconfig.Partner isLocalnet := nodeconfig.GetDefaultConfig().GetNetworkType() == nodeconfig.Localnet - if isDevnet || isLocalnet { + if isDevnet || isLocalnet || isTestnet { if config.IsOneEpochBeforeHIP30(header.Epoch()) { if myShard := chain.ShardID(); myShard != shard.BeaconChainShardID { parentRoot := chain.GetBlockByHash( diff --git a/internal/params/config.go b/internal/params/config.go index 3257e82d5..7775e13a8 100644 --- a/internal/params/config.go +++ b/internal/params/config.go @@ -73,9 +73,9 @@ var ( LeaderRotationExternalBeaconLeaders: EpochTBD, FeeCollectEpoch: big.NewInt(1535), // 2023-07-20 05:51:07+00:00 ValidatorCodeFixEpoch: big.NewInt(1535), // 2023-07-20 05:51:07+00:00 - HIP30Epoch: EpochTBD, + HIP30Epoch: big.NewInt(1673), // 2023-11-02 17:30:00+00:00 NoNilDelegationsEpoch: EpochTBD, - BlockGas30MEpoch: EpochTBD, + BlockGas30MEpoch: big.NewInt(1673), // 2023-11-02 17:30:00+00:00 } // TestnetChainConfig contains the chain parameters to run a node on the harmony test network. @@ -117,9 +117,10 @@ var ( LeaderRotationExternalBeaconLeaders: EpochTBD, FeeCollectEpoch: big.NewInt(1296), // 2023-04-28 07:14:20+00:00 ValidatorCodeFixEpoch: big.NewInt(1296), // 2023-04-28 07:14:20+00:00 - HIP30Epoch: EpochTBD, + HIP30Epoch: big.NewInt(2176), // 2023-10-12 10:00:00+00:00 NoNilDelegationsEpoch: EpochTBD, - BlockGas30MEpoch: EpochTBD, + BlockGas30MEpoch: big.NewInt(2176), // 2023-10-12 10:00:00+00:00 + } // PangaeaChainConfig contains the chain parameters for the Pangaea network. // All features except for CrossLink are enabled at launch.