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
ef9d1e75
Commit
ef9d1e75
authored
Dec 16, 2020
by
ben-chain
Committed by
GitHub
Dec 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ban Dead Addresses (#143)
* add check and test * uint->uint256
parent
e9d41069
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
1 deletion
+29
-1
OVM_ExecutionManager.sol
...ptimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol
+9
-1
ovmCALL.spec.ts
...tracts/OVM/execution/OVM_ExecutionManager/ovmCALL.spec.ts
+20
-0
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/execution/OVM_ExecutionManager.sol
View file @
ef9d1e75
...
...
@@ -894,7 +894,7 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
* Calls the deployed contract associated with a given address.
* @param _nextMessageContext Message context to be used for the call.
* @param _gasLimit Amount of gas to be passed into this call.
* @param _contract
Address used to resolve the deployed contract
.
* @param _contract
OVM address to be called
.
* @param _calldata Data to send along with the call.
* @return _success Whether or not the call returned (rather than reverted).
* @return _returndata Data returned by the call.
...
...
@@ -911,6 +911,14 @@ contract OVM_ExecutionManager is iOVM_ExecutionManager, Lib_AddressResolver {
bytes memory _returndata
)
{
// We reserve addresses of the form 0xdeaddeaddead...NNNN for the container contracts in L2 geth.
// So, we block calls to these addresses since they are not safe to run as an OVM contract itself.
if (
(uint256(_contract) & uint256(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000))
== uint256(0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000)
) {
return (true, hex'');
}
// Both 0x0000... and the EVM precompiles have the same address on L1 and L2 --> no trie lookup needed.
address codeContractAddress =
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCALL.spec.ts
View file @
ef9d1e75
...
...
@@ -11,6 +11,8 @@ import {
const
DUMMY_REVERT_DATA
=
'
0xdeadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420deadbeef1e5420
'
const
DEAD_ADDRESS
=
'
0xdeaddeaddeaddeaddeaddeaddeaddeaddead1234
'
const
test_ovmCALL
:
TestDefinition
=
{
name
:
'
Basic tests for ovmCALL
'
,
preState
:
{
...
...
@@ -241,6 +243,24 @@ const test_ovmCALL: TestDefinition = {
},
],
},
{
name
:
'
ovmCALL(0xdeaddeaddead...) returns (true, 0x)
'
,
steps
:
[
{
functionName
:
'
ovmCALL
'
,
functionParams
:
{
gasLimit
:
OVM_TX_GAS_LIMIT
,
target
:
DEAD_ADDRESS
,
subSteps
:
[]
},
expectedReturnStatus
:
true
,
expectedReturnValue
:
{
ovmSuccess
:
true
,
returnData
:
'
0x
'
},
},
],
},
],
}
...
...
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