mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-05 09:14:28 +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/nat"
|
||||||
"github.com/ethereum/go-ethereum/p2p/netutil"
|
"github.com/ethereum/go-ethereum/p2p/netutil"
|
||||||
"github.com/ethereum/go-ethereum/params"
|
"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"
|
whisper "github.com/ethereum/go-ethereum/whisper/whisperv6"
|
||||||
"gopkg.in/urfave/cli.v1"
|
"gopkg.in/urfave/cli.v1"
|
||||||
)
|
)
|
||||||
@ -536,7 +536,7 @@ var (
|
|||||||
// Sharding Settings
|
// Sharding Settings
|
||||||
DepositFlag = cli.BoolFlag{
|
DepositFlag = cli.BoolFlag{
|
||||||
Name: "deposit",
|
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{
|
ActorFlag = cli.StringFlag{
|
||||||
Name: "actor",
|
Name: "actor",
|
||||||
|
@ -38,7 +38,7 @@ const shardChainDbName = "shardchaindata"
|
|||||||
// it contains APIs and fields that handle the different components of the sharded
|
// it contains APIs and fields that handle the different components of the sharded
|
||||||
// Ethereum network.
|
// Ethereum network.
|
||||||
type ShardEthereum struct {
|
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.
|
txPool *txpool.ShardTXPool // Defines the sharding-specific txpool. To be designed.
|
||||||
actor sharding.Actor // Either notary, proposer, or observer.
|
actor sharding.Actor // Either notary, proposer, or observer.
|
||||||
shardChainDb ethdb.Database // Access to the persistent db to store shard data.
|
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.
|
// Adds the initialized SMCClient to the ShardEthereum instance.
|
||||||
shardEthereum.smcClient = smcClient
|
shardEthereum.smcClient = smcClient
|
||||||
|
|
||||||
// Configure shardConfig by loading from default.
|
// Configure shardConfig by loading the default.
|
||||||
shardEthereum.shardConfig = ¶ms.DefaultShardConfig
|
shardEthereum.shardConfig = params.DefaultShardConfig
|
||||||
|
|
||||||
// Adds the initialized shardChainDb to the ShardEthereum instance.
|
// Adds the initialized shardChainDb to the ShardEthereum instance.
|
||||||
shardEthereum.shardChainDb = shardChainDb
|
shardEthereum.shardChainDb = shardChainDb
|
||||||
|
@ -154,13 +154,13 @@ func TestJoinNotaryPool(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
client.SetDepositFlag(false)
|
client.SetDepositFlag(false)
|
||||||
err = joinNotaryPool(¶ms.DefaultShardConfig, client)
|
err = joinNotaryPool(params.DefaultShardConfig, client)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
t.Error("Joined notary pool while --deposit was not present")
|
t.Error("Joined notary pool while --deposit was not present")
|
||||||
}
|
}
|
||||||
|
|
||||||
client.SetDepositFlag(true)
|
client.SetDepositFlag(true)
|
||||||
err = joinNotaryPool(¶ms.DefaultShardConfig, client)
|
err = joinNotaryPool(params.DefaultShardConfig, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
@ -176,7 +176,7 @@ func TestJoinNotaryPool(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Trying to join while deposited should do nothing
|
// Trying to join while deposited should do nothing
|
||||||
err = joinNotaryPool(¶ms.DefaultShardConfig, client)
|
err = joinNotaryPool(params.DefaultShardConfig, client)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// DefaultShardConfig contains default configs for node to use in the sharded universe
|
// DefaultShardConfig contains default configs for node to use in the sharded universe
|
||||||
var DefaultShardConfig = ShardConfig{
|
var DefaultShardConfig = &ShardConfig{
|
||||||
SMCAddress: common.HexToAddress("0x0"),
|
SMCAddress: common.HexToAddress("0x0"),
|
||||||
PeriodLength: 5,
|
PeriodLength: 5,
|
||||||
NotaryDeposit: new(big.Int).Exp(big.NewInt(10), big.NewInt(21), nil), // 1000 ETH
|
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.
|
// 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.
|
// ShardConfig contains configs for node to participate in the sharded universe.
|
||||||
type ShardConfig struct {
|
type ShardConfig struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user