Commit a7760482 authored by ben-chain's avatar ben-chain

linting

parent a56125c2
import { usePlugin, BuidlerConfig } from '@nomiclabs/buidler/config' import { usePlugin, BuidlerConfig } from '@nomiclabs/buidler/config'
import { DEFAULT_ACCOUNTS_BUIDLER, RUN_OVM_TEST_GAS } from './test/helpers/constants' import {
DEFAULT_ACCOUNTS_BUIDLER,
RUN_OVM_TEST_GAS,
} from './test/helpers/constants'
usePlugin('@nomiclabs/buidler-ethers') usePlugin('@nomiclabs/buidler-ethers')
usePlugin('@nomiclabs/buidler-waffle') usePlugin('@nomiclabs/buidler-waffle')
......
...@@ -3,28 +3,28 @@ import { ...@@ -3,28 +3,28 @@ import {
ExecutionManagerTestRunner, ExecutionManagerTestRunner,
TestDefinition, TestDefinition,
NON_NULL_BYTES32, NON_NULL_BYTES32,
OVM_TX_GAS_LIMIT OVM_TX_GAS_LIMIT,
} from '../../../../helpers' } from '../../../../helpers'
const globalContext = { const globalContext = {
ovmCHAINID: 420 ovmCHAINID: 420,
} }
const transactionContext = { const transactionContext = {
ovmTIMESTAMP: 12341234, ovmTIMESTAMP: 12341234,
ovmNUMBER: 13371337, ovmNUMBER: 13371337,
ovmGASLIMIT: 45674567, ovmGASLIMIT: 45674567,
ovmTXGASLIMIT: 78907890, ovmTXGASLIMIT: 78907890,
ovmL1QUEUEORIGIN: 1, ovmL1QUEUEORIGIN: 1,
ovmL1TXORIGIN: '0x1234123412341234123412341234123412341234' ovmL1TXORIGIN: '0x1234123412341234123412341234123412341234',
} }
const messageContext = { const messageContext = {
ovmCALLER: '0x6789678967896789678967896789678967896789', ovmCALLER: '0x6789678967896789678967896789678967896789',
ovmADDRESS: '0x4567456745674567456745674567456745674567' ovmADDRESS: '0x4567456745674567456745674567456745674567',
} }
const test_contextOpcodes: TestDefinition = { const test_contextOpcodes: TestDefinition = {
name: 'unit tests for basic getter opcodes', name: 'unit tests for basic getter opcodes',
preState: { preState: {
ExecutionManager: { ExecutionManager: {
...@@ -35,7 +35,7 @@ import { ...@@ -35,7 +35,7 @@ import {
}, },
globalContext, globalContext,
transactionContext, transactionContext,
messageContext messageContext,
}, },
StateManager: { StateManager: {
owner: '$OVM_EXECUTION_MANAGER', owner: '$OVM_EXECUTION_MANAGER',
...@@ -72,8 +72,8 @@ import { ...@@ -72,8 +72,8 @@ import {
steps: [ steps: [
{ {
functionName: 'ovmTIMESTAMP', functionName: 'ovmTIMESTAMP',
expectedReturnValue: transactionContext.ovmTIMESTAMP expectedReturnValue: transactionContext.ovmTIMESTAMP,
} },
], ],
}, },
{ {
...@@ -81,8 +81,8 @@ import { ...@@ -81,8 +81,8 @@ import {
steps: [ steps: [
{ {
functionName: 'ovmNUMBER', functionName: 'ovmNUMBER',
expectedReturnValue: transactionContext.ovmNUMBER expectedReturnValue: transactionContext.ovmNUMBER,
} },
], ],
}, },
{ {
...@@ -90,8 +90,8 @@ import { ...@@ -90,8 +90,8 @@ import {
steps: [ steps: [
{ {
functionName: 'ovmGASLIMIT', functionName: 'ovmGASLIMIT',
expectedReturnValue: transactionContext.ovmGASLIMIT expectedReturnValue: transactionContext.ovmGASLIMIT,
} },
], ],
}, },
{ {
...@@ -99,8 +99,8 @@ import { ...@@ -99,8 +99,8 @@ import {
steps: [ steps: [
{ {
functionName: 'ovmL1QUEUEORIGIN', functionName: 'ovmL1QUEUEORIGIN',
expectedReturnValue: transactionContext.ovmL1QUEUEORIGIN expectedReturnValue: transactionContext.ovmL1QUEUEORIGIN,
} },
], ],
}, },
{ {
...@@ -108,8 +108,8 @@ import { ...@@ -108,8 +108,8 @@ import {
steps: [ steps: [
{ {
functionName: 'ovmL1TXORIGIN', functionName: 'ovmL1TXORIGIN',
expectedReturnValue: transactionContext.ovmL1TXORIGIN expectedReturnValue: transactionContext.ovmL1TXORIGIN,
} },
], ],
}, },
{ {
...@@ -117,12 +117,12 @@ import { ...@@ -117,12 +117,12 @@ import {
steps: [ steps: [
{ {
functionName: 'ovmCHAINID', functionName: 'ovmCHAINID',
expectedReturnValue: globalContext.ovmCHAINID expectedReturnValue: globalContext.ovmCHAINID,
} },
], ],
}, },
], ],
} }
const runner = new ExecutionManagerTestRunner() const runner = new ExecutionManagerTestRunner()
runner.run(test_contextOpcodes) runner.run(test_contextOpcodes)
\ No newline at end of file
...@@ -8,19 +8,20 @@ import { ...@@ -8,19 +8,20 @@ import {
VERIFIED_EMPTY_CONTRACT_HASH, VERIFIED_EMPTY_CONTRACT_HASH,
NUISANCE_GAS_COSTS, NUISANCE_GAS_COSTS,
Helper_TestRunner_BYTELEN, Helper_TestRunner_BYTELEN,
ZERO_ADDRESS ZERO_ADDRESS,
} from '../../../../helpers' } from '../../../../helpers'
const DUMMY_REVERT_DATA = const DUMMY_REVERT_DATA =
'0xdeadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420' '0xdeadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420'
const CREATED_CONTRACT_1 = '0x2bda4a99d5be88609d23b1e4ab5d1d34fb1c2feb' const CREATED_CONTRACT_1 = '0x2bda4a99d5be88609d23b1e4ab5d1d34fb1c2feb'
const FRESH_CALL_NUISANCE_GAS_COST = Helper_TestRunner_BYTELEN * NUISANCE_GAS_COSTS.NUISANCE_GAS_PER_CONTRACT_BYTE + NUISANCE_GAS_COSTS.MIN_NUISANCE_GAS_PER_CONTRACT const FRESH_CALL_NUISANCE_GAS_COST =
Helper_TestRunner_BYTELEN *
NUISANCE_GAS_COSTS.NUISANCE_GAS_PER_CONTRACT_BYTE +
NUISANCE_GAS_COSTS.MIN_NUISANCE_GAS_PER_CONTRACT
console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`) const test_nuisanceGas: TestDefinition = {
const test_nuisanceGas: TestDefinition = {
name: 'Basic tests for nuisance gas', name: 'Basic tests for nuisance gas',
preState: { preState: {
ExecutionManager: { ExecutionManager: {
...@@ -54,13 +55,14 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`) ...@@ -54,13 +55,14 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`)
}, },
subTests: [ subTests: [
{ {
name: 'ovmCALL consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE', name:
'ovmCALL consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE',
postState: { postState: {
ExecutionManager: { ExecutionManager: {
messageRecord: { messageRecord: {
nuisanceGasLeft: OVM_TX_GAS_LIMIT - FRESH_CALL_NUISANCE_GAS_COST nuisanceGasLeft: OVM_TX_GAS_LIMIT - FRESH_CALL_NUISANCE_GAS_COST,
} },
} },
}, },
parameters: [ parameters: [
{ {
...@@ -69,7 +71,7 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`) ...@@ -69,7 +71,7 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`)
// do a non-nuisance-gas-consuming opcode (test runner auto-wraps in ovmCALL) // do a non-nuisance-gas-consuming opcode (test runner auto-wraps in ovmCALL)
{ {
functionName: 'ovmADDRESS', functionName: 'ovmADDRESS',
expectedReturnValue: "$DUMMY_OVM_ADDRESS_1", expectedReturnValue: '$DUMMY_OVM_ADDRESS_1',
}, },
], ],
}, },
...@@ -80,23 +82,25 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`) ...@@ -80,23 +82,25 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`)
functionName: 'ovmCALL', functionName: 'ovmCALL',
functionParams: { functionParams: {
gasLimit: OVM_TX_GAS_LIMIT, gasLimit: OVM_TX_GAS_LIMIT,
target: "$DUMMY_OVM_ADDRESS_1", target: '$DUMMY_OVM_ADDRESS_1',
subSteps: [] subSteps: [],
}, },
expectedReturnStatus: true expectedReturnStatus: true,
},
],
}, },
], ],
}
]
}, },
{ {
name: 'ovmCALL consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE twice for two unique ovmCALLS', name:
'ovmCALL consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE twice for two unique ovmCALLS',
postState: { postState: {
ExecutionManager: { ExecutionManager: {
messageRecord: { messageRecord: {
nuisanceGasLeft: OVM_TX_GAS_LIMIT - 2 * FRESH_CALL_NUISANCE_GAS_COST nuisanceGasLeft:
} OVM_TX_GAS_LIMIT - 2 * FRESH_CALL_NUISANCE_GAS_COST,
} },
},
}, },
parameters: [ parameters: [
{ {
...@@ -106,10 +110,10 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`) ...@@ -106,10 +110,10 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`)
functionName: 'ovmCALL', functionName: 'ovmCALL',
functionParams: { functionParams: {
gasLimit: OVM_TX_GAS_LIMIT, gasLimit: OVM_TX_GAS_LIMIT,
target: "$DUMMY_OVM_ADDRESS_2", target: '$DUMMY_OVM_ADDRESS_2',
subSteps: [] subSteps: [],
}, },
expectedReturnStatus: true expectedReturnStatus: true,
}, },
], ],
}, },
...@@ -120,33 +124,37 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`) ...@@ -120,33 +124,37 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`)
functionName: 'ovmCALL', functionName: 'ovmCALL',
functionParams: { functionParams: {
gasLimit: OVM_TX_GAS_LIMIT, gasLimit: OVM_TX_GAS_LIMIT,
target: "$DUMMY_OVM_ADDRESS_2", target: '$DUMMY_OVM_ADDRESS_2',
subSteps: [ subSteps: [
{ {
functionName: 'ovmCALL', functionName: 'ovmCALL',
functionParams: { functionParams: {
gasLimit: OVM_TX_GAS_LIMIT, gasLimit: OVM_TX_GAS_LIMIT,
target: '$DUMMY_OVM_ADDRESS_1', target: '$DUMMY_OVM_ADDRESS_1',
subSteps: [] subSteps: [],
},
expectedReturnStatus: true,
},
],
}, },
expectedReturnStatus: true expectedReturnStatus: true,
}
]
}, },
expectedReturnStatus: true ],
}, },
], ],
}
]
}, },
{ {
name: 'ovmCALL consumes all allotted nuisance gas if code contract throws unknown exception', name:
'ovmCALL consumes all allotted nuisance gas if code contract throws unknown exception',
postState: { postState: {
ExecutionManager: { ExecutionManager: {
messageRecord: { messageRecord: {
nuisanceGasLeft: OVM_TX_GAS_LIMIT - FRESH_CALL_NUISANCE_GAS_COST - OVM_TX_GAS_LIMIT / 2 nuisanceGasLeft:
} OVM_TX_GAS_LIMIT -
} FRESH_CALL_NUISANCE_GAS_COST -
OVM_TX_GAS_LIMIT / 2,
},
},
}, },
parameters: [ parameters: [
{ {
...@@ -156,25 +164,26 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`) ...@@ -156,25 +164,26 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`)
functionName: 'ovmCALL', functionName: 'ovmCALL',
functionParams: { functionParams: {
gasLimit: OVM_TX_GAS_LIMIT / 2, gasLimit: OVM_TX_GAS_LIMIT / 2,
target: "$DUMMY_OVM_ADDRESS_1", target: '$DUMMY_OVM_ADDRESS_1',
subSteps: [ subSteps: [
{ {
functionName: 'evmINVALID' functionName: 'evmINVALID',
} },
] ],
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: { expectedReturnValue: {
ovmSuccess: false, ovmSuccess: false,
returnData: '0x' returnData: '0x',
} },
}, },
], ],
}, },
] ],
}, },
{ {
name: 'ovmCREATE consumes all allotted nuisance gas if creation code throws data-less exception', name:
'ovmCREATE consumes all allotted nuisance gas if creation code throws data-less exception',
postState: { postState: {
ExecutionManager: { ExecutionManager: {
messageRecord: { messageRecord: {
...@@ -183,9 +192,9 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`) ...@@ -183,9 +192,9 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`)
// This is because there is natural gas consumption between the ovmCALL(GAS/2) and ovmCREATE, which allots nuisance gas via _getNuisanceGasLimit. // This is because there is natural gas consumption between the ovmCALL(GAS/2) and ovmCREATE, which allots nuisance gas via _getNuisanceGasLimit.
// This means that the ovmCREATE exception, DOES consumes all nuisance gas allotted, but that allotment // This means that the ovmCREATE exception, DOES consumes all nuisance gas allotted, but that allotment
// is less than the full OVM_TX_GAS_LIMIT / 2 which is alloted to the parent ovmCALL. // is less than the full OVM_TX_GAS_LIMIT / 2 which is alloted to the parent ovmCALL.
nuisanceGasLeft: 4603714 nuisanceGasLeft: 4603714,
} },
} },
}, },
parameters: [ parameters: [
{ {
...@@ -202,24 +211,23 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`) ...@@ -202,24 +211,23 @@ console.log(`first call cost: ${FRESH_CALL_NUISANCE_GAS_COST}`)
functionParams: { functionParams: {
subSteps: [ subSteps: [
{ {
functionName: 'evmINVALID' functionName: 'evmINVALID',
} },
] ],
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValue: ZERO_ADDRESS expectedReturnValue: ZERO_ADDRESS,
}, },
] ],
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
} },
], ],
} },
]
}
], ],
} },
],
const runner = new ExecutionManagerTestRunner() }
runner.run(test_nuisanceGas)
const runner = new ExecutionManagerTestRunner()
runner.run(test_nuisanceGas)
...@@ -186,7 +186,11 @@ const test_ovmSTATICCALL: TestDefinition = { ...@@ -186,7 +186,11 @@ const test_ovmSTATICCALL: TestDefinition = {
[ [
{ {
functionName: 'ovmSTATICCALL', functionName: 'ovmSTATICCALL',
functionParams: [OVM_TX_GAS_LIMIT, '$DUMMY_OVM_ADDRESS_2', []], functionParams: [
OVM_TX_GAS_LIMIT,
'$DUMMY_OVM_ADDRESS_2',
[],
],
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValues: [], expectedReturnValues: [],
}, },
...@@ -226,7 +230,12 @@ const test_ovmSTATICCALL: TestDefinition = { ...@@ -226,7 +230,12 @@ const test_ovmSTATICCALL: TestDefinition = {
functionParams: [ functionParams: [
OVM_TX_GAS_LIMIT / 2, OVM_TX_GAS_LIMIT / 2,
'$DUMMY_OVM_ADDRESS_2', '$DUMMY_OVM_ADDRESS_2',
[REVERT_FLAGS.STATIC_VIOLATION, '0x', OVM_TX_GAS_LIMIT / 2, 0], [
REVERT_FLAGS.STATIC_VIOLATION,
'0x',
OVM_TX_GAS_LIMIT / 2,
0,
],
], ],
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValues: [false, '0x'], expectedReturnValues: [false, '0x'],
...@@ -257,7 +266,12 @@ const test_ovmSTATICCALL: TestDefinition = { ...@@ -257,7 +266,12 @@ const test_ovmSTATICCALL: TestDefinition = {
functionParams: [ functionParams: [
OVM_TX_GAS_LIMIT / 2, OVM_TX_GAS_LIMIT / 2,
'$DUMMY_OVM_ADDRESS_2', '$DUMMY_OVM_ADDRESS_2',
[REVERT_FLAGS.STATIC_VIOLATION, '0x', OVM_TX_GAS_LIMIT / 2, 0], [
REVERT_FLAGS.STATIC_VIOLATION,
'0x',
OVM_TX_GAS_LIMIT / 2,
0,
],
], ],
expectedReturnStatus: true, expectedReturnStatus: true,
expectedReturnValues: [false, '0x'], expectedReturnValues: [false, '0x'],
......
...@@ -21,7 +21,7 @@ export const decodeRevertData = (revertData: string): any => { ...@@ -21,7 +21,7 @@ export const decodeRevertData = (revertData: string): any => {
['uint256', 'uint256', 'uint256', 'bytes'], ['uint256', 'uint256', 'uint256', 'bytes'],
revertData revertData
) )
console.log(`flag is: ${decoded[0].toNumber()}`)
return ( return (
'[revertFlag:' + '[revertFlag:' +
Object.keys(REVERT_FLAGS)[decoded[0]] + Object.keys(REVERT_FLAGS)[decoded[0]] +
......
...@@ -32,5 +32,5 @@ export const NUISANCE_GAS_COSTS = { ...@@ -32,5 +32,5 @@ export const NUISANCE_GAS_COSTS = {
MIN_GAS_FOR_INVALID_STATE_ACCESS: 30000, MIN_GAS_FOR_INVALID_STATE_ACCESS: 30000,
} }
// TODO: get this exported/imported somehow in a way that we can do math on it. unfortunately using require('.....artifacts/contract.json') is erroring... // TODO: get this exported/imported somehow in a way that we can do math on it. unfortunately using require('.....artifacts/contract.json') is erroring...
export const Helper_TestRunner_BYTELEN = 3654 export const Helper_TestRunner_BYTELEN = 3654
...@@ -29,7 +29,11 @@ import { ...@@ -29,7 +29,11 @@ import {
} from './test.types' } from './test.types'
import { encodeRevertData } from '../codec' import { encodeRevertData } from '../codec'
import { getModifiableStorageFactory } from '../storage/contract-storage' import { getModifiableStorageFactory } from '../storage/contract-storage'
import { OVM_TX_GAS_LIMIT, RUN_OVM_TEST_GAS, NON_NULL_BYTES32 } from '../constants' import {
OVM_TX_GAS_LIMIT,
RUN_OVM_TEST_GAS,
NON_NULL_BYTES32,
} from '../constants'
export class ExecutionManagerTestRunner { export class ExecutionManagerTestRunner {
private snapshot: string private snapshot: string
...@@ -55,8 +59,14 @@ export class ExecutionManagerTestRunner { ...@@ -55,8 +59,14 @@ export class ExecutionManagerTestRunner {
test.subTests?.map((subTest) => { test.subTests?.map((subTest) => {
this.run({ this.run({
...subTest, ...subTest,
preState: merge(cloneDeep(test.preState), cloneDeep(subTest.preState)), preState: merge(
postState: merge(cloneDeep(test.postState), cloneDeep(subTest.postState)) cloneDeep(test.preState),
cloneDeep(subTest.preState)
),
postState: merge(
cloneDeep(test.postState),
cloneDeep(subTest.postState)
),
}) })
}) })
...@@ -123,13 +133,11 @@ export class ExecutionManagerTestRunner { ...@@ -123,13 +133,11 @@ export class ExecutionManagerTestRunner {
} }
private async initContracts() { private async initContracts() {
console.log('initcontracts')
if (this.snapshot) { if (this.snapshot) {
await ethers.provider.send('evm_revert', [this.snapshot]) await ethers.provider.send('evm_revert', [this.snapshot])
this.snapshot = await ethers.provider.send('evm_snapshot', []) this.snapshot = await ethers.provider.send('evm_snapshot', [])
return return
} }
console.log('no snapshot')
this.contracts.OVM_SafetyChecker = await ( this.contracts.OVM_SafetyChecker = await (
await ethers.getContractFactory('OVM_SafetyChecker') await ethers.getContractFactory('OVM_SafetyChecker')
...@@ -204,7 +212,9 @@ export class ExecutionManagerTestRunner { ...@@ -204,7 +212,9 @@ export class ExecutionManagerTestRunner {
functionName: 'ovmCALL', functionName: 'ovmCALL',
functionParams: { functionParams: {
gasLimit: OVM_TX_GAS_LIMIT, gasLimit: OVM_TX_GAS_LIMIT,
target: ExecutionManagerTestRunner.getDummyAddress("$DUMMY_OVM_ADDRESS_1"), target: ExecutionManagerTestRunner.getDummyAddress(
'$DUMMY_OVM_ADDRESS_1'
),
subSteps: step.functionParams.subSteps, subSteps: step.functionParams.subSteps,
}, },
expectedReturnStatus: true, expectedReturnStatus: true,
...@@ -224,17 +234,17 @@ export class ExecutionManagerTestRunner { ...@@ -224,17 +234,17 @@ export class ExecutionManagerTestRunner {
data: calldata, data: calldata,
}, },
this.contracts.OVM_StateManager.address, this.contracts.OVM_StateManager.address,
{ gasLimit: RUN_OVM_TEST_GAS} { gasLimit: RUN_OVM_TEST_GAS }
) )
} else { } else {
await this.contracts.OVM_ExecutionManager.ovmCALL( await this.contracts.OVM_ExecutionManager.ovmCALL(
OVM_TX_GAS_LIMIT, OVM_TX_GAS_LIMIT,
ExecutionManagerTestRunner.getDummyAddress("$DUMMY_OVM_ADDRESS_1"), ExecutionManagerTestRunner.getDummyAddress('$DUMMY_OVM_ADDRESS_1'),
this.contracts.Helper_TestRunner.interface.encodeFunctionData( this.contracts.Helper_TestRunner.interface.encodeFunctionData(
'runSingleTestStep', 'runSingleTestStep',
[this.parseTestStep(step)] [this.parseTestStep(step)]
), ),
{ gasLimit: RUN_OVM_TEST_GAS} { gasLimit: RUN_OVM_TEST_GAS }
) )
} }
} }
...@@ -336,13 +346,19 @@ export class ExecutionManagerTestRunner { ...@@ -336,13 +346,19 @@ export class ExecutionManagerTestRunner {
if (isTestStep_CALL(step)) { if (isTestStep_CALL(step)) {
if (step.expectedReturnValue === '0x00') { if (step.expectedReturnValue === '0x00') {
return step.expectedReturnValue return step.expectedReturnValue
} else if (typeof step.expectedReturnValue === 'string' || step.expectedReturnValue === undefined) { } else if (
typeof step.expectedReturnValue === 'string' ||
step.expectedReturnValue === undefined
) {
returnData = [ returnData = [
step.expectedReturnStatus, step.expectedReturnStatus,
step.expectedReturnValue || '0x', step.expectedReturnValue || '0x',
] ]
} else { } else {
returnData = [step.expectedReturnValue.ovmSuccess, step.expectedReturnValue.returnData] returnData = [
step.expectedReturnValue.ovmSuccess,
step.expectedReturnValue.returnData,
]
} }
} else if (BigNumber.isBigNumber(step.expectedReturnValue)) { } else if (BigNumber.isBigNumber(step.expectedReturnValue)) {
returnData = [step.expectedReturnValue.toHexString()] returnData = [step.expectedReturnValue.toHexString()]
......
...@@ -94,7 +94,10 @@ export interface TestStep_CALL { ...@@ -94,7 +94,10 @@ export interface TestStep_CALL {
subSteps?: TestStep[] subSteps?: TestStep[]
} }
expectedReturnStatus: boolean expectedReturnStatus: boolean
expectedReturnValue?: string | RevertFlagError | {ovmSuccess: boolean, returnData: string} expectedReturnValue?:
| string
| RevertFlagError
| { ovmSuccess: boolean; returnData: string }
} }
interface TestStep_CREATE { interface TestStep_CREATE {
...@@ -176,7 +179,7 @@ export const isTestStep_Context = ( ...@@ -176,7 +179,7 @@ export const isTestStep_Context = (
'ovmTIMESTAMP', 'ovmTIMESTAMP',
'ovmGASLIMIT', 'ovmGASLIMIT',
'ovmCHAINID', 'ovmCHAINID',
'ovmL1QUEUEORIGIN' 'ovmL1QUEUEORIGIN',
].includes(step.functionName) ].includes(step.functionName)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment