Skip to content

Commit

Permalink
feat: disable flood publish (#6755)
Browse files Browse the repository at this point in the history
* feat: disable flood publish

* feat: add network.disableFloodPublish cli flag

* chore: address PR comments
  • Loading branch information
twoeths authored and philknows committed May 13, 2024
1 parent fe1e8c2 commit bc1537b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/beacon-node/src/network/gossip/gossipsub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type Eth2GossipsubOpts = {
gossipsubDLow?: number;
gossipsubDHigh?: number;
gossipsubAwaitHandler?: boolean;
disableFloodPublish?: boolean;
skipParamsLog?: boolean;
};

Expand Down Expand Up @@ -128,6 +129,9 @@ export class Eth2Gossipsub extends GossipSub {
maxOutboundBufferSize: MAX_OUTBOUND_BUFFER_SIZE,
// serialize message once and send to all peers when publishing
batchPublish: true,
// if this is false, only publish to mesh peers. If there is not enough GOSSIP_D mesh peers,
// publish to some more topic peers to make sure we always publish to at least GOSSIP_D peers
floodPublish: !opts?.disableFloodPublish,
});
this.scoreParams = scoreParams;
this.config = config;
Expand Down
9 changes: 9 additions & 0 deletions packages/cli/src/options/beaconNodeOptions/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export type NetworkArgs = {
"network.gossipsubDLow"?: number;
"network.gossipsubDHigh"?: number;
"network.gossipsubAwaitHandler"?: boolean;
"network.disableFloodPublish"?: boolean;
"network.rateLimitMultiplier"?: number;
"network.maxGossipTopicConcurrency"?: number;
"network.useWorker"?: boolean;
Expand Down Expand Up @@ -149,6 +150,7 @@ export function parseArgs(args: NetworkArgs): IBeaconNodeOptions["network"] {
gossipsubDLow: args["network.gossipsubDLow"],
gossipsubDHigh: args["network.gossipsubDHigh"],
gossipsubAwaitHandler: args["network.gossipsubAwaitHandler"],
disableFloodPublish: args["network.disableFloodPublish"],
mdns: args["mdns"],
rateLimitMultiplier: args["network.rateLimitMultiplier"],
maxGossipTopicConcurrency: args["network.maxGossipTopicConcurrency"],
Expand Down Expand Up @@ -360,6 +362,13 @@ export const options: CliCommandOptions<NetworkArgs> = {
group: "network",
},

"network.disableFloodPublish": {
hidden: true,
description: "Disable gossipsub flood publish",
type: "boolean",
group: "network",
},

"network.rateLimitMultiplier": {
type: "number",
description: "The multiplier to increase the rate limits. Set to zero to disable rate limiting.",
Expand Down

0 comments on commit bc1537b

Please sign in to comment.