diff --git a/test/svm/SvmSpoke.common.ts b/test/svm/SvmSpoke.common.ts index dc452ef99..4fe0a9ec6 100644 --- a/test/svm/SvmSpoke.common.ts +++ b/test/svm/SvmSpoke.common.ts @@ -7,6 +7,7 @@ import { SvmSpoke } from "../../target/types/svm_spoke"; import { evmAddressToPublicKey } from "../../src/SvmUtils"; import { assert } from "chai"; import { SlowFillLeaf } from "./utils"; +import { randomBytes } from "crypto"; const provider = anchor.AnchorProvider.env(); const program = anchor.workspace.SvmSpoke as Program; @@ -41,7 +42,7 @@ const initializeState = async ( fillDeadlineBuffer: BN; } ) => { - const actualSeed = seed || new BN(Math.floor(Math.random() * 1000000)); + const actualSeed = seed || new BN(randomBytes(8).toString("hex"), 16); // Generate a random u64 const seeds = [Buffer.from("state"), actualSeed.toArrayLike(Buffer, "le", 8)]; const [state] = PublicKey.findProgramAddressSync(seeds, program.programId); if (!initialState) {