linting fixed for remix-debug

pull/4771/head
lianahus 7 months ago
parent f5cdc389a7
commit e5920ae3b2
  1. 2
      libs/remix-debug/src/debugger/debugger.ts
  2. 4
      libs/remix-debug/src/init.ts
  3. 2
      libs/remix-debug/src/solidity-decoder/internalCallTree.ts
  4. 2
      libs/remix-debug/test.ts
  5. 2
      libs/remix-debug/test/codeManager.ts
  6. 8
      libs/remix-debug/test/debugger.ts
  7. 2
      libs/remix-debug/test/decoder/contracts/calldata.ts
  8. 2
      libs/remix-debug/test/decoder/contracts/intLocal.ts
  9. 2
      libs/remix-debug/test/decoder/contracts/miscLocal.ts
  10. 2
      libs/remix-debug/test/decoder/contracts/structArrayLocal.ts
  11. 3
      libs/remix-debug/test/decoder/localsTests/calldata.ts
  12. 6
      libs/remix-debug/test/decoder/stateTests/mapping.ts
  13. 4
      libs/remix-debug/test/helpers/compilerHelper.ts
  14. 27
      libs/remix-debug/test/resources/ast.ts
  15. 2
      libs/remix-debug/test/resources/testWeb3.ts
  16. 8
      libs/remix-debug/test/sourceLocationTracker.ts
  17. 2
      libs/remix-debug/test/traceManager.ts
  18. 1
      libs/remix-debug/test/vmCall.ts

@ -97,7 +97,7 @@ export class Debugger {
const instructionIndexes = lineGasCostObj.indexes.map((index) => { // translate from vmtrace index to instruction index const instructionIndexes = lineGasCostObj.indexes.map((index) => { // translate from vmtrace index to instruction index
return this.debugger.codeManager.getInstructionIndex(address, index) return this.debugger.codeManager.getInstructionIndex(address, index)
}) })
this.vmDebuggerLogic.event.trigger('lineGasCostChanged', [instructionIndexes, lineColumnPos.start.line ]) this.vmDebuggerLogic.event.trigger('lineGasCostChanged', [instructionIndexes, lineColumnPos.start.line])
this.currentFile = rawLocation.file this.currentFile = rawLocation.file
this.currentLine = lineColumnPos.start.line this.currentLine = lineColumnPos.start.line
} }

@ -1,9 +1,9 @@
'use strict' 'use strict'
import Web3, { Web3PluginBase } from 'web3' import Web3, { Web3PluginBase } from 'web3'
import {toNumber} from 'web3-utils' import { toNumber } from 'web3-utils'
export function extendWeb3 (web3) { export function extendWeb3 (web3) {
if(!web3.debug){ if (!web3.debug){
web3.registerPlugin(new Web3DebugPlugin()) web3.registerPlugin(new Web3DebugPlugin())
} }
} }

