Skip to content

Commit

Permalink
vm-mock: generate random opId
Browse files Browse the repository at this point in the history
  • Loading branch information
peterjah committed Jul 20, 2023
1 parent d1886bd commit 5f3c520
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions vm-mock/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const { createHash } = await import('node:crypto');
let callerAddress = 'AU12UBnqTHDQALpocVBnkPNy7y5CndUJQTLutaVDDFgMJcq5kQiKq';
let contractAddress = 'AS12BqZEQ6sByhRLyEuf0YbQmcF2PsDdkNNG1akBJu9XcjZA1eT';

const OpId = "O1kEZsswxG6VFzfrnS5ZzEfcy2mYETUvyLn1NScCzqTX726KLzX";
/**
* return a random string
*
Expand All @@ -31,10 +30,19 @@ function mixRandomChars(length) {
*
* @returns {string} a random Address
*/
function generateDumbAddress() {
export function generateDumbAddress() {
return 'A12' + mixRandomChars(47);
}

/**
* Generates a random operationId.
*
* @returns {string} a random operationId
*/
export function generateRandOpId() {
return 'O1' + mixRandomChars(47);
}

let callStack = callerAddress + ' , ' + contractAddress;

/**
Expand Down Expand Up @@ -713,8 +721,7 @@ export default function createMockedABI(
},

assembly_script_get_origin_operation_id() {
return newString(
OpId
return newString(generateRandOpId()
);
},
},
Expand Down

0 comments on commit 5f3c520

Please sign in to comment.