fix merge conflict

feature/dev-engine_test
static 1 year ago
commit 801716261d
  1. 14
      core/preimages.go
  2. 6
      core/state_processor.go
  3. 9
      internal/params/config.go

@ -17,6 +17,7 @@ import (
"github.com/harmony-one/harmony/core/types" "github.com/harmony-one/harmony/core/types"
"github.com/harmony-one/harmony/internal/utils" "github.com/harmony-one/harmony/internal/utils"
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/syndtr/goleveldb/leveldb"
) )
// ImportPreimages is public so `main.go` can call it directly` // 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 // set this value in database, and prometheus, if needed
prev, err := rawdb.ReadPreimageImportBlock(dbReader) prev, err := rawdb.ReadPreimageImportBlock(dbReader)
if err != nil { 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 blockNumber > prev {
if rawdb.WritePreimageImportBlock(dbReader, blockNumber) != nil { if rawdb.WritePreimageImportBlock(dbReader, blockNumber) != nil {
@ -230,7 +233,7 @@ func GeneratePreimages(chain BlockChain, start, end uint64) error {
if stateAt != nil { if stateAt != nil {
if root, err := endingState.Commit(false); err != 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() { } 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()) 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 // force any pre-images in memory so far to go to disk, if they haven't already
fmt.Println("committing images") fmt.Println("committing images")
if _, err := endingState.Commit(false); err != nil { if endingState != nil {
return fmt.Errorf("unabe to commit state for block: %w", err) if _, err := endingState.Commit(false); err != nil {
return fmt.Errorf("unable to commit state for block: %w", err)
}
} }
if err := chain.CommitPreimages(); err != nil { if err := chain.CommitPreimages(); err != nil {
return fmt.Errorf("error committing preimages %s", err) return fmt.Errorf("error committing preimages %s", err)
} }

@ -574,10 +574,12 @@ func MayBalanceMigration(
} }
} }
} }
// for testing balance migration on testnet
isTestnet := nodeconfig.GetDefaultConfig().GetNetworkType() == nodeconfig.Testnet
// for testing balance migration on devnet // for testing balance migration on devnet
isDevnet := nodeconfig.GetDefaultConfig().GetNetworkType() == nodeconfig.Devnet isDevnet := nodeconfig.GetDefaultConfig().GetNetworkType() == nodeconfig.Partner
isLocalnet := nodeconfig.GetDefaultConfig().GetNetworkType() == nodeconfig.Localnet isLocalnet := nodeconfig.GetDefaultConfig().GetNetworkType() == nodeconfig.Localnet
if isDevnet || isLocalnet { if isDevnet || isLocalnet || isTestnet {
if config.IsOneEpochBeforeHIP30(header.Epoch()) { if config.IsOneEpochBeforeHIP30(header.Epoch()) {
if myShard := chain.ShardID(); myShard != shard.BeaconChainShardID { if myShard := chain.ShardID(); myShard != shard.BeaconChainShardID {
parentRoot := chain.GetBlockByHash( parentRoot := chain.GetBlockByHash(

@ -73,9 +73,9 @@ var (
LeaderRotationExternalBeaconLeaders: EpochTBD, LeaderRotationExternalBeaconLeaders: EpochTBD,
FeeCollectEpoch: big.NewInt(1535), // 2023-07-20 05:51:07+00:00 FeeCollectEpoch: big.NewInt(1535), // 2023-07-20 05:51:07+00:00
ValidatorCodeFixEpoch: 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, 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. // TestnetChainConfig contains the chain parameters to run a node on the harmony test network.
@ -117,9 +117,10 @@ var (
LeaderRotationExternalBeaconLeaders: EpochTBD, LeaderRotationExternalBeaconLeaders: EpochTBD,
FeeCollectEpoch: big.NewInt(1296), // 2023-04-28 07:14:20+00:00 FeeCollectEpoch: big.NewInt(1296), // 2023-04-28 07:14:20+00:00
ValidatorCodeFixEpoch: 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, 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. // PangaeaChainConfig contains the chain parameters for the Pangaea network.
// All features except for CrossLink are enabled at launch. // All features except for CrossLink are enabled at launch.

Loading…
Cancel
Save