diff --git a/yarn-project/foundation/src/fields/fields.ts b/yarn-project/foundation/src/fields/fields.ts index 33050507e66..8939b7adb7c 100644 --- a/yarn-project/foundation/src/fields/fields.ts +++ b/yarn-project/foundation/src/fields/fields.ts @@ -47,7 +47,7 @@ abstract class BaseField { } protected constructor(value: number | bigint | boolean | BaseField | Buffer) { - if (value instanceof Buffer) { + if (Buffer.isBuffer(value)) { if (value.length > BaseField.SIZE_IN_BYTES) { throw new Error(`Value length ${value.length} exceeds ${BaseField.SIZE_IN_BYTES}`); } diff --git a/yarn-project/foundation/src/json-rpc/convert.ts b/yarn-project/foundation/src/json-rpc/convert.ts index 7bdb85aa34b..7e1de2cbd4b 100644 --- a/yarn-project/foundation/src/json-rpc/convert.ts +++ b/yarn-project/foundation/src/json-rpc/convert.ts @@ -130,7 +130,7 @@ export function convertToJsonObj(cc: ClassConverter, obj: any): any { } // Is this a Node buffer? - if (obj instanceof Buffer) { + if (Buffer.isBuffer(obj)) { return { type: 'Buffer', data: obj.toString('base64') }; } diff --git a/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts b/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts index 949dc4b2819..e9ea67945fd 100644 --- a/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts +++ b/yarn-project/simulator/src/avm/serialization/instruction_serialization.ts @@ -158,7 +158,7 @@ function writeBigInt128BE(this: Buffer, value: bigint): void { */ export function deserialize(cursor: BufferCursor | Buffer, operands: OperandType[]): (number | bigint)[] { const argValues = []; - if (cursor instanceof Buffer) { + if (Buffer.isBuffer(cursor)) { cursor = new BufferCursor(cursor); }