rename testPlugin to remix

pull/4108/head
yann300 1 year ago
parent 91964707c3
commit 368d58458a
  1. 2
      apps/remix-ide/src/app/plugins/solidity-script.tsx
  2. 8
      apps/remix-ide/src/blockchain/blockchain.tsx
  3. 4
      libs/remix-lib/src/execution/txListener.ts
  4. 2
      libs/remix-lib/src/execution/txRunnerWeb3.ts
  5. 4
      libs/remix-simulator/src/provider.ts
  6. 10
      libs/remix-tests/src/testRunner.ts

@ -81,7 +81,7 @@ export class SolidityScript extends Plugin {
}
const receiptCall = await web3.eth.sendTransaction(tx)
const hhlogs = await web3.testPlugin.getHHLogsForTx(receiptCall.transactionHash)
const hhlogs = await web3.remix.getHHLogsForTx(receiptCall.transactionHash)
if (hhlogs && hhlogs.length) {
const finalLogs = (

@ -748,7 +748,7 @@ export class Blockchain extends Plugin {
if (error) return reject(error)
try {
if (this.executionContext.isVM()) {
const execResult = await this.web3().testPlugin.getExecutionResultFromSimulator(result.transactionHash)
const execResult = await this.web3().remix.getExecutionResultFromSimulator(result.transactionHash)
resolve(resultToRemixTx(result, execResult))
} else resolve(resultToRemixTx(result))
} catch (e) {
@ -869,7 +869,7 @@ export class Blockchain extends Plugin {
const isVM = this.executionContext.isVM()
if (isVM && tx.useCall) {
try {
result.transactionHash = await this.web3().testPlugin.getHashFromTagBySimulator(timestamp)
result.transactionHash = await this.web3().remix.getHashFromTagBySimulator(timestamp)
} catch (e) {
console.log('unable to retrieve back the "call" hash', e)
}
@ -910,7 +910,7 @@ export class Blockchain extends Plugin {
let execResult
let returnValue = null
if (isVM) {
const hhlogs = await this.web3().testPlugin.getHHLogsForTx(txResult.transactionHash)
const hhlogs = await this.web3().remix.getHHLogsForTx(txResult.transactionHash)
if (hhlogs && hhlogs.length) {
const finalLogs = (
@ -936,7 +936,7 @@ export class Blockchain extends Plugin {
_paq.push(['trackEvent', 'udapp', 'hardhat', 'console.log'])
this.call('terminal', 'logHtml', finalLogs)
}
execResult = await this.web3().testPlugin.getExecutionResultFromSimulator(txResult.transactionHash)
execResult = await this.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash)
if (execResult) {
// if it's not the VM, we don't have return value. We only have the transaction, and it does not contain the return value.

@ -63,7 +63,7 @@ export class TxListener {
let returnValue
let execResult
if (this.executionContext.isVM()) {
execResult = await this.executionContext.web3().testPlugin.getExecutionResultFromSimulator(txResult.transactionHash)
execResult = await this.executionContext.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash)
returnValue = toBuffer(execResult.returnValue)
} else {
returnValue = toBuffer(addHexPrefix(txResult.result))
@ -97,7 +97,7 @@ export class TxListener {
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)
execResult = await this.executionContext.web3().remix.getExecutionResultFromSimulator(txResult.transactionHash)
}
addExecutionCosts(txResult, tx, execResult)

@ -103,7 +103,7 @@ export class TxRunnerWeb3 {
tx['gas'] = gasLimit
if (this._api && this._api.isVM()) {
tx['timestamp'] = timestamp;
(this.getWeb3() as any).testPlugin.callBySimulator(tx)
(this.getWeb3() as any).remix.callBySimulator(tx)
.then((result: any) => callback(null, {
result: result
}))

@ -133,13 +133,13 @@ export class Provider {
}
export function extend (web3) {
if(!web3.testPlugin){
if(!web3.remix){
web3.registerPlugin(new Web3TestPlugin())
}
}
class Web3TestPlugin extends Web3PluginBase {
public pluginNamespace = 'testPlugin'
public pluginNamespace = 'remix'
public getExecutionResultFromSimulator(transactionHash) {
return this.requestManager.send({

@ -250,12 +250,12 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
if (func.constant) {
sendParams = {}
const tagTimestamp = 'remix_tests_tag' + Date.now()
if (web3.testPlugin && web3.testPlugin.registerCallId) web3.testPlugin.registerCallId(tagTimestamp)
if (web3.remix && web3.remix.registerCallId) web3.remix.registerCallId(tagTimestamp)
method.call(sendParams).then(async (result) => {
const time = (Date.now() - startTime) / 1000.0
let tagTxHash
if (web3.testPlugin && web3.testPlugin.getHashFromTagBySimulator) tagTxHash = await web3.testPlugin.getHashFromTagBySimulator(tagTimestamp)
if (web3.testPlugin && web3.testPlugin.getHHLogsForTx) hhLogs = await web3.testPlugin.getHHLogsForTx(tagTxHash)
if (web3.remix && web3.remix.getHashFromTagBySimulator) tagTxHash = await web3.remix.getHashFromTagBySimulator(tagTimestamp)
if (web3.remix && web3.remix.getHHLogsForTx) hhLogs = await web3.remix.getHHLogsForTx(tagTxHash)
debugTxHash = tagTxHash
if (result) {
const resp: TestResultInterface = {
@ -302,7 +302,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
method.send(sendParams).on('receipt', async (receipt) => {
try {
debugTxHash = receipt.transactionHash
if (web3.testPlugin && web3.testPlugin.getHHLogsForTx) hhLogs = await web3.testPlugin.getHHLogsForTx(receipt.transactionHash)
if (web3.remix && web3.remix.getHHLogsForTx) hhLogs = await web3.remix.getHHLogsForTx(receipt.transactionHash)
const time: number = (Date.now() - startTime) / 1000.0
const assertionEventHashes = assertionEvents.map(e => Web3.utils.sha3(e.name + '(' + e.params.join() + ')'))
let testPassed = false
@ -397,7 +397,7 @@ export function runTest (testName: string, testObject: any, contractDetails: Com
else if (err.message.includes('Transaction has been reverted by the EVM')) {
txHash = JSON.parse(err.message.replace('Transaction has been reverted by the EVM:', '')).transactionHash
}
if (web3.testPlugin && web3.testPlugin.getHHLogsForTx && txHash) hhLogs = await web3.testPlugin.getHHLogsForTx(txHash)
if (web3.remix && web3.remix.getHHLogsForTx && txHash) hhLogs = await web3.remix.getHHLogsForTx(txHash)
if (hhLogs && hhLogs.length) resp.hhLogs = hhLogs
resp.debugTxHash = txHash
testCallback(undefined, resp)

Loading…
Cancel
Save