Skip to content

Commit f3e4ee9

Browse files
authored
fix: disable upgradability from ECDSA Account (#885)
1 parent ed0495e commit f3e4ee9

File tree

5 files changed

+33
-13
lines changed

5 files changed

+33
-13
lines changed

.changeset/sharp-roses-admire.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@eth-optimism/contracts': patch
3+
---
4+
5+
Disable upgradability from the ECDSA account instead of the EOA proxy.

packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ECDSAContractAccount.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ contract OVM_ECDSAContractAccount is iOVM_ECDSAContractAccount {
140140

141141
return (true, bytes(""));
142142
} else {
143+
// NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA
144+
// so that they don't have to pay any fees to the sequencer. Function will remain disabled
145+
// until a robust solution is in place.
146+
require(
147+
transaction.to != Lib_ExecutionManagerWrapper.ovmADDRESS(),
148+
"Calls to self are disabled until upgradability is re-enabled."
149+
);
150+
143151
return transaction.to.call(transaction.data);
144152
}
145153
}

packages/contracts/contracts/optimistic-ethereum/OVM/accounts/OVM_ProxyEOA.sol

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,13 @@ contract OVM_ProxyEOA {
7171
)
7272
external
7373
{
74-
// NOTE: Upgrades are temporarily disabled because users can, in theory, modify their EOA
75-
// so that they don't have to pay any fees to the sequencer. Function will remain disabled
76-
// until a robust solution is in place.
74+
require(
75+
msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(),
76+
"EOAs can only upgrade their own EOA implementation."
77+
);
7778

78-
// require(
79-
// msg.sender == Lib_ExecutionManagerWrapper.ovmADDRESS(),
80-
// "EOAs can only upgrade their own EOA implementation"
81-
// );
82-
83-
// _setImplementation(_implementation);
84-
// emit Upgraded(_implementation);
79+
_setImplementation(_implementation);
80+
emit Upgraded(_implementation);
8581
}
8682

8783
/**

packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,5 +176,18 @@ describe('OVM_ECDSAContractAccount', () => {
176176
OVM_ECDSAContractAccount.execute(encodedTransaction)
177177
).to.be.revertedWith('Value is nonzero but input data was provided.')
178178
})
179+
180+
// NOTE: Upgrades are disabled for now but will be re-enabled at a later point in time. See
181+
// comment in OVM_ECDSAContractAccount.sol for additional information.
182+
it(`should revert if trying call itself`, async () => {
183+
const transaction = { ...DEFAULT_EIP155_TX, to: wallet.address }
184+
const encodedTransaction = await wallet.signTransaction(transaction)
185+
186+
await expect(
187+
OVM_ECDSAContractAccount.execute(encodedTransaction)
188+
).to.be.revertedWith(
189+
'Calls to self are disabled until upgradability is re-enabled.'
190+
)
191+
})
179192
})
180193
})

packages/contracts/test/contracts/OVM/accounts/OVM_ProxyEOA.spec.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ describe('OVM_ProxyEOA', () => {
4444
})
4545
})
4646

47-
// NOTE: Upgrades are disabled for now but will be re-enabled at a later point in time. See
48-
// comment in OVM_ProxyEOA.sol for additional information.
49-
describe.skip('upgrade()', () => {
47+
describe('upgrade()', () => {
5048
it(`should upgrade the proxy implementation`, async () => {
5149
const newImpl = `0x${'81'.repeat(20)}`
5250
Mock__OVM_ExecutionManager.smocked.ovmADDRESS.will.return.with(

0 commit comments

Comments
 (0)