localTests code updated

pull/697/head
aniket-engg 4 years ago committed by Aniket
parent b5d655d084
commit b8329729a7
  1. 10
      libs/remix-debug/test/decoder/localsTests/helper.ts
  2. 23
      libs/remix-debug/test/decoder/localsTests/int.ts
  3. 21
      libs/remix-debug/test/decoder/localsTests/misc.ts
  4. 22
      libs/remix-debug/test/decoder/localsTests/misc2.ts
  5. 21
      libs/remix-debug/test/decoder/localsTests/structArray.ts
  6. 8
      libs/remix-debug/test/decoder/vmCall.ts

@ -1,10 +1,10 @@
'use strict'
var localDecoder = require('../../../src/solidity-decoder/localDecoder')
import { solidityLocals } from '../../../src/solidity-decoder/localDecoder'
/*
Decode local variable
*/
function decodeLocal (st, index, traceManager, callTree, verifier) {
export function decodeLocals (st, index, traceManager, callTree, verifier) {
try {
traceManager.waterfall([
function getStackAt (stepIndex, callback) {
@ -28,7 +28,7 @@ function decodeLocal (st, index, traceManager, callTree, verifier) {
if (error) {
return st.fail(error)
}
localDecoder.solidityLocals(index, callTree, result[0].value, result[1].value, {}, { start: 5000 }).then((locals) => {
solidityLocals(index, callTree, result[0].value, result[1].value, {}, { start: 5000 }, null).then((locals) => {
verifier(locals)
})
})
@ -36,7 +36,3 @@ function decodeLocal (st, index, traceManager, callTree, verifier) {
st.fail(e.message)
}
}
module.exports = {
decodeLocals: decodeLocal
}

@ -1,19 +1,16 @@
'use strict'
var vmCall = require('../vmCall')
var remixLib = require('@remix-project/remix-lib')
var TraceManager = require('../../../src/trace/traceManager')
var CodeManager = require('../../../src/code/codeManager')
var traceHelper = require('../../../src/trace/traceHelper')
var SolidityProxy = require('../../../src/solidity-decoder/solidityProxy')
var InternalCallTree = require('../../../src/solidity-decoder/internalCallTree')
var EventManager = require('../../../src/eventManager')
var helper = require('./helper')
import { sendTx } from '../vmCall'
import { TraceManager } from '../../../src/trace/traceManager'
import { CodeManager } from '../../../src/code/codeManager'
import { contractCreationToken } from '../../../src/trace/traceHelper'
import { SolidityProxy } from '../../../src/solidity-decoder/solidityProxy'
import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree'
import { EventManager } from '../../../src/eventManager'
import * as helper from './helper'
module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) {
vmCall.sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) {
sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) {
if (error) {
return st.fail(error)
}
@ -21,7 +18,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
if (error) {
return st.fail(error)
}
tx.to = traceHelper.contractCreationToken('0')
tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3: vm.web3 })
var codeManager = new CodeManager(traceManager)
codeManager.clear()

@ -1,16 +1,15 @@
'use strict'
var vmCall = require('../vmCall')
var traceHelper = require('../../../src/trace/traceHelper')
var SolidityProxy = require('../../../src/solidity-decoder/solidityProxy')
var InternalCallTree = require('../../../src/solidity-decoder/internalCallTree')
var EventManager = require('../../../src/eventManager')
var helper = require('./helper')
var TraceManager = require('../../../src/trace/traceManager')
var CodeManager = require('../../../src/code/codeManager')
import { sendTx } from '../vmCall'
import { contractCreationToken } from '../../../src/trace/traceHelper'
import { SolidityProxy } from '../../../src/solidity-decoder/solidityProxy'
import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree'
import { EventManager } from '../../../src/eventManager'
import * as helper from './helper'
import { TraceManager } from '../../../src/trace/traceManager'
import { CodeManager } from '../../../src/code/codeManager'
module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) {
vmCall.sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) {
sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) {
if (error) {
return st.fail(error)
}
@ -18,7 +17,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
if (error) {
return st.fail(error)
}
tx.to = traceHelper.contractCreationToken('0')
tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3: vm.web3 })
var codeManager = new CodeManager(traceManager)
codeManager.clear()

@ -1,17 +1,15 @@
'use strict'
var vmCall = require('../vmCall')
var traceHelper = require('../../../src/trace/traceHelper')
var SolidityProxy = require('../../../src/solidity-decoder/solidityProxy')
var InternalCallTree = require('../../../src/solidity-decoder/internalCallTree')
var EventManager = require('../../../src/eventManager')
var helper = require('./helper')
var TraceManager = require('../../../src/trace/traceManager')
var CodeManager = require('../../../src/code/codeManager')
import { sendTx } from '../vmCall'
import { contractCreationToken } from '../../../src/trace/traceHelper'
import { SolidityProxy } from '../../../src/solidity-decoder/solidityProxy'
import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree'
import { EventManager } from '../../../src/eventManager'
import * as helper from './helper'
import { TraceManager } from '../../../src/trace/traceManager'
import { CodeManager } from '../../../src/code/codeManager'
module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) {
vmCall.sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) {
sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) {
if (error) {
return st.fail(error)
}
@ -19,7 +17,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
if (error) {
return st.fail(error)
}
tx.to = traceHelper.contractCreationToken('0')
tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3: vm.web3 })
var codeManager = new CodeManager(traceManager)
codeManager.clear()

