mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-03 08:37:37 +00:00
sharding: use pointer for default config
Former-commit-id: 47354dddbeb7c5db47c79c5b929524d221f35814 [formerly 570a02de295c3d30c1b03327615dcb3d47c8c363] Former-commit-id: 329af4b67168e0a58b7bae38c16cae4354fbf808
This commit is contained in:
parent
7c08587d4c
commit
b41b8c823a
@ -55,7 +55,7 @@ import (
|
||||
"github.com/ethereum/go-ethereum/p2p/nat"
|
||||
"github.com/ethereum/go-ethereum/p2p/netutil"
|
||||
"github.com/ethereum/go-ethereum/params"
|
||||
sparams "github.com/ethereum/go-ethereum/sharding/params"
|
||||
shardparams "github.com/ethereum/go-ethereum/sharding/params"
|
||||
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
|
||||
"gopkg.in/urfave/cli.v1"
|
||||
)
|
||||
@ -536,7 +536,7 @@ var (
|
||||
// Sharding Settings
|
||||
DepositFlag = cli.BoolFlag{
|
||||
Name: "deposit",
|
||||
Usage: "To become a notary in a sharding node, " + new(big.Int).Div(sparams.DefaultShardConfig.NotaryDeposit, new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)).String() + " ETH will be deposited into SMC",
|
||||
Usage: "To become a notary in a sharding node, " + new(big.Int).Div(shardparams.DefaultShardConfig.NotaryDeposit, new(big.Int).Exp(big.NewInt(10), big.NewInt(18), nil)).String() + " ETH will be deposited into SMC",
|
||||
}
|
||||
ActorFlag = cli.StringFlag{
|
||||
Name: "actor",
|
||||
|
@ -38,7 +38,7 @@ const shardChainDbName = "shardchaindata"
|
||||
// it contains APIs and fields that handle the different components of the sharded
|
||||
// Ethereum network.
|
||||
type ShardEthereum struct {
|
||||
shardConfig *params.ShardConfig // Holds necessary information to configure shards.
|
||||
shardConfig *params.ShardConfig // Holds necessary information to configure shard node.
|
||||
txPool *txpool.ShardTXPool // Defines the sharding-specific txpool. To be designed.
|
||||
actor sharding.Actor // Either notary, proposer, or observer.
|
||||
shardChainDb ethdb.Database // Access to the persistent db to store shard data.
|
||||
@ -89,8 +89,8 @@ func New(ctx *cli.Context) (*ShardEthereum, error) {
|
||||
// Adds the initialized SMCClient to the ShardEthereum instance.
|
||||
shardEthereum.smcClient = smcClient
|
||||
|
||||
// Configure shardConfig by loading from default.
|
||||
shardEthereum.shardConfig = ¶ms.DefaultShardConfig
|
||||
// Configure shardConfig by loading the default.
|
||||
shardEthereum.shardConfig = params.DefaultShardConfig
|
||||
|
||||
// Adds the initialized shardChainDb to the ShardEthereum instance.
|
||||
shardEthereum.shardChainDb = shardChainDb
|
||||
|
@ -154,13 +154,13 @@ func TestJoinNotaryPool(t *testing.T) {
|
||||
}
|
||||
|
||||
client.SetDepositFlag(false)
|
||||
err = joinNotaryPool(¶ms.DefaultShardConfig, client)
|
||||
err = joinNotaryPool(params.DefaultShardConfig, client)
|
||||
if err == nil {
|
||||
t.Error("Joined notary pool while --deposit was not present")
|
||||
}
|
||||
|
||||
client.SetDepositFlag(true)
|
||||
err = joinNotaryPool(¶ms.DefaultShardConfig, client)
|
||||
err = joinNotaryPool(params.DefaultShardConfig, client)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@ -176,7 +176,7 @@ func TestJoinNotaryPool(t *testing.T) {
|
||||
}
|
||||
|
||||
// Trying to join while deposited should do nothing
|
||||
err = joinNotaryPool(¶ms.DefaultShardConfig, client)
|
||||
err = joinNotaryPool(params.DefaultShardConfig, client)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
// DefaultShardConfig contains default configs for node to use in the sharded universe
|
||||
var DefaultShardConfig = ShardConfig{
|
||||
var DefaultShardConfig = &ShardConfig{
|
||||
SMCAddress: common.HexToAddress("0x0"),
|
||||
PeriodLength: 5,
|
||||
NotaryDeposit: new(big.Int).Exp(big.NewInt(10), big.NewInt(21), nil), // 1000 ETH
|
||||
@ -22,7 +22,7 @@ var DefaultShardConfig = ShardConfig{
|
||||
}
|
||||
|
||||
// DefaultShardChainConfig contains default chain configs of an individual shard.
|
||||
var DefaultShardChainConfig = ShardChainConfig{}
|
||||
var DefaultShardChainConfig = &ShardChainConfig{}
|
||||
|
||||
// ShardConfig contains configs for node to participate in the sharded universe.
|
||||
type ShardConfig struct {
|
||||
|
Loading…
Reference in New Issue
Block a user