Skip to content
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

Merged
merged 3 commits into from
Apr 15, 2024

Conversation

dark64
Copy link
Member

@dark64 dark64 commented Apr 3, 2024

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)

@@ -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)
Copy link
Member Author

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)
Copy link
Member Author

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)

@Schaeff Schaeff merged commit 8699128 into develop Apr 15, 2024
8 checks passed
@Schaeff Schaeff deleted the fix-staticcall branch April 15, 2024 13:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Need Clarification on Input/Output Size for addition/scalar_mul in Generated verifier.sol
2 participants