@ -391,7 +391,7 @@ function getGeneratedSources (tree, scopeId, contractObj) {
async function registerFunctionParameters (tree, functionDefinition, step, scopeId, contractObj, sourceLocation, address) { async function registerFunctionParameters (tree, functionDefinition, step, scopeId, contractObj, sourceLocation, address) {
tree.functionCallStack.push(step) tree.functionCallStack.push(step)
const functionDefinitionAndInputs = { functionDefinition, inputs: [] } const functionDefinitionAndInputs = { functionDefinition, inputs: []}
// means: the previous location was a function definition && JUMPDEST // means: the previous location was a function definition && JUMPDEST
// => we are at the beginning of the function and input/output are setup // => we are at the beginning of the function and input/output are setup
try { try {

@ -37,7 +37,7 @@ const compilationData = JSON.parse(solc.compileStandardWrapper(JSON.stringify(in
console.dir(Object.keys(compilationData)) console.dir(Object.keys(compilationData))
const compilation = {} const compilation = {}
compilation['data'] = compilationData compilation['data'] = compilationData
compilation['source'] = {sources: inputJson.sources} compilation['source'] = { sources: inputJson.sources }
console.dir(compilation) console.dir(compilation)
console.dir(compilation['data'].errors) console.dir(compilation['data'].errors)

@ -5,7 +5,7 @@ import { CodeManager } from '../src/code/codeManager'
const web3Test = require('./resources/testWeb3.ts') const web3Test = require('./resources/testWeb3.ts')
tape('CodeManager', function (t) { tape('CodeManager', function (t) {
const traceManager = new TraceManager({web3: web3Test}) const traceManager = new TraceManager({ web3: web3Test })
const codeManager = new CodeManager(traceManager) const codeManager = new CodeManager(traceManager)
const contractCode = web3Test.eth.getCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5') const contractCode = web3Test.eth.getCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5')
codeManager.codeResolver.cacheExecutingCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', contractCode) // so a call to web3 is not necessary codeManager.codeResolver.cacheExecutingCode('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', contractCode) // so a call to web3 is not necessary

@ -156,7 +156,7 @@ contract Ballot {
output = JSON.parse(output) output = JSON.parse(output)
const param = '0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000148656c6c6f20576f726c64210000000000000000000000000000000000000000' const param = '0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000148656c6c6f20576f726c64210000000000000000000000000000000000000000'
const web3 = await vmCall.getWeb3() const web3 = await vmCall.getWeb3()
vmCall.sendTx(web3, {nonce: 0, privateKey: privateKey}, undefined, 0, output.contracts['test.sol']['Ballot'].evm.bytecode.object + param, (error, hash) => { vmCall.sendTx(web3, { nonce: 0, privateKey: privateKey }, undefined, 0, output.contracts['test.sol']['Ballot'].evm.bytecode.object + param, (error, hash) => {
console.log(error, hash) console.log(error, hash)
if (error) { if (error) {
throw error throw error
@ -279,10 +279,10 @@ function testDebugging (debugManager) {
tape('breakPointManager', (t) => { tape('breakPointManager', (t) => {
t.plan(2) t.plan(2)
const {traceManager, callTree, solidityProxy} = debugManager const { traceManager, callTree, solidityProxy } = debugManager
const breakPointManager = new BreakpointManager({traceManager, callTree, solidityProxy}) const breakPointManager = new BreakpointManager({ traceManager, callTree, solidityProxy })
breakPointManager.add({fileName: 'test.sol', row: 39}) breakPointManager.add({ fileName: 'test.sol', row: 39 })
breakPointManager.event.register('breakpointHit', function (sourceLocation, step) { breakPointManager.event.register('breakpointHit', function (sourceLocation, step) {
t.equal(JSON.stringify(sourceLocation), JSON.stringify({ start: 1146, length: 6, file: 0, jump: '-' })) t.equal(JSON.stringify(sourceLocation), JSON.stringify({ start: 1146, length: 6, file: 0, jump: '-' }))

@ -11,4 +11,4 @@ module.exports = {
uint p = 45; uint p = 45;
} }
} }
`} ` }

@ -39,4 +39,4 @@ contract intLocal {
uint8 ui81 = asd; uint8 ui81 = asd;
} }
} }
`} ` }

@ -36,4 +36,4 @@ contract miscLocal {
string memory smallstring = "test_test_test"; string memory smallstring = "test_test_test";
} }
} }
`} ` }

@ -81,4 +81,4 @@ contract structArrayLocal {
arrayStruct.c = enumdef.three; arrayStruct.c = enumdef.three;
} }
} }
`} ` }

@ -54,7 +54,7 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe
callTree.event.register('callTreeReady', (scopes, scopeStarts) => { callTree.event.register('callTreeReady', (scopes, scopeStarts) => {
helper.decodeLocals(st, 140, traceManager, callTree, function (locals) { helper.decodeLocals(st, 140, traceManager, callTree, function (locals) {
try { try {
const expected = {"p":{"value":"45","type":"uint256"},"foo":{"length":"1","value":[{"value":"3","type":"uint8"}],"type":"uint8[1]"},"boo":{"length":"1","value":[{"length":"2","value":[{"value":"R","type":"string"},{"value":"T","type":"string"}],"type":"string[2]"}],"type":"string[2][1]"}} const expected = { "p":{ "value":"45","type":"uint256" },"foo":{ "length":"1","value":[{ "value":"3","type":"uint8" }],"type":"uint8[1]" },"boo":{ "length":"1","value":[{ "length":"2","value":[{ "value":"R","type":"string" },{ "value":"T","type":"string" }],"type":"string[2]" }],"type":"string[2][1]" } }
st.deepEqual(locals, expected) st.deepEqual(locals, expected)
} catch (e) { } catch (e) {
st.fail(e.message) st.fail(e.message)
@ -63,7 +63,6 @@ module.exports = async function (st, privateKey, contractBytecode, compilationRe
}) })
}) })
traceManager.resolveTrace(tx).then(() => { traceManager.resolveTrace(tx).then(() => {
debuggerEvent.trigger('newTraceLoaded', [traceManager.trace]) debuggerEvent.trigger('newTraceLoaded', [traceManager.trace])
}).catch((error) => { }).catch((error) => {

@ -23,7 +23,7 @@ module.exports = async function testMappingStorage (st, cb) {
} }
const compilationResults = new CompilerAbstract('json', output, sources) const compilationResults = new CompilerAbstract('json', output, sources)
const web3 = await (vmCall as any).getWeb3(); const web3 = await (vmCall as any).getWeb3();
(vmCall as any).sendTx(web3, {nonce: 0, privateKey: privateKey}, undefined, 0, output.contracts['test.sol']['SimpleMappingState'].evm.bytecode.object, function (error, hash) { (vmCall as any).sendTx(web3, { nonce: 0, privateKey: privateKey }, undefined, 0, output.contracts['test.sol']['SimpleMappingState'].evm.bytecode.object, function (error, hash) {
if (error) { if (error) {
console.log(error) console.log(error)
st.end(error) st.end(error)
@ -44,7 +44,7 @@ module.exports = async function testMappingStorage (st, cb) {
} }
function testMapping (st, privateKey, contractAddress, output, compilationResults, web3, cb) { function testMapping (st, privateKey, contractAddress, output, compilationResults, web3, cb) {
(vmCall as any).sendTx(web3, {nonce: 1, privateKey: privateKey}, contractAddress, 0, '2fd0a83a00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001074686973206973206120737472696e6700000000000000000000000000000000', (vmCall as any).sendTx(web3, { nonce: 1, privateKey: privateKey }, contractAddress, 0, '2fd0a83a00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000001074686973206973206120737472696e6700000000000000000000000000000000',
function (error, hash) { function (error, hash) {
if (error) { if (error) {
console.log(error) console.log(error)
@ -74,7 +74,7 @@ function testMapping (st, privateKey, contractAddress, output, compilationResult
stepIndex: 268, stepIndex: 268,
tx: tx, tx: tx,
address: contractAddress address: contractAddress
}, new StorageResolver({web3}), traceManager) }, new StorageResolver({ web3 }), traceManager)
const stateVars = stateDecoder.extractStateVariables('SimpleMappingState', output.sources) const stateVars = stateDecoder.extractStateVariables('SimpleMappingState', output.sources)
stateDecoder.decodeState(stateVars, storageViewer).then((result) => { stateDecoder.decodeState(stateVars, storageViewer).then((result) => {
st.equal(result['_num'].value, '1') st.equal(result['_num'].value, '1')

@ -13,8 +13,8 @@ export function compilerInput (contracts) {
}, },
outputSelection: { outputSelection: {
'*': { '*': {
'': [ 'ast' ], '': ['ast'],
'*': [ 'abi', 'metadata', 'evm.legacyAssembly', 'evm.bytecode', 'evm.deployedBytecode', 'evm.methodIdentifiers', 'evm.gasEstimates' ] '*': ['abi', 'metadata', 'evm.legacyAssembly', 'evm.bytecode', 'evm.deployedBytecode', 'evm.methodIdentifiers', 'evm.gasEstimates']
} }
} }
} }

@ -1,14 +1,14 @@
const node = {} const node = {}
node['ast'] = {"legacyAST":{"children":[{"attributes":{"fullyImplemented":true,"isLibrary":false,"linearizedBaseContracts":[5640396],"name":"test"},"children":[{"attributes":{"name":"x","type":"int256"},"children":[{"attributes":{"name":"int"},"id":5657860,"name":"ElementaryTypeName","src":"21:3:11"}],"id":5658100,"name":"VariableDeclaration","src":"21:5:11"},{"attributes":{"name":"y","type":"int256"},"children":[{"attributes":{"name":"int"},"id":5658180,"name":"ElementaryTypeName","src":"38:3:11"}],"id":5658268,"name":"VariableDeclaration","src":"38:5:11"},{"attributes":{"constant":false,"name":"set","public":true},"children":[{"children":[{"attributes":{"name":"_x","type":"int256"},"children":[{"attributes":{"name":"int"},"id":5658404,"name":"ElementaryTypeName","src":"68:3:11"}],"id":5658492,"name":"VariableDeclaration","src":"68:6:11"}],"id":5658572,"name":"ParameterList","src":"67:8:11"},{"children":[{"attributes":{"name":"_r","type":"int256"},"children":[{"attributes":{"name":"int"},"id":5658628,"name":"ElementaryTypeName","src":"85:3:11"}],"id":5658716,"name":"VariableDeclaration","src":"85:6:11"}],"id":5658796,"name":"ParameterList","src":"84:8:11"},{"children":[{"children":[{"attributes":{"operator":"=","type":"int256"},"children":[{"attributes":{"type":"int256","value":"x"},"id":5658900,"name":"Identifier","src":"108:1:11"},{"attributes":{"type":"int256","value":"_x"},"id":5658980,"name":"Identifier","src":"112:2:11"}],"id":5657492,"name":"Assignment","src":"108:6:11"}],"id":5659028,"name":"ExpressionStatement","src":"108:6:11"},{"children":[{"attributes":{"operator":"=","type":"int256"},"children":[{"attributes":{"type":"int256","value":"y"},"id":5659116,"name":"Identifier","src":"125:1:11"},{"attributes":{"string":null,"type":"int_const 10","value":"10"},"id":5659196,"name":"Literal","src":"129:2:11"}],"id":5659252,"name":"Assignment","src":"125:6:11"}],"id":5659316,"name":"ExpressionStatement","src":"125:6:11"},{"children":[{"attributes":{"operator":"=","type":"int256"},"children":[{"attributes":{"type":"int256","value":"_r"},"id":5659428,"name":"Identifier","src":"141:2:11"},{"attributes":{"type":"int256","value":"x"},"id":5639308,"name":"Identifier","src":"146:1:11"}],"id":5639356,"name":"Assignment","src":"141:6:11"}],"id":5639420,"name":"ExpressionStatement","src":"141:6:11"}],"id":5639516,"name":"Block","src":"97:57:11"}],"id":5639612,"name":"FunctionDefinition","src":"55:99:11"},{"attributes":{"constant":false,"name":"get","public":true},"children":[{"children":[],"id":5639764,"name":"ParameterList","src":"179:2:11"},{"children":[{"attributes":{"name":"x","type":"uint256"},"children":[{"attributes":{"name":"uint"},"id":5639820,"name":"ElementaryTypeName","src":"191:4:11"}],"id":5639908,"name":"VariableDeclaration","src":"191:6:11"},{"attributes":{"name":"y","type":"uint256"},"children":[{"attributes":{"name":"uint"},"id":5639988,"name":"ElementaryTypeName","src":"199:4:11"}],"id":5640076,"name":"VariableDeclaration","src":"199:6:11"}],"id":5640156,"name":"ParameterList","src":"190:16:11"},{"children":[],"id":5640212,"name":"Block","src":"212:17:11"}],"id":5640276,"name":"FunctionDefinition","src":"167:62:11"}],"id":5640396,"name":"ContractDefinition","src":"0:231:11"}],"name":"SourceUnit"}} node['ast'] = { "legacyAST":{ "children":[{ "attributes":{ "fullyImplemented":true,"isLibrary":false,"linearizedBaseContracts":[5640396],"name":"test" },"children":[{ "attributes":{ "name":"x","type":"int256" },"children":[{ "attributes":{ "name":"int" },"id":5657860,"name":"ElementaryTypeName","src":"21:3:11" }],"id":5658100,"name":"VariableDeclaration","src":"21:5:11" },{ "attributes":{ "name":"y","type":"int256" },"children":[{ "attributes":{ "name":"int" },"id":5658180,"name":"ElementaryTypeName","src":"38:3:11" }],"id":5658268,"name":"VariableDeclaration","src":"38:5:11" },{ "attributes":{ "constant":false,"name":"set","public":true },"children":[{ "children":[{ "attributes":{ "name":"_x","type":"int256" },"children":[{ "attributes":{ "name":"int" },"id":5658404,"name":"ElementaryTypeName","src":"68:3:11" }],"id":5658492,"name":"VariableDeclaration","src":"68:6:11" }],"id":5658572,"name":"ParameterList","src":"67:8:11" },{ "children":[{ "attributes":{ "name":"_r","type":"int256" },"children":[{ "attributes":{ "name":"int" },"id":5658628,"name":"ElementaryTypeName","src":"85:3:11" }],"id":5658716,"name":"VariableDeclaration","src":"85:6:11" }],"id":5658796,"name":"ParameterList","src":"84:8:11" },{ "children":[{ "children":[{ "attributes":{ "operator":"=","type":"int256" },"children":[{ "attributes":{ "type":"int256","value":"x" },"id":5658900,"name":"Identifier","src":"108:1:11" },{ "attributes":{ "type":"int256","value":"_x" },"id":5658980,"name":"Identifier","src":"112:2:11" }],"id":5657492,"name":"Assignment","src":"108:6:11" }],"id":5659028,"name":"ExpressionStatement","src":"108:6:11" },{ "children":[{ "attributes":{ "operator":"=","type":"int256" },"children":[{ "attributes":{ "type":"int256","value":"y" },"id":5659116,"name":"Identifier","src":"125:1:11" },{ "attributes":{ "string":null,"type":"int_const 10","value":"10" },"id":5659196,"name":"Literal","src":"129:2:11" }],"id":5659252,"name":"Assignment","src":"125:6:11" }],"id":5659316,"name":"ExpressionStatement","src":"125:6:11" },{ "children":[{ "attributes":{ "operator":"=","type":"int256" },"children":[{ "attributes":{ "type":"int256","value":"_r" },"id":5659428,"name":"Identifier","src":"141:2:11" },{ "attributes":{ "type":"int256","value":"x" },"id":5639308,"name":"Identifier","src":"146:1:11" }],"id":5639356,"name":"Assignment","src":"141:6:11" }],"id":5639420,"name":"ExpressionStatement","src":"141:6:11" }],"id":5639516,"name":"Block","src":"97:57:11" }],"id":5639612,"name":"FunctionDefinition","src":"55:99:11" },{ "attributes":{ "constant":false,"name":"get","public":true },"children":[{ "children":[],"id":5639764,"name":"ParameterList","src":"179:2:11" },{ "children":[{ "attributes":{ "name":"x","type":"uint256" },"children":[{ "attributes":{ "name":"uint" },"id":5639820,"name":"ElementaryTypeName","src":"191:4:11" }],"id":5639908,"name":"VariableDeclaration","src":"191:6:11" },{ "attributes":{ "name":"y","type":"uint256" },"children":[{ "attributes":{ "name":"uint" },"id":5639988,"name":"ElementaryTypeName","src":"199:4:11" }],"id":5640076,"name":"VariableDeclaration","src":"199:6:11" }],"id":5640156,"name":"ParameterList","src":"190:16:11" },{ "children":[],"id":5640212,"name":"Block","src":"212:17:11" }],"id":5640276,"name":"FunctionDefinition","src":"167:62:11" }],"id":5640396,"name":"ContractDefinition","src":"0:231:11" }],"name":"SourceUnit" } }
node['ast'].ast = { node['ast'].ast = {
absolutePath: 'sample.sol', absolutePath: 'sample.sol',
exportedSymbols: { test: [ 33 ] }, exportedSymbols: { test: [33]},
id: 34, id: 34,
nodeType: 'SourceUnit', nodeType: 'SourceUnit',
nodes: nodes:
[ { [{
abstract: false, abstract: false,
baseContracts: [], baseContracts: [],
contractDependencies: [], contractDependencies: [],
@ -16,11 +16,11 @@ node['ast'].ast = {
documentation: null, documentation: null,
fullyImplemented: true, fullyImplemented: true,
id: 33, id: 33,
linearizedBaseContracts: [ 33 ], linearizedBaseContracts: [33],
name: 'test', name: 'test',
nodeType: 'ContractDefinition', nodeType: 'ContractDefinition',
nodes: nodes:
[ { constant: false, [{ constant: false,
id: 2, id: 2,
name: 'x', name: 'x',
nodeType: 'VariableDeclaration', nodeType: 'VariableDeclaration',
@ -54,14 +54,14 @@ node['ast'].ast = {
name: 'int', name: 'int',
nodeType: 'ElementaryTypeName', nodeType: 'ElementaryTypeName',
src: '31:3:0', src: '31:3:0',
typeDescriptions: [Object] }, typeDescriptions: [Object]},
value: null, value: null,
visibility: 'internal' }, visibility: 'internal' },
{ body: { id: 23, { body: { id: 23,
nodeType: 'Block', nodeType: 'Block',
src: '96:55:0', src: '96:55:0',
statements: statements:
[ { expression: [{ expression:
{ argumentTypes: null, { argumentTypes: null,
id: 13, id: 13,
isConstant: false, isConstant: false,
@ -106,7 +106,7 @@ node['ast'].ast = {
operator: '=', operator: '=',
rightHandSide: [Object], rightHandSide: [Object],
src: '122:6:0', src: '122:6:0',
typeDescriptions: [Object] }, typeDescriptions: [Object]},
id: 18, id: 18,
nodeType: 'ExpressionStatement', nodeType: 'ExpressionStatement',
src: '122:6:0' }, src: '122:6:0' },
@ -122,10 +122,10 @@ node['ast'].ast = {
operator: '=', operator: '=',
rightHandSide: [Object], rightHandSide: [Object],
src: '138:6:0', src: '138:6:0',
typeDescriptions: [Object] }, typeDescriptions: [Object]},
id: 22, id: 22,
nodeType: 'ExpressionStatement', nodeType: 'ExpressionStatement',
src: '138:6:0' } ] src: '138:6:0' }]
}, },
documentation: null, documentation: null,
functionSelector: 'e5c19b2d', functionSelector: 'e5c19b2d',
@ -149,7 +149,7 @@ node['ast'].ast = {
stateMutability: 'nonpayable', stateMutability: 'nonpayable',
virtual: false, virtual: false,
visibility: 'public' }, visibility: 'public' },
{ body: { id: 31, nodeType: 'Block', src: '214:17:0', statements: [] }, { body: { id: 31, nodeType: 'Block', src: '214:17:0', statements: []},
documentation: null, documentation: null,
functionSelector: '6d4ce63c', functionSelector: '6d4ce63c',
id: 32, id: 32,
@ -173,14 +173,13 @@ node['ast'].ast = {
src: '163:68:0', src: '163:68:0',
stateMutability: 'nonpayable', stateMutability: 'nonpayable',
virtual: false, virtual: false,
visibility: 'public' } ], visibility: 'public' }],
scope: 34, scope: 34,
src: '0:233:0' src: '0:233:0'
} ], }],
src: '0:233:0' src: '0:233:0'
} }
node['source'] = `contract test { node['source'] = `contract test {
int x; int x;

@ -48,7 +48,7 @@ web3Override.eth.setProvider = function (provider) {}
web3Override.eth.providers = { 'HttpProvider': function (url) {} } web3Override.eth.providers = { 'HttpProvider': function (url) {} }
web3Override.eth.currentProvider = {'host': 'test provider'} web3Override.eth.currentProvider = { 'host': 'test provider' }
if (typeof (module) !== 'undefined' && typeof (module.exports) !== 'undefined') { if (typeof (module) !== 'undefined' && typeof (module.exports) !== 'undefined') {
module.exports = web3Override module.exports = web3Override

@ -11,7 +11,7 @@ import { compilerInput } from './helpers/compilerHelper'
tape('SourceLocationTracker', function (t) { tape('SourceLocationTracker', function (t) {
t.test('SourceLocationTracker.getSourceLocationFromVMTraceIndex - simple contract', async function (st) { t.test('SourceLocationTracker.getSourceLocationFromVMTraceIndex - simple contract', async function (st) {
const traceManager = new TraceManager({web3: web3Test}) const traceManager = new TraceManager({ web3: web3Test })
const codeManager = new CodeManager(traceManager) const codeManager = new CodeManager(traceManager)
let output = compiler.compile(compilerInput(contracts)) let output = compiler.compile(compilerInput(contracts))
@ -23,7 +23,7 @@ tape('SourceLocationTracker', function (t) {
traceManager.resolveTrace(tx).then(async () => { traceManager.resolveTrace(tx).then(async () => {
const sourceLocationTracker = new SourceLocationTracker(codeManager, {debugWithGeneratedSources: false}) const sourceLocationTracker = new SourceLocationTracker(codeManager, { debugWithGeneratedSources: false })
try { try {
const map = await sourceLocationTracker.getSourceLocationFromVMTraceIndex('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', 0, output.contracts) const map = await sourceLocationTracker.getSourceLocationFromVMTraceIndex('0x0d3a18d64dfe4f927832ab58d6451cecc4e517c5', 0, output.contracts)
@ -42,7 +42,7 @@ tape('SourceLocationTracker', function (t) {
t.test('SourceLocationTracker.getSourceLocationFromVMTraceIndex - ABIEncoder V2 contract', async function (st) { t.test('SourceLocationTracker.getSourceLocationFromVMTraceIndex - ABIEncoder V2 contract', async function (st) {
const traceManager = new TraceManager({web3: web3Test}) const traceManager = new TraceManager({ web3: web3Test })
const codeManager = new CodeManager(traceManager) const codeManager = new CodeManager(traceManager)
let output = compiler.compile(compilerInput(ABIEncoderV2)) let output = compiler.compile(compilerInput(ABIEncoderV2))
@ -54,8 +54,6 @@ tape('SourceLocationTracker', function (t) {
traceManager.resolveTrace(tx).then(async () => { traceManager.resolveTrace(tx).then(async () => {
try { try {
// with debugWithGeneratedSources: false // with debugWithGeneratedSources: false
const sourceLocationTracker = new SourceLocationTracker(codeManager, { debugWithGeneratedSources: false }) const sourceLocationTracker = new SourceLocationTracker(codeManager, { debugWithGeneratedSources: false })

@ -7,7 +7,7 @@ tape('TraceManager', function (t) {
let traceManager let traceManager
t.test('TraceManager.init', function (st) { t.test('TraceManager.init', function (st) {
traceManager = new TraceManager({web3: web3Test}) traceManager = new TraceManager({ web3: web3Test })
st.end() st.end()
}) })

@ -4,7 +4,6 @@ import { Address } from '@ethereumjs/util'
import { Web3 } from 'web3'; import { Web3 } from 'web3';
const { Provider } = require('@remix-project/remix-simulator') const { Provider } = require('@remix-project/remix-simulator')
async function getWeb3 () { async function getWeb3 () {
const remixSimulatorProvider = new Provider({ fork: 'berlin' }) const remixSimulatorProvider = new Provider({ fork: 'berlin' })
await remixSimulatorProvider.init() await remixSimulatorProvider.init()

Loading…
Cancel
Save