-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update EIP-2537: Remove redundant MUL precompiles #8945
Conversation
✅ All reviewers have approved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, some line got deleted which likely should not be deleted
bfa6096
to
40cc72d
Compare
I think we have historically preferred to not overload precompiles like this, but I'd love to hear what others think |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure as well, it's kind of matter of taste here. At this point we could even remove |
The We could actually extend |
40cc72d
to
6ff64d1
Compare
EIPS/eip-2537.md
Outdated
@@ -277,10 +251,12 @@ MSMs are expected to be performed by Pippenger's algorithm (we can also say that | |||
|
|||
To avoid non-integer arithmetic, the call cost is calculated as `(k * multiplication_cost * discount) / multiplier` where `multiplier = 1000`, `k` is a number of (scalar, point) pairs for the call, `multiplication_cost` is a corresponding single multiplication call cost for G1/G2. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We remove MUL, so we have to update this reference: "multiplication_cost"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the intent is that removing the precompile is separate from the gas schedule of a multiplication
my read is that multiplication_cost
here would be either the G1 or G2 "base" gas cost depending on the nature of the MSM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to go ahead and approve, we can update this EIP later if needed, but it looks good to me at the moment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the update! decided to move ahead w/ this on ACDE #202
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 |
6ff64d1
to
5f042c9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All Reviewers Have Approved; Performing Automatic Merge...
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. Moreover, 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](ethereum/evmone#1042).
Head branch was pushed to by a user without write access
5f042c9
to
b412323
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All Reviewers Have Approved; Performing Automatic Merge...
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
Signed-off-by: garyschulte <garyschulte@gmail.com>
https://github.com/ethereum/EIPs/pull/9097/files https://github.com/ethereum/EIPs/pull/9098/files https://github.com/ethereum/EIPs/pull/9116/files Signed-off-by: garyschulte <garyschulte@gmail.com> adjust unit test gas costs, fix offset-by-one bug in the discount table Signed-off-by: garyschulte <garyschulte@gmail.com> implement bump in gas cost for bls map functions according to ethereum/EIPs@92c94cf Signed-off-by: garyschulte <garyschulte@gmail.com> using Pawel's suggested discount table from ethereum/EIPs#9116 (comment) Signed-off-by: garyschulte <garyschulte@gmail.com> use bls pairing costs from https://github.com/ethereum/EIPs/pull/9098/files Signed-off-by: garyschulte <garyschulte@gmail.com> remove MUL per ethereum/EIPs#8945 Signed-off-by: garyschulte <garyschulte@gmail.com> fix g1 msm max discount case, add g2 msm max discount case Signed-off-by: garyschulte <garyschulte@gmail.com> remove bls mul ops from benchmark subcommand Signed-off-by: garyschulte <garyschulte@gmail.com> use besu-native 1.1.1 Signed-off-by: garyschulte <garyschulte@gmail.com>
Remove redundant G1/G2 MUL precompiles easily replaceable with MSMs. Spec update: ethereum/EIPs#8945.
This removes
BLS12_G1MUL
andBLS12_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.Moreover, 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.