EIPs icon indicating copy to clipboard operation
EIPs copied to clipboard

Update EIP-2537: Remove MUL precompiles

Open chfast opened this issue 1 year ago • 3 comments

This removes BLS12_G1MUL and BLS12_G2MUL precompiles because they are trivially replaceable by corresponding MSM precompiles.

This reduces the number of precompile's addresses defined in this EIP from 9 to 7. The addresses of remaining 7 precompiles are changed to be continues.

The Rationale entry describes why this change make sense. Additionally, the cost of MSM for single input (k==1) has been corrected to match the original MUL cost. The specification now suggests how this case should be implemented. Morever, because of the ABI compatibility between MUL and MSM all existing tests for MULs can be easily converted to tests for MSMs.

The PoC of MUL and MSM precompiles equivalence is provided in evmone PR#1042.

The adjustment of the MSM implementation for single input in evmone PR#1046.

chfast avatar Oct 09 '24 13:10 chfast

✅ All reviewers have approved.

eth-bot avatar Oct 09 '24 13:10 eth-bot

I think we have historically preferred to not overload precompiles like this, but I'd love to hear what others think

ralexstokes avatar Oct 09 '24 19:10 ralexstokes

not sure as well, it's kind of matter of taste here. At this point we could even remove BLS12_G1ADD and BLS12_G2ADD because they are trivially replaceable by corresponding MSM precompiles......

asanso avatar Oct 12 '24 07:10 asanso

not sure as well, it's kind of matter of taste here. At this point we could even remove BLS12_G1ADD and BLS12_G2ADD because they are trivially replaceable by corresponding MSM precompiles......

The ADD situation is different because: semantic (no subgroup check), ABI (no scalar input), and gas costs differ.

We could actually extend ADD to MULTI_ADD in the future upgrade in (almost) backward compatible manner.

chfast avatar Dec 18 '24 14:12 chfast

I'd like to rebase this on the merged gas cost changes and proof read it.

chfast avatar Dec 19 '24 17:12 chfast

I'd like to rebase this on the merged gas cost changes and proof read it.

ah ok, sounds good

it looks like EIP bot is not responding anyway so I think you can do this in this PR

ralexstokes avatar Dec 19 '24 17:12 ralexstokes