-
Notifications
You must be signed in to change notification settings - Fork 118
[wip] OVM self-upgradability #357
base: master
Are you sure you want to change the base?
Changes from 36 commits
b6289b2
8b7aa9d
c8b9a5c
810b67a
8ccd116
6e71f6a
222e345
42035c6
a648449
563853f
bd7cc45
477819b
9ed5fee
18734c7
eb8e24d
06f3399
d546cf0
99d96d6
bbb4bc5
7f17283
ec4d11d
31f87eb
c64991d
4278b54
b8e3810
b8027b2
250442d
5856cf8
821d27a
014ed31
4a0bdd4
aff7395
d111f06
bc52f97
6bfa26a
c7240c4
843d684
29c3d2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >0.5.0 <0.8.0; | ||
|
||
/* Library Imports */ | ||
import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; | ||
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; | ||
import { Lib_ECDSAUtils } from "../../libraries/utils/Lib_ECDSAUtils.sol"; | ||
import { Lib_SafeExecutionManagerWrapper } from "../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol"; | ||
|
||
contract OVM_Upgrader { | ||
ben-chain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Account which can initiate upgrades on L1 by approving a hash onion. | ||
address public l1UpgradeAuthorizer; | ||
|
||
function doUpgrade( | ||
address _address, | ||
bytes memory _code | ||
) external { | ||
Lib_SafeExecutionManagerWrapper.safeUPGRADE(_address, _code); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity >0.5.0 <0.8.0; | ||
|
||
/* Library Imports */ | ||
import { Lib_BytesUtils } from "../../libraries/utils/Lib_BytesUtils.sol"; | ||
import { Lib_OVMCodec } from "../../libraries/codec/Lib_OVMCodec.sol"; | ||
import { Lib_ECDSAUtils } from "../../libraries/utils/Lib_ECDSAUtils.sol"; | ||
import { Lib_SafeExecutionManagerWrapper } from "../../libraries/wrappers/Lib_SafeExecutionManagerWrapper.sol"; | ||
|
||
contract OVM_Upgrader { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needs comments There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also although IMO the name |
||
// Account which can initiate upgrades on L1 by approving a hash onion. | ||
address public l1UpgradeAuthorizer; | ||
|
||
function doUpgrade( | ||
address _address, | ||
bytes memory _code | ||
) external { | ||
ben-chain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Lib_SafeExecutionManagerWrapper.safeUPGRADE(_address, _code); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,14 +42,15 @@ interface iOVM_StateManager { | |
|
||
function putAccount(address _address, Lib_OVMCodec.Account memory _account) external; | ||
function putEmptyAccount(address _address) external; | ||
function putAccountCode(address _address, bytes memory _code) external; | ||
function getAccount(address _address) external view returns (Lib_OVMCodec.Account memory _account); | ||
function hasAccount(address _address) external view returns (bool _exists); | ||
function hasEmptyAccount(address _address) external view returns (bool _exists); | ||
function setAccountNonce(address _address, uint256 _nonce) external; | ||
function getAccountNonce(address _address) external view returns (uint256 _nonce); | ||
function getAccountEthAddress(address _address) external view returns (address _ethAddress); | ||
function getAccountStorageRoot(address _address) external view returns (bytes32 _storageRoot); | ||
function initPendingAccount(address _address) external; | ||
function initPendingAccount(address _address) external; // todo: deprecate/combine these two with this change? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reminder on this todo |
||
function commitPendingAccount(address _address, address _ethAddress, bytes32 _codeHash) external; | ||
function testAndSetAccountLoaded(address _address) external returns (bool _wasAccountAlreadyLoaded); | ||
function testAndSetAccountChanged(address _address) external returns (bool _wasAccountAlreadyChanged); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -322,6 +322,24 @@ library Lib_SafeExecutionManagerWrapper { | |
); | ||
} | ||
|
||
/** | ||
* Performs a safe asdfasdfasdfasdf call. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reminder to update this. |
||
*/ | ||
function safeUPGRADE( | ||
address _address, | ||
bytes memory _code | ||
) | ||
internal | ||
{ | ||
_safeExecutionManagerInteraction( | ||
abi.encodeWithSignature( | ||
"ovmUPGRADECODE(address,bytes)", | ||
ben-chain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
_address, | ||
_code | ||
) | ||
); | ||
} | ||
|
||
/********************* | ||
* Private Functions * | ||
*********************/ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to be very explicit about the security considerations here. Primarily w/r/t how fraud proofs are impacted, what's safe to do, what isn't. etc.