EIP 2604: Conditional EXTBALANCE Repricing

Rename BALANCE to EXTBALANCE and reduce its cost to 10 if it queries the current account.

It would be nice if we could reduce all trie-based opcode gas when the state is cached, as we do in 1380.

This might have been a good approach to take before Istanbul, but Istanbul enables EIP-1884, which adds the SELFBALANCE opcode, doing exactly as you describe. Probably does not make sense to do both at this point.

Pre-Istanbul contracts get penalized, because these use BALANCE on themselves and do not use SELFBALANCE while what these semantically do is exactly the same. Thus changing BALANCE gas for all addresses, but introducing SELFBALANCE per the Istanbul EIP is not reasonable for me.

I support this EIP.

It also makes sense to rename BALANCE to EXTBALANCE: look at EXTCODESIZE vs CODESIZE. However, this does not apply to SELFBALANCE, but changing that to BALANCE would be confusing.

1 Like

I’m not making a value judgement of this proposal, more just stating that we already have SELFBALANCE, it seems unlikely to have the EVM design basically recant that choice, and do it the “correct” way, which might involve a bunch of additional checks that could affect the cost reduction that EIP-1884 provides

1 Like

Renaming opcodes, includes this one, is also proposed by EIP-1803: Rename opcodes for clarity (Correction: it seems this particular renaming didn’t made it into the forum/EIP, but was discussed on Gitter post-Istanbul)

However as discussed during past ACD calls, this is not part of hard forks, just adopted by tooling.