Skip to content

Allow parameterizing consensus p2p settings #2403

@SuperFluffy

Description

@SuperFluffy

Describe the feature

We should have reasonable default settings for our current small peer world (similar to local or recommended), but also allow overriding these settings.

Right now we only have consensus.use-local-p2p-defaults, which are more aggressive p2p settings intended for running a local p2p stack [1]. For the default, we use commonware's recommended settings, which however assume a network of 1000 nodes (so they don't end up spamming each other with connection requests).

All of this ends up here [2], where we just toggle between commonware's recommended settings, or this aggressive local default.

But as they pointed out during our call, for small networks we probably want to be more aggressive and a) define tighter defaults, but also b) allow setting them through config args.

This also extends to rate-limiting when the marshal actor is trying to backfill blocks. [3]

1:

/// Use P2P defaults optimized for local network environments.
/// Only enable in non-production network nodes.
#[arg(long = "consensus.use-local-p2p-defaults", default_value_t = false)]
pub use_local_defaults: bool,

2:
let default_config = if use_local_defaults {
lookup::Config::local(signing_key, &p2p_namespace, listen_addr, max_message_size)
} else {
lookup::Config::recommended(signing_key, &p2p_namespace, listen_addr, max_message_size)
};

3:
pub const MARSHAL_LIMIT: Quota = Quota::per_second(NonZeroU32::new(8).expect("value is not zero"));

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions