diff --git a/contracts/.gas-snapshot b/contracts/.gas-snapshot new file mode 100644 index 00000000..64fb4de1 --- /dev/null +++ b/contracts/.gas-snapshot @@ -0,0 +1,27 @@ +·------------------------------------------------------|---------------------------|-------------|-----------------------------· +| Solc version: 0.8.18 · Optimizer enabled: true · Runs: 200 · Block limit: 30000000 gas │ +·······················································|···························|·············|······························ +| Methods │ +·····················|·································|·············|·············|·············|···············|·············· +| Contract · Method · Min · Max · Avg · # calls · usd (avg) │ +·····················|·································|·············|·············|·············|···············|·············· +| GrandSumVerifier · verifyProof · - · - · 271155 · 2 · - │ +·····················|·································|·············|·············|·············|···············|·············· +| Summa · submitCommitment · - · - · 1068958 · 5 · - │ +·····················|·································|·············|·············|·············|···············|·············· +| Summa · submitProofOfAddressOwnership · - · - · 700479 · 3 · - │ +·····················|·································|·············|·············|·············|···············|·············· +| Deployments · · % of limit · │ +·······················································|·············|·············|·············|···············|·············· +| GrandSumVerifier · - · - · 277127 · 0.9 % · - │ +·······················································|·············|·············|·············|···············|·············· +| InclusionVerifier · - · - · 284887 · 0.9 % · - │ +·······················································|·············|·············|·············|···············|·············· +| src/DummyVerifyingKey.sol:Halo2VerifyingKey · - · - · 266321 · 0.9 % · - │ +·······················································|·············|·············|·············|···············|·············· +| src/VerifyingKey.sol:Halo2VerifyingKey · - · - · 350335 · 1.2 % · - │ +·······················································|·············|·············|·············|···············|·············· +| Summa · - · - · 1915414 · 6.4 % · - │ +·······················································|·············|·············|·············|···············|·············· +| Verifier · - · - · 1907494 · 6.4 % · - │ +·------------------------------------------------------|-------------|-------------|-------------|---------------|-------------· \ No newline at end of file diff --git a/contracts/hardhat.config.ts b/contracts/hardhat.config.ts index cea08afb..4c84ac97 100644 --- a/contracts/hardhat.config.ts +++ b/contracts/hardhat.config.ts @@ -21,6 +21,9 @@ module.exports = { gasReporter: { currency: "USD", gasPrice: 30, + enabled: process.env.REPORT_GAS ? true : false, + outputFile: ".gas-snapshot", + noColors: true }, solidity: { compilers: [ diff --git a/contracts/src/Summa.sol b/contracts/src/Summa.sol index 66904f83..e2fed642 100644 --- a/contracts/src/Summa.sol +++ b/contracts/src/Summa.sol @@ -272,13 +272,7 @@ contract Summa is Ownable { bytes memory snarkProof = commitments[timestamp]; - bytes memory combinedProofs = new bytes(snarkProof.length + inclusionProof.length); - for (uint256 i = 0; i < inclusionProof.length; i++) { - combinedProofs[i] = inclusionProof[i]; - } - for (uint256 i = 0; i < snarkProof.length; i++) { - combinedProofs[i + inclusionProof.length] = snarkProof[i]; - } + bytes memory combinedProofs = abi.encodePacked(inclusionProof, snarkProof); return inclusionVerifier.verifyProof(verifyingKey, combinedProofs, challenges, values); }