Skip to content

Commit

Permalink
fix: add gnu toolchain for linux as default from compiler version 1.5…
Browse files Browse the repository at this point in the history
….4 (#1359)

Co-authored-by: Marko Arambasic <[email protected]>
  • Loading branch information
kiriyaga-txfusion and kiriyaga authored Sep 5, 2024
1 parent 448a2ce commit 4272477
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 2 additions & 0 deletions packages/hardhat-zksync-vyper/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ export const DEFAULT_COMPILER_VERSION_INFO_CACHE_PERIOD = 24 * 60 * 60 * 1000; /

export const ZKVYPER_COMPILER_MIN_VERSION_WITH_FALLBACK_OZ = '1.3.15';

export const COMPILER_MIN_LINUX_VERSION_WITH_GNU_TOOLCHAIN = '1.5.4';

export const COMPILER_VERSION_INFO_FILE_NOT_FOUND_ERROR =
'Could not find zkvyper compiler version info file. Please check your internet connection and try again.';
export const COMPILER_VERSION_INFO_FILE_DOWNLOAD_ERROR =
Expand Down
14 changes: 11 additions & 3 deletions packages/hardhat-zksync-vyper/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import type { Dispatcher } from 'undici';
import { MultiVyperConfig } from '@nomiclabs/hardhat-vyper/dist/src/types';

import { CompilerVersionInfo } from './compile/downloader';
import { DEFAULT_TIMEOUT_MILISECONDS, UNSUPPORTED_VYPER_VERSIONS, VYPER_VERSION_ERROR } from './constants';
import {
COMPILER_MIN_LINUX_VERSION_WITH_GNU_TOOLCHAIN,
DEFAULT_TIMEOUT_MILISECONDS,
UNSUPPORTED_VYPER_VERSIONS,
VYPER_VERSION_ERROR,
} from './constants';
import { ZkSyncVyperPluginError } from './errors';

const TEMP_FILE_PREFIX = 'tmp-';
Expand All @@ -22,8 +27,11 @@ export function zeroxlify(hex: string): string {
export function getZkvyperUrl(repo: string, version: string, isRelease: boolean = true): string {
// @ts-ignore
const platform = { darwin: 'macosx', linux: 'linux', win32: 'windows' }[process.platform];
// @ts-ignore
const toolchain = { linux: '-musl', win32: '-gnu', darwin: '' }[process.platform];
const toolchain = semver.lt(version, COMPILER_MIN_LINUX_VERSION_WITH_GNU_TOOLCHAIN)
? // @ts-ignore
{ linux: '-musl', win32: '-gnu', darwin: '' }[process.platform]
: // @ts-ignore
{ linux: '-gnu', win32: '-gnu', darwin: '' }[process.platform];
const arch = process.arch === 'x64' ? 'amd64' : process.arch;
const ext = process.platform === 'win32' ? '.exe' : '';

Expand Down

0 comments on commit 4272477

Please sign in to comment.