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

Updates for BLS verification #10

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion contracts/BLS.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.17;

import {console} from "forge-std/console.sol";

import "../../contracts/BN256G2.sol";
import "./BN256G2.sol";

contract BLS {
// Field order
Expand Down Expand Up @@ -615,7 +615,23 @@ contract BLS {
aggregated_pubkey.x_imaginary = x_imaginary;
aggregated_pubkey.y_imaginary = y_imaginary;
}

require(
verifySingle(aggregated_signature, [aggregated_pubkey.x_real, aggregated_pubkey.y_real, aggregated_pubkey.x_imaginary, aggregated_pubkey.y_imaginary], hash),
"Verification failed"
);
}

function verifyAggregatedIsolated(
PublicKey memory aggregated_pubkey,
uint256[2] memory aggregated_signature,
uint256[2] memory hash
) public {

// console.log("Message hash point:");
// console.log(hash[0]);
// console.log(hash[1]);

Comment on lines +631 to +634

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// console.log("Message hash point:");
// console.log(hash[0]);
// console.log(hash[1]);

require(
verifySingle(aggregated_signature, [aggregated_pubkey.x_real, aggregated_pubkey.y_real, aggregated_pubkey.x_imaginary, aggregated_pubkey.y_imaginary], hash),
"Verification failed"
Expand Down
4 changes: 2 additions & 2 deletions contracts/BatchVrsCache.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// // SPDX-License-Identifier: MIT
// SPDX-License-Identifier: MIT

// pragma solidity ^0.8.9;
pragma solidity ^0.8.9;

// contract SimpleVrsCacheEcrecover {
// event Verify(uint256 correctSignatures);
Expand Down
4 changes: 2 additions & 2 deletions gas-report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
·····················|······················|············|··············|·············|···············|··············
| Blake2bTest · testOneBlock · - · - · 1283188 · 2 · - │
·····················|······················|············|··············|·············|···············|··············
| EcdsaOps · checkSignatures · 30373 · 28989246 · 7010349 · 16 · - │
| EcdsaOps · checkSignatures · 30373 · 28989246 · 7010348 · 16 · - │
·····················|······················|············|··············|·············|···············|··············
| KeccakTest · testOneBlock · - · - · 793776 · 2 · - │
·····················|······················|············|··············|·············|···············|··············
| NoCacheEcrecover · benchmarkEcrecover · 29352 · 28024343 · 11202564 · 12 · - │
| NoCacheEcrecover · benchmarkEcrecover · 29328 · 28024895 · 11202784 · 12 · - │
·····················|······················|············|··············|·············|···············|··············
| Deployments · · % of limit · │
············································|············|··············|·············|···············|··············
Expand Down
13 changes: 12 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"hardhat-gas-reporter": "^1.0.9"
},
"dependencies": {
"@openzeppelin/contracts": "^4.7.3"
"@openzeppelin/contracts": "^4.7.3",
"forge-std": "^1.1.2"
}
}
Loading