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
7abe5fae
Commit
7abe5fae
authored
4 years ago
by
ben-chain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nuisance gas evmINVALID
parent
eca126c5
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
12 deletions
+81
-12
nuisance-gas.spec.ts
...s/OVM/execution/OVM_ExecutionManager/nuisance-gas.spec.ts
+81
-12
No files found.
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/nuisance-gas.spec.ts
View file @
7abe5fae
...
...
@@ -12,8 +12,6 @@ import {
const
DUMMY_REVERT_DATA
=
'
0xdeadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420
'
console
.
log
(
'
cost multiplied:
'
,
Helper_TestRunner_BYTELEN
*
NUISANCE_GAS_COSTS
.
NUISANCE_GAS_PER_CONTRACT_BYTE
,
'
bytelenL:
'
,
Helper_TestRunner_BYTELEN
)
const
test_nuisanceGas
:
TestDefinition
=
{
name
:
'
Basic tests for nuisance gas
'
,
...
...
@@ -46,6 +44,7 @@ import {
subTests
:
[
{
name
:
'
ovmCALL consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE
'
,
focus
:
true
,
postState
:
{
ExecutionManager
:
{
messageRecord
:
{
...
...
@@ -64,56 +63,126 @@ import {
expectedReturnValue
:
"
$DUMMY_OVM_ADDRESS_1
"
,
},
],
},
{
name
:
'
nested ovmCALL, same address
'
,
focus
:
true
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
"
$DUMMY_OVM_ADDRESS_1
"
,
subSteps
:
[]
},
expectedReturnStatus
:
true
},
],
}
]
},
{
name
:
'
ovmCALL
only consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE for same contract called twice
'
,
name
:
'
ovmCALL
consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE twice for two unique ovmCALLS
'
,
postState
:
{
ExecutionManager
:
{
messageRecord
:
{
nuisanceGasLeft
:
OVM_TX_GAS_LIMIT
-
Helper_TestRunner_BYTELEN
*
NUISANCE_GAS_COSTS
.
NUISANCE_GAS_PER_CONTRACT_BYTE
nuisanceGasLeft
:
OVM_TX_GAS_LIMIT
-
2
*
(
Helper_TestRunner_BYTELEN
*
NUISANCE_GAS_COSTS
.
NUISANCE_GAS_PER_CONTRACT_BYTE
)
}
}
},
parameters
:
[
{
name
:
'
nested ovmCALL
'
,
focus
:
true
,
name
:
'
directly nested ovmCALL
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
"
$DUMMY_OVM_ADDRESS_
1
"
,
target
:
"
$DUMMY_OVM_ADDRESS_
2
"
,
subSteps
:
[]
},
expectedReturnStatus
:
true
},
],
},
{
name
:
'
with a call to already loaded contract inside
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
"
$DUMMY_OVM_ADDRESS_2
"
,
subSteps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[]
},
expectedReturnStatus
:
true
}
]
},
expectedReturnStatus
:
true
},
],
}
]
},
{
name
:
'
ovmCALL
only consumes nuisance gas of CODESIZE * NUISANCE_GAS_PER_CONTRACT_BYTE twice for two separate ovmCALLS
'
,
name
:
'
ovmCALL
consumes all allotted nuisance gas if code contract throws unknown exception
'
,
postState
:
{
ExecutionManager
:
{
messageRecord
:
{
nuisanceGasLeft
:
OVM_TX_GAS_LIMIT
-
2
*
(
Helper_TestRunner_BYTELEN
*
NUISANCE_GAS_COSTS
.
NUISANCE_GAS_PER_CONTRACT_BYTE
)
nuisanceGasLeft
:
OVM_TX_GAS_LIMIT
-
(
Helper_TestRunner_BYTELEN
*
NUISANCE_GAS_COSTS
.
NUISANCE_GAS_PER_CONTRACT_BYTE
)
-
OVM_TX_GAS_LIMIT
/
2
}
}
},
parameters
:
[
{
name
:
'
nested ovmCALL
'
,
// focus: true,
name
:
'
give 1/2 gas to evmREVERT
'
,
focus
:
true
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
/
2
,
target
:
"
$DUMMY_OVM_ADDRESS_1
"
,
subSteps
:
[
{
functionName
:
'
evmINVALID
'
}
]
},
expectedReturnStatus
:
true
,
expectedReturnValue
:
{
ovmSuccess
:
false
,
returnData
:
'
0x
'
}
},
],
},
{
name
:
'
with a call to already loaded contract inside
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
"
$DUMMY_OVM_ADDRESS_2
"
,
subSteps
:
[]
subSteps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
'
$DUMMY_OVM_ADDRESS_1
'
,
subSteps
:
[]
},
expectedReturnStatus
:
true
}
]
},
expectedReturnStatus
:
true
},
...
...
This diff is collapsed.
Click to expand it.
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