From 23a92c0c05e93fd5b16eeaf0593fbda67bab07d3 Mon Sep 17 00:00:00 2001 From: Sergi Rene Date: Wed, 15 May 2024 21:36:32 +0200 Subject: [PATCH] param rename --- block/manager_test.go | 2 +- config/config_test.go | 2 +- config/defaults.go | 2 +- config/flags.go | 12 ++++++------ config/p2p.go | 4 ++-- config/toml.go | 2 +- node/node_test.go | 2 +- p2p/client.go | 2 +- p2p/client_test.go | 4 ++-- rpc/client/client_test.go | 10 +++++----- rpc/json/service_test.go | 2 +- testutil/block.go | 2 +- testutil/p2p.go | 2 +- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/block/manager_test.go b/block/manager_test.go index b70a7a3b5..4b3ebbb42 100644 --- a/block/manager_test.go +++ b/block/manager_test.go @@ -55,7 +55,7 @@ func TestInitialState(t *testing.T) { p2pClient, err := p2p.NewClient(config.P2PConfig{ ListenAddress: config.DefaultListenAddress, GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, }, privKey, "TestChain", pubsubServer, logger) assert.NoError(err) assert.NotNil(p2pClient) diff --git a/config/config_test.go b/config/config_test.go index 45ca6d96b..f8a06d8f1 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -224,7 +224,7 @@ func fullNodeConfig() config.NodeConfig { }, P2PConfig: config.P2PConfig{ GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, ListenAddress: config.DefaultListenAddress, BootstrapNodes: "", }, diff --git a/config/defaults.go b/config/defaults.go index 14a63552d..40e0a6dc8 100644 --- a/config/defaults.go +++ b/config/defaults.go @@ -39,7 +39,7 @@ func DefaultConfig(home, chainId string) *NodeConfig { }, P2PConfig: P2PConfig{ GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, ListenAddress: DefaultListenAddress, BootstrapNodes: "", }, diff --git a/config/flags.go b/config/flags.go index a63bd3995..7e4fcd927 100644 --- a/config/flags.go +++ b/config/flags.go @@ -29,10 +29,10 @@ const ( ) const ( - FlagP2PListenAddress = "dymint.p2p_config.listen_address" - FlagP2PBootstrapNodes = "dymint.p2p_config.bootstrap_nodes" - FlagP2PGossipCacheSize = "dymint.p2p_config.gossip_cache_size" - FlagP2PBootstrapTime = "dymint.p2p_config.bootstrap_time" + FlagP2PListenAddress = "dymint.p2p_config.listen_address" + FlagP2PBootstrapNodes = "dymint.p2p_config.bootstrap_nodes" + FlagP2PGossipCacheSize = "dymint.p2p_config.gossip_cache_size" + FlagP2PBootstrapRetryTime = "dymint.p2p_config.bootstrap_retry_time" ) // AddNodeFlags adds Dymint specific configuration options to cobra Command. @@ -64,7 +64,7 @@ func AddNodeFlags(cmd *cobra.Command) { cmd.Flags().String(FlagP2PListenAddress, def.P2PConfig.ListenAddress, "P2P listen address") cmd.Flags().String(FlagP2PBootstrapNodes, def.P2PConfig.BootstrapNodes, "P2P bootstrap nodes") - cmd.Flags().Duration(FlagP2PBootstrapTime, def.P2PConfig.BootstrapTime, "P2P bootstrap time") + cmd.Flags().Duration(FlagP2PBootstrapRetryTime, def.P2PConfig.BootstrapRetryTime, "P2P bootstrap time") cmd.Flags().Uint64(FlagP2PGossipCacheSize, uint64(def.P2PConfig.GossipedBlocksCacheSize), "P2P Gossiped blocks cache size") } @@ -124,7 +124,7 @@ func BindDymintFlags(cmd *cobra.Command, v *viper.Viper) error { if err := v.BindPFlag("p2p_gossiped_blocks_cache_size", cmd.Flags().Lookup(FlagP2PGossipCacheSize)); err != nil { return err } - if err := v.BindPFlag("p2p_bootstrap_time", cmd.Flags().Lookup(FlagP2PBootstrapTime)); err != nil { + if err := v.BindPFlag("p2p_bootstrap_retry_time", cmd.Flags().Lookup(FlagP2PBootstrapRetryTime)); err != nil { return err } if err := v.BindPFlag("p2p_bootstrap_nodes", cmd.Flags().Lookup(FlagP2PBootstrapNodes)); err != nil { diff --git a/config/p2p.go b/config/p2p.go index 5f79c6091..be1b22346 100644 --- a/config/p2p.go +++ b/config/p2p.go @@ -14,7 +14,7 @@ type P2PConfig struct { //Size of the Gossipsub router cache GossipedBlocksCacheSize int `mapstructure:"p2p_gossiped_blocks_cache_size"` //Time interval a node tries to bootstrap again, in case no nodes connected - BootstrapTime time.Duration `mapstructure:"p2p_bootstrap_time"` + BootstrapRetryTime time.Duration `mapstructure:"p2p_bootstrap_retry_time"` } // Validate P2PConfig @@ -22,7 +22,7 @@ func (c P2PConfig) Validate() error { if c.GossipedBlocksCacheSize < 0 { return fmt.Errorf("gossipsub cache size cannot be negative") } - if c.BootstrapTime <= 0 { + if c.BootstrapRetryTime <= 0 { return fmt.Errorf("bootstrap time must be positive") } return nil diff --git a/config/toml.go b/config/toml.go index 842fd9597..88dea5582 100644 --- a/config/toml.go +++ b/config/toml.go @@ -98,7 +98,7 @@ p2p_bootstrap_nodes = "{{ .P2PConfig.BootstrapNodes }}" p2p_gossiped_blocks_cache_size = {{ .P2PConfig.GossipedBlocksCacheSize }} # time interval to check if no p2p nodes are connected to bootstrap again -p2p_bootstrap_time = "{{ .P2PConfig.BootstrapTime }}" +p2p_bootstrap_retry_time = "{{ .P2PConfig.BootstrapRetryTime }}" #celestia config example: # da_config = "{\"base_url\":\"http:\/\/127.0.0.1:26658\",\"timeout\":5000000000,\"gas_prices\":0.1,\"auth_token\":\"TOKEN\",\"backoff\":{\"initial_delay\":6000000000,\"max_delay\":6000000000,\"growth_factor\":2},\"retry_attempts\":4,\"retry_delay\":3000000000}" diff --git a/node/node_test.go b/node/node_test.go index af181d0f0..e9f29c057 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -67,7 +67,7 @@ func TestMempoolDirectly(t *testing.T) { P2PConfig: config.P2PConfig{ ListenAddress: config.DefaultListenAddress, GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, BootstrapNodes: "", }, RPC: config.RPCConfig{}, diff --git a/p2p/client.go b/p2p/client.go index 8b11f233b..65f8bb01e 100644 --- a/p2p/client.go +++ b/p2p/client.go @@ -401,7 +401,7 @@ func (c *Client) gossipedBlockReceived(msg *GossipMessage) { } func (c *Client) bootstrapLoop(ctx context.Context) { - ticker := time.NewTicker(c.conf.BootstrapTime) + ticker := time.NewTicker(c.conf.BootstrapRetryTime) defer ticker.Stop() for { select { diff --git a/p2p/client_test.go b/p2p/client_test.go index 5b6c847d7..c519996c5 100644 --- a/p2p/client_test.go +++ b/p2p/client_test.go @@ -29,7 +29,7 @@ func TestClientStartup(t *testing.T) { client, err := p2p.NewClient(config.P2PConfig{ ListenAddress: config.DefaultListenAddress, GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, }, privKey, "TestChain", pubsubServer, log.TestingLogger()) assert := assert.New(t) assert.NoError(err) @@ -180,7 +180,7 @@ func TestSeedStringParsing(t *testing.T) { logger := &testutil.MockLogger{} client, err := p2p.NewClient(config.P2PConfig{ GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, }, privKey, "TestNetwork", pubsubServer, logger) require.NoError(err) require.NotNil(client) diff --git a/rpc/client/client_test.go b/rpc/client/client_test.go index d0139746e..07a24835d 100644 --- a/rpc/client/client_test.go +++ b/rpc/client/client_test.go @@ -104,7 +104,7 @@ func TestGenesisChunked(t *testing.T) { ListenAddress: config.DefaultListenAddress, BootstrapNodes: "", GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, }, RPC: config.RPCConfig{}, BlockManagerConfig: config.BlockManagerConfig{ @@ -704,7 +704,7 @@ func TestValidatorSetHandling(t *testing.T) { ListenAddress: config.DefaultListenAddress, BootstrapNodes: "", GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, }, BlockManagerConfig: config.BlockManagerConfig{ BlockTime: 10 * time.Millisecond, @@ -856,7 +856,7 @@ func getRPCInternal(t *testing.T, aggregator bool) (*tmmocks.MockApplication, *C ListenAddress: config.DefaultListenAddress, BootstrapNodes: "", GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, }, RPC: config.RPCConfig{}, MempoolConfig: *tmcfg.DefaultMempoolConfig(), @@ -967,7 +967,7 @@ func TestMempool2Nodes(t *testing.T) { ListenAddress: "/ip4/127.0.0.1/tcp/9001", BootstrapNodes: "", GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, }, BlockManagerConfig: config.BlockManagerConfig{ BlockTime: 100 * time.Millisecond, @@ -996,7 +996,7 @@ func TestMempool2Nodes(t *testing.T) { P2PConfig: config.P2PConfig{ ListenAddress: "/ip4/127.0.0.1/tcp/9002", BootstrapNodes: "/ip4/127.0.0.1/tcp/9001/p2p/" + id1.String(), - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, GossipedBlocksCacheSize: 50, }, MempoolConfig: *tmcfg.DefaultMempoolConfig(), diff --git a/rpc/json/service_test.go b/rpc/json/service_test.go index 9cf26cecc..fa14e3eef 100644 --- a/rpc/json/service_test.go +++ b/rpc/json/service_test.go @@ -316,7 +316,7 @@ func getRPC(t *testing.T) (*tmmocks.MockApplication, *client.Client) { P2PConfig: config.P2PConfig{ ListenAddress: config.DefaultListenAddress, GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, }, } node, err := node.NewNode( diff --git a/testutil/block.go b/testutil/block.go index 26ef95c4e..e965809a7 100644 --- a/testutil/block.go +++ b/testutil/block.go @@ -92,7 +92,7 @@ func GetManagerWithProposerKey(conf config.BlockManagerConfig, proposerKey crypt p2pKey, _, _ := crypto.GenerateEd25519Key(rand.Reader) p2pClient, err := p2p.NewClient(config.P2PConfig{ GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, }, p2pKey, "TestChain", pubsubServer, logger) if err != nil { return nil, err diff --git a/testutil/p2p.go b/testutil/p2p.go index 752019b33..713a7aada 100644 --- a/testutil/p2p.go +++ b/testutil/p2p.go @@ -110,7 +110,7 @@ func StartTestNetwork(ctx context.Context, t *testing.T, n int, conf map[int]Hos client, err := p2p.NewClient(config.P2PConfig{ BootstrapNodes: seeds[i], GossipedBlocksCacheSize: 50, - BootstrapTime: 30 * time.Second, + BootstrapRetryTime: 30 * time.Second, ListenAddress: config.DefaultListenAddress, }, mnet.Hosts()[i].Peerstore().PrivKey(mnet.Hosts()[i].ID()),