From 752334e3175ed2af78e21c0f4745a5dd21888c93 Mon Sep 17 00:00:00 2001 From: plusminushalf Date: Wed, 22 Nov 2023 11:42:05 +0530 Subject: [PATCH] generate predective bytes --- packages/utils/src/validation.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/utils/src/validation.ts b/packages/utils/src/validation.ts index 91aca9f3..0800a2fa 100644 --- a/packages/utils/src/validation.ts +++ b/packages/utils/src/validation.ts @@ -196,9 +196,14 @@ const getL1FeeAbi = [ // Assuming you have a function to generate random bytes function randomBytes(length: number): Uint8Array { - const bytes = new Uint8Array(length) - window.crypto.getRandomValues(bytes) - return bytes + const pattern = "10101010101" + const repeatedPattern = pattern.repeat(Math.ceil(length / pattern.length)) + + const byteArray = repeatedPattern.split("").map(Number) + + const bytes = new Uint8Array(byteArray) + + return bytes.slice(0, length) } export async function calcOptimismPreVerificationGas(