Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
4a177ba1
Commit
4a177ba1
authored
Sep 21, 2020
by
Kelvin Fichter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ported DELEGATECALL tests
parent
4e9fc86f
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
233 additions
and
267 deletions
+233
-267
package.json
packages/contracts/package.json
+1
-1
ovmDELEGATECALL.spec.ts
...VM/execution/OVM_ExecutionManager/ovmDELEGATECALL.spec.ts
+229
-110
OVM_test.spec.ts
...s/contracts/test/contracts/OVM/execution/OVM_test.spec.ts
+0
-155
test-runner.ts
packages/contracts/test/helpers/test-utils/test-runner.ts
+3
-1
No files found.
packages/contracts/package.json
View file @
4a177ba1
...
...
@@ -7,7 +7,7 @@
"build"
:
"yarn run build:contracts"
,
"build:contracts"
:
"buidler compile"
,
"test"
:
"yarn run test:contracts"
,
"test:contracts"
:
"buidler test
\"
test/contracts/OVM/execution/OVM_ExecutionManager/ovm
CREATE
.spec.ts
\"
"
,
"test:contracts"
:
"buidler test
\"
test/contracts/OVM/execution/OVM_ExecutionManager/ovm
DELEGATECALL
.spec.ts
\"
"
,
"lint"
:
"tslint --format stylish --project ."
,
"fix"
:
"prettier --config prettier-config.json --write
\"
buidler.config.ts
\"
\"
{src,test}/**/*.ts
\"
"
},
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmDELEGATECALL.spec.ts
View file @
4a177ba1
This diff is collapsed.
Click to expand it.
packages/contracts/test/contracts/OVM/execution/OVM_test.spec.ts
deleted
100644 → 0
View file @
4e9fc86f
import
{
ExecutionManagerTestRunner
}
from
'
../../../helpers/test-utils/test-runner
'
import
{
TestDefinition
}
from
'
../../../helpers/test-utils/test.types2
'
import
{
GAS_LIMIT
,
NULL_BYTES32
,
NON_NULL_BYTES32
,
REVERT_FLAGS
,
DUMMY_BYTECODE
,
VERIFIED_EMPTY_CONTRACT_HASH
,
}
from
'
../../../helpers
'
const
CREATED_CONTRACT_1
=
'
0x2bda4a99d5be88609d23b1e4ab5d1d34fb1c2feb
'
const
DUMMY_REVERT_DATA
=
'
0xdeadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420
'
const
test
:
TestDefinition
=
{
name
:
'
An Example Test
'
,
preState
:
{
ExecutionManager
:
{
ovmStateManager
:
'
$OVM_STATE_MANAGER
'
,
ovmSafetyChecker
:
'
$OVM_SAFETY_CHECKER
'
,
messageRecord
:
{
nuisanceGasLeft
:
GAS_LIMIT
,
},
},
StateManager
:
{
owner
:
'
$OVM_EXECUTION_MANAGER
'
,
accounts
:
{
$DUMMY_OVM_ADDRESS_1
:
{
codeHash
:
NON_NULL_BYTES32
,
ethAddress
:
'
$OVM_CALL_HELPER
'
,
},
$DUMMY_OVM_ADDRESS_2
:
{
codeHash
:
NON_NULL_BYTES32
,
ethAddress
:
'
$OVM_CALL_HELPER
'
,
},
[
CREATED_CONTRACT_1
]:
{
codeHash
:
VERIFIED_EMPTY_CONTRACT_HASH
,
},
},
},
},
subTests
:
[
{
name
:
'
An Example Subtest
'
,
parameters
:
[
{
name
:
'
An Example CALL revert test
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_2
'
,
subSteps
:
[
{
functionName
:
'
evmREVERT
'
,
returnData
:
{
flag
:
REVERT_FLAGS
.
INTENTIONAL_REVERT
,
data
:
DUMMY_REVERT_DATA
,
},
},
],
},
expectedReturnStatus
:
false
,
expectedReturnValue
:
DUMMY_REVERT_DATA
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
{
name
:
'
An Example CREATE test
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmCREATE
'
,
functionParams
:
{
subSteps
:
[
{
functionName
:
'
ovmCALLER
'
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
'
$DUMMY_OVM_ADDRESS_1
'
,
},
],
},
expectedReturnStatus
:
true
,
expectedReturnValue
:
CREATED_CONTRACT_1
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
{
name
:
'
An Example CALL test
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[
{
functionName
:
'
ovmADDRESS
'
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
'
$DUMMY_OVM_ADDRESS_1
'
,
},
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_2
'
,
subSteps
:
[
{
functionName
:
'
ovmADDRESS
'
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
'
$DUMMY_OVM_ADDRESS_2
'
,
},
{
functionName
:
'
ovmCALLER
'
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
'
$DUMMY_OVM_ADDRESS_1
'
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
expectedReturnStatus
:
true
,
},
],
},
],
},
],
}
const
runner
=
new
ExecutionManagerTestRunner
()
runner
.
run
(
test
)
packages/contracts/test/helpers/test-utils/test-runner.ts
View file @
4a177ba1
...
...
@@ -113,7 +113,9 @@ export class ExecutionManagerTestRunner {
}
}
catch
(
err
)
{
if
(
parameter
.
expectInvalidStateAccess
)
{
expect
(
err
.
toString
()).
to
.
contain
(
'
VM Exception while processing transaction: revert
'
)
expect
(
err
.
toString
()).
to
.
contain
(
'
VM Exception while processing transaction: revert
'
)
}
else
{
throw
err
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment