Skip to content

Commit

Permalink
hardhat-gas-reporter reports about TestPlaceholderVerifier gas consum…
Browse files Browse the repository at this point in the history
…ption #47
  • Loading branch information
ETatuzova committed May 29, 2023
1 parent 7968c60 commit 3195180
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion contracts/placeholder/test/public_api_placeholder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ contract TestPlaceholderVerifier {
uint256[] calldata init_params,
int256[][] calldata columns_rotations,
address gate_argument
) public view{
) public{
require(
IVerifier(_verifier).verify(blob,init_params,columns_rotations,gate_argument),
"Proof is not correct"
Expand Down
18 changes: 13 additions & 5 deletions test/proof-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,47 +62,55 @@ describe('Proof Tests', function () {
let configPath = "./data/unified_addition/lambda2.json"
let proofPath = "./data/unified_addition/lambda2.data"
let params = getVerifierParams(configPath,proofPath);
await deployments.fixture(['testPlaceholderAPIConsumerFixture', 'unifiedAdditionGateFixture']);
await deployments.fixture(['testPlaceholderAPIConsumerFixture', 'unifiedAdditionGateFixture', 'placeholderVerifierFixture']);

let testPlaceholderAPI = await ethers.getContract('TestPlaceholderVerifier');
let unifiedAdditionGate = await ethers.getContract('UnifiedAdditionGate');
let placeholderVerifier = await ethers.getContract('PlaceholderVerifier');

await testPlaceholderAPI.initialize(placeholderVerifier.address);
await testPlaceholderAPI.verify(params['proof'],params['init_params'], params['columns_rotations'],unifiedAdditionGate.address ,{gasLimit: 30_500_000});
});

it("Merkle Tree Poseidon", async function () {
let configPath = "./data/merkle_tree_poseidon/circuit_params.json"
let proofPath = "./data/merkle_tree_poseidon/proof.bin"
let params = getVerifierParams(configPath,proofPath);
await deployments.fixture(['testPlaceholderAPIConsumerFixture', 'merkleTreePoseidonGateFixture']);
await deployments.fixture(['testPlaceholderAPIConsumerFixture', 'merkleTreePoseidonGateFixture', 'placeholderVerifierFixture']);

let testPlaceholderAPI = await ethers.getContract('TestPlaceholderVerifier');
let merkleTreePosidonGate = await ethers.getContract('MerkleTreePoseidonGate');
let placeholderVerifier = await ethers.getContract('PlaceholderVerifier');

await testPlaceholderAPI.initialize(placeholderVerifier.address);
await testPlaceholderAPI.verify(params['proof'],params['init_params'], params['columns_rotations'],merkleTreePosidonGate.address ,{gasLimit: 30_500_000});
});

it("Mina Base", async function () {
let configPath = "./data/mina_base/circuit_params.json"
let proofPath = "./data/mina_base/proof.bin"
let params = getVerifierParams(configPath,proofPath);
await deployments.fixture(['testPlaceholderAPIConsumerFixture', 'minaBaseGateFixture']);
await deployments.fixture(['testPlaceholderAPIConsumerFixture', 'minaBaseGateFixture', 'placeholderVerifierFixture']);

let testPlaceholderAPI = await ethers.getContract('TestPlaceholderVerifier');
let minaBaseGate = await ethers.getContract('MinaBaseGate');
let placeholderVerifier = await ethers.getContract('PlaceholderVerifier');

await testPlaceholderAPI.initialize(placeholderVerifier.address);
await testPlaceholderAPI.verify(params['proof'],params['init_params'], params['columns_rotations'],minaBaseGate.address ,{gasLimit: 30_500_000});
});

it("Mina Scalar", async function () {
let configPath = "./data/mina_scalar/circuit_params.json"
let proofPath = "./data/mina_scalar/proof.bin"
let params = getVerifierParams(configPath,proofPath);
await deployments.fixture(['testPlaceholderAPIConsumerFixture', 'minaScalarGateFixture']);
await deployments.fixture(['testPlaceholderAPIConsumerFixture', 'minaScalarGateFixture', 'placeholderVerifierFixture']);

let testPlaceholderAPI = await ethers.getContract('TestPlaceholderVerifier');
let minaScalarGate = await ethers.getContract('MinaScalarGate');
let placeholderVerifier = await ethers.getContract('PlaceholderVerifier');

await testPlaceholderAPI.verify(params['proof'],params['init_params'], params['columns_rotations'],minaScalarGate.address ,{gasLimit: 30_500_000});
await testPlaceholderAPI.initialize(placeholderVerifier.address);
});

})

0 comments on commit 3195180

Please sign in to comment.