Skip to content

Commit

Permalink
fix: incorrect variable access (#6862)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluard authored Jun 9, 2024
1 parent f6d3bce commit 14855ea
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/beacon-node/src/network/gossip/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import xxhashFactory from "xxhash-wasm";
import {Message} from "@libp2p/interface";
import {digest} from "@chainsafe/as-sha256";
import {RPC} from "@chainsafe/libp2p-gossipsub/message";
import {DataTransform} from "@chainsafe/libp2p-gossipsub/types";
import {intToBytes, toHex} from "@lodestar/utils";
import {ForkName} from "@lodestar/params";
import {MESSAGE_DOMAIN_VALID_SNAPPY} from "./constants.js";
Expand Down Expand Up @@ -61,7 +62,7 @@ export function msgIdFn(gossipTopicCache: GossipTopicCache, msg: Message): Uint8
return digest(Buffer.concat(vec)).subarray(0, 20);
}

export class DataTransformSnappy {
export class DataTransformSnappy implements DataTransform {
constructor(
private readonly gossipTopicCache: GossipTopicCache,
private readonly maxSizePerMessage: number
Expand Down Expand Up @@ -96,9 +97,9 @@ export class DataTransformSnappy {
* Takes the data to be published (a topic and associated data) transforms the data. The
* transformed data will then be used to create a `RawGossipsubMessage` to be sent to peers.
*/
outboundTransform(topicStr: string, data: Uint8Array): Uint8Array {
outboundTransform(_topicStr: string, data: Uint8Array): Uint8Array {
if (data.length > this.maxSizePerMessage) {
throw Error(`ssz_snappy encoded data length ${length} > ${this.maxSizePerMessage}`);
throw Error(`ssz_snappy encoded data length ${data.length} > ${this.maxSizePerMessage}`);
}
// No need to parse topic, everything is snappy compressed
return compress(data);
Expand Down

0 comments on commit 14855ea

Please sign in to comment.