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
9cd9a28c
Commit
9cd9a28c
authored
Nov 17, 2020
by
ben-chain
Committed by
GitHub
Nov 17, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use less common slot for EOA implementation (#69)
* set EOA implementation slot to deaddeaddead.... * fix tests
parent
148cb966
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
OVM_ProxyEOA.sol
...ntracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol
+4
-2
OVM_ProxyEOA.spec.ts
...ontracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts
+2
-1
ovmCREATEEOA.spec.ts
...s/OVM/execution/OVM_ExecutionManager/ovmCREATEEOA.spec.ts
+1
-1
No files found.
packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol
View file @
9cd9a28c
...
@@ -11,6 +11,8 @@ import { Lib_SafeExecutionManagerWrapper } from "../../libraries/wrappers/Lib_Sa
...
@@ -11,6 +11,8 @@ import { Lib_SafeExecutionManagerWrapper } from "../../libraries/wrappers/Lib_Sa
*/
*/
contract OVM_ProxyEOA {
contract OVM_ProxyEOA {
bytes32 constant IMPLEMENTATION_KEY = 0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead;
/***************
/***************
* Constructor *
* Constructor *
***************/
***************/
...
@@ -72,7 +74,7 @@ contract OVM_ProxyEOA {
...
@@ -72,7 +74,7 @@ contract OVM_ProxyEOA {
{
{
return address(uint160(uint256(
return address(uint160(uint256(
Lib_SafeExecutionManagerWrapper.safeSLOAD(
Lib_SafeExecutionManagerWrapper.safeSLOAD(
bytes32(uint256(0))
IMPLEMENTATION_KEY
)
)
)));
)));
}
}
...
@@ -87,7 +89,7 @@ contract OVM_ProxyEOA {
...
@@ -87,7 +89,7 @@ contract OVM_ProxyEOA {
internal
internal
{
{
Lib_SafeExecutionManagerWrapper.safeSSTORE(
Lib_SafeExecutionManagerWrapper.safeSSTORE(
bytes32(uint256(0))
,
IMPLEMENTATION_KEY
,
bytes32(uint256(uint160(_implementation)))
bytes32(uint256(uint160(_implementation)))
);
);
}
}
...
...
packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts
View file @
9cd9a28c
...
@@ -100,6 +100,7 @@ describe('OVM_ProxyEOA', () => {
...
@@ -100,6 +100,7 @@ describe('OVM_ProxyEOA', () => {
})
})
})
})
describe
(
'
upgrade()
'
,
()
=>
{
describe
(
'
upgrade()
'
,
()
=>
{
const
implSlotKey
=
'
0xdeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddeaddead
'
it
(
`should upgrade the proxy implementation`
,
async
()
=>
{
it
(
`should upgrade the proxy implementation`
,
async
()
=>
{
const
newImpl
=
`0x
${
'
81
'
.
repeat
(
20
)}
`
const
newImpl
=
`0x
${
'
81
'
.
repeat
(
20
)}
`
const
newImplBytes32
=
addrToBytes32
(
newImpl
)
const
newImplBytes32
=
addrToBytes32
(
newImpl
)
...
@@ -108,7 +109,7 @@ describe('OVM_ProxyEOA', () => {
...
@@ -108,7 +109,7 @@ describe('OVM_ProxyEOA', () => {
])
])
const
ovmSSTORE
:
any
=
const
ovmSSTORE
:
any
=
Mock__OVM_ExecutionManager
.
smocked
.
ovmSSTORE
.
calls
[
0
]
Mock__OVM_ExecutionManager
.
smocked
.
ovmSSTORE
.
calls
[
0
]
expect
(
ovmSSTORE
.
_key
).
to
.
equal
(
`0x
${
'
00
'
.
repeat
(
32
)}
`
)
expect
(
ovmSSTORE
.
_key
).
to
.
equal
(
implSlotKey
)
expect
(
ovmSSTORE
.
_value
).
to
.
equal
(
newImplBytes32
)
expect
(
ovmSSTORE
.
_value
).
to
.
equal
(
newImplBytes32
)
})
})
it
(
`should not allow upgrade of the proxy implementation by another account`
,
async
()
=>
{
it
(
`should not allow upgrade of the proxy implementation by another account`
,
async
()
=>
{
...
...
packages/contracts/test/contracts/OVM/execution/OVM_ExecutionManager/ovmCREATEEOA.spec.ts
View file @
9cd9a28c
...
@@ -65,7 +65,7 @@ const test_ovmCREATEEOA: TestDefinition = {
...
@@ -65,7 +65,7 @@ const test_ovmCREATEEOA: TestDefinition = {
address
:
'
0x17ec8597ff92C3F44523bDc65BF0f1bE632917ff
'
,
address
:
'
0x17ec8597ff92C3F44523bDc65BF0f1bE632917ff
'
,
},
},
expectedReturnStatus
:
true
,
expectedReturnStatus
:
true
,
expectedReturnValue
:
16
19
,
expectedReturnValue
:
16
82
,
},
},
],
],
},
},
...
...
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