fix remix-tests; fix commit condition

pull/7/head
Iuri Matias 5 years ago
parent 002eb5e2fb
commit 12ff79a116
  1. 12
      remix-lib/src/execution/txRunner.js
  2. 2
      remix-simulator/src/genesis.js
  3. 2
      remix-simulator/test/blocks.js
  4. 1
      remix-tests/src/testRunner.ts
  5. 6
      remix-tests/tests/testRunner.ts

@ -104,7 +104,7 @@ class TxRunner {
timestamp: timestamp,
nonce: new BN(account.nonce++),
gasPrice: new BN(1),
gasLimit: new BN(gasLimit, 10),
gasLimit: gasLimit,
to: to,
value: new BN(value, 10),
data: Buffer.from(data.slice(2), 'hex')
@ -119,7 +119,7 @@ class TxRunner {
number: self.blockNumber,
coinbase: coinbases[self.blockNumber % coinbases.length],
difficulty: difficulties[self.blockNumber % difficulties.length],
gasLimit: new BN('5000000').imuln(1)
gasLimit: new BN('8000000').imuln(1)
},
transactions: [tx],
uncleHeaders: []
@ -132,12 +132,14 @@ class TxRunner {
this.checkpointAndCommit(() => {
executionContext.vm().runBlock({ block: block, generate: true, skipBlockValidation: true, skipBalance: false }, function (err, results) {
err = err ? err.message : err
if (err) {
return callback(err)
}
let result = results.results[0]
console.dir(result)
if (useCall) {
executionContext.vm().stateManager.revert(function () { })
}
err = err ? err.message : err
if (result) {
result.status = '0x' + result.vm.exception.toString(16)
}
@ -154,7 +156,7 @@ class TxRunner {
}
checkpointAndCommit (cb) {
if (executionContext.vm().stateManager._checkpointCount > 0) {
if (executionContext.vm().stateManager._checkpointCount > 1) {
return executionContext.vm().stateManager.commit(() => {
cb()
})

@ -24,7 +24,7 @@ function generateBlock () {
number: 1,
coinbase: '0x0e9281e9c6a0808672eaba6bd1220e144c9bb07a',
difficulty: (new BN('69762765929000', 10)),
gasLimit: new BN('5000000').imuln(1)
gasLimit: new BN('8000000').imuln(1)
},
transactions: [],
uncleHeaders: []

@ -18,7 +18,7 @@ describe('blocks', function () {
let expectedBlock = {
difficulty: '69762765929000',
extraData: '0x0',
gasLimit: 5000000,
gasLimit: 8000000,
gasUsed: 0,
hash: block.hash.toString('hex'),
logsBloom: '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331',

@ -76,6 +76,7 @@ export function runTest (testName, testObject: any, contractDetails: any, opts:
value: testName,
filename: testObject.filename
}
testCallback(undefined, resp)
async.eachOfLimit(runList, 1, function (func, index, next) {
let sender

@ -9,15 +9,18 @@ import { deployAll } from '../dist/deployer'
import { runTest } from '../dist/index'
import { ResultsInterface, TestCbInterface, ResultCbInterface } from '../dist/index'
var provider = new Provider()
function compileAndDeploy(filename: string, callback: Function) {
let web3: Web3 = new Web3()
web3.setProvider(new Provider())
web3.setProvider(provider)
let compilationData: object
let accounts: string[]
async.waterfall([
function getAccountList(next: Function): void {
web3.eth.getAccounts((_err: Error | null | undefined, _accounts: string[]) => {
accounts = _accounts
web3.eth.defaultAccount = accounts[0]
next(_err)
})
},
@ -93,6 +96,7 @@ describe('testRunner', () => {
results = _results
done()
}
runTest('MyTest', contracts.MyTest, compilationData[filename]['MyTest'], { accounts }, testCallback, resultsCallback)
})
})

Loading…
Cancel
Save