-
Notifications
You must be signed in to change notification settings - Fork 363
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
Fix input/output size in staticcall for addition and scalar_mul #1368
Conversation
@@ -481,7 +481,7 @@ library Pairing { | |||
input[2] = s; | |||
bool success; | |||
assembly { | |||
success := staticcall(sub(gas(), 2000), 7, input, 0x80, r, 0x60) | |||
success := staticcall(sub(gas(), 2000), 7, input, 0x60, r, 0x40) |
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.
https://github.com/ethereum/go-ethereum/blob/master/core/vm/contracts.go#L488
Bn256ScalarMul
takes 96 bytes (0x60) and outputs G1 which is 64 bytes (0x40)
@@ -456,7 +456,7 @@ library Pairing { | |||
input[3] = p2.Y; | |||
bool success; | |||
assembly { | |||
success := staticcall(sub(gas(), 2000), 6, input, 0xc0, r, 0x60) | |||
success := staticcall(sub(gas(), 2000), 6, input, 0x80, r, 0x40) |
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.
https://github.com/ethereum/go-ethereum/blob/master/core/vm/contracts.go#L446
Bn256Add
takes 128 bytes (0x80) and outputs G1 which is 64 bytes (0x40)
Closes #1364, merge after #1369
Note: This is not a huge issue as the sizes are clamped in the precompile to the correct values anyways (see here)