From 77643b7a841153bcd61f3dacbe6d458d0dbe0671 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 14:31:36 +0100 Subject: [PATCH 01/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index 434d1dde16..13b0af890f 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -2,6 +2,8 @@ name: Rebase Pull Requests on: push: branches: [master] + workflow_dispatch: + jobs: rebase: runs-on: ubuntu-latest From 732e86e211a205b546e9068cf0c1e7b99102e6b2 Mon Sep 17 00:00:00 2001 From: Adasauce Date: Tue, 3 Nov 2020 15:07:26 -0400 Subject: [PATCH 02/41] feat(remix-tests): add optimization flag to CLI Adds an optimize flag to the commander CLI config which generates a CompilerConfiguration object and passes it down the line to the compiler optionally. --- libs/remix-tests/src/compiler.ts | 6 +++++- libs/remix-tests/src/run.ts | 19 ++++++++++++++++++- libs/remix-tests/src/runTestFiles.ts | 7 ++++--- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 6890e6c03b..4039ef803b 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -85,7 +85,7 @@ const isBrowser = !(typeof (window) === 'undefined' || userAgent.indexOf(' elect * TODO: replace this with remix's own compiler code */ -export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: any, cb): void { +export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: any, compilerConfig: CompilerConfiguration, cb): void { let compiler: any const accounts: string[] = opts.accounts || [] const sources: SrcIfc = { @@ -125,7 +125,11 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: } finally { async.waterfall([ function loadCompiler(next) { + const {currentCompilerUrl, evmVersion, optimize, usingWorker} = compilerConfig compiler = new RemixCompiler() + compiler.set('evmVersion', evmVersion) + compiler.set('optimize', optimize) + // compiler.loadVersion(usingWorker, currentCompilerUrl) compiler.onInternalCompilerLoaded() // compiler.event.register('compilerLoaded', this, function (version) { next() diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index 61164edde3..31318a1ccb 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -4,6 +4,7 @@ import path from 'path' import { runTestFiles } from './runTestFiles' import fs from './fileSystem' import { Provider } from '@remix-project/remix-simulator' +import { CompilerConfiguration } from './types' import Log from './logger' const logger = new Log() const log = logger.logger @@ -21,6 +22,15 @@ function mapVerbosity (v: number) { } return levels[v] } + +function mapOptimize (v: string) { + const optimize = { + 'true': true, + 'false': false + } + return optimize[v]; +} + const version = require('../package.json').version commander.version(version) @@ -36,6 +46,7 @@ commander.command('help').description('output usage information').action(functio // get current version commander .option('-v, --verbose ', 'run with verbosity', mapVerbosity) + .option('-o, --optimize ', 'run compiler optimization', mapOptimize) .action(async (testsPath) => { // Check if path exists @@ -67,7 +78,13 @@ commander await provider.init() web3.setProvider(provider) - runTestFiles(path.resolve(testsPath), isDirectory, web3) + const compilerConfig = {} as CompilerConfiguration + if (commander.optimize) { + compilerConfig.optimize = commander.optimize + log.info('compiler optimization set to ' + compilerConfig.optimize) + } + + runTestFiles(path.resolve(testsPath), isDirectory, web3, compilerConfig) }) if (!process.argv.slice(2).length) { diff --git a/libs/remix-tests/src/runTestFiles.ts b/libs/remix-tests/src/runTestFiles.ts index 1bc34c8828..25564e69a6 100644 --- a/libs/remix-tests/src/runTestFiles.ts +++ b/libs/remix-tests/src/runTestFiles.ts @@ -1,7 +1,7 @@ import async from 'async' import fs from './fileSystem' import { runTest } from './testRunner' -import { TestResultInterface, ResultsInterface, compilationInterface, ASTInterface, Options, AstNode } from './types' +import { TestResultInterface, ResultsInterface, CompilerConfiguration, compilationInterface, ASTInterface, Options, AstNode } from './types' import colors from 'colors' import Web3 from 'web3'; @@ -18,8 +18,9 @@ import { deployAll } from './deployer' */ // eslint-disable-next-line @typescript-eslint/no-empty-function -export function runTestFiles(filepath: string, isDirectory: boolean, web3: Web3, finalCallback: any = () => {}, opts?: Options) { +export function runTestFiles(filepath: string, isDirectory: boolean, web3: Web3, compilerConfig: CompilerConfiguration, finalCallback: any = () => {}, opts?: Options) { opts = opts || {} + compilerConfig = compilerConfig || {} as CompilerConfiguration const sourceASTs: any = {} const { Signale } = require('signale') // signale configuration @@ -53,7 +54,7 @@ export function runTestFiles(filepath: string, isDirectory: boolean, web3: Web3, }) }, function compile(next) { - compileFileOrFiles(filepath, isDirectory, { accounts }, next) + compileFileOrFiles(filepath, isDirectory, { accounts }, compilerConfig, next) }, function deployAllContracts (compilationResult: compilationInterface, asts: ASTInterface, next) { // Extract AST of test contract file source From 5745e9dac43638fe5ff21310a1c6b73b91923dfd Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 15 Jan 2021 16:12:18 +0530 Subject: [PATCH 03/41] added new options --- libs/remix-tests/src/run.ts | 7 +++++-- libs/remix-tests/src/types.ts | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index 31318a1ccb..2fed37bd6e 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -45,8 +45,11 @@ commander.command('help').description('output usage information').action(functio // get current version commander - .option('-v, --verbose ', 'run with verbosity', mapVerbosity) - .option('-o, --optimize ', 'run compiler optimization', mapOptimize) + .option('-c, --compiler ', 'set compiler version') + .option('-e, --evm ', 'set EVM version') + .option('-o, --optimize ', 'enable/disable optimization', mapOptimize) + .option('-r, --runs ', 'set runs') + .option('-v, --verbose ', 'set verbosity level', mapVerbosity) .action(async (testsPath) => { // Check if path exists diff --git a/libs/remix-tests/src/types.ts b/libs/remix-tests/src/types.ts index 67293ba38b..e0953d0a7c 100644 --- a/libs/remix-tests/src/types.ts +++ b/libs/remix-tests/src/types.ts @@ -53,7 +53,7 @@ export interface CompilerConfiguration { currentCompilerUrl: string, evmVersion: string, optimize: boolean, - usingWorker: boolean, + usingWorker?: boolean, runs: number } From 96fabf9f1df47c79bf9f38e99d04b1e4da503fe6 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Fri, 15 Jan 2021 16:31:31 +0530 Subject: [PATCH 04/41] tests working --- libs/remix-tests/src/compiler.ts | 9 +++++---- libs/remix-tests/tests/testRunner.cli.spec.ts | 14 +++++++++----- libs/remix-tests/tests/testRunner.spec.ts | 2 +- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 4039ef803b..df771f1b4a 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -125,11 +125,12 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: } finally { async.waterfall([ function loadCompiler(next) { - const {currentCompilerUrl, evmVersion, optimize, usingWorker} = compilerConfig compiler = new RemixCompiler() - compiler.set('evmVersion', evmVersion) - compiler.set('optimize', optimize) - // compiler.loadVersion(usingWorker, currentCompilerUrl) + if(compilerConfig) { + const {currentCompilerUrl, evmVersion, optimize, usingWorker} = compilerConfig + compiler.set('evmVersion', evmVersion) + compiler.set('optimize', optimize) + } compiler.onInternalCompilerLoaded() // compiler.event.register('compilerLoaded', this, function (version) { next() diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index a203a0d0f5..7708b3bf7d 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -22,13 +22,17 @@ describe('testRunner: remix-tests CLI', () => { const expectedHelp = `Usage: remix-tests [options] [command] Options: - -V, --version output the version number - -v, --verbose run with verbosity - -h, --help output usage information + -V, --version output the version number + -c, --compiler set compiler version + -e, --evm set EVM version + -o, --optimize enable/disable optimization + -r, --runs set runs + -v, --verbose set verbosity level + -h, --help output usage information Commands: - version output the version number - help output usage information` + version output the version number + help output usage information` expect(res.stdout.toString().trim()).toBe(expectedHelp) }) diff --git a/libs/remix-tests/tests/testRunner.spec.ts b/libs/remix-tests/tests/testRunner.spec.ts index ce4032f614..f545c87d44 100644 --- a/libs/remix-tests/tests/testRunner.spec.ts +++ b/libs/remix-tests/tests/testRunner.spec.ts @@ -57,7 +57,7 @@ async function compileAndDeploy(filename: string, callback: Function) { }) }, function compile(next: Function): void { - compileFileOrFiles(filename, false, { accounts }, next) + compileFileOrFiles(filename, false, { accounts }, null, next) }, function deployAllContracts(compilationResult: compilationInterface, asts, next: Function): void { for(const filename in asts) { From 5628654383d773f253fb4ffd52d5f11719d13831 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 18 Jan 2021 15:03:15 +0530 Subject: [PATCH 05/41] compiler options implemented --- libs/remix-tests/src/compiler.ts | 10 +- libs/remix-tests/src/run.ts | 30 +- libs/remix-tests/tests/testRunner.cli.spec.ts | 2 +- libs/remix-tests/tests/testRunner.spec.ts | 800 +++++++++--------- 4 files changed, 429 insertions(+), 413 deletions(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index df771f1b4a..49b58d6e15 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -126,11 +126,11 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: async.waterfall([ function loadCompiler(next) { compiler = new RemixCompiler() - if(compilerConfig) { - const {currentCompilerUrl, evmVersion, optimize, usingWorker} = compilerConfig - compiler.set('evmVersion', evmVersion) - compiler.set('optimize', optimize) - } + const {currentCompilerUrl, evmVersion, optimize, runs} = compilerConfig + evmVersion ? compiler.set('evmVersion', evmVersion) : + optimize ? compiler.set('optimize', optimize) : + runs ? compiler.set('runs', runs) : + currentCompilerUrl ? compiler.loadVersion('false', currentCompilerUrl) : compiler.onInternalCompilerLoaded() // compiler.event.register('compilerLoaded', this, function (version) { next() diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index 2fed37bd6e..d300807c66 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -1,6 +1,7 @@ import commander from 'commander' -import Web3 from 'web3'; +import Web3 from 'web3' import path from 'path' +import axios, { AxiosResponse } from 'axios' import { runTestFiles } from './runTestFiles' import fs from './fileSystem' import { Provider } from '@remix-project/remix-simulator' @@ -45,7 +46,7 @@ commander.command('help').description('output usage information').action(functio // get current version commander - .option('-c, --compiler ', 'set compiler version') + .option('-c, --compiler ', 'set compiler version (e.g: 0.6.1, 0.7.1 etc)') .option('-e, --evm ', 'set EVM version') .option('-o, --optimize ', 'enable/disable optimization', mapOptimize) .option('-r, --runs ', 'set runs') @@ -76,17 +77,32 @@ commander log.info('verbosity level set to ' + commander.verbose.blue) } - const web3 = new Web3() - const provider: any = new Provider() - await provider.init() - web3.setProvider(provider) + let compilerConfig = {} as CompilerConfiguration + if (commander.compiler) { + const compVersion = commander.compiler + const baseURL = 'https://binaries.soliditylang.org/wasm/' + const response: AxiosResponse = await axios.get(baseURL + 'list.json') + const { releases, latestRelease } = response.data + const compString = releases[compVersion] + if(!compString) { + log.error(`No compiler found in releases with version ${compVersion}`) + process.exit() + } else { + log.info(`Compiler version set to ${compVersion}. Latest version is ${latestRelease}`) + compilerConfig.currentCompilerUrl = baseURL + '/' + compString + } + } - const compilerConfig = {} as CompilerConfiguration if (commander.optimize) { compilerConfig.optimize = commander.optimize log.info('compiler optimization set to ' + compilerConfig.optimize) } + const web3 = new Web3() + const provider: any = new Provider() + await provider.init() + web3.setProvider(provider) + runTestFiles(path.resolve(testsPath), isDirectory, web3, compilerConfig) }) diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 7708b3bf7d..952a1623c8 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -23,7 +23,7 @@ describe('testRunner: remix-tests CLI', () => { Options: -V, --version output the version number - -c, --compiler set compiler version + -c, --compiler set compiler version (e.g: 0.6.1, 0.7.1 etc) -e, --evm set EVM version -o, --optimize enable/disable optimization -r, --runs set runs diff --git a/libs/remix-tests/tests/testRunner.spec.ts b/libs/remix-tests/tests/testRunner.spec.ts index f545c87d44..95005e83ea 100644 --- a/libs/remix-tests/tests/testRunner.spec.ts +++ b/libs/remix-tests/tests/testRunner.spec.ts @@ -78,404 +78,404 @@ async function compileAndDeploy(filename: string, callback: Function) { // Use `export NODE_OPTIONS="--max-old-space-size=4096"` if there is a JavaScript heap out of memory issue -describe('testRunner', () => { - let tests: any[] = [], results: ResultsInterface; - - const testCallback: TestCbInterface = (err, test) => { - if (err) { throw err } - - if (test.type === 'testPass' || test.type === 'testFailure') { - assert.ok(test.time, 'test time not reported') - assert.ok(!Number.isInteger(test.time || 0), 'test time should not be an integer') - } - - tests.push(test) - } - - const resultsCallback: Function = (done) => { - return (err, _results) => { - if (err) { throw err } - results = _results - done() - } - } - - describe('#runTest', () => { - - describe('assert library OK method tests', () => { - const filename: string = __dirname + '/examples_0/assert_ok_test.sol' - - beforeAll((done) => { - compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { - runTest('AssertOkTest', contracts.AssertOkTest, compilationData[filename]['AssertOkTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 1 passing test', () => { - assert.equal(results.passingNum, 1) - }) - - it('should have 1 failing test', () => { - assert.equal(results.failureNum, 1) - }) - - it('should return', () => { - deepEqualExcluding(tests, [ - { type: 'accountList', value: accounts }, - { type: 'contract', value: 'AssertOkTest', filename: __dirname + '/examples_0/assert_ok_test.sol' }, - { type: 'testPass', value: 'Ok pass test', filename: __dirname + '/examples_0/assert_ok_test.sol', context: 'AssertOkTest' }, - { type: 'testFailure', value: 'Ok fail test', filename: __dirname + '/examples_0/assert_ok_test.sol', errMsg: 'okFailTest fails', context: 'AssertOkTest', assertMethod: 'ok', location: '234:36:0', expected: 'true', returned: 'false'}, +// describe('testRunner', () => { +// let tests: any[] = [], results: ResultsInterface; + +// const testCallback: TestCbInterface = (err, test) => { +// if (err) { throw err } + +// if (test.type === 'testPass' || test.type === 'testFailure') { +// assert.ok(test.time, 'test time not reported') +// assert.ok(!Number.isInteger(test.time || 0), 'test time should not be an integer') +// } + +// tests.push(test) +// } + +// const resultsCallback: Function = (done) => { +// return (err, _results) => { +// if (err) { throw err } +// results = _results +// done() +// } +// } + +// describe('#runTest', () => { + +// describe('assert library OK method tests', () => { +// const filename: string = __dirname + '/examples_0/assert_ok_test.sol' + +// beforeAll((done) => { +// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { +// runTest('AssertOkTest', contracts.AssertOkTest, compilationData[filename]['AssertOkTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 1 passing test', () => { +// assert.equal(results.passingNum, 1) +// }) + +// it('should have 1 failing test', () => { +// assert.equal(results.failureNum, 1) +// }) + +// it('should return', () => { +// deepEqualExcluding(tests, [ +// { type: 'accountList', value: accounts }, +// { type: 'contract', value: 'AssertOkTest', filename: __dirname + '/examples_0/assert_ok_test.sol' }, +// { type: 'testPass', value: 'Ok pass test', filename: __dirname + '/examples_0/assert_ok_test.sol', context: 'AssertOkTest' }, +// { type: 'testFailure', value: 'Ok fail test', filename: __dirname + '/examples_0/assert_ok_test.sol', errMsg: 'okFailTest fails', context: 'AssertOkTest', assertMethod: 'ok', location: '234:36:0', expected: 'true', returned: 'false'}, - ], ['time']) - }) - }) - - describe('assert library EQUAL method tests', () => { - const filename: string = __dirname + '/examples_0/assert_equal_test.sol' - - beforeAll((done) => { - compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { - runTest('AssertEqualTest', contracts.AssertEqualTest, compilationData[filename]['AssertEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 6 passing test', () => { - assert.equal(results.passingNum, 6) - }) - - it('should have 6 failing test', () => { - assert.equal(results.failureNum, 6) - }) - - it('should return', () => { - deepEqualExcluding(tests, [ - { type: 'accountList', value: accounts }, - { type: 'contract', value: 'AssertEqualTest', filename: __dirname + '/examples_0/assert_equal_test.sol' }, - { type: 'testPass', value: 'Equal uint pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, - { type: 'testFailure', value: 'Equal uint fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalUintFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '273:57:0', expected: '2', returned: '1'}, - { type: 'testPass', value: 'Equal int pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, - { type: 'testFailure', value: 'Equal int fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalIntFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '493:45:0', expected: '2', returned: '-1'}, - { type: 'testPass', value: 'Equal bool pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, - { type: 'testFailure', value: 'Equal bool fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBoolFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '708:52:0', expected: false, returned: true}, - { type: 'testPass', value: 'Equal address pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, - { type: 'testFailure', value: 'Equal address fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalAddressFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1015:130:0', expected: '0x1c6637567229159d1eFD45f95A6675e77727E013', returned: '0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9'}, - { type: 'testPass', value: 'Equal bytes32 pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, - { type: 'testFailure', value: 'Equal bytes32 fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBytes32FailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1670:48:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6979000000000000000000000000000000000000000000000000000000'}, - { type: 'testPass', value: 'Equal string pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, - { type: 'testFailure', value: 'Equal string fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalStringFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1916:81:0', expected: 'remix-tests', returned: 'remix'} - ], ['time']) - }) - }) - - describe('assert library NOTEQUAL method tests', () => { - const filename: string = __dirname + '/examples_0/assert_notEqual_test.sol' - - beforeAll((done) => { - compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { - runTest('AssertNotEqualTest', contracts.AssertNotEqualTest, compilationData[filename]['AssertNotEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 6 passing test', () => { - assert.equal(results.passingNum, 6) - }) - - it('should have 6 failing test', () => { - assert.equal(results.failureNum, 6) - }) - - it('should return', () => { - deepEqualExcluding(tests, [ - { type: 'accountList', value: accounts }, - { type: 'contract', value: 'AssertNotEqualTest', filename: __dirname + '/examples_0/assert_notEqual_test.sol' }, - { type: 'testPass', value: 'Not equal uint pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, - { type: 'testFailure', value: 'Not equal uint fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualUintFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '288:63:0', expected: '1', returned: '1'}, - { type: 'testPass', value: 'Not equal int pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, - { type: 'testFailure', value: 'Not equal int fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualIntFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '525:52:0', expected: '-2', returned: '-2'}, - { type: 'testPass', value: 'Not equal bool pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, - { type: 'testFailure', value: 'Not equal bool fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBoolFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '760:57:0', expected: true, returned: true}, - { type: 'testPass', value: 'Not equal address pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, - { type: 'testFailure', value: 'Not equal address fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualAddressFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1084:136:0', expected: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9, returned: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9}, - { type: 'testPass', value: 'Not equal bytes32 pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, - { type: 'testFailure', value: 'Not equal bytes32 fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBytes32FailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1756:54:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6978000000000000000000000000000000000000000000000000000000'}, - { type: 'testPass', value: 'Not equal string pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, - { type: 'testFailure', value: 'Not equal string fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualStringFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '2026:81:0', expected: 'remix', returned: 'remix'}, - ], ['time']) - }) - }) - - describe('assert library GREATERTHAN method tests', () => { - const filename: string = __dirname + '/examples_0/assert_greaterThan_test.sol' - - beforeAll((done) => { - compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { - runTest('AssertGreaterThanTest', contracts.AssertGreaterThanTest, compilationData[filename]['AssertGreaterThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 4 passing test', () => { - assert.equal(results.passingNum, 4) - }) - - it('should have 4 failing test', () => { - assert.equal(results.failureNum, 4) - }) - it('should return', () => { - deepEqualExcluding(tests, [ - { type: 'accountList', value: accounts }, - { type: 'contract', value: 'AssertGreaterThanTest', filename: __dirname + '/examples_0/assert_greaterThan_test.sol' }, - { type: 'testPass', value: 'Greater than uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, - { type: 'testFailure', value: 'Greater than uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '303:69:0', expected: '4', returned: '1'}, - { type: 'testPass', value: 'Greater than int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, - { type: 'testFailure', value: 'Greater than int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '569:67:0', expected: '1', returned: '-1'}, - { type: 'testPass', value: 'Greater than uint int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, - { type: 'testFailure', value: 'Greater than uint int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '845:71:0', expected: '2', returned: '1'}, - { type: 'testPass', value: 'Greater than int uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, - { type: 'testFailure', value: 'Greater than int uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '1125:76:0', expected: '115792089237316195423570985008687907853269984665640564039457584007913129639836', returned: '100'} - ], ['time']) - }) - }) - - describe('assert library LESSERTHAN method tests', () => { - const filename: string = __dirname + '/examples_0/assert_lesserThan_test.sol' - - beforeAll((done) => { - compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { - runTest('AssertLesserThanTest', contracts.AssertLesserThanTest, compilationData[filename]['AssertLesserThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 4 passing test', () => { - assert.equal(results.passingNum, 4) - }) - - it('should have 4 failing test', () => { - assert.equal(results.failureNum, 4) - }) - - it('should return', () => { - deepEqualExcluding(tests, [ - { type: 'accountList', value: accounts }, - { type: 'contract', value: 'AssertLesserThanTest', filename: __dirname + '/examples_0/assert_lesserThan_test.sol' }, - { type: 'testPass', value: 'Lesser than uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, - { type: 'testFailure', value: 'Lesser than uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '298:67:0', expected: '2', returned: '4'}, - { type: 'testPass', value: 'Lesser than int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, - { type: 'testFailure', value: 'Lesser than int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '557:65:0', expected: '-1', returned: '1'}, - { type: 'testPass', value: 'Lesser than uint int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, - { type: 'testFailure', value: 'Lesser than uint int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '826:71:0', expected: '-1', returned: '115792089237316195423570985008687907853269984665640564039457584007913129639935'}, - { type: 'testPass', value: 'Lesser than int uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, - { type: 'testFailure', value: 'Lesser than int uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '1105:69:0', expected: '1', returned: '1'}, - ], ['time']) - }) - }) - - describe('test with beforeAll', () => { - const filename: string = __dirname + '/examples_1/simple_storage_test.sol' - - beforeAll((done) => { - compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { - runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 3 passing test', () => { - assert.equal(results.passingNum, 3) - }) - - it('should have 1 failing test', () => { - assert.equal(results.failureNum, 1) - }) - - it('should return 6 messages', () => { - deepEqualExcluding(tests, [ - { type: 'accountList', value: accounts }, - { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_1/simple_storage_test.sol' }, - { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, - { type: 'testPass', value: 'Initial value should not be200', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, - { type: 'testFailure', value: 'Should trigger one fail', filename: __dirname + '/examples_1/simple_storage_test.sol', errMsg: 'uint test 1 fails', context: 'MyTest', assertMethod: 'equal', location: '532:51:1', expected: '2', returned: '1'}, - { type: 'testPass', value: 'Should trigger one pass', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' } - ], ['time']) - }) - }) - - describe('test with beforeEach', () => { - const filename: string = __dirname + '/examples_2/simple_storage_test.sol' - - beforeAll(done => { - compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { - runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 2 passing tests', () => { - assert.equal(results.passingNum, 2) - }) - - it('should 0 failing tests', () => { - assert.equal(results.failureNum, 0) - }) - - it('should return 4 messages', () => { - deepEqualExcluding(tests, [ - { type: 'accountList', value: accounts }, - { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_2/simple_storage_test.sol' }, - { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' }, - { type: 'testPass', value: 'Value is set200', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' } - ], ['time']) - }) - }) - - // Test string equality - describe('test string equality', () => { - const filename: string = __dirname + '/examples_3/simple_string_test.sol' - - beforeAll(done => { - compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { - runTest('StringTest', contracts.StringTest, compilationData[filename]['StringTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should 2 passing tests', () => { - assert.equal(results.passingNum, 2) - }) - - it('should return 4 messages', () => { - deepEqualExcluding(tests, [ - { type: 'accountList', value: accounts }, - { type: 'contract', value: 'StringTest', filename: __dirname + '/examples_3/simple_string_test.sol' }, - { type: 'testPass', value: 'Initial value should be hello world', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' }, - { type: 'testPass', value: 'Value should not be hello wordl', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' } - ], ['time']) - }) - }) - - // Test multiple directory import in test contract - describe('test multiple directory import in test contract', () => { - const filename: string = __dirname + '/examples_5/test/simple_storage_test.sol' - - beforeAll(done => { - compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { - runTest('StorageResolveTest', contracts.StorageResolveTest, compilationData[filename]['StorageResolveTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should 3 passing tests', () => { - assert.equal(results.passingNum, 3) - }) - - it('should return 4 messages', () => { - deepEqualExcluding(tests, [ - { type: 'accountList', value: accounts }, - { type: 'contract', value: 'StorageResolveTest', filename: __dirname + '/examples_5/test/simple_storage_test.sol' }, - { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, - { type: 'testPass', value: 'Check if even', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, - { type: 'testPass', value: 'Check if odd', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' } - ], ['time']) - }) - }) - - //Test SafeMath library methods - describe('test SafeMath library', () => { - const filename: string = __dirname + '/examples_4/SafeMath_test.sol' - - beforeAll(done => { - compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { - runTest('SafeMathTest', contracts.SafeMathTest, compilationData[filename]['SafeMathTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 10 passing tests', () => { - assert.equal(results.passingNum, 10) - }) - it('should have 0 failing tests', () => { - assert.equal(results.failureNum, 0) - }) - }) - - //Test signed/unsigned integer weight - describe('test number weight', () => { - const filename: string = __dirname + '/number/number_test.sol' - - beforeAll(done => { - compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { - runTest('IntegerTest', contracts.IntegerTest, compilationData[filename]['IntegerTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 6 passing tests', () => { - assert.equal(results.passingNum, 6) - }) - it('should have 2 failing tests', () => { - assert.equal(results.failureNum, 2) - }) - }) - - // Test Transaction with custom sender & value - describe('various sender', () => { - const filename: string = __dirname + '/various_sender/sender_and_value_test.sol' - - beforeAll(done => { - compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { - runTest('SenderAndValueTest', contracts.SenderAndValueTest, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) - }) - }) - - afterAll(() => { tests = [] }) - - it('should have 17 passing tests', () => { - assert.equal(results.passingNum, 17) - }) - it('should have 0 failing tests', () => { - assert.equal(results.failureNum, 0) - }) - }) - - // Test `runTest` method without sending contract object (should throw error) - describe('runTest method without contract json interface', () => { - const filename: string = __dirname + '/various_sender/sender_and_value_test.sol' - const errorCallback: Function = (done) => { - return (err, _results) => { - if (err && err.message.includes('Contract interface not available')) { - results = _results - done() - } - else throw err - } - } - beforeAll(done => { - compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { - runTest('SenderAndValueTest', undefined, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, errorCallback(done)) - }) - }) - - it('should have 0 passing tests', () => { - assert.equal(results.passingNum, 0) - }) - it('should have 0 failing tests', () => { - assert.equal(results.failureNum, 0) - }) - }) - }) -}) +// ], ['time']) +// }) +// }) + +// describe('assert library EQUAL method tests', () => { +// const filename: string = __dirname + '/examples_0/assert_equal_test.sol' + +// beforeAll((done) => { +// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { +// runTest('AssertEqualTest', contracts.AssertEqualTest, compilationData[filename]['AssertEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 6 passing test', () => { +// assert.equal(results.passingNum, 6) +// }) + +// it('should have 6 failing test', () => { +// assert.equal(results.failureNum, 6) +// }) + +// it('should return', () => { +// deepEqualExcluding(tests, [ +// { type: 'accountList', value: accounts }, +// { type: 'contract', value: 'AssertEqualTest', filename: __dirname + '/examples_0/assert_equal_test.sol' }, +// { type: 'testPass', value: 'Equal uint pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, +// { type: 'testFailure', value: 'Equal uint fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalUintFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '273:57:0', expected: '2', returned: '1'}, +// { type: 'testPass', value: 'Equal int pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, +// { type: 'testFailure', value: 'Equal int fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalIntFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '493:45:0', expected: '2', returned: '-1'}, +// { type: 'testPass', value: 'Equal bool pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, +// { type: 'testFailure', value: 'Equal bool fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBoolFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '708:52:0', expected: false, returned: true}, +// { type: 'testPass', value: 'Equal address pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, +// { type: 'testFailure', value: 'Equal address fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalAddressFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1015:130:0', expected: '0x1c6637567229159d1eFD45f95A6675e77727E013', returned: '0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9'}, +// { type: 'testPass', value: 'Equal bytes32 pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, +// { type: 'testFailure', value: 'Equal bytes32 fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBytes32FailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1670:48:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6979000000000000000000000000000000000000000000000000000000'}, +// { type: 'testPass', value: 'Equal string pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, +// { type: 'testFailure', value: 'Equal string fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalStringFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1916:81:0', expected: 'remix-tests', returned: 'remix'} +// ], ['time']) +// }) +// }) + +// describe('assert library NOTEQUAL method tests', () => { +// const filename: string = __dirname + '/examples_0/assert_notEqual_test.sol' + +// beforeAll((done) => { +// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { +// runTest('AssertNotEqualTest', contracts.AssertNotEqualTest, compilationData[filename]['AssertNotEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 6 passing test', () => { +// assert.equal(results.passingNum, 6) +// }) + +// it('should have 6 failing test', () => { +// assert.equal(results.failureNum, 6) +// }) + +// it('should return', () => { +// deepEqualExcluding(tests, [ +// { type: 'accountList', value: accounts }, +// { type: 'contract', value: 'AssertNotEqualTest', filename: __dirname + '/examples_0/assert_notEqual_test.sol' }, +// { type: 'testPass', value: 'Not equal uint pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, +// { type: 'testFailure', value: 'Not equal uint fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualUintFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '288:63:0', expected: '1', returned: '1'}, +// { type: 'testPass', value: 'Not equal int pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, +// { type: 'testFailure', value: 'Not equal int fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualIntFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '525:52:0', expected: '-2', returned: '-2'}, +// { type: 'testPass', value: 'Not equal bool pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, +// { type: 'testFailure', value: 'Not equal bool fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBoolFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '760:57:0', expected: true, returned: true}, +// { type: 'testPass', value: 'Not equal address pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, +// { type: 'testFailure', value: 'Not equal address fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualAddressFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1084:136:0', expected: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9, returned: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9}, +// { type: 'testPass', value: 'Not equal bytes32 pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, +// { type: 'testFailure', value: 'Not equal bytes32 fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBytes32FailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1756:54:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6978000000000000000000000000000000000000000000000000000000'}, +// { type: 'testPass', value: 'Not equal string pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, +// { type: 'testFailure', value: 'Not equal string fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualStringFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '2026:81:0', expected: 'remix', returned: 'remix'}, +// ], ['time']) +// }) +// }) + +// describe('assert library GREATERTHAN method tests', () => { +// const filename: string = __dirname + '/examples_0/assert_greaterThan_test.sol' + +// beforeAll((done) => { +// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { +// runTest('AssertGreaterThanTest', contracts.AssertGreaterThanTest, compilationData[filename]['AssertGreaterThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 4 passing test', () => { +// assert.equal(results.passingNum, 4) +// }) + +// it('should have 4 failing test', () => { +// assert.equal(results.failureNum, 4) +// }) +// it('should return', () => { +// deepEqualExcluding(tests, [ +// { type: 'accountList', value: accounts }, +// { type: 'contract', value: 'AssertGreaterThanTest', filename: __dirname + '/examples_0/assert_greaterThan_test.sol' }, +// { type: 'testPass', value: 'Greater than uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, +// { type: 'testFailure', value: 'Greater than uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '303:69:0', expected: '4', returned: '1'}, +// { type: 'testPass', value: 'Greater than int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, +// { type: 'testFailure', value: 'Greater than int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '569:67:0', expected: '1', returned: '-1'}, +// { type: 'testPass', value: 'Greater than uint int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, +// { type: 'testFailure', value: 'Greater than uint int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '845:71:0', expected: '2', returned: '1'}, +// { type: 'testPass', value: 'Greater than int uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, +// { type: 'testFailure', value: 'Greater than int uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '1125:76:0', expected: '115792089237316195423570985008687907853269984665640564039457584007913129639836', returned: '100'} +// ], ['time']) +// }) +// }) + +// describe('assert library LESSERTHAN method tests', () => { +// const filename: string = __dirname + '/examples_0/assert_lesserThan_test.sol' + +// beforeAll((done) => { +// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { +// runTest('AssertLesserThanTest', contracts.AssertLesserThanTest, compilationData[filename]['AssertLesserThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 4 passing test', () => { +// assert.equal(results.passingNum, 4) +// }) + +// it('should have 4 failing test', () => { +// assert.equal(results.failureNum, 4) +// }) + +// it('should return', () => { +// deepEqualExcluding(tests, [ +// { type: 'accountList', value: accounts }, +// { type: 'contract', value: 'AssertLesserThanTest', filename: __dirname + '/examples_0/assert_lesserThan_test.sol' }, +// { type: 'testPass', value: 'Lesser than uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, +// { type: 'testFailure', value: 'Lesser than uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '298:67:0', expected: '2', returned: '4'}, +// { type: 'testPass', value: 'Lesser than int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, +// { type: 'testFailure', value: 'Lesser than int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '557:65:0', expected: '-1', returned: '1'}, +// { type: 'testPass', value: 'Lesser than uint int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, +// { type: 'testFailure', value: 'Lesser than uint int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '826:71:0', expected: '-1', returned: '115792089237316195423570985008687907853269984665640564039457584007913129639935'}, +// { type: 'testPass', value: 'Lesser than int uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, +// { type: 'testFailure', value: 'Lesser than int uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '1105:69:0', expected: '1', returned: '1'}, +// ], ['time']) +// }) +// }) + +// describe('test with beforeAll', () => { +// const filename: string = __dirname + '/examples_1/simple_storage_test.sol' + +// beforeAll((done) => { +// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { +// runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 3 passing test', () => { +// assert.equal(results.passingNum, 3) +// }) + +// it('should have 1 failing test', () => { +// assert.equal(results.failureNum, 1) +// }) + +// it('should return 6 messages', () => { +// deepEqualExcluding(tests, [ +// { type: 'accountList', value: accounts }, +// { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_1/simple_storage_test.sol' }, +// { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, +// { type: 'testPass', value: 'Initial value should not be200', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, +// { type: 'testFailure', value: 'Should trigger one fail', filename: __dirname + '/examples_1/simple_storage_test.sol', errMsg: 'uint test 1 fails', context: 'MyTest', assertMethod: 'equal', location: '532:51:1', expected: '2', returned: '1'}, +// { type: 'testPass', value: 'Should trigger one pass', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' } +// ], ['time']) +// }) +// }) + +// describe('test with beforeEach', () => { +// const filename: string = __dirname + '/examples_2/simple_storage_test.sol' + +// beforeAll(done => { +// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { +// runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 2 passing tests', () => { +// assert.equal(results.passingNum, 2) +// }) + +// it('should 0 failing tests', () => { +// assert.equal(results.failureNum, 0) +// }) + +// it('should return 4 messages', () => { +// deepEqualExcluding(tests, [ +// { type: 'accountList', value: accounts }, +// { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_2/simple_storage_test.sol' }, +// { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' }, +// { type: 'testPass', value: 'Value is set200', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' } +// ], ['time']) +// }) +// }) + +// // Test string equality +// describe('test string equality', () => { +// const filename: string = __dirname + '/examples_3/simple_string_test.sol' + +// beforeAll(done => { +// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { +// runTest('StringTest', contracts.StringTest, compilationData[filename]['StringTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should 2 passing tests', () => { +// assert.equal(results.passingNum, 2) +// }) + +// it('should return 4 messages', () => { +// deepEqualExcluding(tests, [ +// { type: 'accountList', value: accounts }, +// { type: 'contract', value: 'StringTest', filename: __dirname + '/examples_3/simple_string_test.sol' }, +// { type: 'testPass', value: 'Initial value should be hello world', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' }, +// { type: 'testPass', value: 'Value should not be hello wordl', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' } +// ], ['time']) +// }) +// }) + +// // Test multiple directory import in test contract +// describe('test multiple directory import in test contract', () => { +// const filename: string = __dirname + '/examples_5/test/simple_storage_test.sol' + +// beforeAll(done => { +// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { +// runTest('StorageResolveTest', contracts.StorageResolveTest, compilationData[filename]['StorageResolveTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should 3 passing tests', () => { +// assert.equal(results.passingNum, 3) +// }) + +// it('should return 4 messages', () => { +// deepEqualExcluding(tests, [ +// { type: 'accountList', value: accounts }, +// { type: 'contract', value: 'StorageResolveTest', filename: __dirname + '/examples_5/test/simple_storage_test.sol' }, +// { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, +// { type: 'testPass', value: 'Check if even', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, +// { type: 'testPass', value: 'Check if odd', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' } +// ], ['time']) +// }) +// }) + +// //Test SafeMath library methods +// describe('test SafeMath library', () => { +// const filename: string = __dirname + '/examples_4/SafeMath_test.sol' + +// beforeAll(done => { +// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { +// runTest('SafeMathTest', contracts.SafeMathTest, compilationData[filename]['SafeMathTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 10 passing tests', () => { +// assert.equal(results.passingNum, 10) +// }) +// it('should have 0 failing tests', () => { +// assert.equal(results.failureNum, 0) +// }) +// }) + +// //Test signed/unsigned integer weight +// describe('test number weight', () => { +// const filename: string = __dirname + '/number/number_test.sol' + +// beforeAll(done => { +// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { +// runTest('IntegerTest', contracts.IntegerTest, compilationData[filename]['IntegerTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 6 passing tests', () => { +// assert.equal(results.passingNum, 6) +// }) +// it('should have 2 failing tests', () => { +// assert.equal(results.failureNum, 2) +// }) +// }) + +// // Test Transaction with custom sender & value +// describe('various sender', () => { +// const filename: string = __dirname + '/various_sender/sender_and_value_test.sol' + +// beforeAll(done => { +// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { +// runTest('SenderAndValueTest', contracts.SenderAndValueTest, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) +// }) +// }) + +// afterAll(() => { tests = [] }) + +// it('should have 17 passing tests', () => { +// assert.equal(results.passingNum, 17) +// }) +// it('should have 0 failing tests', () => { +// assert.equal(results.failureNum, 0) +// }) +// }) + +// // Test `runTest` method without sending contract object (should throw error) +// describe('runTest method without contract json interface', () => { +// const filename: string = __dirname + '/various_sender/sender_and_value_test.sol' +// const errorCallback: Function = (done) => { +// return (err, _results) => { +// if (err && err.message.includes('Contract interface not available')) { +// results = _results +// done() +// } +// else throw err +// } +// } +// beforeAll(done => { +// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { +// runTest('SenderAndValueTest', undefined, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, errorCallback(done)) +// }) +// }) + +// it('should have 0 passing tests', () => { +// assert.equal(results.passingNum, 0) +// }) +// it('should have 0 failing tests', () => { +// assert.equal(results.failureNum, 0) +// }) +// }) +// }) +// }) From 508dd8e70aa3d43006eef412d304b838dfdc7de7 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 18 Jan 2021 17:51:25 +0530 Subject: [PATCH 06/41] custom compiler in progress --- libs/remix-solidity/src/compiler/compiler.ts | 35 +++++++++++++++++++ libs/remix-tests/package.json | 2 +- libs/remix-tests/src/compiler.ts | 9 +++-- libs/remix-tests/src/run.ts | 2 +- libs/remix-tests/tests/testRunner.cli.spec.ts | 14 ++++++++ 5 files changed, 55 insertions(+), 7 deletions(-) diff --git a/libs/remix-solidity/src/compiler/compiler.ts b/libs/remix-solidity/src/compiler/compiler.ts index 95e1f92195..5b45a8c41b 100644 --- a/libs/remix-solidity/src/compiler/compiler.ts +++ b/libs/remix-solidity/src/compiler/compiler.ts @@ -163,6 +163,41 @@ export class Compiler { } } + /** + * @dev Load compiler using given version (used by remix-tests CLI) + * @param version compiler version + */ + + loadRemoteVersion (version: string): void { + console.log('Loading remote solc version ' + version) + const compiler: any = require('solc') + compiler.loadRemoteVersion(version, (err, remoteCompiler) => { + if (err) { + console.error('Error in loading remote solc compiler: ', err) + } else { + this.state.compileJSON = (source: SourceWithTarget) => { + const missingInputs: string[] = [] + const missingInputsCallback = (path: string) => { + missingInputs.push(path) + return { error: 'Deferred import' } + } + let result: CompilationResult = {} + try { + if(source && source.sources) { + const {optimize, runs, evmVersion, language} = this.state + const input = compilerInput(source.sources, {optimize, runs, evmVersion, language}) + result = JSON.parse(remoteCompiler.compile(input, { import: missingInputsCallback })) + } + } catch (exception) { + result = { error: { formattedMessage: 'Uncaught JavaScript exception:\n' + exception, severity: 'error', mode: 'panic' } } + } + this.onCompilationFinished(result, missingInputs, source) + } + this.onCompilerLoaded(version) + } + }) + } + /** * @dev Load compiler using given URL (used by IDE) * @param usingWorker if true, load compiler using worker diff --git a/libs/remix-tests/package.json b/libs/remix-tests/package.json index eb9062c841..334f7a402d 100644 --- a/libs/remix-tests/package.json +++ b/libs/remix-tests/package.json @@ -37,7 +37,7 @@ "dependencies": { "@remix-project/remix-lib": "^0.4.31", "@remix-project/remix-simulator": "^0.1.9-beta.8", - "@remix-project/remix-solidity": "^0.3.32", + "@remix-project/remix-solidity": "file:../remix-solidity", "ansi-gray": "^0.1.1", "async": "^2.6.0", "change-case": "^3.0.1", diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 49b58d6e15..0c6c3a0f27 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -130,11 +130,10 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: evmVersion ? compiler.set('evmVersion', evmVersion) : optimize ? compiler.set('optimize', optimize) : runs ? compiler.set('runs', runs) : - currentCompilerUrl ? compiler.loadVersion('false', currentCompilerUrl) : - compiler.onInternalCompilerLoaded() - // compiler.event.register('compilerLoaded', this, function (version) { - next() - // }); + currentCompilerUrl ? compiler.loadRemoteVersion(currentCompilerUrl) : compiler.onInternalCompilerLoaded() + compiler.event.register('compilerLoaded', this, function (version) { + next() + }); }, function doCompilation(next) { // @ts-ignore diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index d300807c66..1ecc09c879 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -89,7 +89,7 @@ commander process.exit() } else { log.info(`Compiler version set to ${compVersion}. Latest version is ${latestRelease}`) - compilerConfig.currentCompilerUrl = baseURL + '/' + compString + compilerConfig.currentCompilerUrl = compString.replace('soljson-', '').replace('.js', '') } } diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 952a1623c8..9347988a50 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -50,5 +50,19 @@ Commands: expect(res.stdout.toString().trim()).toMatch(/expected value to be ok to: true/) expect(res.stdout.toString().trim()).toMatch(/returned: false/) }) + + test('remix-tests running a test file with custom compiler version', () => { + const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) + console.log('res.stdout.toString().trim()---------->', res.stdout.toString().trim()) + // match initial lines + expect(res.stdout.toString().trim()).toMatch(/Loading remote solc version v0.7.4+commit.3f05b770/) + expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) + // match test result + expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) + expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) + // macth fail test details + expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + }) }) }) \ No newline at end of file From 532d2d9834091ec1b994ccc1094e9e4b44d257a6 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Mon, 18 Jan 2021 19:44:56 +0530 Subject: [PATCH 07/41] compiler version tests working fine --- libs/remix-tests/src/compiler.ts | 13 +++++++++---- libs/remix-tests/tests/testRunner.cli.spec.ts | 3 +-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 0c6c3a0f27..9a608ed7e0 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -129,11 +129,16 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: const {currentCompilerUrl, evmVersion, optimize, runs} = compilerConfig evmVersion ? compiler.set('evmVersion', evmVersion) : optimize ? compiler.set('optimize', optimize) : - runs ? compiler.set('runs', runs) : - currentCompilerUrl ? compiler.loadRemoteVersion(currentCompilerUrl) : compiler.onInternalCompilerLoaded() - compiler.event.register('compilerLoaded', this, function (version) { + runs ? compiler.set('runs', runs) : '' + if(currentCompilerUrl) { + compiler.loadRemoteVersion(currentCompilerUrl) + compiler.event.register('compilerLoaded', this, function (version) { + next() + }); + } else { + compiler.onInternalCompilerLoaded() next() - }); + } }, function doCompilation(next) { // @ts-ignore diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 9347988a50..da5152ebb5 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -53,9 +53,8 @@ Commands: test('remix-tests running a test file with custom compiler version', () => { const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) - console.log('res.stdout.toString().trim()---------->', res.stdout.toString().trim()) // match initial lines - expect(res.stdout.toString().trim()).toMatch(/Loading remote solc version v0.7.4+commit.3f05b770/) + expect(res.stdout.toString().trim().includes('Loading remote solc version v0.7.4+commit.3f05b770')).toBeTruthy() expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) // match test result From e986507ce688f28c9b4f3aed1d01ee1c6dc6102e Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 13:53:21 +0530 Subject: [PATCH 08/41] evm option added --- libs/remix-tests/src/run.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index 1ecc09c879..724e71f424 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -93,6 +93,11 @@ commander } } + if (commander.evm) { + compilerConfig.evmVersion = commander.evm + log.info('EVM set to ' + compilerConfig.evmVersion) + } + if (commander.optimize) { compilerConfig.optimize = commander.optimize log.info('compiler optimization set to ' + compilerConfig.optimize) From cf0e2201e39e6b4a65d692da3023b400284ce859 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 14:25:40 +0530 Subject: [PATCH 09/41] tests for custom EVM --- libs/remix-solidity/src/compiler/compiler.ts | 2 +- libs/remix-tests/tests/testRunner.cli.spec.ts | 16 +- libs/remix-tests/tests/testRunner.spec.ts | 800 +++++++++--------- 3 files changed, 416 insertions(+), 402 deletions(-) diff --git a/libs/remix-solidity/src/compiler/compiler.ts b/libs/remix-solidity/src/compiler/compiler.ts index 5b45a8c41b..0c8f9faca0 100644 --- a/libs/remix-solidity/src/compiler/compiler.ts +++ b/libs/remix-solidity/src/compiler/compiler.ts @@ -169,7 +169,7 @@ export class Compiler { */ loadRemoteVersion (version: string): void { - console.log('Loading remote solc version ' + version) + console.log(`Loading remote solc version ${version} ...`) const compiler: any = require('solc') compiler.loadRemoteVersion(version, (err, remoteCompiler) => { if (err) { diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index da5152ebb5..a2a2bfa3d2 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -54,7 +54,21 @@ Commands: test('remix-tests running a test file with custom compiler version', () => { const res = spawnSync(executablePath, ['--compiler', '0.7.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines - expect(res.stdout.toString().trim().includes('Loading remote solc version v0.7.4+commit.3f05b770')).toBeTruthy() + expect(res.stdout.toString().trim().includes('Compiler version set to 0.7.4. Latest version is')).toBeTruthy() + expect(res.stdout.toString().trim().includes('Loading remote solc version v0.7.4+commit.3f05b770 ...')).toBeTruthy() + expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) + // match test result + expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) + expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) + // macth fail test details + expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + }) + + test('remix-tests running a test file with custom EVM', () => { + const res = spawnSync(executablePath, ['--evm', 'petersburg', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) + // match initial lines + expect(res.stdout.toString().trim().includes('EVM set to petersburg')).toBeTruthy() expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) // match test result diff --git a/libs/remix-tests/tests/testRunner.spec.ts b/libs/remix-tests/tests/testRunner.spec.ts index 95005e83ea..f545c87d44 100644 --- a/libs/remix-tests/tests/testRunner.spec.ts +++ b/libs/remix-tests/tests/testRunner.spec.ts @@ -78,404 +78,404 @@ async function compileAndDeploy(filename: string, callback: Function) { // Use `export NODE_OPTIONS="--max-old-space-size=4096"` if there is a JavaScript heap out of memory issue -// describe('testRunner', () => { -// let tests: any[] = [], results: ResultsInterface; - -// const testCallback: TestCbInterface = (err, test) => { -// if (err) { throw err } - -// if (test.type === 'testPass' || test.type === 'testFailure') { -// assert.ok(test.time, 'test time not reported') -// assert.ok(!Number.isInteger(test.time || 0), 'test time should not be an integer') -// } - -// tests.push(test) -// } - -// const resultsCallback: Function = (done) => { -// return (err, _results) => { -// if (err) { throw err } -// results = _results -// done() -// } -// } - -// describe('#runTest', () => { - -// describe('assert library OK method tests', () => { -// const filename: string = __dirname + '/examples_0/assert_ok_test.sol' - -// beforeAll((done) => { -// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { -// runTest('AssertOkTest', contracts.AssertOkTest, compilationData[filename]['AssertOkTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 1 passing test', () => { -// assert.equal(results.passingNum, 1) -// }) - -// it('should have 1 failing test', () => { -// assert.equal(results.failureNum, 1) -// }) - -// it('should return', () => { -// deepEqualExcluding(tests, [ -// { type: 'accountList', value: accounts }, -// { type: 'contract', value: 'AssertOkTest', filename: __dirname + '/examples_0/assert_ok_test.sol' }, -// { type: 'testPass', value: 'Ok pass test', filename: __dirname + '/examples_0/assert_ok_test.sol', context: 'AssertOkTest' }, -// { type: 'testFailure', value: 'Ok fail test', filename: __dirname + '/examples_0/assert_ok_test.sol', errMsg: 'okFailTest fails', context: 'AssertOkTest', assertMethod: 'ok', location: '234:36:0', expected: 'true', returned: 'false'}, +describe('testRunner', () => { + let tests: any[] = [], results: ResultsInterface; + + const testCallback: TestCbInterface = (err, test) => { + if (err) { throw err } + + if (test.type === 'testPass' || test.type === 'testFailure') { + assert.ok(test.time, 'test time not reported') + assert.ok(!Number.isInteger(test.time || 0), 'test time should not be an integer') + } + + tests.push(test) + } + + const resultsCallback: Function = (done) => { + return (err, _results) => { + if (err) { throw err } + results = _results + done() + } + } + + describe('#runTest', () => { + + describe('assert library OK method tests', () => { + const filename: string = __dirname + '/examples_0/assert_ok_test.sol' + + beforeAll((done) => { + compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { + runTest('AssertOkTest', contracts.AssertOkTest, compilationData[filename]['AssertOkTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 1 passing test', () => { + assert.equal(results.passingNum, 1) + }) + + it('should have 1 failing test', () => { + assert.equal(results.failureNum, 1) + }) + + it('should return', () => { + deepEqualExcluding(tests, [ + { type: 'accountList', value: accounts }, + { type: 'contract', value: 'AssertOkTest', filename: __dirname + '/examples_0/assert_ok_test.sol' }, + { type: 'testPass', value: 'Ok pass test', filename: __dirname + '/examples_0/assert_ok_test.sol', context: 'AssertOkTest' }, + { type: 'testFailure', value: 'Ok fail test', filename: __dirname + '/examples_0/assert_ok_test.sol', errMsg: 'okFailTest fails', context: 'AssertOkTest', assertMethod: 'ok', location: '234:36:0', expected: 'true', returned: 'false'}, -// ], ['time']) -// }) -// }) - -// describe('assert library EQUAL method tests', () => { -// const filename: string = __dirname + '/examples_0/assert_equal_test.sol' - -// beforeAll((done) => { -// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { -// runTest('AssertEqualTest', contracts.AssertEqualTest, compilationData[filename]['AssertEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 6 passing test', () => { -// assert.equal(results.passingNum, 6) -// }) - -// it('should have 6 failing test', () => { -// assert.equal(results.failureNum, 6) -// }) - -// it('should return', () => { -// deepEqualExcluding(tests, [ -// { type: 'accountList', value: accounts }, -// { type: 'contract', value: 'AssertEqualTest', filename: __dirname + '/examples_0/assert_equal_test.sol' }, -// { type: 'testPass', value: 'Equal uint pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, -// { type: 'testFailure', value: 'Equal uint fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalUintFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '273:57:0', expected: '2', returned: '1'}, -// { type: 'testPass', value: 'Equal int pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, -// { type: 'testFailure', value: 'Equal int fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalIntFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '493:45:0', expected: '2', returned: '-1'}, -// { type: 'testPass', value: 'Equal bool pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, -// { type: 'testFailure', value: 'Equal bool fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBoolFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '708:52:0', expected: false, returned: true}, -// { type: 'testPass', value: 'Equal address pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, -// { type: 'testFailure', value: 'Equal address fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalAddressFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1015:130:0', expected: '0x1c6637567229159d1eFD45f95A6675e77727E013', returned: '0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9'}, -// { type: 'testPass', value: 'Equal bytes32 pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, -// { type: 'testFailure', value: 'Equal bytes32 fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBytes32FailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1670:48:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6979000000000000000000000000000000000000000000000000000000'}, -// { type: 'testPass', value: 'Equal string pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, -// { type: 'testFailure', value: 'Equal string fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalStringFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1916:81:0', expected: 'remix-tests', returned: 'remix'} -// ], ['time']) -// }) -// }) - -// describe('assert library NOTEQUAL method tests', () => { -// const filename: string = __dirname + '/examples_0/assert_notEqual_test.sol' - -// beforeAll((done) => { -// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { -// runTest('AssertNotEqualTest', contracts.AssertNotEqualTest, compilationData[filename]['AssertNotEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 6 passing test', () => { -// assert.equal(results.passingNum, 6) -// }) - -// it('should have 6 failing test', () => { -// assert.equal(results.failureNum, 6) -// }) - -// it('should return', () => { -// deepEqualExcluding(tests, [ -// { type: 'accountList', value: accounts }, -// { type: 'contract', value: 'AssertNotEqualTest', filename: __dirname + '/examples_0/assert_notEqual_test.sol' }, -// { type: 'testPass', value: 'Not equal uint pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, -// { type: 'testFailure', value: 'Not equal uint fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualUintFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '288:63:0', expected: '1', returned: '1'}, -// { type: 'testPass', value: 'Not equal int pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, -// { type: 'testFailure', value: 'Not equal int fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualIntFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '525:52:0', expected: '-2', returned: '-2'}, -// { type: 'testPass', value: 'Not equal bool pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, -// { type: 'testFailure', value: 'Not equal bool fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBoolFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '760:57:0', expected: true, returned: true}, -// { type: 'testPass', value: 'Not equal address pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, -// { type: 'testFailure', value: 'Not equal address fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualAddressFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1084:136:0', expected: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9, returned: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9}, -// { type: 'testPass', value: 'Not equal bytes32 pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, -// { type: 'testFailure', value: 'Not equal bytes32 fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBytes32FailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1756:54:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6978000000000000000000000000000000000000000000000000000000'}, -// { type: 'testPass', value: 'Not equal string pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, -// { type: 'testFailure', value: 'Not equal string fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualStringFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '2026:81:0', expected: 'remix', returned: 'remix'}, -// ], ['time']) -// }) -// }) - -// describe('assert library GREATERTHAN method tests', () => { -// const filename: string = __dirname + '/examples_0/assert_greaterThan_test.sol' - -// beforeAll((done) => { -// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { -// runTest('AssertGreaterThanTest', contracts.AssertGreaterThanTest, compilationData[filename]['AssertGreaterThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 4 passing test', () => { -// assert.equal(results.passingNum, 4) -// }) - -// it('should have 4 failing test', () => { -// assert.equal(results.failureNum, 4) -// }) -// it('should return', () => { -// deepEqualExcluding(tests, [ -// { type: 'accountList', value: accounts }, -// { type: 'contract', value: 'AssertGreaterThanTest', filename: __dirname + '/examples_0/assert_greaterThan_test.sol' }, -// { type: 'testPass', value: 'Greater than uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, -// { type: 'testFailure', value: 'Greater than uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '303:69:0', expected: '4', returned: '1'}, -// { type: 'testPass', value: 'Greater than int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, -// { type: 'testFailure', value: 'Greater than int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '569:67:0', expected: '1', returned: '-1'}, -// { type: 'testPass', value: 'Greater than uint int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, -// { type: 'testFailure', value: 'Greater than uint int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '845:71:0', expected: '2', returned: '1'}, -// { type: 'testPass', value: 'Greater than int uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, -// { type: 'testFailure', value: 'Greater than int uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '1125:76:0', expected: '115792089237316195423570985008687907853269984665640564039457584007913129639836', returned: '100'} -// ], ['time']) -// }) -// }) - -// describe('assert library LESSERTHAN method tests', () => { -// const filename: string = __dirname + '/examples_0/assert_lesserThan_test.sol' - -// beforeAll((done) => { -// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { -// runTest('AssertLesserThanTest', contracts.AssertLesserThanTest, compilationData[filename]['AssertLesserThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 4 passing test', () => { -// assert.equal(results.passingNum, 4) -// }) - -// it('should have 4 failing test', () => { -// assert.equal(results.failureNum, 4) -// }) - -// it('should return', () => { -// deepEqualExcluding(tests, [ -// { type: 'accountList', value: accounts }, -// { type: 'contract', value: 'AssertLesserThanTest', filename: __dirname + '/examples_0/assert_lesserThan_test.sol' }, -// { type: 'testPass', value: 'Lesser than uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, -// { type: 'testFailure', value: 'Lesser than uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '298:67:0', expected: '2', returned: '4'}, -// { type: 'testPass', value: 'Lesser than int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, -// { type: 'testFailure', value: 'Lesser than int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '557:65:0', expected: '-1', returned: '1'}, -// { type: 'testPass', value: 'Lesser than uint int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, -// { type: 'testFailure', value: 'Lesser than uint int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '826:71:0', expected: '-1', returned: '115792089237316195423570985008687907853269984665640564039457584007913129639935'}, -// { type: 'testPass', value: 'Lesser than int uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, -// { type: 'testFailure', value: 'Lesser than int uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '1105:69:0', expected: '1', returned: '1'}, -// ], ['time']) -// }) -// }) - -// describe('test with beforeAll', () => { -// const filename: string = __dirname + '/examples_1/simple_storage_test.sol' - -// beforeAll((done) => { -// compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { -// runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 3 passing test', () => { -// assert.equal(results.passingNum, 3) -// }) - -// it('should have 1 failing test', () => { -// assert.equal(results.failureNum, 1) -// }) - -// it('should return 6 messages', () => { -// deepEqualExcluding(tests, [ -// { type: 'accountList', value: accounts }, -// { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_1/simple_storage_test.sol' }, -// { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, -// { type: 'testPass', value: 'Initial value should not be200', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, -// { type: 'testFailure', value: 'Should trigger one fail', filename: __dirname + '/examples_1/simple_storage_test.sol', errMsg: 'uint test 1 fails', context: 'MyTest', assertMethod: 'equal', location: '532:51:1', expected: '2', returned: '1'}, -// { type: 'testPass', value: 'Should trigger one pass', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' } -// ], ['time']) -// }) -// }) - -// describe('test with beforeEach', () => { -// const filename: string = __dirname + '/examples_2/simple_storage_test.sol' - -// beforeAll(done => { -// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { -// runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 2 passing tests', () => { -// assert.equal(results.passingNum, 2) -// }) - -// it('should 0 failing tests', () => { -// assert.equal(results.failureNum, 0) -// }) - -// it('should return 4 messages', () => { -// deepEqualExcluding(tests, [ -// { type: 'accountList', value: accounts }, -// { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_2/simple_storage_test.sol' }, -// { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' }, -// { type: 'testPass', value: 'Value is set200', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' } -// ], ['time']) -// }) -// }) - -// // Test string equality -// describe('test string equality', () => { -// const filename: string = __dirname + '/examples_3/simple_string_test.sol' - -// beforeAll(done => { -// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { -// runTest('StringTest', contracts.StringTest, compilationData[filename]['StringTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should 2 passing tests', () => { -// assert.equal(results.passingNum, 2) -// }) - -// it('should return 4 messages', () => { -// deepEqualExcluding(tests, [ -// { type: 'accountList', value: accounts }, -// { type: 'contract', value: 'StringTest', filename: __dirname + '/examples_3/simple_string_test.sol' }, -// { type: 'testPass', value: 'Initial value should be hello world', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' }, -// { type: 'testPass', value: 'Value should not be hello wordl', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' } -// ], ['time']) -// }) -// }) - -// // Test multiple directory import in test contract -// describe('test multiple directory import in test contract', () => { -// const filename: string = __dirname + '/examples_5/test/simple_storage_test.sol' - -// beforeAll(done => { -// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { -// runTest('StorageResolveTest', contracts.StorageResolveTest, compilationData[filename]['StorageResolveTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should 3 passing tests', () => { -// assert.equal(results.passingNum, 3) -// }) - -// it('should return 4 messages', () => { -// deepEqualExcluding(tests, [ -// { type: 'accountList', value: accounts }, -// { type: 'contract', value: 'StorageResolveTest', filename: __dirname + '/examples_5/test/simple_storage_test.sol' }, -// { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, -// { type: 'testPass', value: 'Check if even', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, -// { type: 'testPass', value: 'Check if odd', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' } -// ], ['time']) -// }) -// }) - -// //Test SafeMath library methods -// describe('test SafeMath library', () => { -// const filename: string = __dirname + '/examples_4/SafeMath_test.sol' - -// beforeAll(done => { -// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { -// runTest('SafeMathTest', contracts.SafeMathTest, compilationData[filename]['SafeMathTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 10 passing tests', () => { -// assert.equal(results.passingNum, 10) -// }) -// it('should have 0 failing tests', () => { -// assert.equal(results.failureNum, 0) -// }) -// }) - -// //Test signed/unsigned integer weight -// describe('test number weight', () => { -// const filename: string = __dirname + '/number/number_test.sol' - -// beforeAll(done => { -// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { -// runTest('IntegerTest', contracts.IntegerTest, compilationData[filename]['IntegerTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 6 passing tests', () => { -// assert.equal(results.passingNum, 6) -// }) -// it('should have 2 failing tests', () => { -// assert.equal(results.failureNum, 2) -// }) -// }) - -// // Test Transaction with custom sender & value -// describe('various sender', () => { -// const filename: string = __dirname + '/various_sender/sender_and_value_test.sol' - -// beforeAll(done => { -// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { -// runTest('SenderAndValueTest', contracts.SenderAndValueTest, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) -// }) -// }) - -// afterAll(() => { tests = [] }) - -// it('should have 17 passing tests', () => { -// assert.equal(results.passingNum, 17) -// }) -// it('should have 0 failing tests', () => { -// assert.equal(results.failureNum, 0) -// }) -// }) - -// // Test `runTest` method without sending contract object (should throw error) -// describe('runTest method without contract json interface', () => { -// const filename: string = __dirname + '/various_sender/sender_and_value_test.sol' -// const errorCallback: Function = (done) => { -// return (err, _results) => { -// if (err && err.message.includes('Contract interface not available')) { -// results = _results -// done() -// } -// else throw err -// } -// } -// beforeAll(done => { -// compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { -// runTest('SenderAndValueTest', undefined, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, errorCallback(done)) -// }) -// }) - -// it('should have 0 passing tests', () => { -// assert.equal(results.passingNum, 0) -// }) -// it('should have 0 failing tests', () => { -// assert.equal(results.failureNum, 0) -// }) -// }) -// }) -// }) + ], ['time']) + }) + }) + + describe('assert library EQUAL method tests', () => { + const filename: string = __dirname + '/examples_0/assert_equal_test.sol' + + beforeAll((done) => { + compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { + runTest('AssertEqualTest', contracts.AssertEqualTest, compilationData[filename]['AssertEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 6 passing test', () => { + assert.equal(results.passingNum, 6) + }) + + it('should have 6 failing test', () => { + assert.equal(results.failureNum, 6) + }) + + it('should return', () => { + deepEqualExcluding(tests, [ + { type: 'accountList', value: accounts }, + { type: 'contract', value: 'AssertEqualTest', filename: __dirname + '/examples_0/assert_equal_test.sol' }, + { type: 'testPass', value: 'Equal uint pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, + { type: 'testFailure', value: 'Equal uint fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalUintFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '273:57:0', expected: '2', returned: '1'}, + { type: 'testPass', value: 'Equal int pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, + { type: 'testFailure', value: 'Equal int fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalIntFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '493:45:0', expected: '2', returned: '-1'}, + { type: 'testPass', value: 'Equal bool pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, + { type: 'testFailure', value: 'Equal bool fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBoolFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '708:52:0', expected: false, returned: true}, + { type: 'testPass', value: 'Equal address pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, + { type: 'testFailure', value: 'Equal address fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalAddressFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1015:130:0', expected: '0x1c6637567229159d1eFD45f95A6675e77727E013', returned: '0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9'}, + { type: 'testPass', value: 'Equal bytes32 pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, + { type: 'testFailure', value: 'Equal bytes32 fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalBytes32FailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1670:48:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6979000000000000000000000000000000000000000000000000000000'}, + { type: 'testPass', value: 'Equal string pass test', filename: __dirname + '/examples_0/assert_equal_test.sol', context: 'AssertEqualTest' }, + { type: 'testFailure', value: 'Equal string fail test', filename: __dirname + '/examples_0/assert_equal_test.sol', errMsg: 'equalStringFailTest fails', context: 'AssertEqualTest', assertMethod: 'equal', location: '1916:81:0', expected: 'remix-tests', returned: 'remix'} + ], ['time']) + }) + }) + + describe('assert library NOTEQUAL method tests', () => { + const filename: string = __dirname + '/examples_0/assert_notEqual_test.sol' + + beforeAll((done) => { + compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { + runTest('AssertNotEqualTest', contracts.AssertNotEqualTest, compilationData[filename]['AssertNotEqualTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 6 passing test', () => { + assert.equal(results.passingNum, 6) + }) + + it('should have 6 failing test', () => { + assert.equal(results.failureNum, 6) + }) + + it('should return', () => { + deepEqualExcluding(tests, [ + { type: 'accountList', value: accounts }, + { type: 'contract', value: 'AssertNotEqualTest', filename: __dirname + '/examples_0/assert_notEqual_test.sol' }, + { type: 'testPass', value: 'Not equal uint pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, + { type: 'testFailure', value: 'Not equal uint fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualUintFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '288:63:0', expected: '1', returned: '1'}, + { type: 'testPass', value: 'Not equal int pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, + { type: 'testFailure', value: 'Not equal int fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualIntFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '525:52:0', expected: '-2', returned: '-2'}, + { type: 'testPass', value: 'Not equal bool pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, + { type: 'testFailure', value: 'Not equal bool fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBoolFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '760:57:0', expected: true, returned: true}, + { type: 'testPass', value: 'Not equal address pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, + { type: 'testFailure', value: 'Not equal address fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualAddressFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1084:136:0', expected: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9, returned: 0x7994f14563F39875a2F934Ce42cAbF48a93FdDA9}, + { type: 'testPass', value: 'Not equal bytes32 pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, + { type: 'testFailure', value: 'Not equal bytes32 fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualBytes32FailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '1756:54:0', expected: '0x72656d6978000000000000000000000000000000000000000000000000000000', returned: '0x72656d6978000000000000000000000000000000000000000000000000000000'}, + { type: 'testPass', value: 'Not equal string pass test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', context: 'AssertNotEqualTest' }, + { type: 'testFailure', value: 'Not equal string fail test', filename: __dirname + '/examples_0/assert_notEqual_test.sol', errMsg: 'notEqualStringFailTest fails', context: 'AssertNotEqualTest', assertMethod: 'notEqual', location: '2026:81:0', expected: 'remix', returned: 'remix'}, + ], ['time']) + }) + }) + + describe('assert library GREATERTHAN method tests', () => { + const filename: string = __dirname + '/examples_0/assert_greaterThan_test.sol' + + beforeAll((done) => { + compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { + runTest('AssertGreaterThanTest', contracts.AssertGreaterThanTest, compilationData[filename]['AssertGreaterThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 4 passing test', () => { + assert.equal(results.passingNum, 4) + }) + + it('should have 4 failing test', () => { + assert.equal(results.failureNum, 4) + }) + it('should return', () => { + deepEqualExcluding(tests, [ + { type: 'accountList', value: accounts }, + { type: 'contract', value: 'AssertGreaterThanTest', filename: __dirname + '/examples_0/assert_greaterThan_test.sol' }, + { type: 'testPass', value: 'Greater than uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, + { type: 'testFailure', value: 'Greater than uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '303:69:0', expected: '4', returned: '1'}, + { type: 'testPass', value: 'Greater than int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, + { type: 'testFailure', value: 'Greater than int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '569:67:0', expected: '1', returned: '-1'}, + { type: 'testPass', value: 'Greater than uint int pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, + { type: 'testFailure', value: 'Greater than uint int fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanUintIntFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '845:71:0', expected: '2', returned: '1'}, + { type: 'testPass', value: 'Greater than int uint pass test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', context: 'AssertGreaterThanTest' }, + { type: 'testFailure', value: 'Greater than int uint fail test', filename: __dirname + '/examples_0/assert_greaterThan_test.sol', errMsg: 'greaterThanIntUintFailTest fails', context: 'AssertGreaterThanTest', assertMethod: 'greaterThan', location: '1125:76:0', expected: '115792089237316195423570985008687907853269984665640564039457584007913129639836', returned: '100'} + ], ['time']) + }) + }) + + describe('assert library LESSERTHAN method tests', () => { + const filename: string = __dirname + '/examples_0/assert_lesserThan_test.sol' + + beforeAll((done) => { + compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { + runTest('AssertLesserThanTest', contracts.AssertLesserThanTest, compilationData[filename]['AssertLesserThanTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 4 passing test', () => { + assert.equal(results.passingNum, 4) + }) + + it('should have 4 failing test', () => { + assert.equal(results.failureNum, 4) + }) + + it('should return', () => { + deepEqualExcluding(tests, [ + { type: 'accountList', value: accounts }, + { type: 'contract', value: 'AssertLesserThanTest', filename: __dirname + '/examples_0/assert_lesserThan_test.sol' }, + { type: 'testPass', value: 'Lesser than uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, + { type: 'testFailure', value: 'Lesser than uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '298:67:0', expected: '2', returned: '4'}, + { type: 'testPass', value: 'Lesser than int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, + { type: 'testFailure', value: 'Lesser than int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '557:65:0', expected: '-1', returned: '1'}, + { type: 'testPass', value: 'Lesser than uint int pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, + { type: 'testFailure', value: 'Lesser than uint int fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanUintIntFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '826:71:0', expected: '-1', returned: '115792089237316195423570985008687907853269984665640564039457584007913129639935'}, + { type: 'testPass', value: 'Lesser than int uint pass test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', context: 'AssertLesserThanTest' }, + { type: 'testFailure', value: 'Lesser than int uint fail test', filename: __dirname + '/examples_0/assert_lesserThan_test.sol', errMsg: 'lesserThanIntUintFailTest fails', context: 'AssertLesserThanTest', assertMethod: 'lesserThan', location: '1105:69:0', expected: '1', returned: '1'}, + ], ['time']) + }) + }) + + describe('test with beforeAll', () => { + const filename: string = __dirname + '/examples_1/simple_storage_test.sol' + + beforeAll((done) => { + compileAndDeploy(filename, (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) => { + runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 3 passing test', () => { + assert.equal(results.passingNum, 3) + }) + + it('should have 1 failing test', () => { + assert.equal(results.failureNum, 1) + }) + + it('should return 6 messages', () => { + deepEqualExcluding(tests, [ + { type: 'accountList', value: accounts }, + { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_1/simple_storage_test.sol' }, + { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, + { type: 'testPass', value: 'Initial value should not be200', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' }, + { type: 'testFailure', value: 'Should trigger one fail', filename: __dirname + '/examples_1/simple_storage_test.sol', errMsg: 'uint test 1 fails', context: 'MyTest', assertMethod: 'equal', location: '532:51:1', expected: '2', returned: '1'}, + { type: 'testPass', value: 'Should trigger one pass', filename: __dirname + '/examples_1/simple_storage_test.sol', context: 'MyTest' } + ], ['time']) + }) + }) + + describe('test with beforeEach', () => { + const filename: string = __dirname + '/examples_2/simple_storage_test.sol' + + beforeAll(done => { + compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { + runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 2 passing tests', () => { + assert.equal(results.passingNum, 2) + }) + + it('should 0 failing tests', () => { + assert.equal(results.failureNum, 0) + }) + + it('should return 4 messages', () => { + deepEqualExcluding(tests, [ + { type: 'accountList', value: accounts }, + { type: 'contract', value: 'MyTest', filename: __dirname + '/examples_2/simple_storage_test.sol' }, + { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' }, + { type: 'testPass', value: 'Value is set200', filename: __dirname + '/examples_2/simple_storage_test.sol', context: 'MyTest' } + ], ['time']) + }) + }) + + // Test string equality + describe('test string equality', () => { + const filename: string = __dirname + '/examples_3/simple_string_test.sol' + + beforeAll(done => { + compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { + runTest('StringTest', contracts.StringTest, compilationData[filename]['StringTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should 2 passing tests', () => { + assert.equal(results.passingNum, 2) + }) + + it('should return 4 messages', () => { + deepEqualExcluding(tests, [ + { type: 'accountList', value: accounts }, + { type: 'contract', value: 'StringTest', filename: __dirname + '/examples_3/simple_string_test.sol' }, + { type: 'testPass', value: 'Initial value should be hello world', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' }, + { type: 'testPass', value: 'Value should not be hello wordl', filename: __dirname + '/examples_3/simple_string_test.sol', context: 'StringTest' } + ], ['time']) + }) + }) + + // Test multiple directory import in test contract + describe('test multiple directory import in test contract', () => { + const filename: string = __dirname + '/examples_5/test/simple_storage_test.sol' + + beforeAll(done => { + compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { + runTest('StorageResolveTest', contracts.StorageResolveTest, compilationData[filename]['StorageResolveTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should 3 passing tests', () => { + assert.equal(results.passingNum, 3) + }) + + it('should return 4 messages', () => { + deepEqualExcluding(tests, [ + { type: 'accountList', value: accounts }, + { type: 'contract', value: 'StorageResolveTest', filename: __dirname + '/examples_5/test/simple_storage_test.sol' }, + { type: 'testPass', value: 'Initial value should be100', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, + { type: 'testPass', value: 'Check if even', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' }, + { type: 'testPass', value: 'Check if odd', filename: __dirname + '/examples_5/test/simple_storage_test.sol', context: 'StorageResolveTest' } + ], ['time']) + }) + }) + + //Test SafeMath library methods + describe('test SafeMath library', () => { + const filename: string = __dirname + '/examples_4/SafeMath_test.sol' + + beforeAll(done => { + compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { + runTest('SafeMathTest', contracts.SafeMathTest, compilationData[filename]['SafeMathTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 10 passing tests', () => { + assert.equal(results.passingNum, 10) + }) + it('should have 0 failing tests', () => { + assert.equal(results.failureNum, 0) + }) + }) + + //Test signed/unsigned integer weight + describe('test number weight', () => { + const filename: string = __dirname + '/number/number_test.sol' + + beforeAll(done => { + compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { + runTest('IntegerTest', contracts.IntegerTest, compilationData[filename]['IntegerTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 6 passing tests', () => { + assert.equal(results.passingNum, 6) + }) + it('should have 2 failing tests', () => { + assert.equal(results.failureNum, 2) + }) + }) + + // Test Transaction with custom sender & value + describe('various sender', () => { + const filename: string = __dirname + '/various_sender/sender_and_value_test.sol' + + beforeAll(done => { + compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { + runTest('SenderAndValueTest', contracts.SenderAndValueTest, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, resultsCallback(done)) + }) + }) + + afterAll(() => { tests = [] }) + + it('should have 17 passing tests', () => { + assert.equal(results.passingNum, 17) + }) + it('should have 0 failing tests', () => { + assert.equal(results.failureNum, 0) + }) + }) + + // Test `runTest` method without sending contract object (should throw error) + describe('runTest method without contract json interface', () => { + const filename: string = __dirname + '/various_sender/sender_and_value_test.sol' + const errorCallback: Function = (done) => { + return (err, _results) => { + if (err && err.message.includes('Contract interface not available')) { + results = _results + done() + } + else throw err + } + } + beforeAll(done => { + compileAndDeploy(filename, function (_err: Error | null | undefined, compilationData: object, contracts: any, asts: any, accounts: string[]) { + runTest('SenderAndValueTest', undefined, compilationData[filename]['SenderAndValueTest'], asts[filename], { accounts }, testCallback, errorCallback(done)) + }) + }) + + it('should have 0 passing tests', () => { + assert.equal(results.passingNum, 0) + }) + it('should have 0 failing tests', () => { + assert.equal(results.failureNum, 0) + }) + }) + }) +}) From 8d59edf1d538bd5e3bdbde97a729585a846da2e8 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 14:30:11 +0530 Subject: [PATCH 10/41] optimize option added --- libs/remix-tests/src/run.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index 724e71f424..82983d9f10 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -88,19 +88,19 @@ commander log.error(`No compiler found in releases with version ${compVersion}`) process.exit() } else { - log.info(`Compiler version set to ${compVersion}. Latest version is ${latestRelease}`) compilerConfig.currentCompilerUrl = compString.replace('soljson-', '').replace('.js', '') + log.info(`Compiler version set to ${compVersion}. Latest version is ${latestRelease}`) } } if (commander.evm) { compilerConfig.evmVersion = commander.evm - log.info('EVM set to ' + compilerConfig.evmVersion) + log.info(`EVM set to ${compilerConfig.evmVersion}`) } if (commander.optimize) { compilerConfig.optimize = commander.optimize - log.info('compiler optimization set to ' + compilerConfig.optimize) + log.info(`Optimization is ${compilerConfig.optimize ? 'enabled' : 'disabled'}`) } const web3 = new Web3() From 02c68046ffcdedeaada3c7646fb6c5cb782f3546 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 14:48:28 +0530 Subject: [PATCH 11/41] tests for custom optimize option --- libs/remix-tests/src/compiler.ts | 21 ++++++++++++------- libs/remix-tests/src/run.ts | 4 ++-- libs/remix-tests/tests/testRunner.cli.spec.ts | 13 ++++++++++++ 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 9a608ed7e0..681fb2d613 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -126,15 +126,20 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: async.waterfall([ function loadCompiler(next) { compiler = new RemixCompiler() - const {currentCompilerUrl, evmVersion, optimize, runs} = compilerConfig - evmVersion ? compiler.set('evmVersion', evmVersion) : - optimize ? compiler.set('optimize', optimize) : - runs ? compiler.set('runs', runs) : '' - if(currentCompilerUrl) { - compiler.loadRemoteVersion(currentCompilerUrl) - compiler.event.register('compilerLoaded', this, function (version) { + if(compilerConfig) { + const {currentCompilerUrl, evmVersion, optimize, runs} = compilerConfig + evmVersion ? compiler.set('evmVersion', evmVersion) : null + optimize ? compiler.set('optimize', optimize) : null + runs ? compiler.set('runs', runs) : null + if(currentCompilerUrl) { + compiler.loadRemoteVersion(currentCompilerUrl) + compiler.event.register('compilerLoaded', this, function (version) { + next() + }); + } else { + compiler.onInternalCompilerLoaded() next() - }); + } } else { compiler.onInternalCompilerLoaded() next() diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index 82983d9f10..c0cb4cc329 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -99,8 +99,8 @@ commander } if (commander.optimize) { - compilerConfig.optimize = commander.optimize - log.info(`Optimization is ${compilerConfig.optimize ? 'enabled' : 'disabled'}`) + compilerConfig.optimize = commander.optimize + log.info(`Optimization is ${compilerConfig.optimize ? 'enabled' : 'disabled'}`) } const web3 = new Web3() diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index a2a2bfa3d2..d045d8261f 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -77,5 +77,18 @@ Commands: // macth fail test details expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) }) + + test('remix-tests running a test file by enabling optimization', () => { + const res = spawnSync(executablePath, ['--optimize', 'true', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) + // match initial lines + expect(res.stdout.toString().trim().includes('Optimization is enabled')).toBeTruthy() + expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) + // match test result + expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) + expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) + // macth fail test details + expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + }) }) }) \ No newline at end of file From f0721bd5c10034f9ba7cb4c9444e323cc6bf73cb Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 14:55:27 +0530 Subject: [PATCH 12/41] custom runs option added --- libs/remix-tests/src/run.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index c0cb4cc329..dbaf04c09e 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -103,6 +103,15 @@ commander log.info(`Optimization is ${compilerConfig.optimize ? 'enabled' : 'disabled'}`) } + if (commander.runs) { + if(!commander.optimize) { + log.error(`Optimization should be enabled for runs`) + process.exit() + } + compilerConfig.runs = commander.runs + log.info(`Runs set to ${compilerConfig.runs}`) + } + const web3 = new Web3() const provider: any = new Provider() await provider.init() From 9c0bb0fb1b3d694f8b3800c86d10bfe2c6d2802a Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 15:01:40 +0530 Subject: [PATCH 13/41] test for custom runs --- libs/remix-tests/tests/testRunner.cli.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index d045d8261f..e6de8a6762 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -90,5 +90,19 @@ Commands: // macth fail test details expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) }) + + test('remix-tests running a test file by enabling optimization and setting runs', () => { + const res = spawnSync(executablePath, ['--optimize', 'true', '--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) + // match initial lines + expect(res.stdout.toString().trim().includes('Optimization is enabled')).toBeTruthy() + expect(res.stdout.toString().trim().includes('Runs set to 300')).toBeTruthy() + expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) + // match test result + expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) + expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) + // macth fail test details + expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + }) }) }) \ No newline at end of file From a6b0e14036a7cb2443cd96ffab1add7a0cdcf3f7 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 16:22:42 +0530 Subject: [PATCH 14/41] semicolons --- libs/remix-tests/src/compiler.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index 681fb2d613..1d791ca536 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -45,15 +45,15 @@ function isRemixTestFile(path: string) { */ function processFile(filePath: string, sources: SrcIfc, isRoot = false) { - const importRegEx = /import ['"](.+?)['"];/g; - let group: RegExpExecArray| null = null; + const importRegEx = /import ['"](.+?)['"];/g + let group: RegExpExecArray| null = null const isFileAlreadyInSources: boolean = Object.keys(sources).includes(filePath) // Return if file is a remix test file or already processed if(isRemixTestFile(filePath) || isFileAlreadyInSources) return - let content: string = fs.readFileSync(filePath, { encoding: 'utf-8' }); + let content: string = fs.readFileSync(filePath, { encoding: 'utf-8' }) const testFileImportRegEx = /^(import)\s['"](remix_tests.sol|tests.sol)['"];/gm // import 'remix_tests.sol', if file is a root test contract file and doesn't already have it @@ -61,13 +61,13 @@ function processFile(filePath: string, sources: SrcIfc, isRoot = false) { const includeTestLibs = '\nimport \'remix_tests.sol\';\n' content = includeTestLibs.concat(content) } - sources[filePath] = {content}; - importRegEx.exec(''); // Resetting state of RegEx + sources[filePath] = {content} + importRegEx.exec('') // Resetting state of RegEx // Process each 'import' in file content while ((group = importRegEx.exec(content))) { - const importedFile: string = group[1]; - const importedFilePath: string = path.join(path.dirname(filePath), importedFile); + const importedFile: string = group[1] + const importedFilePath: string = path.join(path.dirname(filePath), importedFile) processFile(importedFilePath, sources) } } @@ -103,11 +103,11 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: } } else { // walkSync only if it is a directory - let testFileCount = 0; + let testFileCount = 0 fs.walkSync(filepath, (foundpath: string) => { // only process .sol files if (foundpath.split('.').pop() === 'sol' && foundpath.endsWith('_test.sol')) { - testFileCount++; + testFileCount++ processFile(foundpath, sources, true) } }) @@ -135,7 +135,7 @@ export function compileFileOrFiles(filename: string, isDirectory: boolean, opts: compiler.loadRemoteVersion(currentCompilerUrl) compiler.event.register('compilerLoaded', this, function (version) { next() - }); + }) } else { compiler.onInternalCompilerLoaded() next() From fb440d1fe08ff67ab84a56b01ce0456aa17b5f64 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 16:38:03 +0530 Subject: [PATCH 15/41] more tests --- libs/remix-tests/tests/testRunner.cli.spec.ts | 39 ++++++++++++++++--- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index e6de8a6762..951a385712 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -45,7 +45,7 @@ Commands: expect(res.stdout.toString().trim()).toMatch(/AssertOkTest/) expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) - // macth fail test details + // match fail test details expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) expect(res.stdout.toString().trim()).toMatch(/expected value to be ok to: true/) expect(res.stdout.toString().trim()).toMatch(/returned: false/) @@ -61,10 +61,16 @@ Commands: // match test result expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) - // macth fail test details + // match fail test details expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) }) + test('remix-tests running a test file with unavailable custom compiler version (should fail)', () => { + const res = spawnSync(executablePath, ['--compiler', '1.10.4', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) + // match initial lines + expect(res.stdout.toString().trim().includes('No compiler found in releases with version 1.10.4')).toBeTruthy() + }) + test('remix-tests running a test file with custom EVM', () => { const res = spawnSync(executablePath, ['--evm', 'petersburg', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) // match initial lines @@ -74,7 +80,7 @@ Commands: // match test result expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) - // macth fail test details + // match fail test details expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) }) @@ -87,7 +93,7 @@ Commands: // match test result expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) - // macth fail test details + // match fail test details expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) }) @@ -101,7 +107,30 @@ Commands: // match test result expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) - // macth fail test details + // match fail test details + expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) + }) + + test('remix-tests running a test file without enabling optimization and setting runs (should fail)', () => { + const res = spawnSync(executablePath, ['--runs', '300', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) + // match initial lines + expect(res.stdout.toString().trim().includes('Optimization should be enabled for runs')).toBeTruthy() + }) + + test('remix-tests running a test file with all options', () => { + const res = spawnSync(executablePath, ['--compiler', '0.7.5', '--evm', 'istanbul', '--optimize', 'true', '--runs', '250', resolve(__dirname + '/examples_0/assert_ok_test.sol')]) + // match initial lines + expect(res.stdout.toString().trim().includes('Compiler version set to 0.7.5. Latest version is')).toBeTruthy() + expect(res.stdout.toString().trim().includes('Loading remote solc version v0.7.5+commit.eb77ed08 ...')).toBeTruthy() + expect(res.stdout.toString().trim().includes('EVM set to istanbul')).toBeTruthy() + expect(res.stdout.toString().trim().includes('Optimization is enabled')).toBeTruthy() + expect(res.stdout.toString().trim().includes('Runs set to 250')).toBeTruthy() + expect(res.stdout.toString().trim()).toMatch(/:: Running remix-tests - Unit testing for solidity ::/) + expect(res.stdout.toString().trim()).toMatch(/creation of library remix_tests.sol:Assert pending.../) + // match test result + expect(res.stdout.toString().trim()).toMatch(/Ok pass test/) + expect(res.stdout.toString().trim()).toMatch(/Ok fail test/) + // match fail test details expect(res.stdout.toString().trim()).toMatch(/error: okFailTest fails/) }) }) From ae30454abdf3f8b6109508e727099150ea1175b7 Mon Sep 17 00:00:00 2001 From: aniket-engg Date: Tue, 19 Jan 2021 16:48:14 +0530 Subject: [PATCH 16/41] help updated --- libs/remix-tests/src/run.ts | 6 +++--- libs/remix-tests/tests/testRunner.cli.spec.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/remix-tests/src/run.ts b/libs/remix-tests/src/run.ts index dbaf04c09e..38518b90dc 100644 --- a/libs/remix-tests/src/run.ts +++ b/libs/remix-tests/src/run.ts @@ -47,10 +47,10 @@ commander.command('help').description('output usage information').action(functio // get current version commander .option('-c, --compiler ', 'set compiler version (e.g: 0.6.1, 0.7.1 etc)') - .option('-e, --evm ', 'set EVM version') + .option('-e, --evm ', 'set EVM version (e.g: petersburg, istanbul etc)') .option('-o, --optimize ', 'enable/disable optimization', mapOptimize) - .option('-r, --runs ', 'set runs') - .option('-v, --verbose ', 'set verbosity level', mapVerbosity) + .option('-r, --runs ', 'set runs (e.g: 150, 250 etc)') + .option('-v, --verbose ', 'set verbosity level (0 to 5)', mapVerbosity) .action(async (testsPath) => { // Check if path exists diff --git a/libs/remix-tests/tests/testRunner.cli.spec.ts b/libs/remix-tests/tests/testRunner.cli.spec.ts index 951a385712..3d906095f3 100644 --- a/libs/remix-tests/tests/testRunner.cli.spec.ts +++ b/libs/remix-tests/tests/testRunner.cli.spec.ts @@ -24,10 +24,10 @@ describe('testRunner: remix-tests CLI', () => { Options: -V, --version output the version number -c, --compiler set compiler version (e.g: 0.6.1, 0.7.1 etc) - -e, --evm set EVM version + -e, --evm set EVM version (e.g: petersburg, istanbul etc) -o, --optimize enable/disable optimization - -r, --runs set runs - -v, --verbose set verbosity level + -r, --runs set runs (e.g: 150, 250 etc) + -v, --verbose set verbosity level (0 to 5) -h, --help output usage information Commands: From 6871ea74f6e49a45be0004c8fdfdf1be87129959 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 14:47:46 +0100 Subject: [PATCH 17/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index 13b0af890f..45533fdee9 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: linhbn123/rebase-pull-requests@v1.0.1 + - uses: yann300/rebase-pull-requests@v1.0.2 From 8af550837635f3bf69d3c99cb6decc3bd2d79801 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 15:20:00 +0100 Subject: [PATCH 18/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index 45533fdee9..cfc3bce95f 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.2 + - uses: yann300/rebase-pull-requests@v1.0.3 From bc2ec1f5d4e422c5383de1a406c249d5eb34ec8e Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 15:48:14 +0100 Subject: [PATCH 19/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index cfc3bce95f..327d1f30b0 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.3 + - uses: yann300/rebase-pull-requests@v1.0.4 From ad204a72485ed6876331fe4dc26971d10a2c6e94 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 16:08:29 +0100 Subject: [PATCH 20/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index 327d1f30b0..b033909b37 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.4 + - uses: yann300/rebase-pull-requests@v1.0.5 From 5444f2d8369340a7212f4d13f4ea3d8066fe67bd Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 16:17:56 +0100 Subject: [PATCH 21/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index b033909b37..eec4f5d747 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.5 + - uses: yann300/rebase-pull-requests@v1.0.6 From e3be9cd831dfe2e8d478c2b9cc1035244e097081 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 16:19:38 +0100 Subject: [PATCH 22/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index eec4f5d747..d24e513133 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.6 + - uses: yann300/rebase-pull-requests@v1.0.7 From 7f4d4734c809cfd9ed422eae97c78148c7e7e5ec Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 16:23:26 +0100 Subject: [PATCH 23/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index d24e513133..d2e99a1c18 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.7 + - uses: yann300/rebase-pull-requests@v1.0.8 From 8860c2842ecee87504ef3cfafd82fab061e0fc3a Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 18 Jan 2021 12:42:28 +0100 Subject: [PATCH 24/41] padding and format --- .../src/lib/vm-debugger/dropdown-panel.tsx | 372 +++++++++--------- 1 file changed, 186 insertions(+), 186 deletions(-) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx index fe79e93539..7a6d35b37b 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx @@ -6,206 +6,206 @@ import { initialState, reducer } from '../../reducers/calldata' import './styles/dropdown-panel.css' export const DropdownPanel = (props: DropdownPanelProps) => { - const [calldataObj, dispatch] = useReducer(reducer, initialState) - const { dropdownName, dropdownMessage, calldata, header, loading, extractFunc, formatSelfFunc, registerEvent, triggerEvent, loadMoreEvent, loadMoreCompletedEvent } = props - const extractDataDefault: ExtractFunc = (item, parent?) => { - const ret: ExtractData = {} - - if (item instanceof Array) { - ret.children = item.map((item, index) => { - return {key: index, value: item} - }) - ret.self = 'Array' - ret.isNode = true - ret.isLeaf = false - } else if (item instanceof Object) { - ret.children = Object.keys(item).map((key) => { - return {key: key, value: item[key]} - }) - ret.self = 'Object' - ret.isNode = true - ret.isLeaf = false - } else { - ret.self = item - ret.children = null - ret.isNode = false - ret.isLeaf = true - } - return ret + const [calldataObj, dispatch] = useReducer(reducer, initialState) + const { dropdownName, dropdownMessage, calldata, header, loading, extractFunc, formatSelfFunc, registerEvent, triggerEvent, loadMoreEvent, loadMoreCompletedEvent } = props + const extractDataDefault: ExtractFunc = (item, parent?) => { + const ret: ExtractData = {} + + if (item instanceof Array) { + ret.children = item.map((item, index) => { + return { key: index, value: item } + }) + ret.self = 'Array' + ret.isNode = true + ret.isLeaf = false + } else if (item instanceof Object) { + ret.children = Object.keys(item).map((key) => { + return { key: key, value: item[key] } + }) + ret.self = 'Object' + ret.isNode = true + ret.isLeaf = false + } else { + ret.self = item + ret.children = null + ret.isNode = false + ret.isLeaf = true } - const formatSelfDefault = (key: string | number, data: ExtractData) => { - return ( -
- - -
- ) + return ret + } + const formatSelfDefault = (key: string | number, data: ExtractData) => { + return ( +
+ + +
+ ) + } + const [state, setState] = useState({ + header: '', + toggleDropdown: false, + message: { + innerText: 'No data available.', + display: 'block' + }, + dropdownContent: { + innerText: '', + display: 'none' + }, + title: { + innerText: '', + display: 'none' + }, + copiableContent: '', + updating: false, + expandPath: [], + data: null + }) + + useEffect(() => { + registerEvent && registerEvent(loadMoreCompletedEvent, (updatedCalldata) => { + dispatch({ type: 'UPDATE_CALLDATA_SUCCESS', payload: updatedCalldata }) + }) + }, []) + + useEffect(() => { + dispatch({ type: 'FETCH_CALLDATA_SUCCESS', payload: calldata }) + }, [calldata]) + + useEffect(() => { + update(calldata) + }, [calldataObj.calldata]) + + useEffect(() => { + message(dropdownMessage) + }, [dropdownMessage]) + + useEffect(() => { + if (loading && !state.updating) setLoading() + }, [loading]) + + const handleToggle = () => { + setState(prevState => { + return { + ...prevState, + toggleDropdown: !prevState.toggleDropdown + } + }) + } + + const handleExpand = (keyPath) => { + if (!state.expandPath.includes(keyPath)) { + state.expandPath.push(keyPath) + } else { + state.expandPath = state.expandPath.filter(path => !path.startsWith(keyPath)) } - const [state, setState] = useState({ - header: '', - toggleDropdown: false, + } + + const message = (message) => { + if (message === state.message.innerText) return + setState(prevState => { + return { + ...prevState, message: { - innerText: 'No data available.', - display: 'block' + innerText: message, + display: message ? 'block' : '' }, - dropdownContent: { - innerText: '', - display: 'none' + updating: false + } + }) + } + + const setLoading = () => { + setState(prevState => { + return { + ...prevState, + message: { + innerText: '', + display: 'none' }, - title: { - innerText: '', - display: 'none' + dropdownContent: { + ...prevState.dropdownContent, + display: 'none' }, copiableContent: '', - updating: false, - expandPath: [], - data: null + updating: true + } }) + } - useEffect(() => { - registerEvent && registerEvent(loadMoreCompletedEvent, (updatedCalldata) => { - dispatch({ type: 'UPDATE_CALLDATA_SUCCESS', payload: updatedCalldata }) - }) - }, []) - - useEffect(() => { - dispatch({ type: 'FETCH_CALLDATA_SUCCESS', payload: calldata }) - }, [calldata]) - - useEffect(() => { - update(calldata) - }, [calldataObj.calldata]) - - useEffect(() => { - message(dropdownMessage) - }, [dropdownMessage]) - - useEffect(() => { - if (loading && !state.updating) setLoading() - }, [loading]) - - const handleToggle = () => { - setState(prevState => { - return { - ...prevState, - toggleDropdown: !prevState.toggleDropdown - } - }) - } - - const handleExpand = (keyPath) => { - if (!state.expandPath.includes(keyPath)) { - state.expandPath.push(keyPath) - } else { - state.expandPath = state.expandPath.filter(path => !path.startsWith(keyPath)) - } - } - - const message = (message) => { - if (message === state.message.innerText) return - setState(prevState => { - return { - ...prevState, - message: { - innerText: message, - display: message ? 'block' : '' - }, - updating: false - } - }) - } + const update = function (calldata) { + let isEmpty = !calldata ? true : false - const setLoading = () => { - setState(prevState => { - return { - ...prevState, - message: { - innerText: '', - display: 'none' - }, - dropdownContent: { - ...prevState.dropdownContent, - display: 'none' - }, - copiableContent: '', - updating: true - } - }) - } + if (calldata && Array.isArray(calldata) && calldata.length === 0) isEmpty = true + else if (calldata && Object.keys(calldata).length === 0 && calldata.constructor === Object) isEmpty = true - const update = function (calldata) { - let isEmpty = !calldata ? true : false - - if(calldata && Array.isArray(calldata) && calldata.length === 0) isEmpty = true - else if(calldata && Object.keys(calldata).length === 0 && calldata.constructor === Object) isEmpty = true - - setState(prevState => { - return { - ...prevState, - dropdownContent: { - ...prevState.dropdownContent, - display: 'block' - }, - copiableContent: JSON.stringify(calldata, null, '\t'), - message: { - innerText: isEmpty ? 'No data available' : '', - display: isEmpty ? 'block' : 'none' - }, - updating: false, - toggleDropdown: !isEmpty, - data: calldata - } - }) - } + setState(prevState => { + return { + ...prevState, + dropdownContent: { + ...prevState.dropdownContent, + display: 'block' + }, + copiableContent: JSON.stringify(calldata, null, '\t'), + message: { + innerText: isEmpty ? 'No data available' : '', + display: isEmpty ? 'block' : 'none' + }, + updating: false, + toggleDropdown: !isEmpty, + data: calldata + } + }) + } + + const renderData = (item: ExtractData, parent, key: string | number, keyPath: string) => { + const data = extractFunc ? extractFunc(item, parent) : extractDataDefault(item, parent) + const children = (data.children || []).map((child) => { + return ( + renderData(child.value, data, child.key, keyPath + '/' + child.key) + ) + }) - const renderData = (item: ExtractData, parent, key: string | number, keyPath: string) => { - const data = extractFunc ? extractFunc(item, parent) : extractDataDefault(item, parent) - const children = (data.children || []).map((child) => { - return ( - renderData(child.value, data, child.key, keyPath + '/' + child.key) - ) - }) - - if (children && children.length > 0 ) { - return ( - handleExpand(keyPath)} expand={state.expandPath.includes(keyPath)}> - - { children } - { data.hasNext && { triggerEvent(loadMoreEvent, [data.cursor]) }} /> } - - - ) - } else { - return handleExpand(keyPath)} expand={state.expandPath.includes(keyPath)} /> - } + if (children && children.length > 0) { + return ( + handleExpand(keyPath)} expand={state.expandPath.includes(keyPath)}> + + {children} + {data.hasNext && { triggerEvent(loadMoreEvent, [data.cursor]) }} />} + + + ) + } else { + return handleExpand(keyPath)} expand={state.expandPath.includes(keyPath)} /> } - - const uniquePanelName = dropdownName.split(' ').join('') - - return ( -
-
-
-
{dropdownName}
{ header } - -
-
- -
- { - state.data && - - { - Object.keys(state.data).map((innerkey) => renderData(state.data[innerkey], state.data, innerkey, innerkey)) - } - - } -
- -
{ state.message.innerText }
-
+ } + + const uniquePanelName = dropdownName.split(' ').join('') + + return ( +
+
+
+
{dropdownName}
{header} + +
+
+ +
+ { + state.data && + + { + Object.keys(state.data).map((innerkey) => renderData(state.data[innerkey], state.data, innerkey, innerkey)) + } + + }
- ) + +
{state.message.innerText}
+
+
+ ) } export default DropdownPanel \ No newline at end of file From 272c90571055adc9125b15e1247cacfc20857cf6 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 18 Jan 2021 12:44:22 +0100 Subject: [PATCH 25/41] indent --- .../src/lib/vm-debugger/assembly-items.tsx | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx index f0479d8eac..77d4f0c5fa 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx @@ -3,59 +3,59 @@ import { initialState, reducer } from '../../reducers/assembly-items' import './styles/assembly-items.css' export const AssemblyItems = ({ registerEvent }) => { - const [assemblyItems, dispatch] = useReducer(reducer, initialState) - const [selectedItem, setSelectedItem] = useState(0) - const refs = useRef({}) - const asmItemsRef = useRef(null) - - useEffect(()=>{ - registerEvent && registerEvent('codeManagerChanged', (code, address, index) => { - dispatch({ type: 'FETCH_OPCODES_SUCCESS', payload: { code, address, index } }) - }) - }, []) - - useEffect(() => { - if (selectedItem !== assemblyItems.index) { - indexChanged(assemblyItems.index) - } - }, [assemblyItems.index]) - - const indexChanged = (index: number) => { - if (index < 0) return - let currentItem = refs.current[selectedItem] ? refs.current[selectedItem] : null - - if (currentItem) { - currentItem.removeAttribute('selected') - currentItem.removeAttribute('style') - if (currentItem.firstChild) { - currentItem.firstChild.removeAttribute('style') - } - const codeView = asmItemsRef.current - - currentItem = codeView.children[index] - currentItem.style.setProperty('border-color', 'var(--primary)') - currentItem.style.setProperty('border-style', 'solid') - currentItem.setAttribute('selected', 'selected') - codeView.scrollTop = currentItem.offsetTop - parseInt(codeView.offsetTop) - setSelectedItem(index) - } + const [assemblyItems, dispatch] = useReducer(reducer, initialState) + const [selectedItem, setSelectedItem] = useState(0) + const refs = useRef({}) + const asmItemsRef = useRef(null) + + useEffect(() => { + registerEvent && registerEvent('codeManagerChanged', (code, address, index) => { + dispatch({ type: 'FETCH_OPCODES_SUCCESS', payload: { code, address, index } }) + }) + }, []) + + useEffect(() => { + if (selectedItem !== assemblyItems.index) { + indexChanged(assemblyItems.index) + } + }, [assemblyItems.index]) + + const indexChanged = (index: number) => { + if (index < 0) return + let currentItem = refs.current[selectedItem] ? refs.current[selectedItem] : null + + if (currentItem) { + currentItem.removeAttribute('selected') + currentItem.removeAttribute('style') + if (currentItem.firstChild) { + currentItem.firstChild.removeAttribute('style') + } + const codeView = asmItemsRef.current + + currentItem = codeView.children[index] + currentItem.style.setProperty('border-color', 'var(--primary)') + currentItem.style.setProperty('border-style', 'solid') + currentItem.setAttribute('selected', 'selected') + codeView.scrollTop = currentItem.offsetTop - parseInt(codeView.offsetTop) + setSelectedItem(index) } + } - return ( -
-
-
-
- { - assemblyItems.display.map((item, i) => { - return
refs.current[i] = ref}>{item}
- }) - } -
-
-
+ return ( +
+
+
+
+ { + assemblyItems.display.map((item, i) => { + return
refs.current[i] = ref}>{item}
+ }) + } +
- ) +
+
+ ) } export default AssemblyItems \ No newline at end of file From f0dbdb9eed425bc30a7da5dac79178ee94f6780a Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 18 Jan 2021 12:54:08 +0100 Subject: [PATCH 26/41] style fixes --- .../src/lib/vm-debugger/calldata-panel.tsx | 10 +- .../src/lib/vm-debugger/callstack-panel.tsx | 10 +- .../lib/vm-debugger/full-storages-changes.tsx | 10 +- .../src/lib/vm-debugger/function-panel.tsx | 18 ++-- .../src/lib/vm-debugger/memory-panel.tsx | 8 +- .../src/lib/vm-debugger/solidity-locals.tsx | 96 +++++++++---------- .../src/lib/vm-debugger/stack-panel.tsx | 12 +-- .../src/lib/vm-debugger/step-detail.tsx | 12 +-- .../src/lib/vm-debugger/storage-panel.tsx | 12 +-- .../src/lib/vm-debugger/vm-debugger-head.tsx | 16 ++-- .../src/lib/vm-debugger/vm-debugger.tsx | 4 +- 11 files changed, 104 insertions(+), 104 deletions(-) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx index 78f8d89b78..70fc5be139 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx @@ -2,11 +2,11 @@ import React from 'react' import DropdownPanel from './dropdown-panel' export const CalldataPanel = ({ calldata }) => { - return ( -
- -
- ) + return ( +
+ +
+ ) } export default CalldataPanel \ No newline at end of file diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx index 2ac5adb2ed..63183b3ed5 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx @@ -2,11 +2,11 @@ import React from 'react' import DropdownPanel from './dropdown-panel' export const CallstackPanel = ({ calldata }) => { - return ( -
- -
- ) + return ( +
+ +
+ ) } export default CallstackPanel \ No newline at end of file diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx index 7ba3374187..1bed4b97d1 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx @@ -2,11 +2,11 @@ import React from 'react' import { DropdownPanel } from './dropdown-panel' export const FullStoragesChanges = ({ calldata }) => { - return ( -
- -
- ) + return ( +
+ +
+ ) } export default FullStoragesChanges \ No newline at end of file diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/function-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/function-panel.tsx index 333c79dedc..43ccaea0f1 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/function-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/function-panel.tsx @@ -3,17 +3,17 @@ import DropdownPanel from './dropdown-panel' import { default as deepequal } from 'deep-equal' export const FunctionPanel = ({ data }) => { - const [calldata, setCalldata] = useState(null) + const [calldata, setCalldata] = useState(null) - useEffect(() => { - if (!deepequal(calldata, data)) setCalldata(data) - }, [data]) + useEffect(() => { + if (!deepequal(calldata, data)) setCalldata(data) + }, [data]) - return ( -
- -
- ) + return ( +
+ +
+ ) } export default FunctionPanel diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx index 2685586356..9330d6f864 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx @@ -2,9 +2,9 @@ import React from 'react' import DropdownPanel from './dropdown-panel' export const MemoryPanel = ({ calldata }) => { - return ( - - ) + return ( + + ) } -export default MemoryPanel \ No newline at end of file +export default MemoryPanel diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx index 99662cc6d0..bcf8ce11dd 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx @@ -4,59 +4,59 @@ import { extractData } from '../../utils/solidityTypeFormatter' import { ExtractData } from '../../types' export const SolidityLocals = ({ data, message, registerEvent, triggerEvent }) => { - const [calldata, setCalldata] = useState(null) + const [calldata, setCalldata] = useState(null) - useEffect(() => { - data && setCalldata(data) - }, [data]) + useEffect(() => { + data && setCalldata(data) + }, [data]) - const formatSelf = (key: string, data: ExtractData) => { - let color = 'var(--primary)' - if (data.isArray || data.isStruct || data.isMapping) { - color = 'var(--info)' - } else if ( - data.type.indexOf('uint') === 0 || - data.type.indexOf('int') === 0 || - data.type.indexOf('bool') === 0 || - data.type.indexOf('enum') === 0 - ) { - color = 'var(--green)' - } else if (data.type === 'string') { - color = 'var(--teal)' - } else if (data.self == 0x0) { // eslint-disable-line - color = 'var(--gray)' - } - if (data.type === 'string') { - data.self = JSON.stringify(data.self) - } - return ( - - ) + const formatSelf = (key: string, data: ExtractData) => { + let color = 'var(--primary)' + if (data.isArray || data.isStruct || data.isMapping) { + color = 'var(--info)' + } else if ( + data.type.indexOf('uint') === 0 || + data.type.indexOf('int') === 0 || + data.type.indexOf('bool') === 0 || + data.type.indexOf('enum') === 0 + ) { + color = 'var(--green)' + } else if (data.type === 'string') { + color = 'var(--teal)' + } else if (data.self == 0x0) { // eslint-disable-line + color = 'var(--gray)' + } + if (data.type === 'string') { + data.self = JSON.stringify(data.self) } - return ( -
- -
+ ) + } + + return ( +
+ +
+ ) } export default SolidityLocals \ No newline at end of file diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx index 65c9a75140..72587cc49c 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx @@ -2,11 +2,11 @@ import React from 'react' import DropdownPanel from './dropdown-panel' export const StackPanel = ({ calldata }) => { - return ( -
- -
- ) + return ( +
+ +
+ ) } -export default StackPanel \ No newline at end of file +export default StackPanel diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx index 4acde10731..c4e340eb16 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx @@ -2,11 +2,11 @@ import React from 'react' import DropdownPanel from './dropdown-panel' export const StepDetail = ({ stepDetail }) => { - return ( -
- -
- ) + return ( +
+ +
+ ) } -export default StepDetail \ No newline at end of file +export default StepDetail diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/storage-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/storage-panel.tsx index 0520d5d099..46714c70da 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/storage-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/storage-panel.tsx @@ -2,11 +2,11 @@ import React from 'react' import DropdownPanel from './dropdown-panel' export const StoragePanel = ({ calldata, header }) => { - return ( -
- -
- ) + return ( +
+ +
+ ) } -export default StoragePanel \ No newline at end of file +export default StoragePanel diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx index b28cc36066..f9ed8d7612 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx @@ -17,18 +17,18 @@ export const VmDebuggerHead = ({ vmDebugger: { registerEvent, triggerEvent } }) }) const [solidityState, setSolidityState] = useState({ calldata: null, - message: null, + message: null }) const [solidityLocals, setSolidityLocals] = useState({ calldata: null, - message: null, + message: null }) useEffect(() => { registerEvent && registerEvent('functionsStackUpdate', (stack) => { if (stack === null || stack.length === 0) return const functions = [] - + for (const func of stack) { functions.push(func.functionDefinition.name + '(' + func.inputs.join(', ') + ')') } @@ -97,15 +97,15 @@ export const VmDebuggerHead = ({ vmDebugger: { registerEvent, triggerEvent } }) }, [registerEvent]) return ( -
-
-
+
+
+
-
-
+
+
) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger.tsx index 00642d864b..df47ff7afc 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger.tsx @@ -51,14 +51,14 @@ export const VmDebugger = ({ vmDebugger: { registerEvent } }) => { }, [registerEvent]) return ( -
+
- +
From 9693c2f272c33ea768d67d9ddf063c512c087bd1 Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 18 Jan 2021 14:28:21 +0100 Subject: [PATCH 27/41] added right margin for treeview item --- apps/remix-ide/src/app/ui/TreeView.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/ui/TreeView.js b/apps/remix-ide/src/app/ui/TreeView.js index 0e020472e7..413f49f667 100644 --- a/apps/remix-ide/src/app/ui/TreeView.js +++ b/apps/remix-ide/src/app/ui/TreeView.js @@ -176,7 +176,7 @@ class TreeView { formatSelfDefault (key, data) { return yo` -
+
From 786c693c21fccf9220f6b53d2d678adb7ea13c48 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 19 Jan 2021 10:24:53 +0100 Subject: [PATCH 28/41] Added linting config --- libs/remix-ui/debugger-ui/.eslintrc | 262 +----------------- libs/remix-ui/debugger-ui/jest.config.js | 2 +- .../debugger-ui/src/hooks/extract-data.tsx | 96 +++---- .../lib/button-navigator/button-navigator.tsx | 4 +- .../debugger-ui/src/lib/debugger-ui.tsx | 93 +++---- .../debugger-ui/src/lib/idebugger-api.ts | 8 +- .../debugger-ui/src/lib/slider/slider.tsx | 20 +- .../src/lib/step-manager/step-manager.tsx | 2 +- .../src/lib/tx-browser/tx-browser.tsx | 2 +- .../src/lib/vm-debugger/assembly-items.tsx | 2 +- .../src/lib/vm-debugger/calldata-panel.tsx | 2 +- .../src/lib/vm-debugger/callstack-panel.tsx | 2 +- .../src/lib/vm-debugger/code-list-view.tsx | 4 +- .../src/lib/vm-debugger/dropdown-panel.tsx | 6 +- .../lib/vm-debugger/full-storages-changes.tsx | 2 +- .../src/lib/vm-debugger/solidity-locals.tsx | 4 +- .../src/lib/vm-debugger/solidity-state.tsx | 60 ++-- .../src/lib/vm-debugger/vm-debugger-head.tsx | 8 +- .../src/reducers/assembly-items.ts | 62 ++--- .../debugger-ui/src/reducers/calldata.ts | 76 ++--- libs/remix-ui/debugger-ui/src/types/index.ts | 2 +- .../src/utils/solidityTypeFormatter.ts | 78 +++--- package.json | 2 +- 23 files changed, 283 insertions(+), 516 deletions(-) diff --git a/libs/remix-ui/debugger-ui/.eslintrc b/libs/remix-ui/debugger-ui/.eslintrc index 73f9b856ee..b8666066e9 100644 --- a/libs/remix-ui/debugger-ui/.eslintrc +++ b/libs/remix-ui/debugger-ui/.eslintrc @@ -1,250 +1,18 @@ { - "rules": { - "@typescript-eslint/ban-types": "off", - "no-case-declarations": "off", - "array-callback-return": "warn", - "dot-location": ["warn", "property"], - "eqeqeq": ["warn", "smart"], - "new-parens": "warn", - "no-caller": "warn", - "no-cond-assign": ["warn", "except-parens"], - "no-const-assign": "warn", - "no-control-regex": "warn", - "no-delete-var": "warn", - "no-dupe-args": "warn", - "no-dupe-keys": "warn", - "no-duplicate-case": "warn", - "no-empty-character-class": "warn", - "no-empty-pattern": "warn", - "no-eval": "warn", - "no-ex-assign": "warn", - "no-extend-native": "warn", - "no-extra-bind": "warn", - "no-extra-label": "warn", - "no-fallthrough": "warn", - "no-func-assign": "warn", - "no-implied-eval": "warn", - "no-invalid-regexp": "warn", - "no-iterator": "warn", - "no-label-var": "warn", - "no-labels": ["warn", { "allowLoop": true, "allowSwitch": false }], - "no-lone-blocks": "warn", - "no-loop-func": "warn", - "no-mixed-operators": [ - "warn", - { - "groups": [ - ["&", "|", "^", "~", "<<", ">>", ">>>"], - ["==", "!=", "===", "!==", ">", ">=", "<", "<="], - ["&&", "||"], - ["in", "instanceof"] - ], - "allowSamePrecedence": false - } - ], - "no-multi-str": "warn", - "no-native-reassign": "warn", - "no-negated-in-lhs": "warn", - "no-new-func": "warn", - "no-new-object": "warn", - "no-new-symbol": "warn", - "no-new-wrappers": "warn", - "no-obj-calls": "warn", - "no-octal": "warn", - "no-octal-escape": "warn", - "no-redeclare": "warn", - "no-regex-spaces": "warn", - "no-restricted-syntax": ["warn", "WithStatement"], - "no-script-url": "warn", - "no-self-assign": "warn", - "no-self-compare": "warn", - "no-sequences": "warn", - "no-shadow-restricted-names": "warn", - "no-sparse-arrays": "warn", - "no-template-curly-in-string": "warn", - "no-this-before-super": "warn", - "no-throw-literal": "warn", - "no-restricted-globals": [ - "error", - "addEventListener", - "blur", - "close", - "closed", - "confirm", - "defaultStatus", - "defaultstatus", - "event", - "external", - "find", - "focus", - "frameElement", - "frames", - "history", - "innerHeight", - "innerWidth", - "length", - "location", - "locationbar", - "menubar", - "moveBy", - "moveTo", - "name", - "onblur", - "onerror", - "onfocus", - "onload", - "onresize", - "onunload", - "open", - "opener", - "opera", - "outerHeight", - "outerWidth", - "pageXOffset", - "pageYOffset", - "parent", - "print", - "removeEventListener", - "resizeBy", - "resizeTo", - "screen", - "screenLeft", - "screenTop", - "screenX", - "screenY", - "scroll", - "scrollbars", - "scrollBy", - "scrollTo", - "scrollX", - "scrollY", - "self", - "status", - "statusbar", - "stop", - "toolbar", - "top" - ], - "no-unexpected-multiline": "warn", - "no-unreachable": "warn", - "no-unused-expressions": [ - "error", - { - "allowShortCircuit": true, - "allowTernary": true, - "allowTaggedTemplates": true - } - ], - "no-unused-labels": "warn", - "no-useless-computed-key": "warn", - "no-useless-concat": "warn", - "no-useless-escape": "warn", - "no-useless-rename": [ - "warn", - { - "ignoreDestructuring": false, - "ignoreImport": false, - "ignoreExport": false - } - ], - "no-with": "warn", - "no-whitespace-before-property": "warn", - "react-hooks/exhaustive-deps": "warn", - "require-yield": "warn", - "rest-spread-spacing": ["warn", "never"], - "strict": ["warn", "never"], - "unicode-bom": ["warn", "never"], - "use-isnan": "warn", - "valid-typeof": "warn", - "no-restricted-properties": [ - "error", - { - "object": "require", - "property": "ensure", - "message": "Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting" - }, - { - "object": "System", - "property": "import", - "message": "Please use import() instead. More info: https://facebook.github.io/create-react-app/docs/code-splitting" - } - ], - "getter-return": "warn", - "import/first": "error", - "import/no-amd": "error", - "import/no-webpack-loader-syntax": "error", - "react/forbid-foreign-prop-types": ["warn", { "allowInPropTypes": true }], - "react/jsx-no-comment-textnodes": "warn", - "react/jsx-no-duplicate-props": "warn", - "react/jsx-no-target-blank": "warn", - "react/jsx-no-undef": "error", - "react/jsx-pascal-case": ["warn", { "allowAllCaps": true, "ignore": [] }], - "react/jsx-uses-react": "warn", - "react/jsx-uses-vars": "warn", - "react/no-danger-with-children": "warn", - "react/no-direct-mutation-state": "warn", - "react/no-is-mounted": "warn", - "react/no-typos": "error", - "react/react-in-jsx-scope": "error", - "react/require-render-return": "error", - "react/style-prop-object": "warn", - "react/jsx-no-useless-fragment": "warn", - "jsx-a11y/accessible-emoji": "warn", - "jsx-a11y/alt-text": "warn", - "jsx-a11y/anchor-has-content": "warn", - "jsx-a11y/anchor-is-valid": [ - "warn", - { "aspects": ["noHref", "invalidHref"] } - ], - "jsx-a11y/aria-activedescendant-has-tabindex": "warn", - "jsx-a11y/aria-props": "warn", - "jsx-a11y/aria-proptypes": "warn", - "jsx-a11y/aria-role": "warn", - "jsx-a11y/aria-unsupported-elements": "warn", - "jsx-a11y/heading-has-content": "warn", - "jsx-a11y/iframe-has-title": "warn", - "jsx-a11y/img-redundant-alt": "warn", - "jsx-a11y/no-access-key": "warn", - "jsx-a11y/no-distracting-elements": "warn", - "jsx-a11y/no-redundant-roles": "warn", - "jsx-a11y/role-has-required-aria-props": "warn", - "jsx-a11y/role-supports-aria-props": "warn", - "jsx-a11y/scope": "warn", - "react-hooks/rules-of-hooks": "error", - "default-case": "off", - "no-dupe-class-members": "off", - "no-undef": "off", - "@typescript-eslint/consistent-type-assertions": "warn", - "no-array-constructor": "off", - "@typescript-eslint/no-array-constructor": "warn", - "@typescript-eslint/no-namespace": "error", - "no-use-before-define": "off", - "@typescript-eslint/no-use-before-define": [ - "warn", - { - "functions": false, - "classes": false, - "variables": false, - "typedefs": false - } - ], - "no-unused-vars": "off", - "@typescript-eslint/no-unused-vars": [ - "warn", - { "args": "none", "ignoreRestSiblings": true } - ], - "no-useless-constructor": "off", - "@typescript-eslint/no-useless-constructor": "warn" - }, "env": { - "browser": true, - "commonjs": true, - "es6": true, - "jest": true, - "node": true + "browser": true, + "es6": true + }, + "extends": "../../../.eslintrc", + "globals": { + "Atomics": "readonly", + "SharedArrayBuffer": "readonly" }, - "settings": { "react": { "version": "detect" } }, - "plugins": ["import", "jsx-a11y", "react", "react-hooks"], - "extends": ["../../../.eslintrc"], - "ignorePatterns": ["!**/*"] -} + "parserOptions": { + "ecmaVersion": 11, + "sourceType": "module" + }, + "rules": { + "standard/no-callback-literal": "off" + } +} diff --git a/libs/remix-ui/debugger-ui/jest.config.js b/libs/remix-ui/debugger-ui/jest.config.js index 7b3def7c76..1505cc5eff 100644 --- a/libs/remix-ui/debugger-ui/jest.config.js +++ b/libs/remix-ui/debugger-ui/jest.config.js @@ -9,4 +9,4 @@ module.exports = { }, moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'html'], coverageDirectory: '../../coverage/libs/debugger-ui' -}; +} diff --git a/libs/remix-ui/debugger-ui/src/hooks/extract-data.tsx b/libs/remix-ui/debugger-ui/src/hooks/extract-data.tsx index da28dfb4bb..d65090363a 100644 --- a/libs/remix-ui/debugger-ui/src/hooks/extract-data.tsx +++ b/libs/remix-ui/debugger-ui/src/hooks/extract-data.tsx @@ -2,57 +2,57 @@ import React, { useState, useEffect } from 'react' import { ExtractData, ExtractFunc } from '../types' export const useExtractData = (json, extractFunc?: ExtractFunc): Array<{ key: string, data: ExtractData }> => { - const [data, setData] = useState([]) - - useEffect(() => { - const data: Array<{ key: string, data: ExtractData }> = Object.keys(json).map((innerKey) => { - if (extractFunc) { - return { - key: innerKey, - data : extractFunc(json[innerKey], json) - } - } else { - return { - key: innerKey, - data: extractDataDefault(json[innerKey], json) - } - } - }) - - setData(data) - - return () => { - setData(null) + const [data, setData] = useState([]) + + useEffect(() => { + const data: Array<{ key: string, data: ExtractData }> = Object.keys(json).map((innerKey) => { + if (extractFunc) { + return { + key: innerKey, + data: extractFunc(json[innerKey], json) } - }, [json, extractFunc]) - - const extractDataDefault: ExtractFunc = (item, parent?) => { - const ret: ExtractData = {} - - if (item instanceof Array) { - ret.children = item.map((item, index) => { - return {key: index, value: item} - }) - ret.self = 'Array' - ret.isNode = true - ret.isLeaf = false - } else if (item instanceof Object) { - ret.children = Object.keys(item).map((key) => { - return {key: key, value: item[key]} - }) - ret.self = 'Object' - ret.isNode = true - ret.isLeaf = false - } else { - ret.self = item - ret.children = null - ret.isNode = false - ret.isLeaf = true + } else { + return { + key: innerKey, + data: extractDataDefault(json[innerKey], json) } - return ret + } + }) + + setData(data) + + return () => { + setData(null) + } + }, [json, extractFunc]) + + const extractDataDefault: ExtractFunc = (item, parent?) => { + const ret: ExtractData = {} + + if (item instanceof Array) { + ret.children = item.map((item, index) => { + return { key: index, value: item } + }) + ret.self = 'Array' + ret.isNode = true + ret.isLeaf = false + } else if (item instanceof Object) { + ret.children = Object.keys(item).map((key) => { + return { key: key, value: item[key] } + }) + ret.self = 'Object' + ret.isNode = true + ret.isLeaf = false + } else { + ret.self = item + ret.children = null + ret.isNode = false + ret.isLeaf = true } + return ret + } - return data + return data } -export default useExtractData \ No newline at end of file +export default useExtractData diff --git a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx index 8e2a893227..98da9e6eb7 100644 --- a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx @@ -45,7 +45,7 @@ export const ButtonNavigation = ({ stepOverBack, stepIntoBack, stepIntoForward, intoForwardDisabled: stepState === 'end', overForwardDisabled: stepState === 'end', jumpNextBreakpointDisabled: stepState === 'end', - jumpOutDisabled: jumpOutDisabled ? jumpOutDisabled : true + jumpOutDisabled: jumpOutDisabled || true } }) } @@ -60,7 +60,7 @@ export const ButtonNavigation = ({ stepOverBack, stepIntoBack, stepIntoForward,
- +
diff --git a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx index b8cd7b9bcf..8c6fcc2fca 100644 --- a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx @@ -34,7 +34,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => { }, []) debuggerModule.onDebugRequested((hash) => { - if (hash) debug(hash) + if (hash) debug(hash) }) debuggerModule.onRemoveHighlights(async () => { @@ -43,15 +43,14 @@ export const DebuggerUI = (props: DebuggerUIProps) => { useEffect(() => { const setEditor = () => { - debuggerModule.onBreakpointCleared((fileName, row) => { - if (state.debugger) state.debugger.breakPointManager.remove({fileName: fileName, row: row}) + if (state.debugger) state.debugger.breakPointManager.remove({ fileName: fileName, row: row }) }) - + debuggerModule.onBreakpointAdded((fileName, row) => { - if (state.debugger) state.debugger.breakPointManager.add({fileName: fileName, row: row}) + if (state.debugger) state.debugger.breakPointManager.add({ fileName: fileName, row: row }) }) - + debuggerModule.onEditorContentChanged(() => { if (state.debugger) unLoad() }) @@ -65,7 +64,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => { debuggerInstance.event.register('debuggerStatus', async (isActive) => { await debuggerModule.discardHighlight() - setState( prevState => { + setState(prevState => { return { ...prevState, isActive } }) }) @@ -151,7 +150,7 @@ export const DebuggerUI = (props: DebuggerUIProps) => { offsetToLineColumnConverter: debuggerModule.offsetToLineColumnConverter, compilationResult: async (address) => { try { - const ret = await debuggerModule.fetchContractAndCompile(address, currentReceipt) + const ret = await debuggerModule.fetchContractAndCompile(address, currentReceipt) return ret } catch (e) { console.error(e) @@ -184,49 +183,49 @@ export const DebuggerUI = (props: DebuggerUIProps) => { }) } -const debug = (txHash) => { - startDebugging(null, txHash, null) -} + const debug = (txHash) => { + startDebugging(null, txHash, null) + } -const stepManager = { - jumpTo: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpTo.bind(state.debugger.step_manager) : null, - stepOverBack: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.stepOverBack.bind(state.debugger.step_manager) : null, - stepIntoBack: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.stepIntoBack.bind(state.debugger.step_manager) : null, - stepIntoForward: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.stepIntoForward.bind(state.debugger.step_manager) : null, - stepOverForward: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.stepOverForward.bind(state.debugger.step_manager) : null, - jumpOut: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpOut.bind(state.debugger.step_manager) : null, - jumpPreviousBreakpoint: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpPreviousBreakpoint.bind(state.debugger.step_manager) : null, - jumpNextBreakpoint: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpNextBreakpoint.bind(state.debugger.step_manager) : null, - jumpToException: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpToException.bind(state.debugger.step_manager) : null, - traceLength: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.traceLength : null, - registerEvent: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.event.register.bind(state.debugger.step_manager.event) : null, -} -const vmDebugger = { - registerEvent: state.debugger && state.debugger.vmDebuggerLogic ? state.debugger.vmDebuggerLogic.event.register.bind(state.debugger.vmDebuggerLogic.event) : null, - triggerEvent: state.debugger && state.debugger.vmDebuggerLogic ? state.debugger.vmDebuggerLogic.event.trigger.bind(state.debugger.vmDebuggerLogic.event) : null -} - return ( -
- -
-
-

Debugger Configuration

-
- { - setState(prevState => { - return { ...prevState, opt: { debugWithGeneratedSources: checked }} - }) - }} type="checkbox" title="Debug with generated sources" /> - -
+ const stepManager = { + jumpTo: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpTo.bind(state.debugger.step_manager) : null, + stepOverBack: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.stepOverBack.bind(state.debugger.step_manager) : null, + stepIntoBack: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.stepIntoBack.bind(state.debugger.step_manager) : null, + stepIntoForward: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.stepIntoForward.bind(state.debugger.step_manager) : null, + stepOverForward: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.stepOverForward.bind(state.debugger.step_manager) : null, + jumpOut: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpOut.bind(state.debugger.step_manager) : null, + jumpPreviousBreakpoint: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpPreviousBreakpoint.bind(state.debugger.step_manager) : null, + jumpNextBreakpoint: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpNextBreakpoint.bind(state.debugger.step_manager) : null, + jumpToException: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.jumpToException.bind(state.debugger.step_manager) : null, + traceLength: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.traceLength : null, + registerEvent: state.debugger && state.debugger.step_manager ? state.debugger.step_manager.event.register.bind(state.debugger.step_manager.event) : null + } + const vmDebugger = { + registerEvent: state.debugger && state.debugger.vmDebuggerLogic ? state.debugger.vmDebuggerLogic.event.register.bind(state.debugger.vmDebuggerLogic.event) : null, + triggerEvent: state.debugger && state.debugger.vmDebuggerLogic ? state.debugger.vmDebuggerLogic.event.trigger.bind(state.debugger.vmDebuggerLogic.event) : null + } + return ( +
+ +
+
+

Debugger Configuration

+
+ { + setState(prevState => { + return { ...prevState, opt: { debugWithGeneratedSources: checked } } + }) + }} type="checkbox" title="Debug with generated sources" /> +
- - { state.debugging && } - { state.debugging && }
- { state.debugging &&
{ state.statusMessage }
} - { state.debugging && } + + { state.debugging && } + { state.debugging && }
+ { state.debugging &&
{ state.statusMessage }
} + { state.debugging && } +
) } diff --git a/libs/remix-ui/debugger-ui/src/lib/idebugger-api.ts b/libs/remix-ui/debugger-ui/src/lib/idebugger-api.ts index 418cd9ba4a..212d6cac3d 100644 --- a/libs/remix-ui/debugger-ui/src/lib/idebugger-api.ts +++ b/libs/remix-ui/debugger-ui/src/lib/idebugger-api.ts @@ -2,13 +2,13 @@ import type { CompilationResult, CompilationSource } from '@remix-project/remix-solidity-ts' export interface DebuggerUIProps { - debuggerAPI: IDebuggerApi + debuggerAPI: IDebuggerApi } export interface LineColumnLocation { start: { line: number, column: number - }, + }, end: { line: number, column: number } @@ -39,7 +39,7 @@ export interface TransactionReceipt { transactionIndex: number from: string to: string - contractAddress: string | null + contractAddress: string | null } export type onBreakpointClearedListener = (params: string, row: number) => void @@ -63,4 +63,4 @@ export interface IDebuggerApi { getFile: (path: string) => Promise setFile: (path: string, content: string) => Promise getDebugWeb3: () => any // returns an instance of web3.js -} \ No newline at end of file +} diff --git a/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx b/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx index 691b4175a1..bfd184fd78 100644 --- a/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx @@ -25,16 +25,16 @@ export const Slider = ({ jumpTo, sliderValue, traceLength }) => { return (
- +
) } diff --git a/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx b/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx index 75259c179c..21812cf58e 100644 --- a/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx @@ -31,7 +31,7 @@ export const StepManager = ({ stepManager: { jumpTo, traceLength, stepIntoBack, return (
- { debugging ? 'Stop' : 'Start' } debugging diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx index 77d4f0c5fa..d80b189f1e 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx @@ -58,4 +58,4 @@ export const AssemblyItems = ({ registerEvent }) => { ) } -export default AssemblyItems \ No newline at end of file +export default AssemblyItems diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx index 70fc5be139..d9bc218adb 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx @@ -9,4 +9,4 @@ export const CalldataPanel = ({ calldata }) => { ) } -export default CalldataPanel \ No newline at end of file +export default CalldataPanel diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx index 63183b3ed5..974a2ffb37 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx @@ -9,4 +9,4 @@ export const CallstackPanel = ({ calldata }) => { ) } -export default CallstackPanel \ No newline at end of file +export default CallstackPanel diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx index 0869755cb1..13b83e7a0c 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx @@ -10,7 +10,7 @@ export const CodeListView = ({ registerEvent }) => { }) const indexChanged = (index) => { - if(index < 0) return + if (index < 0) return setState(prevState => { return { ...prevState, @@ -31,7 +31,7 @@ export const CodeListView = ({ registerEvent }) => { } }) indexChanged(index) - } + } return (
diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx index 7a6d35b37b..332e334aed 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx @@ -134,7 +134,7 @@ export const DropdownPanel = (props: DropdownPanelProps) => { } const update = function (calldata) { - let isEmpty = !calldata ? true : false + let isEmpty = !calldata if (calldata && Array.isArray(calldata) && calldata.length === 0) isEmpty = true else if (calldata && Object.keys(calldata).length === 0 && calldata.constructor === Object) isEmpty = true @@ -171,7 +171,7 @@ export const DropdownPanel = (props: DropdownPanelProps) => { handleExpand(keyPath)} expand={state.expandPath.includes(keyPath)}> {children} - {data.hasNext && { triggerEvent(loadMoreEvent, [data.cursor]) }} />} + {data.hasNext && { triggerEvent(loadMoreEvent, [data.cursor]) }} />} ) @@ -208,4 +208,4 @@ export const DropdownPanel = (props: DropdownPanelProps) => { ) } -export default DropdownPanel \ No newline at end of file +export default DropdownPanel diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx index 1bed4b97d1..5faa0b8f03 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx @@ -9,4 +9,4 @@ export const FullStoragesChanges = ({ calldata }) => { ) } -export default FullStoragesChanges \ No newline at end of file +export default FullStoragesChanges diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx index bcf8ce11dd..80ef3c85e9 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx @@ -44,7 +44,7 @@ export const SolidityLocals = ({ data, message, registerEvent, triggerEvent }) = return (
- { - const formatSelf = (key: string, data: ExtractData) => { - let color = 'var(--primary)' - if (data.isArray || data.isStruct || data.isMapping) { - color = 'var(--info)' - } else if ( - data.type.indexOf('uint') === 0 || + const formatSelf = (key: string, data: ExtractData) => { + let color = 'var(--primary)' + if (data.isArray || data.isStruct || data.isMapping) { + color = 'var(--info)' + } else if ( + data.type.indexOf('uint') === 0 || data.type.indexOf('int') === 0 || data.type.indexOf('bool') === 0 || data.type.indexOf('enum') === 0 - ) { - color = 'var(--green)' - } else if (data.type === 'string') { - color = 'var(--teal)' + ) { + color = 'var(--green)' + } else if (data.type === 'string') { + color = 'var(--teal)' } else if (data.self == 0x0) { // eslint-disable-line - color = 'var(--gray)' - } - return ( - - ) + color = 'var(--gray)' } - return ( -
- { - - } -
+ ) + } + + return ( +
+ { + + } +
+ ) } -export default SolidityState \ No newline at end of file +export default SolidityState diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx index f9ed8d7612..7ea61fd67e 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx @@ -11,7 +11,7 @@ export const VmDebuggerHead = ({ vmDebugger: { registerEvent, triggerEvent } }) 'vm trace step': '-', 'execution step': '-', 'add memory': '', - 'gas': '', + gas: '', 'remaining gas': '-', 'loaded address': '-' }) @@ -36,12 +36,12 @@ export const VmDebuggerHead = ({ vmDebugger: { registerEvent, triggerEvent } }) }) registerEvent && registerEvent('traceUnloaded', () => { setStepDetail(() => { - return { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' } + return { 'vm trace step': '-', 'execution step': '-', 'add memory': '', gas: '', 'remaining gas': '-', 'loaded address': '-' } }) }) registerEvent && registerEvent('newTraceLoaded', () => { setStepDetail(() => { - return { 'vm trace step': '-', 'execution step': '-', 'add memory': '', 'gas': '', 'remaining gas': '-', 'loaded address': '-' } + return { 'vm trace step': '-', 'execution step': '-', 'add memory': '', gas: '', 'remaining gas': '-', 'loaded address': '-' } }) }) registerEvent && registerEvent('traceCurrentStepUpdate', (error, step) => { @@ -56,7 +56,7 @@ export const VmDebuggerHead = ({ vmDebugger: { registerEvent, triggerEvent } }) }) registerEvent && registerEvent('traceStepCostUpdate', (error, gas) => { setStepDetail(prevState => { - return { ...prevState, 'gas': (error ? '-' : gas) } + return { ...prevState, gas: (error ? '-' : gas) } }) }) registerEvent && registerEvent('traceCurrentCalledAddressAtUpdate', (error, address) => { diff --git a/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts b/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts index 12af113a14..f47eaedd67 100644 --- a/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts +++ b/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts @@ -6,18 +6,18 @@ interface Action { } export const initialState = { - opCodes: { - code: [], - index: 0, - address: '' - }, - display: [], + opCodes: { + code: [], index: 0, - top: 0, - bottom: 0, - isRequesting: false, - isSuccessful: false, - hasError: null + address: '' + }, + display: [], + index: 0, + top: 0, + bottom: 0, + isRequesting: false, + isSuccessful: false, + hasError: null } export const reducer = (state = initialState, action: Action) => { @@ -28,36 +28,36 @@ export const reducer = (state = initialState, action: Action) => { isRequesting: true, isSuccessful: false, hasError: null - }; + } } case 'FETCH_OPCODES_SUCCESS': { - const opCodes = action.payload.address === state.opCodes.address ? { - ...state.opCodes, index: action.payload.index + const opCodes = action.payload.address === state.opCodes.address ? { + ...state.opCodes, index: action.payload.index } : deepEqual(action.payload.code, state.opCodes.code) ? state.opCodes : action.payload const top = opCodes.index - 3 > 0 ? opCodes.index - 3 : 0 const bottom = opCodes.index + 4 < opCodes.code.length ? opCodes.index + 4 : opCodes.code.length - const display = opCodes.code.slice(top, bottom) + const display = opCodes.code.slice(top, bottom) return { - opCodes, - display, - index: display.findIndex(code => code === opCodes.code[opCodes.index]), - top, - bottom, - isRequesting: false, - isSuccessful: true, - hasError: null - }; + opCodes, + display, + index: display.findIndex(code => code === opCodes.code[opCodes.index]), + top, + bottom, + isRequesting: false, + isSuccessful: true, + hasError: null + } } case 'FETCH_OPCODES_ERROR': { return { - ...state, - isRequesting: false, - isSuccessful: false, - hasError: action.payload - }; + ...state, + isRequesting: false, + isSuccessful: false, + hasError: action.payload + } } default: - throw new Error(); + throw new Error() } -} \ No newline at end of file +} diff --git a/libs/remix-ui/debugger-ui/src/reducers/calldata.ts b/libs/remix-ui/debugger-ui/src/reducers/calldata.ts index aa37739a7a..e33425d8fd 100644 --- a/libs/remix-ui/debugger-ui/src/reducers/calldata.ts +++ b/libs/remix-ui/debugger-ui/src/reducers/calldata.ts @@ -4,58 +4,58 @@ interface Action { } export const initialState = { - calldata: {}, - isRequesting: false, - isSuccessful: false, - hasError: null + calldata: {}, + isRequesting: false, + isSuccessful: false, + hasError: null } export const reducer = (state = initialState, action: Action) => { switch (action.type) { case 'FETCH_CALLDATA_REQUEST': return { - ...state, - isRequesting: true, - isSuccessful: false, - hasError: null - }; + ...state, + isRequesting: true, + isSuccessful: false, + hasError: null + } case 'FETCH_CALLDATA_SUCCESS': return { - calldata: action.payload, - isRequesting: false, - isSuccessful: true, - hasError: null - }; + calldata: action.payload, + isRequesting: false, + isSuccessful: true, + hasError: null + } case 'FETCH_CALLDATA_ERROR': - return { - ...state, - isRequesting: false, - isSuccessful: false, - hasError: action.payload - }; + return { + ...state, + isRequesting: false, + isSuccessful: false, + hasError: action.payload + } case 'UPDATE_CALLDATA_REQUEST': return { - ...state, - isRequesting: true, - isSuccessful: false, - hasError: null - }; + ...state, + isRequesting: true, + isSuccessful: false, + hasError: null + } case 'UPDATE_CALLDATA_SUCCESS': return { - calldata: mergeLocals(action.payload, state.calldata), - isRequesting: false, - isSuccessful: true, - hasError: null - }; + calldata: mergeLocals(action.payload, state.calldata), + isRequesting: false, + isSuccessful: true, + hasError: null + } case 'UPDATE_CALLDATA_ERROR': - return { - ...state, - isRequesting: false, - isSuccessful: false, - hasError: action.payload - }; + return { + ...state, + isRequesting: false, + isSuccessful: false, + hasError: action.payload + } default: - throw new Error(); + throw new Error() } } @@ -69,4 +69,4 @@ function mergeLocals (locals1, locals2) { } }) return locals2 -} \ No newline at end of file +} diff --git a/libs/remix-ui/debugger-ui/src/types/index.ts b/libs/remix-ui/debugger-ui/src/types/index.ts index 7b3861b251..45a26384dc 100644 --- a/libs/remix-ui/debugger-ui/src/types/index.ts +++ b/libs/remix-ui/debugger-ui/src/types/index.ts @@ -30,4 +30,4 @@ export interface DropdownPanelProps { loadMoreCompletedEvent?: string } -export type FormatSelfFunc = (key: string | number, data: ExtractData) => JSX.Element \ No newline at end of file +export type FormatSelfFunc = (key: string | number, data: ExtractData) => JSX.Element diff --git a/libs/remix-ui/debugger-ui/src/utils/solidityTypeFormatter.ts b/libs/remix-ui/debugger-ui/src/utils/solidityTypeFormatter.ts index c0d0dfcb3b..25015892e3 100644 --- a/libs/remix-ui/debugger-ui/src/utils/solidityTypeFormatter.ts +++ b/libs/remix-ui/debugger-ui/src/utils/solidityTypeFormatter.ts @@ -2,43 +2,43 @@ import { BN } from 'ethereumjs-util' import { ExtractData } from '../types' export function extractData (item, parent): ExtractData { - const ret: ExtractData = {} + const ret: ExtractData = {} - if (item.isProperty) { - return item - } - if (item.type.lastIndexOf(']') === item.type.length - 1) { - ret.children = (item.value || []).map(function (item, index) { - return {key: index, value: item} - }) - ret.children.unshift({ - key: 'length', - value: { - self: (new BN(item.length.replace('0x', ''), 16)).toString(10), - type: 'uint', - isProperty: true - } - }) - ret.isArray = true - ret.self = parent.isArray ? '' : item.type - ret.cursor = item.cursor - ret.hasNext = item.hasNext - } else if (item.type.indexOf('struct') === 0) { - ret.children = Object.keys((item.value || {})).map(function (key) { - return {key: key, value: item.value[key]} - }) - ret.self = item.type - ret.isStruct = true - } else if (item.type.indexOf('mapping') === 0) { - ret.children = Object.keys((item.value || {})).map(function (key) { - return {key: key, value: item.value[key]} - }) - ret.isMapping = true - ret.self = item.type - } else { - ret.children = null - ret.self = item.value - ret.type = item.type - } - return ret -} \ No newline at end of file + if (item.isProperty) { + return item + } + if (item.type.lastIndexOf(']') === item.type.length - 1) { + ret.children = (item.value || []).map(function (item, index) { + return { key: index, value: item } + }) + ret.children.unshift({ + key: 'length', + value: { + self: (new BN(item.length.replace('0x', ''), 16)).toString(10), + type: 'uint', + isProperty: true + } + }) + ret.isArray = true + ret.self = parent.isArray ? '' : item.type + ret.cursor = item.cursor + ret.hasNext = item.hasNext + } else if (item.type.indexOf('struct') === 0) { + ret.children = Object.keys((item.value || {})).map(function (key) { + return { key: key, value: item.value[key] } + }) + ret.self = item.type + ret.isStruct = true + } else if (item.type.indexOf('mapping') === 0) { + ret.children = Object.keys((item.value || {})).map(function (key) { + return { key: key, value: item.value[key] } + }) + ret.isMapping = true + ret.self = item.type + } else { + ret.children = null + ret.self = item.value + ret.type = item.type + } + return ret +} diff --git a/package.json b/package.json index 04c5887ac2..783ad4b020 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "workspace-schematic": "nx workspace-schematic", "dep-graph": "nx dep-graph", "help": "nx help", - "lint:libs": "nx run-many --target=lint --projects=remixd,remix-ui-tree-view,remix-ui-modal-dialog,remix-ui-toaster,remix-ui-file-explorer", + "lint:libs": "nx run-many --target=lint --projects=remixd,remix-ui-tree-view,remix-ui-modal-dialog,remix-ui-toaster,remix-ui-file-explorer,remix-ui-debugger-ui", "build:libs": "nx run-many --target=build --parallel=false --with-deps=true --projects=remix-analyzer,remix-astwalker,remix-debug,remix-lib,remix-simulator,remix-solidity,remix-tests,remix-url-resolver,remixd", "test:libs": "nx run-many --target=test --projects=remix-analyzer,remix-astwalker,remix-debug,remix-lib,remix-simulator,remix-solidity,remix-tests,remix-url-resolver,remixd", "publish:libs": "npm run build:libs & lerna publish --skip-git & npm run bumpVersion:libs", From 303094a713208514d5242d2270dc398d81c6fc77 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 19 Jan 2021 12:05:14 +0100 Subject: [PATCH 29/41] Fixed linting errors --- .../debugger-ui/src/hooks/extract-data.tsx | 4 +-- .../lib/button-navigator/button-navigator.tsx | 2 +- .../debugger-ui/src/lib/debugger-ui.tsx | 16 ++++----- .../debugger-ui/src/lib/idebugger-api.ts | 2 +- .../debugger-ui/src/lib/slider/slider.tsx | 2 +- .../src/lib/step-manager/step-manager.tsx | 6 ++-- .../src/lib/tx-browser/tx-browser.tsx | 2 +- .../src/lib/vm-debugger/assembly-items.tsx | 4 +-- .../src/lib/vm-debugger/calldata-panel.tsx | 4 +-- .../src/lib/vm-debugger/callstack-panel.tsx | 4 +-- .../src/lib/vm-debugger/code-list-view.tsx | 35 ++----------------- .../src/lib/vm-debugger/dropdown-panel.tsx | 8 ++--- .../lib/vm-debugger/full-storages-changes.tsx | 4 +-- .../src/lib/vm-debugger/function-panel.tsx | 6 ++-- .../src/lib/vm-debugger/memory-panel.tsx | 4 +-- .../src/lib/vm-debugger/solidity-locals.tsx | 8 ++--- .../src/lib/vm-debugger/solidity-state.tsx | 6 ++-- .../src/lib/vm-debugger/stack-panel.tsx | 4 +-- .../src/lib/vm-debugger/step-detail.tsx | 4 +-- .../src/lib/vm-debugger/storage-panel.tsx | 4 +-- .../src/lib/vm-debugger/vm-debugger-head.tsx | 12 +++---- .../src/lib/vm-debugger/vm-debugger.tsx | 16 ++++----- .../src/reducers/assembly-items.ts | 2 +- .../src/utils/solidityTypeFormatter.ts | 2 +- 24 files changed, 65 insertions(+), 96 deletions(-) diff --git a/libs/remix-ui/debugger-ui/src/hooks/extract-data.tsx b/libs/remix-ui/debugger-ui/src/hooks/extract-data.tsx index d65090363a..e60dccd6e7 100644 --- a/libs/remix-ui/debugger-ui/src/hooks/extract-data.tsx +++ b/libs/remix-ui/debugger-ui/src/hooks/extract-data.tsx @@ -1,5 +1,5 @@ -import React, { useState, useEffect } from 'react' -import { ExtractData, ExtractFunc } from '../types' +import React, { useState, useEffect } from 'react' // eslint-disable-line +import { ExtractData, ExtractFunc } from '../types' // eslint-disable-line export const useExtractData = (json, extractFunc?: ExtractFunc): Array<{ key: string, data: ExtractData }> => { const [data, setData] = useState([]) diff --git a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx index 98da9e6eb7..55ffc569b4 100644 --- a/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/button-navigator/button-navigator.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect } from 'react' // eslint-disable-line import './button-navigator.css' export const ButtonNavigation = ({ stepOverBack, stepIntoBack, stepIntoForward, stepOverForward, jumpOut, jumpPreviousBreakpoint, jumpNextBreakpoint, jumpToException, revertedReason, stepState, jumpOutDisabled }) => { diff --git a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx index 8c6fcc2fca..8b159744af 100644 --- a/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx @@ -1,11 +1,11 @@ -import React, { useState, useEffect } from 'react' -import TxBrowser from './tx-browser/tx-browser' -import StepManager from './step-manager/step-manager' -import VmDebugger from './vm-debugger/vm-debugger' -import VmDebuggerHead from './vm-debugger/vm-debugger-head' -import { TransactionDebugger as Debugger } from '@remix-project/remix-debug' -import { DebuggerUIProps } from './idebugger-api' -import { Toaster } from '@remix-ui/toaster' +import React, { useState, useEffect } from 'react' // eslint-disable-line +import TxBrowser from './tx-browser/tx-browser' // eslint-disable-line +import StepManager from './step-manager/step-manager' // eslint-disable-line +import VmDebugger from './vm-debugger/vm-debugger' // eslint-disable-line +import VmDebuggerHead from './vm-debugger/vm-debugger-head' // eslint-disable-line +import { TransactionDebugger as Debugger } from '@remix-project/remix-debug' // eslint-disable-line +import { DebuggerUIProps } from './idebugger-api' // eslint-disable-line +import { Toaster } from '@remix-ui/toaster' // eslint-disable-line /* eslint-disable-next-line */ import './debugger-ui.css' diff --git a/libs/remix-ui/debugger-ui/src/lib/idebugger-api.ts b/libs/remix-ui/debugger-ui/src/lib/idebugger-api.ts index 212d6cac3d..4919b2ca13 100644 --- a/libs/remix-ui/debugger-ui/src/lib/idebugger-api.ts +++ b/libs/remix-ui/debugger-ui/src/lib/idebugger-api.ts @@ -1,5 +1,5 @@ -import type { CompilationResult, CompilationSource } from '@remix-project/remix-solidity-ts' +import type { CompilationResult, CompilationSource } from '@remix-project/remix-solidity-ts' // eslint-disable-line export interface DebuggerUIProps { debuggerAPI: IDebuggerApi diff --git a/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx b/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx index bfd184fd78..81e036a8b8 100644 --- a/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/slider/slider.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect } from 'react' // eslint-disable-line export const Slider = ({ jumpTo, sliderValue, traceLength }) => { const [state, setState] = useState({ diff --git a/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx b/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx index 21812cf58e..4094184310 100644 --- a/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/step-manager/step-manager.tsx @@ -1,6 +1,6 @@ -import React, { useState, useEffect } from 'react' -import Slider from '../slider/slider' -import ButtonNavigator from '../button-navigator/button-navigator' +import React, { useState, useEffect } from 'react' // eslint-disable-line +import Slider from '../slider/slider' // eslint-disable-line +import ButtonNavigator from '../button-navigator/button-navigator' // eslint-disable-line export const StepManager = ({ stepManager: { jumpTo, traceLength, stepIntoBack, stepIntoForward, stepOverBack, stepOverForward, jumpOut, jumpNextBreakpoint, jumpPreviousBreakpoint, jumpToException, registerEvent } }) => { const [state, setState] = useState({ diff --git a/libs/remix-ui/debugger-ui/src/lib/tx-browser/tx-browser.tsx b/libs/remix-ui/debugger-ui/src/lib/tx-browser/tx-browser.tsx index 1d4bc51f08..46b937f795 100644 --- a/libs/remix-ui/debugger-ui/src/lib/tx-browser/tx-browser.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/tx-browser/tx-browser.tsx @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react' +import React, { useState, useEffect } from 'react' // eslint-disable-line import './tx-browser.css' export const TxBrowser = ({ requestDebug, unloadRequested, transactionNumber, debugging }) => { diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx index d80b189f1e..67f9821960 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/assembly-items.tsx @@ -1,4 +1,4 @@ -import React, { useState, useRef, useEffect, useReducer } from 'react' +import React, { useState, useRef, useEffect, useReducer } from 'react' // eslint-disable-line import { initialState, reducer } from '../../reducers/assembly-items' import './styles/assembly-items.css' @@ -48,7 +48,7 @@ export const AssemblyItems = ({ registerEvent }) => {
{ assemblyItems.display.map((item, i) => { - return
refs.current[i] = ref}>{item}
+ return
{ refs.current[i] = ref }}>{item}
}) }
diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx index d9bc218adb..bf9cba0173 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/calldata-panel.tsx @@ -1,5 +1,5 @@ -import React from 'react' -import DropdownPanel from './dropdown-panel' +import React from 'react' // eslint-disable-line +import DropdownPanel from './dropdown-panel' // eslint-disable-line export const CalldataPanel = ({ calldata }) => { return ( diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx index 974a2ffb37..9b9d9b93e9 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/callstack-panel.tsx @@ -1,5 +1,5 @@ -import React from 'react' -import DropdownPanel from './dropdown-panel' +import React from 'react' // eslint-disable-line +import DropdownPanel from './dropdown-panel' // eslint-disable-line export const CallstackPanel = ({ calldata }) => { return ( diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx index 13b83e7a0c..59df67d5ee 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/code-list-view.tsx @@ -1,38 +1,7 @@ -import React, { useState, useEffect } from 'react' -import AssemblyItems from './assembly-items' +import React, { useState, useEffect } from 'react' // eslint-disable-line +import AssemblyItems from './assembly-items' // eslint-disable-line export const CodeListView = ({ registerEvent }) => { - const [state, setState] = useState({ - code: [], - address: '', - itemSelected: null, - index: null - }) - - const indexChanged = (index) => { - if (index < 0) return - setState(prevState => { - return { - ...prevState, - index - } - }) - } - - const changed = (code, address, index) => { - if (state.address === address) { - return indexChanged(index) - } - setState(prevState => { - return { - ...prevState, - code, - address - } - }) - indexChanged(index) - } - return (
diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx index 332e334aed..7a93aa426d 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/dropdown-panel.tsx @@ -1,7 +1,7 @@ -import React, { useState, useEffect, useReducer } from 'react' -import { TreeView, TreeViewItem } from '@remix-ui/tree-view' -import { DropdownPanelProps, ExtractData, ExtractFunc } from '../../types' -import { CopyToClipboard } from '@remix-ui/clipboard' +import React, { useState, useEffect, useReducer } from 'react' // eslint-disable-line +import { TreeView, TreeViewItem } from '@remix-ui/tree-view' // eslint-disable-line +import { DropdownPanelProps, ExtractData, ExtractFunc } from '../../types' // eslint-disable-line +import { CopyToClipboard } from '@remix-ui/clipboard' // eslint-disable-line import { initialState, reducer } from '../../reducers/calldata' import './styles/dropdown-panel.css' diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx index 5faa0b8f03..c7de304965 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/full-storages-changes.tsx @@ -1,5 +1,5 @@ -import React from 'react' -import { DropdownPanel } from './dropdown-panel' +import React from 'react' // eslint-disable-line +import { DropdownPanel } from './dropdown-panel' // eslint-disable-line export const FullStoragesChanges = ({ calldata }) => { return ( diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/function-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/function-panel.tsx index 43ccaea0f1..6fa7686d5f 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/function-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/function-panel.tsx @@ -1,6 +1,6 @@ -import React, { useState, useEffect } from 'react' -import DropdownPanel from './dropdown-panel' -import { default as deepequal } from 'deep-equal' +import React, { useState, useEffect } from 'react' // eslint-disable-line +import DropdownPanel from './dropdown-panel' // eslint-disable-line +import { default as deepequal } from 'deep-equal' // eslint-disable-line export const FunctionPanel = ({ data }) => { const [calldata, setCalldata] = useState(null) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx index 9330d6f864..b772369ec6 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/memory-panel.tsx @@ -1,5 +1,5 @@ -import React from 'react' -import DropdownPanel from './dropdown-panel' +import React from 'react' // eslint-disable-line +import DropdownPanel from './dropdown-panel' // eslint-disable-line export const MemoryPanel = ({ calldata }) => { return ( diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx index 80ef3c85e9..15ee3d2bb8 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-locals.tsx @@ -1,7 +1,7 @@ -import React, { useState, useEffect } from 'react' -import DropdownPanel from './dropdown-panel' -import { extractData } from '../../utils/solidityTypeFormatter' -import { ExtractData } from '../../types' +import React, { useState, useEffect } from 'react' // eslint-disable-line +import DropdownPanel from './dropdown-panel' // eslint-disable-line +import { extractData } from '../../utils/solidityTypeFormatter' // eslint-disable-line +import { ExtractData } from '../../types' // eslint-disable-line export const SolidityLocals = ({ data, message, registerEvent, triggerEvent }) => { const [calldata, setCalldata] = useState(null) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-state.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-state.tsx index 8439b8838e..0bc60b9a3f 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-state.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/solidity-state.tsx @@ -1,7 +1,7 @@ -import React from 'react' -import DropdownPanel from './dropdown-panel' +import React from 'react' // eslint-disable-line +import DropdownPanel from './dropdown-panel' // eslint-disable-line import { extractData } from '../../utils/solidityTypeFormatter' -import { ExtractData } from '../../types' +import { ExtractData } from '../../types' // eslint-disable-line export const SolidityState = ({ calldata, message }) => { const formatSelf = (key: string, data: ExtractData) => { diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx index 72587cc49c..fcb86b2699 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/stack-panel.tsx @@ -1,5 +1,5 @@ -import React from 'react' -import DropdownPanel from './dropdown-panel' +import React from 'react' // eslint-disable-line +import DropdownPanel from './dropdown-panel' // eslint-disable-line export const StackPanel = ({ calldata }) => { return ( diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx index c4e340eb16..15d17a7792 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/step-detail.tsx @@ -1,5 +1,5 @@ -import React from 'react' -import DropdownPanel from './dropdown-panel' +import React from 'react' // eslint-disable-line +import DropdownPanel from './dropdown-panel' // eslint-disable-line export const StepDetail = ({ stepDetail }) => { return ( diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/storage-panel.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/storage-panel.tsx index 46714c70da..f7f8ce1714 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/storage-panel.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/storage-panel.tsx @@ -1,5 +1,5 @@ -import React from 'react' -import DropdownPanel from './dropdown-panel' +import React from 'react' // eslint-disable-line +import DropdownPanel from './dropdown-panel' // eslint-disable-line export const StoragePanel = ({ calldata, header }) => { return ( diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx index 7ea61fd67e..8a951cf4fa 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger-head.tsx @@ -1,9 +1,9 @@ -import React, { useState, useEffect } from 'react' -import CodeListView from './code-list-view' -import FunctionPanel from './function-panel' -import StepDetail from './step-detail' -import SolidityState from './solidity-state' -import SolidityLocals from './solidity-locals' +import React, { useState, useEffect } from 'react' // eslint-disable-line +import CodeListView from './code-list-view' // eslint-disable-line +import FunctionPanel from './function-panel' // eslint-disable-line +import StepDetail from './step-detail' // eslint-disable-line +import SolidityState from './solidity-state' // eslint-disable-line +import SolidityLocals from './solidity-locals' // eslint-disable-line export const VmDebuggerHead = ({ vmDebugger: { registerEvent, triggerEvent } }) => { const [functionPanel, setFunctionPanel] = useState(null) diff --git a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger.tsx b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger.tsx index df47ff7afc..a02b95a377 100644 --- a/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger.tsx +++ b/libs/remix-ui/debugger-ui/src/lib/vm-debugger/vm-debugger.tsx @@ -1,11 +1,11 @@ -import React, { useState, useEffect } from 'react' -import CalldataPanel from './calldata-panel' -import MemoryPanel from './memory-panel' -import CallstackPanel from './callstack-panel' -import StackPanel from './stack-panel' -import StoragePanel from './storage-panel' -import ReturnValuesPanel from './dropdown-panel' -import FullStoragesChangesPanel from './full-storages-changes' +import React, { useState, useEffect } from 'react' // eslint-disable-line +import CalldataPanel from './calldata-panel' // eslint-disable-line +import MemoryPanel from './memory-panel' // eslint-disable-line +import CallstackPanel from './callstack-panel' // eslint-disable-line +import StackPanel from './stack-panel' // eslint-disable-line +import StoragePanel from './storage-panel' // eslint-disable-line +import ReturnValuesPanel from './dropdown-panel' // eslint-disable-line +import FullStoragesChangesPanel from './full-storages-changes' // eslint-disable-line export const VmDebugger = ({ vmDebugger: { registerEvent } }) => { const [calldataPanel, setCalldataPanel] = useState(null) diff --git a/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts b/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts index f47eaedd67..4038cce2d9 100644 --- a/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts +++ b/libs/remix-ui/debugger-ui/src/reducers/assembly-items.ts @@ -1,4 +1,4 @@ -import { default as deepEqual } from 'deep-equal' +import { default as deepEqual } from 'deep-equal' // eslint-disable-line interface Action { type: string; diff --git a/libs/remix-ui/debugger-ui/src/utils/solidityTypeFormatter.ts b/libs/remix-ui/debugger-ui/src/utils/solidityTypeFormatter.ts index 25015892e3..65ad0d61a0 100644 --- a/libs/remix-ui/debugger-ui/src/utils/solidityTypeFormatter.ts +++ b/libs/remix-ui/debugger-ui/src/utils/solidityTypeFormatter.ts @@ -1,5 +1,5 @@ import { BN } from 'ethereumjs-util' -import { ExtractData } from '../types' +import { ExtractData } from '../types' // eslint-disable-line export function extractData (item, parent): ExtractData { const ret: ExtractData = {} From 88e7fb214cd0b8ca76f49f896a66c61440a4e700 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 19 Jan 2021 13:21:42 +0100 Subject: [PATCH 30/41] Fixed failing firefox tests --- apps/remix-ide-e2e/src/commands/executeScript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/commands/executeScript.ts b/apps/remix-ide-e2e/src/commands/executeScript.ts index c89f6bd500..d85e9118e0 100644 --- a/apps/remix-ide-e2e/src/commands/executeScript.ts +++ b/apps/remix-ide-e2e/src/commands/executeScript.ts @@ -5,7 +5,7 @@ class ExecuteScript extends EventEmitter { command (this: NightwatchBrowser, script: string): NightwatchBrowser { this.api .clearEditableContent('*[data-id="terminalCliInput"]') - .click('*[data-id="terminalCli"]') + .click('*[data-id="terminalCliInput"]') .sendKeys('*[data-id="terminalCliInput"]', script) .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) From 1d845ebf393d7e4cab5e81f9b4c9cd1b797e3346 Mon Sep 17 00:00:00 2001 From: ioedeveloper Date: Tue, 19 Jan 2021 15:02:21 +0100 Subject: [PATCH 31/41] Revert "Fixed failing firefox tests" This reverts commit 64e4ee8e96dbae05fad16deb4efc59fc523008ff. --- apps/remix-ide-e2e/src/commands/executeScript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide-e2e/src/commands/executeScript.ts b/apps/remix-ide-e2e/src/commands/executeScript.ts index d85e9118e0..c89f6bd500 100644 --- a/apps/remix-ide-e2e/src/commands/executeScript.ts +++ b/apps/remix-ide-e2e/src/commands/executeScript.ts @@ -5,7 +5,7 @@ class ExecuteScript extends EventEmitter { command (this: NightwatchBrowser, script: string): NightwatchBrowser { this.api .clearEditableContent('*[data-id="terminalCliInput"]') - .click('*[data-id="terminalCliInput"]') + .click('*[data-id="terminalCli"]') .sendKeys('*[data-id="terminalCliInput"]', script) .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) .sendKeys('*[data-id="terminalCliInput"]', this.api.Keys.ENTER) From 50dc88fa9907bbb9b9ad17154841727449cd639f Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 16:42:01 +0100 Subject: [PATCH 32/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index d2e99a1c18..2984dc9503 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.8 + - uses: yann300/rebase-pull-requests@v1.0.9 From 6abbdc7cf1b3cbccf4f630b52999bb057726b1a0 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 19 Jan 2021 16:46:04 +0100 Subject: [PATCH 33/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index 2984dc9503..c1404a2a57 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.9 + - uses: yann300/rebase-pull-requests@v1.0.10 From 45c68cd3a4d25db3bd5e58eca4c95598709d176c Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 20 Jan 2021 09:51:18 +0100 Subject: [PATCH 34/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index c1404a2a57..19c9256740 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.10 + - uses: yann300/rebase-pull-requests@v1.0.11 From a57b27b768600c73792662940ec594c4c88b51b7 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 20 Jan 2021 09:55:19 +0100 Subject: [PATCH 35/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index 19c9256740..2179ea3c4f 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.11 + - uses: yann300/rebase-pull-requests@v1.0.12 From 584b90be1b2222fb86a13dfac049560ab9117968 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 20 Jan 2021 09:58:29 +0100 Subject: [PATCH 36/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index 2179ea3c4f..e902f7c8a3 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.12 + - uses: yann300/rebase-pull-requests@v1.0.13 From 1a6565ae7944c0bcbc888b2df68da0b64b0a79e6 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 20 Jan 2021 10:02:25 +0100 Subject: [PATCH 37/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index e902f7c8a3..f10a1850b0 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.13 + - uses: yann300/rebase-pull-requests@v1.0.14 From c5fbc9932f9c21d9168c7f76dc19dee3ed67bccc Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 20 Jan 2021 10:08:02 +0100 Subject: [PATCH 38/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index f10a1850b0..f7afe6cbca 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.14 + - uses: yann300/rebase-pull-requests@v1.0.15 From 53d496ff15fce2da16c25feeba1797fec06a0bf2 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 20 Jan 2021 10:12:02 +0100 Subject: [PATCH 39/41] Update rebase-pull-requests.yml --- .github/workflows/rebase-pull-requests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rebase-pull-requests.yml b/.github/workflows/rebase-pull-requests.yml index f7afe6cbca..50fd616a5f 100644 --- a/.github/workflows/rebase-pull-requests.yml +++ b/.github/workflows/rebase-pull-requests.yml @@ -8,4 +8,4 @@ jobs: rebase: runs-on: ubuntu-latest steps: - - uses: yann300/rebase-pull-requests@v1.0.15 + - uses: yann300/rebase-pull-requests@v1.0.16 From 5b53751942b1ad0f751684b246f13701b6c43cef Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Mon, 18 Jan 2021 12:16:20 +0100 Subject: [PATCH 40/41] Update the size of shadowbox --- apps/remix-ide/src/app/ui/styles/modaldialog-styles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/remix-ide/src/app/ui/styles/modaldialog-styles.js b/apps/remix-ide/src/app/ui/styles/modaldialog-styles.js index b651d951e4..e3468aaf03 100644 --- a/apps/remix-ide/src/app/ui/styles/modaldialog-styles.js +++ b/apps/remix-ide/src/app/ui/styles/modaldialog-styles.js @@ -5,7 +5,7 @@ var css = csjs` .modalFooter { } .modalContent { - box-shadow: 0 0 8px 1000px rgba(0,0,0,0.6),0 6px 20px 0 rgba(0,0,0,0.19); + box-shadow: 0 0 8px 10000px rgba(0,0,0,0.6),0 6px 20px 0 rgba(0,0,0,0.19); -webkit-animation-name: animatetop; -webkit-animation-duration: 0.4s; animation-name: animatetop; From 42db67accd4104eda54938890acedbaede2d07cb Mon Sep 17 00:00:00 2001 From: LianaHus Date: Mon, 18 Jan 2021 12:17:49 +0100 Subject: [PATCH 41/41] updated the reactModal --- libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.css b/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.css index e9385c251c..6f6cd9b221 100644 --- a/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.css +++ b/libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.css @@ -1,5 +1,5 @@ .remixModalContent { - box-shadow: 0 0 8px 1000px rgba(0,0,0,0.6),0 6px 20px 0 rgba(0,0,0,0.19); + box-shadow: 0 0 8px 10000px rgba(0,0,0,0.6),0 6px 20px 0 rgba(0,0,0,0.19); -webkit-animation-name: animatetop; -webkit-animation-duration: 0.4s; animation-name: animatetop;