From 553c5f3ecfae6b318498f41e8476e4675ca7e038 Mon Sep 17 00:00:00 2001 From: harkamal Date: Fri, 6 Dec 2024 22:44:28 +0530 Subject: [PATCH] simplify to just bump coefficient --- packages/beacon-node/src/constants/network.ts | 4 ++-- packages/beacon-node/src/network/gossip/encoding.ts | 9 +-------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/packages/beacon-node/src/constants/network.ts b/packages/beacon-node/src/constants/network.ts index f0282893e8f4..c41df37cbdce 100644 --- a/packages/beacon-node/src/constants/network.ts +++ b/packages/beacon-node/src/constants/network.ts @@ -12,10 +12,10 @@ export const ATTESTATION_PROPAGATION_SLOT_RANGE = 32; /** The maximum allowed size of uncompressed gossip messages. */ export const GOSSIP_MAX_SIZE = 2 ** 20; -export const GOSSIP_MAX_SIZE_BELLATRIX = 10 * GOSSIP_MAX_SIZE; +export const GOSSIP_MAX_SIZE_BELLATRIX = 15 * GOSSIP_MAX_SIZE; /** The maximum allowed size of uncompressed req/resp chunked responses. */ export const MAX_CHUNK_SIZE = 2 ** 20; -export const MAX_CHUNK_SIZE_BELLATRIX = 10 * MAX_CHUNK_SIZE; +export const MAX_CHUNK_SIZE_BELLATRIX = 15 * MAX_CHUNK_SIZE; export enum GoodByeReasonCode { CLIENT_SHUTDOWN = 1, diff --git a/packages/beacon-node/src/network/gossip/encoding.ts b/packages/beacon-node/src/network/gossip/encoding.ts index cb0f489f3269..f6121bf8af91 100644 --- a/packages/beacon-node/src/network/gossip/encoding.ts +++ b/packages/beacon-node/src/network/gossip/encoding.ts @@ -69,7 +69,6 @@ export function msgIdFn(gossipTopicCache: GossipTopicCache, msg: Message): Uint8 export class DataTransformSnappy implements DataTransform { constructor( private readonly gossipTopicCache: GossipTopicCache, - /** size of the compressed message */ private readonly maxSizePerMessage: number ) {} @@ -80,13 +79,7 @@ export class DataTransformSnappy implements DataTransform { * - `outboundTransform()`: compress snappy payload */ inboundTransform(topicStr: string, data: Uint8Array): Uint8Array { - if (data.length > this.maxSizePerMessage) { - throw Error(`ssz_snappy data length ${data.length} > maxSizePerMessage`); - } - - // snappy compression efficiency is around ~36% so the max uncompressed bound - // should be 3X - const uncompressedData = uncompress(data, 3 * this.maxSizePerMessage); + const uncompressedData = uncompress(data, this.maxSizePerMessage); // check uncompressed data length before we extract beacon block root, slot or // attestation data at later steps