diff --git a/.deployment/dockernet/nodes/node1/posichain.conf b/.deployment/dockernet/nodes/node1/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node1/posichain.conf +++ b/.deployment/dockernet/nodes/node1/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node10/posichain.conf b/.deployment/dockernet/nodes/node10/posichain.conf index 71d6aff56..c9040f3aa 100644 --- a/.deployment/dockernet/nodes/node10/posichain.conf +++ b/.deployment/dockernet/nodes/node10/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -63,6 +62,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 DisablePrivateIPScan = false diff --git a/.deployment/dockernet/nodes/node11/posichain.conf b/.deployment/dockernet/nodes/node11/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node11/posichain.conf +++ b/.deployment/dockernet/nodes/node11/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node12/posichain.conf b/.deployment/dockernet/nodes/node12/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node12/posichain.conf +++ b/.deployment/dockernet/nodes/node12/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node13/posichain.conf b/.deployment/dockernet/nodes/node13/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node13/posichain.conf +++ b/.deployment/dockernet/nodes/node13/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node2/posichain.conf b/.deployment/dockernet/nodes/node2/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node2/posichain.conf +++ b/.deployment/dockernet/nodes/node2/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node3/posichain.conf b/.deployment/dockernet/nodes/node3/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node3/posichain.conf +++ b/.deployment/dockernet/nodes/node3/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node4/posichain.conf b/.deployment/dockernet/nodes/node4/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node4/posichain.conf +++ b/.deployment/dockernet/nodes/node4/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node5/posichain.conf b/.deployment/dockernet/nodes/node5/posichain.conf index 71ec2c510..d108362da 100644 --- a/.deployment/dockernet/nodes/node5/posichain.conf +++ b/.deployment/dockernet/nodes/node5/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -33,6 +32,7 @@ Version = "2.5.4" IsOffline = false NoStaking = false NodeType = "explorer" + RunElasticMode = false ShardID = 0 TraceEnable = false @@ -66,6 +66,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] @@ -104,11 +105,12 @@ Version = "2.5.4" MinPeers = 2 [TxPool] - BlacklistFile = "./.psc/blacklist.txt" AccountSlots = 16 - LocalAccountsFile = "./.psc/locals.txt" - RosettaFixFile = "" + AllowedTxsFile = "./.hmy/allowedtxs.txt" + BlacklistFile = "./.hmy/blacklist.txt" GlobalSlots = 5120 + LocalAccountsFile = "./.hmy/locals.txt" + RosettaFixFile = "" [WS] AuthPort = 9801 diff --git a/.deployment/dockernet/nodes/node6/posichain.conf b/.deployment/dockernet/nodes/node6/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node6/posichain.conf +++ b/.deployment/dockernet/nodes/node6/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node7/posichain.conf b/.deployment/dockernet/nodes/node7/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node7/posichain.conf +++ b/.deployment/dockernet/nodes/node7/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node8/posichain.conf b/.deployment/dockernet/nodes/node8/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node8/posichain.conf +++ b/.deployment/dockernet/nodes/node8/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/.deployment/dockernet/nodes/node9/posichain.conf b/.deployment/dockernet/nodes/node9/posichain.conf index f3b55cec1..576655e0d 100644 --- a/.deployment/dockernet/nodes/node9/posichain.conf +++ b/.deployment/dockernet/nodes/node9/posichain.conf @@ -1,4 +1,4 @@ -Version = "2.5.4" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.4" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 @@ -62,6 +61,7 @@ Version = "2.5.4" IP = "0.0.0.0" KeyFile = "./.psckey" MaxConnsPerIP = 10 + MaxPeers = 0 Port = 9000 [Pprof] diff --git a/cmd/posichain/config.go b/cmd/posichain/config.go index d4ee62d25..c5d9e1908 100644 --- a/cmd/posichain/config.go +++ b/cmd/posichain/config.go @@ -81,10 +81,9 @@ func getDefaultDNSSyncConfig(nt nodeconfig.NetworkType) harmonyconfig.DnsSync { zone := nodeconfig.GetDefaultDNSZone(nt) port := nodeconfig.GetDefaultDNSPort(nt) dnsSync := harmonyconfig.DnsSync{ - Port: port, - Zone: zone, - LegacySyncing: false, - ServerPort: nodeconfig.DefaultDNSPort, + Port: port, + Zone: zone, + ServerPort: nodeconfig.DefaultDNSPort, } switch nt { case nodeconfig.Mainnet: diff --git a/cmd/posichain/config_migrations.go b/cmd/posichain/config_migrations.go index 2f5560ce2..d5be28400 100644 --- a/cmd/posichain/config_migrations.go +++ b/cmd/posichain/config_migrations.go @@ -288,6 +288,12 @@ func init() { confTree.Set("Version", "2.5.7") return confTree } + migrations["2.5.7"] = func(confTree *toml.Tree) *toml.Tree { + confTree.Delete("DNSSync.LegacySyncing") + + confTree.Set("Version", "2.5.8") + return confTree + } // check that the latest version here is the same as in default.go largestKey := getNextVersion(migrations) diff --git a/cmd/posichain/default.go b/cmd/posichain/default.go index ef348d10d..4b7944321 100644 --- a/cmd/posichain/default.go +++ b/cmd/posichain/default.go @@ -5,7 +5,7 @@ import ( nodeconfig "github.com/PositionExchange/posichain/internal/configs/node" ) -const tomlConfigVersion = "2.5.7" +const tomlConfigVersion = "2.5.8" const ( defNetworkType = nodeconfig.Mainnet diff --git a/cmd/posichain/flags.go b/cmd/posichain/flags.go index 8a25058b8..cdcabee60 100644 --- a/cmd/posichain/flags.go +++ b/cmd/posichain/flags.go @@ -498,10 +498,6 @@ func applyDNSSyncFlags(cmd *cobra.Command, cfg *harmonyconfig.HarmonyConfig) { } else if cli.IsFlagChanged(cmd, legacyDNSZoneFlag) { cfg.DNSSync.Zone = cli.GetStringFlagValue(cmd, legacyDNSZoneFlag) } else if cli.IsFlagChanged(cmd, legacyDNSFlag) { - val := cli.GetBoolFlagValue(cmd, legacyDNSFlag) - if !val { - cfg.DNSSync.LegacySyncing = true - } } if cli.IsFlagChanged(cmd, dnsPortFlag) { diff --git a/cmd/posichain/main.go b/cmd/posichain/main.go index 23a107987..56bb55e07 100644 --- a/cmd/posichain/main.go +++ b/cmd/posichain/main.go @@ -99,6 +99,7 @@ var configFlag = cli.StringFlag{ func init() { rand.Seed(time.Now().UnixNano()) cli.SetParseErrorHandle(func(err error) { + fmt.Fprint(os.Stderr, errors.WithMessage(err, "cli parse error")) os.Exit(128) // 128 - invalid command line arguments }) configCmd.AddCommand(dumpConfigCmd) @@ -136,12 +137,12 @@ func runPosichainNode(cmd *cobra.Command, args []string) { } if err := prepareRootCmd(cmd); err != nil { - fmt.Fprint(os.Stderr, err) + fmt.Fprint(os.Stderr, errors.WithMessage(err, "prepare root cmd error")) os.Exit(128) } cfg, err := getHarmonyConfig(cmd) if err != nil { - fmt.Fprint(os.Stderr, err) + fmt.Fprint(os.Stderr, errors.WithMessage(err, "get config error")) os.Exit(128) } @@ -687,7 +688,18 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi } } - blockchain, err := collection.ShardChain(nodeConfig.ShardID) + var blockchain core.BlockChain + + // We are not beacon chain, make sure beacon already initialized. + if nodeConfig.ShardID != shard.BeaconChainShardID { + _, err = collection.ShardChain(shard.BeaconChainShardID) + if err != nil { + _, _ = fmt.Fprintf(os.Stderr, "Error :%v \n", err) + os.Exit(1) + } + } + + blockchain, err = collection.ShardChain(nodeConfig.ShardID) if err != nil { _, _ = fmt.Fprintf(os.Stderr, "Error :%v \n", err) os.Exit(1) @@ -721,8 +733,6 @@ func setupConsensusAndNode(hc harmonyconfig.HarmonyConfig, nodeConfig *nodeconfi selfPort := hc.P2P.Port currentNode.SyncingPeerProvider = node.NewLocalSyncingPeerProvider( 6000, uint16(selfPort), epochConfig.NumShards(), uint32(epochConfig.NumNodesPerShard())) - } else if hc.DNSSync.LegacySyncing { - currentNode.SyncingPeerProvider = node.NewLegacySyncingPeerProvider(currentNode) } else { currentNode.SyncingPeerProvider = node.NewDNSSyncingPeerProvider(hc.DNSSync.Zone, strconv.Itoa(hc.DNSSync.Port)) } diff --git a/consensus/engine/consensus_engine.go b/consensus/engine/consensus_engine.go index 1bd693dc6..89e95a94e 100644 --- a/consensus/engine/consensus_engine.go +++ b/consensus/engine/consensus_engine.go @@ -108,12 +108,6 @@ type Engine interface { // VerifyVRF verifies the vrf of the block VerifyVRF(chain ChainReader, header *block.Header) error - // Beaconchain provides the handle for Beaconchain - Beaconchain() ChainReader - - // SetBeaconchain sets the beaconchain handler on engine - SetBeaconchain(ChainReader) - // Finalize runs any post-transaction state modifications (e.g. block rewards) // and assembles the final block. // Note: The block header and state database might be updated to reflect any @@ -121,7 +115,9 @@ type Engine interface { // sigsReady signal indicates whether the commit sigs are populated in the header object. // Finalize() will block on sigsReady signal until the first value is send to the channel. Finalize( - chain ChainReader, header *block.Header, + chain ChainReader, + beacon ChainReader, + header *block.Header, state *state.DB, txs []*types.Transaction, receipts []*types.Receipt, outcxs []*types.CXReceipt, incxs []*types.CXReceiptsProof, stks staking.StakingTransactions, diff --git a/core/blockchain_impl.go b/core/blockchain_impl.go index 5a96d9aff..baa3e6ca7 100644 --- a/core/blockchain_impl.go +++ b/core/blockchain_impl.go @@ -200,24 +200,25 @@ type BlockChainImpl struct { // NewBlockChainWithOptions same as NewBlockChain but can accept additional behaviour options. func NewBlockChainWithOptions( - db ethdb.Database, stateCache state.Database, cacheConfig *CacheConfig, chainConfig *params.ChainConfig, + db ethdb.Database, stateCache state.Database, beaconChain BlockChain, cacheConfig *CacheConfig, chainConfig *params.ChainConfig, engine consensus_engine.Engine, vmConfig vm.Config, options Options, ) (*BlockChainImpl, error) { - return newBlockChainWithOptions(db, stateCache, cacheConfig, chainConfig, engine, vmConfig, options) + return newBlockChainWithOptions(db, stateCache, beaconChain, cacheConfig, chainConfig, engine, vmConfig, options) } // NewBlockChain returns a fully initialised block chain using information // available in the database. It initialises the default Ethereum validator and // Processor. func NewBlockChain( - db ethdb.Database, stateCache state.Database, cacheConfig *CacheConfig, chainConfig *params.ChainConfig, + db ethdb.Database, stateCache state.Database, beaconChain BlockChain, cacheConfig *CacheConfig, chainConfig *params.ChainConfig, engine consensus_engine.Engine, vmConfig vm.Config, ) (*BlockChainImpl, error) { - return newBlockChainWithOptions(db, stateCache, cacheConfig, chainConfig, engine, vmConfig, Options{}) + return newBlockChainWithOptions(db, stateCache, beaconChain, cacheConfig, chainConfig, engine, vmConfig, Options{}) } func newBlockChainWithOptions( - db ethdb.Database, stateCache state.Database, cacheConfig *CacheConfig, chainConfig *params.ChainConfig, + db ethdb.Database, stateCache state.Database, beaconChain BlockChain, + cacheConfig *CacheConfig, chainConfig *params.ChainConfig, engine consensus_engine.Engine, vmConfig vm.Config, options Options) (*BlockChainImpl, error) { if cacheConfig == nil { cacheConfig = &CacheConfig{ @@ -272,8 +273,6 @@ func newBlockChainWithOptions( maxGarbCollectedBlkNum: -1, options: options, } - bc.SetValidator(NewBlockValidator(chainConfig, bc, engine)) - bc.SetProcessor(NewStateProcessor(chainConfig, bc, engine)) var err error bc.hc, err = NewHeaderChain(db, chainConfig, engine, bc.getProcInterrupt) @@ -291,6 +290,13 @@ func newBlockChainWithOptions( return nil, err } bc.shardID = bc.CurrentBlock().ShardID() + if beaconChain == nil && bc.shardID == shard.BeaconChainShardID { + beaconChain = bc + } + + bc.SetValidator(NewBlockValidator(chainConfig, bc, engine)) + bc.SetProcessor(NewStateProcessor(chainConfig, bc, beaconChain, engine)) + // Take ownership of this particular state go bc.update() return bc, nil diff --git a/core/evm_test.go b/core/evm_test.go index 3c03d2873..805e67645 100644 --- a/core/evm_test.go +++ b/core/evm_test.go @@ -46,7 +46,7 @@ func getTestEnvironment(testBankKey ecdsa.PrivateKey) (*BlockChainImpl, *state.D genesis := gspec.MustCommit(database) // fake blockchain - chain, _ := NewBlockChain(database, state.NewDatabase(database), nil, gspec.Config, engine, vm.Config{}) + chain, _ := NewBlockChain(database, state.NewDatabase(database), nil, nil, gspec.Config, engine, vm.Config{}) db, _ := chain.StateAt(genesis.Root()) // make a fake block header (use epoch 1 so that locked tokens can be tested) diff --git a/core/state_processor.go b/core/state_processor.go index 446db1514..525b5dc86 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -49,7 +49,8 @@ const ( // StateProcessor implements Processor. type StateProcessor struct { config *params.ChainConfig // Chain configuration options - bc BlockChain // Canonical block chain + bc BlockChain // Canonical blockchain + beacon BlockChain // Beacon chain engine consensus_engine.Engine // Consensus engine used for block rewards resultCache *lru.Cache // Cache for result after a certain block is processed } @@ -67,12 +68,19 @@ type ProcessorResult struct { // NewStateProcessor initialises a new StateProcessor. func NewStateProcessor( - config *params.ChainConfig, bc BlockChain, engine consensus_engine.Engine, + config *params.ChainConfig, bc BlockChain, beacon BlockChain, engine consensus_engine.Engine, ) *StateProcessor { + if bc == nil { + panic("bc is nil") + } + if beacon == nil { + panic("beacon is nil") + } resultCache, _ := lru.New(resultCacheLimit) return &StateProcessor{ config: config, bc: bc, + beacon: beacon, engine: engine, resultCache: resultCache, } @@ -182,7 +190,9 @@ func (p *StateProcessor) Process( sigsReady <- true }() _, payout, err := p.engine.Finalize( - p.bc, header, statedb, block.Transactions(), + p.bc, + p.beacon, + header, statedb, block.Transactions(), receipts, outcxs, incxs, block.StakingTransactions(), slashes, sigsReady, func() uint64 { return header.ViewID().Uint64() }, ) if err != nil { diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index ac30fce69..f26dfe408 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -160,7 +160,7 @@ func createBlockChain() *BlockChainImpl { genesis := gspec.MustCommit(database) _ = genesis engine := chain2.NewEngine() - blockchain, _ := NewBlockChain(database, state.NewDatabase(database), nil, gspec.Config, engine, vm.Config{}) + blockchain, _ := NewBlockChain(database, state.NewDatabase(database), nil, nil, gspec.Config, engine, vm.Config{}) return blockchain } diff --git a/go.mod b/go.mod index b34420d05..7c6c1710a 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( github.com/VictoriaMetrics/fastcache v1.5.7 github.com/Workiva/go-datastructures v1.0.50 github.com/allegro/bigcache v1.2.1 - github.com/aws/aws-sdk-go v1.30.1 + github.com/aws/aws-sdk-go v1.33.0 github.com/beevik/ntp v0.3.0 github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce github.com/cespare/cp v1.1.1 @@ -51,7 +51,7 @@ require ( github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.6.1 github.com/stretchr/testify v1.7.0 - github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca + github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/tikv/client-go/v2 v2.0.1 github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee go.uber.org/ratelimit v0.1.0 @@ -106,7 +106,7 @@ require ( github.com/gobwas/glob v0.2.3 // indirect github.com/gofrs/flock v0.0.0-20190320160742-5135e617513b // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang/snappy v0.0.2-0.20190904063534-ff6b7dc882cf // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 // indirect github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a // indirect github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 // indirect diff --git a/go.sum b/go.sum index 51416ebb4..22d40e91f 100644 --- a/go.sum +++ b/go.sum @@ -75,8 +75,8 @@ github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.30.1 h1:cUMxtoFvIHhScZgv17tGxw15r6rVKJHR1hsIFRx9hcA= -github.com/aws/aws-sdk-go v1.30.1/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= +github.com/aws/aws-sdk-go v1.33.0 h1:Bq5Y6VTLbfnJp1IV8EL/qUU5qO1DYHda/zis/sqevkY= +github.com/aws/aws-sdk-go v1.33.0/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= github.com/beevik/ntp v0.3.0 h1:xzVrPrE4ziasFXgBVBZJDP0Wg/KpMwk2KHJ4Ba8GrDw= github.com/beevik/ntp v0.3.0/go.mod h1:hIHWr+l3+/clUnF44zdK+CWW7fO8dR5cIylAQ76NRpg= @@ -330,8 +330,9 @@ github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.2-0.20190904063534-ff6b7dc882cf h1:gFVkHXmVAhEbxZVDln5V9GKrLaluNoFHDbrZwAWZgws= github.com/golang/snappy v0.0.2-0.20190904063534-ff6b7dc882cf/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5DB4XJkc6BU31uODLD1o1gKvZmD0= github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= @@ -1230,8 +1231,8 @@ github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/goleveldb v1.0.0/go.mod h1:ZVVdQEZoIme9iO1Ch2Jdy24qqXrMMOU6lpPAyBWyWuQ= github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d/go.mod h1:9OrXJhf154huy1nPWmuSrkgjPUtUNhA+Zmy+6AESzuA= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca h1:Ld/zXl5t4+D69SiV4JoN7kkfvJdOWlPpfxrzxpLMoUk= -github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca/go.mod h1:u2MKkTVTVJWe5D1rCvame8WqhBd88EuIwODJZ1VHCPM= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= +github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tarm/serial v0.0.0-20180830185346-98f6abe2eb07/go.mod h1:kDXzergiv9cbyO7IOYJZWg1U88JhDg3PB6klq9Hg2pA= github.com/tidwall/gjson v1.6.7/go.mod h1:zeFuBCIqD4sN/gmqBzZ4j7Jd6UcA2Fc56x7QFsv+8fI= github.com/tidwall/match v1.0.3/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= diff --git a/hmy/downloader/adapter_test.go b/hmy/downloader/adapter_test.go index 407372226..3b163948f 100644 --- a/hmy/downloader/adapter_test.go +++ b/hmy/downloader/adapter_test.go @@ -147,7 +147,7 @@ func (e *dummyEngine) VerifyShardState(engine.ChainReader, engine.ChainReader, * func (e *dummyEngine) Beaconchain() engine.ChainReader { return nil } func (e *dummyEngine) SetBeaconchain(engine.ChainReader) {} func (e *dummyEngine) Finalize( - chain engine.ChainReader, header *block.Header, + chain engine.ChainReader, beacon engine.ChainReader, header *block.Header, state *state.DB, txs []*types.Transaction, receipts []*types.Receipt, outcxs []*types.CXReceipt, incxs []*types.CXReceiptsProof, stks staking.StakingTransactions, diff --git a/internal/chain/engine.go b/internal/chain/engine.go index 9e35d32c8..b7eb962fc 100644 --- a/internal/chain/engine.go +++ b/internal/chain/engine.go @@ -40,8 +40,6 @@ const ( ) type engineImpl struct { - beacon engine.ChainReader - // Caching field epochCtxCache *lru.Cache // epochCtxKey -> epochCtx verifiedSigCache *lru.Cache // verifiedSigKey -> struct{}{} @@ -52,21 +50,11 @@ func NewEngine() *engineImpl { sigCache, _ := lru.New(verifiedSigCache) epochCtxCache, _ := lru.New(epochCtxCache) return &engineImpl{ - beacon: nil, epochCtxCache: epochCtxCache, verifiedSigCache: sigCache, } } -func (e *engineImpl) Beaconchain() engine.ChainReader { - return e.beacon -} - -// SetBeaconchain assigns the beaconchain handle used -func (e *engineImpl) SetBeaconchain(beaconchain engine.ChainReader) { - e.beacon = beaconchain -} - // VerifyHeader checks whether a header conforms to the consensus rules of the bft engine. // Note that each block header contains the bls signature of the parent block func (e *engineImpl) VerifyHeader(chain engine.ChainReader, header *block.Header, seal bool) error { @@ -274,7 +262,7 @@ func (e *engineImpl) VerifySeal(chain engine.ChainReader, header *block.Header) // setting the final state and assembling the block. // sigsReady signal indicates whether the commit sigs are populated in the header object. func (e *engineImpl) Finalize( - chain engine.ChainReader, header *block.Header, + chain engine.ChainReader, beacon engine.ChainReader, header *block.Header, state *state.DB, txs []*types.Transaction, receipts []*types.Receipt, outcxs []*types.CXReceipt, incxs []*types.CXReceiptsProof, stks staking.StakingTransactions, @@ -324,7 +312,7 @@ func (e *engineImpl) Finalize( // Accumulate block rewards and commit the final state root // Header seems complete, assemble into a block and return payout, err := AccumulateRewardsAndCountSigs( - chain, state, header, e.Beaconchain(), sigsReady, + chain, state, header, beacon, sigsReady, ) if err != nil { return nil, nil, err diff --git a/internal/configs/harmony/harmony.go b/internal/configs/harmony/harmony.go index 165387306..4d6e4ea12 100644 --- a/internal/configs/harmony/harmony.go +++ b/internal/configs/harmony/harmony.go @@ -33,12 +33,11 @@ type HarmonyConfig struct { } type DnsSync struct { - Port int // replaces: Network.DNSSyncPort - Zone string // replaces: Network.DNSZone - LegacySyncing bool // replaces: Network.LegacySyncing - Client bool // replaces: Sync.LegacyClient - Server bool // replaces: Sync.LegacyServer - ServerPort int + Port int // replaces: Network.DNSSyncPort + Zone string // replaces: Network.DNSZone + Client bool // replaces: Sync.LegacyClient + Server bool // replaces: Sync.LegacyServer + ServerPort int } type NetworkConfig struct { diff --git a/internal/shardchain/shardchains.go b/internal/shardchain/shardchains.go index 1311c2d91..867854f68 100644 --- a/internal/shardchain/shardchains.go +++ b/internal/shardchain/shardchains.go @@ -123,10 +123,20 @@ func (sc *CollectionImpl) ShardChain(shardID uint32, options ...core.Options) (c if err != nil { return nil, err } - - bc, err = core.NewBlockChainWithOptions( - db, stateCache, cacheConfig, &chainConfig, sc.engine, vm.Config{}, opts, - ) + if shardID == shard.BeaconChainShardID { + bc, err = core.NewBlockChainWithOptions( + db, stateCache, bc, cacheConfig, &chainConfig, sc.engine, vm.Config{}, opts, + ) + } else { + beacon, ok := sc.pool[shard.BeaconChainShardID] + if !ok { + return nil, errors.New("beacon chain is not initialized") + } + + bc, err = core.NewBlockChainWithOptions( + db, stateCache, beacon, cacheConfig, &chainConfig, sc.engine, vm.Config{}, opts, + ) + } } if err != nil { diff --git a/node/node.go b/node/node.go index 0e1ccc303..a73d9726c 100644 --- a/node/node.go +++ b/node/node.go @@ -90,13 +90,9 @@ type Node struct { pendingCXMutex sync.Mutex crosslinks *crosslinks.Crosslinks // Memory storage for crosslink processing. // Shard databases - shardChains shardchain.Collection - SelfPeer p2p.Peer - // TODO: Neighbors should store only neighbor nodes in the same shard - Neighbors sync.Map // All the neighbor nodes, key is the sha256 of Peer IP/Port, value is the p2p.Peer - stateMutex sync.Mutex // mutex for change node state - // BeaconNeighbors store only neighbor nodes in the beacon chain shard - BeaconNeighbors sync.Map // All the neighbor nodes, key is the sha256 of Peer IP/Port, value is the p2p.Peer + shardChains shardchain.Collection + SelfPeer p2p.Peer + stateMutex sync.Mutex // mutex for change node state TxPool *core.TxPool CxPool *core.CxPool // pool for missing cross shard receipts resend Worker *worker.Worker @@ -1078,7 +1074,7 @@ func New( node.TxPool = core.NewTxPool(txPoolConfig, node.Blockchain().Config(), blockchain, node.TransactionErrorSink) node.CxPool = core.NewCxPool(core.CxPoolSize) - node.Worker = worker.New(node.Blockchain().Config(), blockchain, engine) + node.Worker = worker.New(node.Blockchain().Config(), blockchain, beaconChain, engine) node.deciderCache, _ = lru.New(16) node.committeeCache, _ = lru.New(16) @@ -1086,7 +1082,6 @@ func New( node.pendingCXReceipts = map[string]*types.CXReceiptsProof{} node.proposedBlock = map[uint64]*types.Block{} node.Consensus.VerifiedNewBlock = make(chan *types.Block, 1) - engine.SetBeaconchain(beaconChain) // the sequence number is the next block number to be added in consensus protocol, which is // always one more than current chain header block node.Consensus.SetBlockNum(blockchain.CurrentBlock().NumberU64() + 1) @@ -1221,30 +1216,6 @@ func (node *Node) InitConsensusWithValidators() (err error) { return nil } -// AddPeers adds neighbors nodes -func (node *Node) AddPeers(peers []*p2p.Peer) int { - for _, p := range peers { - key := fmt.Sprintf("%s:%s:%s", p.IP, p.Port, p.PeerID) - _, ok := node.Neighbors.LoadOrStore(key, *p) - if !ok { - // !ok means new peer is stored - node.host.AddPeer(p) - continue - } - } - - return node.host.GetPeerCount() -} - -// AddBeaconPeer adds beacon chain neighbors nodes -// Return false means new neighbor peer was added -// Return true means redundant neighbor peer wasn't added -func (node *Node) AddBeaconPeer(p *p2p.Peer) bool { - key := fmt.Sprintf("%s:%s:%s", p.IP, p.Port, p.PeerID) - _, ok := node.BeaconNeighbors.LoadOrStore(key, *p) - return ok -} - func (node *Node) initNodeConfiguration() (service.NodeConfig, chan p2p.Peer, error) { chanPeer := make(chan p2p.Peer) nodeConfig := service.NodeConfig{ diff --git a/node/node_syncing.go b/node/node_syncing.go index 51b6d62b4..356287f0c 100644 --- a/node/node_syncing.go +++ b/node/node_syncing.go @@ -115,36 +115,6 @@ type SyncingPeerProvider interface { SyncingPeers(shardID uint32) (peers []p2p.Peer, err error) } -// LegacySyncingPeerProvider uses neighbor lists stored in a Node to serve -// syncing peer list query. -type LegacySyncingPeerProvider struct { - node *Node - shardID func() uint32 -} - -// NewLegacySyncingPeerProvider creates and returns a new node-based syncing -// peer provider. -func NewLegacySyncingPeerProvider(node *Node) *LegacySyncingPeerProvider { - var shardID func() uint32 - if node.shardChains != nil { - shardID = node.Blockchain().ShardID - } - return &LegacySyncingPeerProvider{node: node, shardID: shardID} -} - -// SyncingPeers returns peers stored in neighbor maps in the node structure. -func (p *LegacySyncingPeerProvider) SyncingPeers(shardID uint32) (peers []p2p.Peer, err error) { - switch shardID { - case p.shardID(): - peers = getNeighborPeers(&p.node.Neighbors) - case 0: - peers = getNeighborPeers(&p.node.BeaconNeighbors) - default: - return nil, errors.Errorf("unsupported shard ID %v", shardID) - } - return peers, nil -} - // DNSSyncingPeerProvider uses the given DNS zone to resolve syncing peers. type DNSSyncingPeerProvider struct { zone, port string diff --git a/node/node_test.go b/node/node_test.go index b2a4ba394..2a38380ca 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -2,7 +2,6 @@ package node import ( "errors" - "sync" "testing" "github.com/PositionExchange/posichain/consensus" @@ -61,59 +60,6 @@ func TestNewNode(t *testing.T) { } } -func TestLegacySyncingPeerProvider(t *testing.T) { - t.Run("ShardChain", func(t *testing.T) { - p := makeLegacySyncingPeerProvider() - expectedPeers := []p2p.Peer{ - {IP: "127.0.0.1", Port: "6001"}, - {IP: "127.0.0.1", Port: "6003"}, - } - actualPeers, err := p.SyncingPeers(1) - if assert.NoError(t, err) { - assert.ElementsMatch(t, actualPeers, expectedPeers) - } - }) - t.Run("BeaconChain", func(t *testing.T) { - p := makeLegacySyncingPeerProvider() - expectedPeers := []p2p.Peer{ - {IP: "127.0.0.1", Port: "6000"}, - {IP: "127.0.0.1", Port: "6002"}, - } - actualPeers, err := p.SyncingPeers(0) - if assert.NoError(t, err) { - assert.ElementsMatch(t, actualPeers, expectedPeers) - } - }) - t.Run("NoMatch", func(t *testing.T) { - p := makeLegacySyncingPeerProvider() - _, err := p.SyncingPeers(999) - assert.Error(t, err) - }) -} - -func makeLegacySyncingPeerProvider() *LegacySyncingPeerProvider { - node := makeSyncOnlyNode() - p := NewLegacySyncingPeerProvider(node) - p.shardID = func() uint32 { return 1 } - return p -} - -func makeSyncOnlyNode() *Node { - node := &Node{ - Neighbors: sync.Map{}, - BeaconNeighbors: sync.Map{}, - } - node.Neighbors.Store( - "127.0.0.1:9001:omg", p2p.Peer{IP: "127.0.0.1", Port: "9001"}) - node.Neighbors.Store( - "127.0.0.1:9003:wtf", p2p.Peer{IP: "127.0.0.1", Port: "9003"}) - node.BeaconNeighbors.Store( - "127.0.0.1:9000:bbq", p2p.Peer{IP: "127.0.0.1", Port: "9000"}) - node.BeaconNeighbors.Store( - "127.0.0.1:9002:cakes", p2p.Peer{IP: "127.0.0.1", Port: "9002"}) - return node -} - func TestDNSSyncingPeerProvider(t *testing.T) { t.Run("Happy", func(t *testing.T) { p := NewDNSSyncingPeerProvider("example.com", "1234") @@ -181,67 +127,3 @@ func TestLocalSyncingPeerProvider(t *testing.T) { func makeLocalSyncingPeerProvider() *LocalSyncingPeerProvider { return NewLocalSyncingPeerProvider(6000, 6001, 2, 3) } - -func TestAddBeaconPeer(t *testing.T) { - pubKey1 := bls.RandPrivateKey().GetPublicKey() - pubKey2 := bls.RandPrivateKey().GetPublicKey() - - peers1 := []*p2p.Peer{ - { - IP: "127.0.0.1", - Port: "8888", - ConsensusPubKey: pubKey1, - PeerID: "1234", - }, - { - IP: "127.0.0.1", - Port: "9999", - ConsensusPubKey: pubKey2, - PeerID: "4567", - }, - } - blsKey := bls.RandPrivateKey() - pubKey := blsKey.GetPublicKey() - leader := p2p.Peer{IP: "127.0.0.1", Port: "8982", ConsensusPubKey: pubKey} - priKey, _, _ := utils.GenKeyP2P("127.0.0.1", "9902") - host, err := p2p.NewHost(p2p.HostConfig{ - Self: &leader, - BLSKey: priKey, - }) - if err != nil { - t.Fatalf("newhost failure: %v", err) - } - engine := chain.NewEngine() - chainconfig := nodeconfig.GetShardConfig(shard.BeaconChainShardID).GetNetworkType().ChainConfig() - collection := shardchain.NewCollection( - nil, testDBFactory, &core.GenesisInitializer{NetworkType: nodeconfig.GetShardConfig(shard.BeaconChainShardID).GetNetworkType()}, engine, &chainconfig, - ) - blockchain, err := collection.ShardChain(shard.BeaconChainShardID) - if err != nil { - t.Fatalf("Cannot craeate consensus: %v", err) - } - decider := quorum.NewDecider( - quorum.SuperMajorityVote, shard.BeaconChainShardID, - ) - - consensus, err := consensus.New( - host, shard.BeaconChainShardID, multibls.GetPrivateKeys(blsKey), blockchain, decider, 3, false, - ) - - archiveMode := make(map[uint32]bool) - archiveMode[0] = true - archiveMode[1] = false - node := New(host, consensus, engine, collection, nil, nil, nil, archiveMode, nil) - for _, p := range peers1 { - ret := node.AddBeaconPeer(p) - if ret { - t.Errorf("AddBeaconPeer Failed, expecting false, got %v, peer %v", ret, p) - } - } - for _, p := range peers1 { - ret := node.AddBeaconPeer(p) - if !ret { - t.Errorf("AddBeaconPeer Failed, expecting true, got %v, peer %v", ret, p) - } - } -} diff --git a/node/worker/worker.go b/node/worker/worker.go index 23ac850cf..eaee4eb5c 100644 --- a/node/worker/worker.go +++ b/node/worker/worker.go @@ -56,6 +56,7 @@ type Worker struct { config *params.ChainConfig factory blockfactory.Factory chain core.BlockChain + beacon core.BlockChain current *environment // An environment for current running cycle. engine consensus_engine.Engine gasFloor uint64 @@ -552,7 +553,9 @@ func (w *Worker) FinalizeNewBlock( }() block, payout, err := w.engine.Finalize( - w.chain, copyHeader, state, w.current.txs, w.current.receipts, + w.chain, + w.beacon, + copyHeader, state, w.current.txs, w.current.receipts, w.current.outcxs, w.current.incxs, w.current.stakingTxs, w.current.slashes, sigsReady, viewID, ) @@ -565,12 +568,13 @@ func (w *Worker) FinalizeNewBlock( // New create a new worker object. func New( - config *params.ChainConfig, chain core.BlockChain, engine consensus_engine.Engine, + config *params.ChainConfig, chain core.BlockChain, beacon core.BlockChain, engine consensus_engine.Engine, ) *Worker { worker := &Worker{ config: config, factory: blockfactory.NewFactory(config), chain: chain, + beacon: beacon, engine: engine, } worker.gasFloor = 80000000 diff --git a/node/worker/worker_test.go b/node/worker/worker_test.go index c7d446607..3d1f0fed8 100644 --- a/node/worker/worker_test.go +++ b/node/worker/worker_test.go @@ -45,13 +45,13 @@ func TestNewWorker(t *testing.T) { genesis := gspec.MustCommit(database) _ = genesis - chain, err := core.NewBlockChain(database, state.NewDatabase(database), nil, gspec.Config, engine, vm.Config{}) + chain, err := core.NewBlockChain(database, state.NewDatabase(database), &core.BlockChainImpl{}, nil, gspec.Config, engine, vm.Config{}) if err != nil { t.Error(err) } // Create a new worker - worker := New(params.TestChainConfig, chain, engine) + worker := New(params.TestChainConfig, chain, nil, engine) if worker.GetCurrentState().GetBalance(crypto.PubkeyToAddress(testBankKey.PublicKey)).Cmp(testBankFunds) != 0 { t.Error("Worker state is not setup correctly") @@ -72,10 +72,10 @@ func TestCommitTransactions(t *testing.T) { ) gspec.MustCommit(database) - chain, _ := core.NewBlockChain(database, state.NewDatabase(database), nil, gspec.Config, engine, vm.Config{}) + chain, _ := core.NewBlockChain(database, state.NewDatabase(database), nil, nil, gspec.Config, engine, vm.Config{}) // Create a new worker - worker := New(params.TestChainConfig, chain, engine) + worker := New(params.TestChainConfig, chain, nil, engine) // Generate a test tx baseNonce := worker.GetCurrentState().GetNonce(crypto.PubkeyToAddress(testBankKey.PublicKey)) diff --git a/rosetta/infra/posichain-mainnet.conf b/rosetta/infra/posichain-mainnet.conf index c6431a409..65c7b3711 100644 --- a/rosetta/infra/posichain-mainnet.conf +++ b/rosetta/infra/posichain-mainnet.conf @@ -1,4 +1,4 @@ -Version = "2.5.7" +Version = "2.5.8" [BLSKeys] KMSConfigFile = "" @@ -18,7 +18,6 @@ Version = "2.5.7" [DNSSync] Client = true - LegacySyncing = false Port = 6000 Server = true ServerPort = 6000 diff --git a/test/chain/chain/chain_makers.go b/test/chain/chain/chain_makers.go index dfbcf0aec..683fb03a5 100644 --- a/test/chain/chain/chain_makers.go +++ b/test/chain/chain/chain_makers.go @@ -197,7 +197,7 @@ func GenerateChain( if b.engine != nil { // Finalize and seal the block block, _, err := b.engine.Finalize( - chainreader, b.header, statedb, b.txs, b.receipts, nil, nil, nil, nil, nil, func() uint64 { return 0 }, + chainreader, nil, b.header, statedb, b.txs, b.receipts, nil, nil, nil, nil, nil, func() uint64 { return 0 }, ) if err != nil { panic(err) diff --git a/test/chain/main.go b/test/chain/main.go index 3757b6a5b..bf645e556 100644 --- a/test/chain/main.go +++ b/test/chain/main.go @@ -94,7 +94,7 @@ func fundFaucetContract(chain core.BlockChain) { fmt.Println("--------- Funding addresses for Faucet Contract Call ---------") fmt.Println() - contractworker = pkgworker.New(params.TestChainConfig, chain, chain.Engine()) + contractworker = pkgworker.New(params.TestChainConfig, chain, nil, chain.Engine()) nonce = contractworker.GetCurrentState().GetNonce(crypto.PubkeyToAddress(FaucetPriKey.PublicKey)) dataEnc = common.FromHex(FaucetContractBinary) ftx, _ := types.SignTx( @@ -206,7 +206,7 @@ func playFaucetContract(chain core.BlockChain) { func main() { genesis := gspec.MustCommit(database) - chain, _ := core.NewBlockChain(database, harmonyState.NewDatabase(database), nil, gspec.Config, chain.Engine(), vm.Config{}) + chain, _ := core.NewBlockChain(database, harmonyState.NewDatabase(database), nil, nil, gspec.Config, chain.Engine(), vm.Config{}) txpool := core.NewTxPool(core.DefaultTxPoolConfig, chainConfig, chain, types.NewTransactionErrorSink()) backend := &testWorkerBackend{ diff --git a/test/chain/reward/main.go b/test/chain/reward/main.go index aa2c02778..b91fe49fb 100644 --- a/test/chain/reward/main.go +++ b/test/chain/reward/main.go @@ -109,7 +109,7 @@ func main() { genesis := gspec.MustCommit(database) _ = genesis engine := chain.NewEngine() - bc, _ := core.NewBlockChain(database, state.NewDatabase(database), nil, gspec.Config, engine, vm.Config{}) + bc, _ := core.NewBlockChain(database, state.NewDatabase(database), nil, nil, gspec.Config, engine, vm.Config{}) statedb, _ := state.New(common2.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase())) msg := createValidator() statedb.AddBalance(msg.ValidatorAddress, new(big.Int).Mul(big.NewInt(5e18), big.NewInt(2000)))