Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libs/remix-analyzer/src/solidity-analyzer/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
import { AstWalker } from '@remix-project/remix-astwalker'
import { AstWalker } from 'remix-astwalker'
import list from './modules/list'
import { CompilationResult, AnalyzerModule, AnalysisReportObj, AnalysisReport } from '../types'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getStateVariableDeclarationsFromContractNode, getInheritsFromName, getContractName,
getFunctionOrModifierDefinitionParameterPart, getType, getDeclaredVariableName, getFunctionDefinitionReturnParameterPart } from './staticAnalysisCommon'
import { AstWalker } from '@remix-project/remix-astwalker'
import { AstWalker } from 'remix-astwalker'
import { FunctionDefinitionAstNode, ParameterListAstNode, ModifierDefinitionAstNode, ContractHLAst, VariableDeclarationAstNode,
FunctionHLAst, ReportObj, ReportFunction, VisitFunction, ModifierHLAst, CompilationResult } from '../../types'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import * as test from "tape"
import test from "tape"
import { helpers } from '@remix-project/remix-lib'
import { readFileSync } from 'fs'
import { join } from 'path'
import { default as StatRunner } from '../../src/solidity-analyzer'
import * as modules from '../../src/solidity-analyzer/modules/'
import { CompilationResult, AnalysisReportObj, AnalysisReport } from '../../src/types'
import { install, require as requireNPMmodule } from 'npm-install-version'
install('solc@0.4.24')
const solc = requireNPMmodule('solc@0.4.24')
import solcOrg from 'solc';
const { compilerInput } = helpers.compiler
const folder: string = 'solidity-v0.4.24'


const testFiles: string[] = [
'KingOfTheEtherThrone.sol',
'assembly.sol',
Expand Down Expand Up @@ -41,13 +38,21 @@ const testFiles: string[] = [
'forLoopIteratesOverDynamicArray.sol'
]

var compilationResults: Record<string, CompilationResult> = {}
let compilationResults: Record<string, CompilationResult> = {}

testFiles.forEach((fileName) => {
const content: string = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
// Latest AST is available under 'compileStandardWrapper' under solc for, 0.4.12 <= version < 0.5.0
compilationResults[fileName] = JSON.parse(solc.compileStandardWrapper(compilerInput(content)))
})
test('setup', function (t: test.Test) {
solcOrg.loadRemoteVersion('v0.4.24+commit.e67f0147', (error, compiler) => {
if (error) throw error

testFiles.forEach((fileName) => {
const content: string = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
// Latest AST is available under 'compileStandardWrapper' under solc for, 0.4.12 <= version < 0.5.0
compilationResults[fileName] = JSON.parse(compiler.compile(compilerInput(content)))
})

t.end()
})
});

test('Integration test thisLocal module', function (t: test.Test) {
t.plan(testFiles.length)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import * as test from "tape"
import test from "tape"
import { helpers } from '@remix-project/remix-lib'
import { readFileSync } from 'fs'
import { join } from 'path'
import { default as StatRunner } from '../../src/solidity-analyzer'
import * as modules from '../../src/solidity-analyzer/modules/'
import solc from 'solc';
import { CompilationResult, AnalysisReportObj, AnalysisReport } from '../../src/types'
import { install, require as requireNPMmodule } from 'npm-install-version'
install('solc@0.5.0')
const solc = requireNPMmodule('solc@0.5.0')
const { compilerInput } = helpers.compiler
const folder: string = 'solidity-v0.5'

Expand Down Expand Up @@ -40,12 +38,23 @@ const testFiles: string[] = [
'forLoopIteratesOverDynamicArray.sol'
]

var compilationResults: Record<string, CompilationResult> = {}
let compilationResults: Record<string, CompilationResult> = {}

test('setup', function (t) {
solc.loadRemoteVersion('v0.5.0+commit.1d4f565a', (error, compiler) => {
if (error) throw error

testFiles.forEach((fileName) => {
const content = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
compilationResults[fileName] = JSON.parse(compiler.compile(compilerInput(content)))
})

t.end()
})
});



testFiles.forEach((fileName) => {
const content = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
compilationResults[fileName] = JSON.parse(solc.compile(compilerInput(content)))
})

test('Integration test thisLocal module', function (t: test.Test) {
t.plan(testFiles.length)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
import * as test from "tape"
import test from "tape"
import { helpers } from '@remix-project/remix-lib'
import { readFileSync } from 'fs'
import { join } from 'path'
import { default as StatRunner } from '../../src/solidity-analyzer'
import solc from 'solc';
import { CompilationResult, AnalysisReportObj, AnalysisReport, AnalyzerModule } from '../../src/types'
import { checksEffectsInteraction } from '../../src/solidity-analyzer/modules/'
import { install, require as requireNPMmodule } from 'npm-install-version'
install('solc@0.4.24')
const compiler = requireNPMmodule('solc@0.4.24')
const { compilerInput } = helpers.compiler
const folder: string = 'solidity-v0.4.24'

let compiler
test('setup', function (t) {
solc.loadRemoteVersion('v0.4.24+commit.e67f0147', (error, solcVersion) => {
if (error) throw error
compiler = solcVersion
t.end()
})
});

function compile (fileName: string): CompilationResult {
const content: string = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
return JSON.parse(compiler.compileStandardWrapper(compilerInput(content)))
return JSON.parse(compiler.compile(compilerInput(content)))
}

test('staticAnalysisIssues.functionParameterPassingError', function (t) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import * as test from "tape"
import test from "tape"
import { helpers } from '@remix-project/remix-lib'
import { readFileSync } from 'fs'
import { join } from 'path'
import { default as StatRunner } from '../../src/solidity-analyzer'
import solc from 'solc';
import { CompilationResult, AnalysisReportObj, AnalysisReport } from '../../src/types'
import { checksEffectsInteraction } from '../../src/solidity-analyzer/modules/'
import { install, require as requireNPMmodule } from 'npm-install-version'
install('solc@0.5.0')
const compiler = requireNPMmodule('solc@0.5.0')
const {compilerInput } = helpers.compiler
const folder: string = 'solidity-v0.5'

let compiler
test('setup', function (t) {
solc.loadRemoteVersion('v0.5.0+commit.1d4f565a', (error, solcVersion) => {
if (error) throw error
compiler = solcVersion
t.end()
})
});

function compile (fileName): CompilationResult {
const content: string = readFileSync(join(__dirname, 'test-contracts/' + folder, fileName), 'utf8')
return JSON.parse(compiler.compile(compilerInput(content)))
Expand Down
3 changes: 2 additions & 1 deletion libs/remix-analyzer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["node"],
"types": ["node"], "module": "commonjs", "esModuleInterop": true,
"outDir": "./dist",
},
"include": ["**/*.ts"]
}