From 189436563737f8c044c84a6efb9f90cedcc3ac35 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 9 Feb 2022 11:25:21 +0100 Subject: [PATCH] fix providing wrong evm version --- .../src/lib/compiler-container.tsx | 13 ++----------- .../src/lib/logic/compileTabLogic.ts | 10 ++++++++-- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx index 434309e790..9555cd12cc 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/compiler-container.tsx @@ -74,7 +74,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => { const params = api.getCompilerParameters() const optimize = params.optimize const runs = params.runs as string - const evmVersion = params.evmVersion + const evmVersion = compileTabLogic.evmVersions.includes(params.evmVersion) ? params.evmVersion : 'default' const language = getValidLanguage(params.language) return { @@ -547,16 +547,7 @@ export const CompilerContainer = (props: CompilerContainerProps) => {
diff --git a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts index 368a5e1875..631d4c7949 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts +++ b/libs/remix-ui/solidity-compiler/src/lib/logic/compileTabLogic.ts @@ -17,10 +17,12 @@ export class CompileTabLogic { public language: string public compilerImport public event + public evmVersions: Array constructor (public api: ICompilerApi, public contentImport) { this.event = new EventEmitter() this.compiler = new Compiler((url, cb) => api.resolveContentAndSave(url).then((result) => cb(null, result)).catch((error) => cb(error.message))) + this.evmVersions = ['default', 'london', 'istanbul', 'petersburg', 'constantinople', 'byzantium', 'spuriousDragon', 'tangerineWhistle', 'homestead'] } init () { @@ -34,8 +36,12 @@ export class CompileTabLogic { this.compiler.set('runs', this.runs) this.evmVersion = this.api.getCompilerParameters().evmVersion - if (this.evmVersion === 'undefined' || this.evmVersion === 'null' || !this.evmVersion) { - this.evmVersion = null + if ( + this.evmVersion === 'undefined' || + this.evmVersion === 'null' || + !this.evmVersion || + !this.evmVersions.includes(this.evmVersion)) { + this.evmVersion = null } this.api.setCompilerParameters({ evmVersion: this.evmVersion }) this.compiler.set('evmVersion', this.evmVersion)