Skip to content

Commit

Permalink
fixed injection
Browse files Browse the repository at this point in the history
  • Loading branch information
shaharyakir committed Mar 12, 2024
1 parent 193cbdd commit 54afdb0
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/source-verifier/func-source-verifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import { fiftToCodeCell } from "./fift-source-verifier";
import { FuncCompilerVersion } from "@ton-community/contract-verifier-sdk";
import { binaryPath } from "../binaries";

const semverRegex = () =>
/^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(0|[1-9A-Za-z-][0-9A-Za-z-]*)(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$/;

function prepareFuncCommand(
executable: string,
funcArgs: string,
Expand All @@ -40,6 +43,10 @@ async function compileFuncToCodeHash(
commandLine: string,
tmpDir: string,
) {
if (!semverRegex().test(funcVersion)) {
throw new Error(`Invalid func version: ${funcVersion}`);
}

const fiftOutFile = "output.fif";
const executable = path.join(process.cwd(), binaryPath, funcVersion, "func");
const funcCmd = prepareFuncCommand(executable, funcArgs, fiftOutFile, commandLine);
Expand Down

0 comments on commit 54afdb0

Please sign in to comment.