Skip to content

Commit

Permalink
cleanup: remove seed referencies from config
Browse files Browse the repository at this point in the history
  • Loading branch information
ssd04 committed Sep 20, 2022
1 parent 6cc8a00 commit a0ad600
Show file tree
Hide file tree
Showing 8 changed files with 0 additions and 45 deletions.
14 changes: 0 additions & 14 deletions cmd/node/config/p2p.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@
#If the port = 0, the node will search for a free port on the machine and use it
Port = "37373-38383"

#Seed represents the seed string generator for p2p identity (used during authentication and message passing).
#An empty Seed value will mean that the identity will be generated randomly in a secure cryptographically manner.
#The seed provided in this string can be of any length.
#########################################################################################
# WARNING! FOR SECURITY REASONS, ONE MIGHT USE A GENERATED STRING AS LONG AS POSSIBLE! #
# IT IS RECOMMENDED THAT THE SEED FIELD SHOULD REMAIN EMPTY (NO CHARACTERS BETWEEN "") #
# THIS SEED WILL BE USED FOR P2P'S PRIVATE KEY GENERATION. SAME SEED USED WILL LEAD TO #
# THE GENERATION OF THE SAME P2P IDENTITY. #
# SPECIFY A SEED VALUE IF YOU KNOW WHAT YOU ARE DOING! #
#########################################################################################
#The seed provided will be hashed using SHA256 and the resulting 32 byte length byte array will be used in
#p2p identity generation
Seed = ""

#ThresholdMinConnectedPeers represents the minimum number of connections a node should have before it can start
#the sync and consensus mechanisms
ThresholdMinConnectedPeers = 3
Expand Down
14 changes: 0 additions & 14 deletions cmd/seednode/config/p2p.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@
#Can use single values such as 0, 10230, 15670 or a range such as 5000-10000
Port = "10000"

#Seed represents the seed string generator for p2p identity (used during authentication and message passing).
#An empty Seed value will mean that the identity will be generated randomly in a secure cryptographically manner.
#The seed provided in this string can be of any length.
#########################################################################################
# WARNING! FOR SECURITY REASONS, ONE MIGHT USE A GENERATED STRING AS LONG AS POSSIBLE! #
# IT IS RECOMMENDED THAT THE SEED FIELD SHOULD REMAIN EMPTY (NO CHARACTERS BETWEEN "") #
# THIS SEED WILL BE USED FOR P2P'S PRIVATE KEY GENERATION. SAME SEED USED WILL LEAD TO #
# THE GENERATION OF THE SAME P2P IDENTITY. #
# SPECIFY A SEED VALUE IF YOU KNOW WHAT YOU ARE DOING! #
#########################################################################################
#The seed provided will be hashed using SHA256 and the resulting 32 byte length byte array will be used in
#p2p identity generation
Seed = "seed"

# The maximum peers that will connect to this node
MaximumExpectedPeerCount = 1024

Expand Down
10 changes: 0 additions & 10 deletions cmd/seednode/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,6 @@ VERSION:
"To bind to all available interfaces, set this flag to :8080. If set to `off` then the API won't be available",
Value: facade.DefaultRestInterface,
}
// p2pSeed defines a flag to be used as a seed when generating P2P credentials. Useful for seed nodes.
p2pSeed = cli.StringFlag{
Name: "p2p-seed",
Usage: "P2P seed will be used when generating credentials for p2p component. Can be any string.",
Value: "seed",
}
// logLevel defines the logger level
logLevel = cli.StringFlag{
Name: "log-level",
Expand Down Expand Up @@ -110,7 +104,6 @@ func main() {
app.Flags = []cli.Flag{
port,
restApiInterfaceFlag,
p2pSeed,
logLevel,
logSaveFile,
configurationFile,
Expand Down Expand Up @@ -194,9 +187,6 @@ func startNode(ctx *cli.Context) error {
if ctx.IsSet(port.Name) {
p2pConfig.Node.Port = ctx.GlobalString(port.Name)
}
if ctx.IsSet(p2pSeed.Name) {
p2pConfig.Node.Seed = ctx.GlobalString(p2pSeed.Name)
}

err = checkExpectedPeerCount(*p2pConfig)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion config/p2pConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ type P2PConfig struct {
// NodeConfig will hold basic p2p settings
type NodeConfig struct {
Port string
Seed string
PemFileName string
MaximumExpectedPeerCount uint64
ThresholdMinConnectedPeers uint32
Expand Down
3 changes: 0 additions & 3 deletions config/tomlConfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,14 +434,12 @@ func TestP2pConfig(t *testing.T) {
initialPeersList := "/ip4/127.0.0.1/tcp/9999/p2p/16Uiu2HAkw5SNNtSvH1zJiQ6Gc3WoGNSxiyNueRKe6fuAuh57G3Bk"
protocolID := "test protocol id"
shardingType := "ListSharder"
seed := "test seed"
port := "37373-38383"

testString := `
#P2P config file
[Node]
Port = "` + port + `"
Seed = "` + seed + `"
ThresholdMinConnectedPeers = 0
[KadDhtPeerDiscovery]
Expand Down Expand Up @@ -472,7 +470,6 @@ func TestP2pConfig(t *testing.T) {
expectedCfg := P2PConfig{
Node: NodeConfig{
Port: port,
Seed: seed,
},
KadDhtPeerDiscovery: KadDhtPeerDiscoveryConfig{
ProtocolID: protocolID,
Expand Down
1 change: 0 additions & 1 deletion factory/networkComponents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ func getNetworkArgs() factory.NetworkComponentsFactoryArgs {
p2pConfig := config.P2PConfig{
Node: config.NodeConfig{
Port: "0",
Seed: "seed",
},
KadDhtPeerDiscovery: config.KadDhtPeerDiscoveryConfig{
Enabled: false,
Expand Down
1 change: 0 additions & 1 deletion integrationTests/testInitializer.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ func CreateP2PConfigWithNoDiscovery() config.P2PConfig {
return config.P2PConfig{
Node: config.NodeConfig{
Port: "0",
Seed: "",
},
KadDhtPeerDiscovery: config.KadDhtPeerDiscoveryConfig{
Enabled: false,
Expand Down
1 change: 0 additions & 1 deletion p2p/libp2p/netMessenger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,6 @@ func TestNetworkMessenger_Bootstrap(t *testing.T) {
P2pConfig: config.P2PConfig{
Node: config.NodeConfig{
Port: "0",
Seed: "",
MaximumExpectedPeerCount: 1,
ThresholdMinConnectedPeers: 1,
},
Expand Down

0 comments on commit a0ad600

Please sign in to comment.