From 7651050c2607d29be0aa695651097382b5dd6aad Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 12 May 2021 16:42:01 -0400 Subject: [PATCH 1/5] feat[contracts]: disable eoa upgrades temporarily --- .../OVM/accounts/OVM_ProxyEOA.sol | 38 ++++++++++--------- .../OVM/accounts/OVM_ProxyEOA.spec.ts | 4 +- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index 785b92b872a5..24c6ca6cfda0 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -62,23 +62,27 @@ contract OVM_ProxyEOA { * Public Functions * ********************/ - /** - * Changes the implementation address. - * @param _implementation New implementation address. - */ - function upgrade( - address _implementation - ) - external - { - require( - msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(), - "EOAs can only upgrade their own EOA implementation" - ); - - _setImplementation(_implementation); - emit Upgraded(_implementation); - } + // NOTE: Upgrades are temporarily disabled while we construct a whitelist-based system of + // contract accounts that users can use. Without such a system, users could upgrade their + // accounts to a contract that completely avoids paying fees. + // + // /** + // * Changes the implementation address. + // * @param _implementation New implementation address. + // */ + // function upgrade( + // address _implementation + // ) + // external + // { + // require( + // msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(), + // "EOAs can only upgrade their own EOA implementation" + // ); + // + // _setImplementation(_implementation); + // emit Upgraded(_implementation); + // } /** * Gets the address of the current implementation. diff --git a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts index a80e97a48cdc..a5a6f35f736a 100644 --- a/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts +++ b/packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts @@ -44,7 +44,9 @@ describe('OVM_ProxyEOA', () => { }) }) - describe('upgrade()', () => { + // NOTE: Upgrades are disabled for now but will be re-enabled at a later point in time. See + // comment in OVM_ProxyEOA.sol for additional information. + describe.skip('upgrade()', () => { it(`should upgrade the proxy implementation`, async () => { const newImpl = `0x${'81'.repeat(20)}` Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with( From 39d943765eceac034528a9d7dd168ff65d628056 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 12 May 2021 16:42:48 -0400 Subject: [PATCH 2/5] chore: add changeset --- .changeset/chatty-walls-rescue.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/chatty-walls-rescue.md diff --git a/.changeset/chatty-walls-rescue.md b/.changeset/chatty-walls-rescue.md new file mode 100644 index 000000000000..6bd374c21536 --- /dev/null +++ b/.changeset/chatty-walls-rescue.md @@ -0,0 +1,5 @@ +--- +'@eth-optimism/contracts': minor +--- + +Disables EOA contract upgrades until further notice From 95d2993efa42473b725be369e5ffe11cfa6a6222 Mon Sep 17 00:00:00 2001 From: smartcontracts Date: Wed, 12 May 2021 17:16:38 -0400 Subject: [PATCH 3/5] Update OVM_ProxyEOA.sol --- .../optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index 24c6ca6cfda0..33cc2aeb8c52 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -20,9 +20,10 @@ contract OVM_ProxyEOA { * Events * **********/ - event Upgraded( - address indexed implementation - ); + // NOTE: See comment below w/r/t/ upgrade() to understand why we've commented this out. + // event Upgraded( + // address indexed implementation + // ); /************* From cd0aed67c35568dc1bd2c01e2c37adfd4b2f45ce Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 12 May 2021 19:24:27 -0400 Subject: [PATCH 4/5] fix: turn upgrade into a noop --- .../OVM/accounts/OVM_ProxyEOA.sol | 51 +++++++++---------- 1 file changed, 25 insertions(+), 26 deletions(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index 33cc2aeb8c52..85390d3f1273 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -19,11 +19,10 @@ contract OVM_ProxyEOA { /********** * Events * **********/ - - // NOTE: See comment below w/r/t/ upgrade() to understand why we've commented this out. - // event Upgraded( - // address indexed implementation - // ); + + event Upgraded( + address indexed implementation + ); /************* @@ -63,27 +62,27 @@ contract OVM_ProxyEOA { * Public Functions * ********************/ - // NOTE: Upgrades are temporarily disabled while we construct a whitelist-based system of - // contract accounts that users can use. Without such a system, users could upgrade their - // accounts to a contract that completely avoids paying fees. - // - // /** - // * Changes the implementation address. - // * @param _implementation New implementation address. - // */ - // function upgrade( - // address _implementation - // ) - // external - // { - // require( - // msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(), - // "EOAs can only upgrade their own EOA implementation" - // ); - // - // _setImplementation(_implementation); - // emit Upgraded(_implementation); - // } + /** + * Changes the implementation address. + * @param _implementation New implementation address. + */ + function upgrade( + address _implementation + ) + external + { + // NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA + // so that they don't have to pay any fees to the sequencer. Function will remain disabled + // until a robust solution is in place. + + // require( + // msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(), + // "EOAs can only upgrade their own EOA implementation" + // ); + + // _setImplementation(_implementation); + // emit Upgraded(_implementation); + } /** * Gets the address of the current implementation. From c2d312f0593c2922758cdec9072dc4051304a566 Mon Sep 17 00:00:00 2001 From: Kelvin Fichter Date: Wed, 12 May 2021 19:25:12 -0400 Subject: [PATCH 5/5] lint: fix --- .../contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol index 85390d3f1273..a8dbc6c38c0f 100644 --- a/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol +++ b/packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol @@ -21,7 +21,7 @@ contract OVM_ProxyEOA { **********/ event Upgraded( - address indexed implementation + address indexed implementation );