pull/3951/head
Oleksii Kosynskyi 1 year ago
parent 53153832d2
commit 2aae76c350
No known key found for this signature in database
GPG Key ID: B4A8D3CCE22EA65E
  1. 15
      libs/remix-lib/src/execution/txListener.ts
  2. 4
      libs/remix-lib/src/execution/txRunner.ts
  3. 2
      libs/remix-lib/src/execution/txRunnerVM.ts
  4. 2
      libs/remix-lib/src/execution/txRunnerWeb3.ts
  5. 2
      libs/remix-tests/tests/testRunner.cli.spec.ts

@ -33,7 +33,7 @@ export class TxListener {
_listenOnNetwork:boolean
_loopId
blocks
constructor (opt, executionContext) {
this.event = new EventManager()
// has a default for now for backwards compatability
@ -94,9 +94,7 @@ export class TxListener {
// in web3 mode && listen remix txs only
if (!this._isListening) return // we don't listen
if (this._loopId) return // we seems to already listen on a "web3" network
this.executionContext.web3().eth.getTransaction(txResult.transactionHash, async (error, tx) => {
if (error) return console.log(error)
this.executionContext.web3().eth.getTransaction(txResult.transactionHash).then(async tx=>{
let execResult
if (this.executionContext.isVM()) {
execResult = await this.executionContext.web3().testPlugin.getExecutionResultFromSimulator(txResult.transactionHash)
@ -106,7 +104,7 @@ export class TxListener {
tx.envMode = this.executionContext.getProvider()
tx.status = txResult.receipt.status
this._resolve([tx])
})
}).catch(error=>console.log(error))
})
}
@ -204,7 +202,7 @@ export class TxListener {
async _manageBlock (blockNumber) {
try {
const result = await this.executionContext.web3().eth.getBlock(blockNumber, true)
return await this._newBlock(Object.assign({ type: 'web3' }, result))
return await this._newBlock(Object.assign({ type: 'web3' }, result))
} catch (e) {}
}
@ -285,8 +283,7 @@ export class TxListener {
// first check known contract, resolve against the `runtimeBytecode` if not known
contract = this._resolvedContracts[tx.to]
if (!contract) {
this.executionContext.web3().eth.getCode(tx.to, (error, code) => {
if (error) return cb(error)
this.executionContext.web3().eth.getCode(tx.to).then(code=>{
if (code) {
const contract = this._tryResolveContract(code, contracts, false)
if (contract) {
@ -296,7 +293,7 @@ export class TxListener {
}
}
return cb()
})
}).catch(error=>cb(error))
return
}
if (contract) {

@ -32,6 +32,10 @@ export class TxRunner {
}
execute (args: Transaction, confirmationCb, gasEstimationForceSend, promptCb, callback) {
let data = args.data
if (data.slice(0, 2) !== '0x') {
data = '0x' + data
}
this.internalRunner.execute(args, confirmationCb, gasEstimationForceSend, promptCb, callback)
}
}

@ -56,7 +56,7 @@ export class TxRunnerVM {
execute (args: InternalTransaction, confirmationCb, gasEstimationForceSend, promptCb, callback: VMExecutionCallBack) {
let data = args.data
if (data && data.slice(0, 2) !== '0x') {
if (data.slice(0, 2) !== '0x') {
data = '0x' + data
}

@ -82,7 +82,7 @@ export class TxRunnerWeb3 {
execute (args: InternalTransaction, confirmationCb, gasEstimationForceSend, promptCb, callback) {
let data = args.data
if (data && data.slice(0, 2) !== '0x') {
if (data.slice(0, 2) !== '0x') {
data = '0x' + data
}

@ -60,7 +60,7 @@ Commands:
it('remix-tests running a test file', function() {
const res = spawnSync(executablePath, [resolve(__dirname + '/examples_0/assert_ok_test.sol')])
// console.log(res.stdout.toString())
console.log(res.stdout.toString())
// match initial lines
expect(res.stdout.toString().trim()).to.match(/:: Running tests using remix-tests ::/)
expect(res.stdout.toString().trim()).to.match(/creation of library remix_tests.sol:Assert pending.../)

Loading…
Cancel
Save