@ -1,16 +1,15 @@
'use strict'
var vmCall = require('../vmCall')
var traceHelper = require('../../../src/trace/traceHelper')
var SolidityProxy = require('../../../src/solidity-decoder/solidityProxy')
var InternalCallTree = require('../../../src/solidity-decoder/internalCallTree')
var EventManager = require('../../../src/eventManager')
var helper = require('./helper')
var TraceManager = require('../../../src/trace/traceManager')
var CodeManager = require('../../../src/code/codeManager')
import { sendTx } from '../vmCall'
import { contractCreationToken } from '../../../src/trace/traceHelper'
import { SolidityProxy } from '../../../src/solidity-decoder/solidityProxy'
import { InternalCallTree } from '../../../src/solidity-decoder/internalCallTree'
import { EventManager } from '../../../src/eventManager'
import * as helper from './helper'
import { TraceManager } from '../../../src/trace/traceManager'
import { CodeManager } from '../../../src/code/codeManager'
module.exports = function (st, vm, privateKey, contractBytecode, compilationResult, cb) {
vmCall.sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) {
sendTx(vm, { nonce: 0, privateKey: privateKey }, null, 0, contractBytecode, function (error, txHash) {
if (error) {
return st.fail(error)
}
@ -18,7 +17,7 @@ module.exports = function (st, vm, privateKey, contractBytecode, compilationResu
if (error) {
return st.fail(error)
}
tx.to = traceHelper.contractCreationToken('0')
tx.to = contractCreationToken('0')
var traceManager = new TraceManager({ web3: vm.web3 })
var codeManager = new CodeManager(traceManager)
codeManager.clear()

@ -6,7 +6,7 @@ var BN = require('ethereumjs-util').BN
var remixLib = require('@remix-project/remix-lib')
var EthJSVM = require('ethereumjs-vm').default
function sendTx (vm, from, to, value, data, cb) {
export function sendTx (vm, from, to, value, data, cb) {
var tx = new Tx({
nonce: new BN(from.nonce++),
gasPrice: new BN(1),
@ -52,7 +52,7 @@ function createVm (hardfork) {
/*
Init VM / Send Transaction
*/
function initVM (st, privateKey) {
export function initVM (st, privateKey) {
var VM = createVm('muirGlacier')
const vm = VM.vm
@ -72,7 +72,3 @@ function initVM (st, privateKey) {
return vm
}
module.exports = {
sendTx: sendTx,
initVM: initVM
}

Loading…
Cancel
Save