diff --git a/.changeset/fluffy-clocks-lie.md b/.changeset/fluffy-clocks-lie.md new file mode 100644 index 0000000..6345358 --- /dev/null +++ b/.changeset/fluffy-clocks-lie.md @@ -0,0 +1,5 @@ +--- +'@rosen-bridge/rosenet-relay': minor +--- + +Add pubsub related configs diff --git a/packages/rosenet-relay/lib/constants.ts b/packages/rosenet-relay/lib/constants.ts index de726d3..5a38cce 100644 --- a/packages/rosenet-relay/lib/constants.ts +++ b/packages/rosenet-relay/lib/constants.ts @@ -1,3 +1,4 @@ export const DEFAULT_LISTEN_HOST = '0.0.0.0'; export const RESERVATION_DATA_LIMIT = 1_000_000_000n; // 1GB export const RESERVATION_DURATION_LIMIT = 60 * 60_000; // 1 hour +export const DEFAULT_GOSSIPSUB_MAX_INBOUND_DATA_LENGTH = 170_000_000; diff --git a/packages/rosenet-relay/lib/createRoseNetRelay.ts b/packages/rosenet-relay/lib/createRoseNetRelay.ts index 97160c5..d44b3a6 100644 --- a/packages/rosenet-relay/lib/createRoseNetRelay.ts +++ b/packages/rosenet-relay/lib/createRoseNetRelay.ts @@ -19,6 +19,7 @@ import { import { RoseNetRelayError } from './errors'; import { + DEFAULT_GOSSIPSUB_MAX_INBOUND_DATA_LENGTH, DEFAULT_LISTEN_HOST, RESERVATION_DATA_LIMIT, RESERVATION_DURATION_LIMIT, @@ -93,7 +94,8 @@ const createRoseNetRelay = async ({ Dhi: 0, Dout: 0, doPX: true, - globalSignaturePolicy: 'StrictNoSign', + globalSignaturePolicy: + config.pubsub?.gossipsubSignaturePolicy ?? 'StrictNoSign', ignoreDuplicatePublishError: true, /** * Current implementation of Gossipsub includes at most 5000 messages in @@ -102,7 +104,9 @@ const createRoseNetRelay = async ({ * maximum of around 5000*100KB=500MB is received in 3 heartbeats from * a single stream, which is 500MB/3≃170MB. */ - maxInboundDataLength: 170_000_000, // 170MB + maxInboundDataLength: + config.pubsub?.gossipsubMaxInboundDataLength ?? + DEFAULT_GOSSIPSUB_MAX_INBOUND_DATA_LENGTH, }), identify: identify(), ping: ping({ diff --git a/packages/rosenet-relay/lib/types.ts b/packages/rosenet-relay/lib/types.ts index 02d06c1..25cd33f 100644 --- a/packages/rosenet-relay/lib/types.ts +++ b/packages/rosenet-relay/lib/types.ts @@ -1,4 +1,5 @@ import { AbstractLogger } from '@rosen-bridge/logger-interface'; +import { SignaturePolicy } from '@libp2p/interface'; export interface RoseNetRelayConfig { listen?: { @@ -12,4 +13,8 @@ export interface RoseNetRelayConfig { debug?: { libp2pComponents?: string[]; }; + pubsub?: { + gossipsubMaxInboundDataLength?: number; + gossipsubSignaturePolicy?: SignaturePolicy; + }; }