Skip to content

Commit

Permalink
Merge branch 'feat/configs' into 'dev'
Browse files Browse the repository at this point in the history
feat(rosenet-relay): add new configs

See merge request ergo/rosen-bridge/rosenet!49
  • Loading branch information
vorujack committed Oct 19, 2024
2 parents a05d95c + 7e8c844 commit 12dd127
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/fluffy-clocks-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rosen-bridge/rosenet-relay': minor
---

Add pubsub related configs
1 change: 1 addition & 0 deletions packages/rosenet-relay/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -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;
8 changes: 6 additions & 2 deletions packages/rosenet-relay/lib/createRoseNetRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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({
Expand Down
5 changes: 5 additions & 0 deletions packages/rosenet-relay/lib/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AbstractLogger } from '@rosen-bridge/logger-interface';
import { SignaturePolicy } from '@libp2p/interface';

export interface RoseNetRelayConfig {
listen?: {
Expand All @@ -12,4 +13,8 @@ export interface RoseNetRelayConfig {
debug?: {
libp2pComponents?: string[];
};
pubsub?: {
gossipsubMaxInboundDataLength?: number;
gossipsubSignaturePolicy?: SignaturePolicy;
};
}

0 comments on commit 12dd127

Please sign in to comment.