If Bob has an EOA and Alice deploys an EOA and delegates to Bob, Charlie can run EXTCODECOPY on Alice’s account and get back the contents of Bob’s code. If Bob’s not delegated at all, Charlie gets a zero-length result. If Bob instead delegates to 0x0, Charlie gets 0xef0100000000000000000000000000000000000000000000000000
. In fact, one could write a contract that used this as an access-control measure – which probably means someone will, thinking that an EOA that’s never delegated is more secure or some such – and that fact could discourage users from taking the “irreversible” step of delegating in the first place.
Hey, I’m not against cheaper costs here – IMO everyone would benefit from an optimization for the minimal proxy use-case, and it makes sense that it would be cheaper as a delegation mechanism like this would be much cheaper for nodes to process than actually executing the ERC-1167 bytecode. Your point about 3607 is well-taken. I expect that a majority of contract authors would happily take that security tradeoff for the gas savings, so it’s worth considering how to avoid presenting them with the choice.
(It’s also worth pointing out the EIP-3702 doesn’t have this issue, but only because it doesn’t enable this usecase.)
There’s an argument to be made that we should intentionally break the proxy usecase to maintain EIP-3607 protection. I don’t think it’s a good argument, though; I’ve tried to think of what modifications to this EIP could be made to prevent it from being used to deploy proxies, and all of them have significant undesirable impacts.
- Raise PER_EMPTY_ACCOUNT_COST to match the gas cost of deploying an ERC-1167 proxy.
This would effectively make opening an AA account several times more expensive than it should be just to discourage people who aren’t even in target users from shooting their own feet on a regular basis, which seems like a perverse set of incentives. The current 25,000 gas cost is in the ballpark of the 21,000 base gas for making a transaction; one can easily justify the small marginal cost of opening a contract-wallet AA account instead of a regular one. I don’t have the exact numbers in front of me but a minimal proxy contract ~3 times that much; raising the cost to prevent the use of EOAs as cheap proxies would have to also raise the barrier to AA by several times.
- Prohibit delegations from EOAs with a nonce equal to 0. This would indirectly require at least two signatures to be made by an EOA’s keypair, preventing the use of an EOA derived via the deterministic signature method.
Not only would this cause a gas-sponsorship chicken-and-egg problem, since you’d have to get ETH into the EOA to pay for the initial nonce-bumping TX before you could set delegation to an AA contract wallet with a sponsored gas arrangement, I’m not sure it would even actually prevent the deployment of proxies via EOA delegates. One could, after all, create a “burner” keypair for deployment and then throw it away, as long as you could convince your users that you’d actually thrown it away. That is, of course, impossible to actually prove – but I can totally see a dApp glossing over that point to users who aren’t savvy enough to recognize the security issue in order to gain a competitive advantage due to their greater gas efficiency. (And then, once that gets normalized, someone will hold onto the “ephemeral” EOA keys and do a rugpull.)
- Require set code transactions to contain two different signatures.
This is the best I could think of to avoid the first problem from point #2 (gas sponsorship), but it doesn’t avoid the second and would not only require a second ecrecover
but increase the TX storage costs for fullnodes to boot.
If it’s inevitable that 7702 will be used to deploy proxies, perhaps we could add a mechanism to allow that usecase to maintain 3607 protection. That could be as simple as introducing a special type of delegation designator that’s not allowed to be updated by a set code transaction. Perhaps this could be paired with an exception to EIP-3541 allowing direct creation of contracts with delegation designators, or some new opcode like CREATE3, or maybe a modification to the authorization format to add a flag to enable immutability; in any case, it should be no more expensive than deploying a proxy via deterministic signature without the 3607 protection immutability provides.