Skip to content

Commit

Permalink
Update gas benchmark (#581)
Browse files Browse the repository at this point in the history
* Fix benchmark typo

* Use snapshot instead of test for gas benchmark

* Update AABenchmarkArtifacts compilation bytecode
  • Loading branch information
jakeloo authored Nov 23, 2023
1 parent ef6a072 commit 0370cac
Show file tree
Hide file tree
Showing 8 changed files with 247 additions and 1,111 deletions.
1,068 changes: 61 additions & 1,007 deletions .gas-snapshot

Large diffs are not rendered by default.

238 changes: 160 additions & 78 deletions gasreport.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"build": "yarn clean && yarn compile",
"forge:build": "forge build",
"forge:test": "forge test",
"gas": "forge test --mc Benchmark --gas-report > gasreport.txt",
"gas": "forge snapshot --mc Benchmark --gas-report --diff .gas-snapshot > gasreport.txt",
"forge:snapshot": "forge snapshot --check",
"aabenchmark": "forge test --mc AABenchmarkPrepare && forge test --mc ProfileThirdwebAccount -vvv"
}
Expand Down
10 changes: 5 additions & 5 deletions src/test/benchmark/DropERC1155Benchmark.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contract DropERC1155BenchmarkTest is BaseTest {
DropERC1155 benchmark
//////////////////////////////////////////////////////////////*/

function test_bechmark_dropERC1155_claim() public {
function test_benchmark_dropERC1155_claim() public {
vm.pauseGasMetering();
uint256 _tokenId = 0;
string[] memory inputs = new string[](5);
Expand Down Expand Up @@ -81,7 +81,7 @@ contract DropERC1155BenchmarkTest is BaseTest {
drop.claim(receiver, _tokenId, 100, address(erc20), 5, alp, "");
}

function test_bechmark_dropERC1155_setClaimConditions_five_conditions() public {
function test_benchmark_dropERC1155_setClaimConditions_five_conditions() public {
vm.pauseGasMetering();
uint256 _tokenId = 0;
string[] memory inputs = new string[](5);
Expand Down Expand Up @@ -145,7 +145,7 @@ contract DropERC1155BenchmarkTest is BaseTest {
drop.lazyMint(100, "ipfs://", emptyEncodedBytes);
}

// function test_bechmark_dropERC1155_setClaimConditions_one_condition() public {
// function test_benchmark_dropERC1155_setClaimConditions_one_condition() public {
// vm.pauseGasMetering();
// uint256 _tokenId = 0;
// string[] memory inputs = new string[](5);
Expand Down Expand Up @@ -188,7 +188,7 @@ contract DropERC1155BenchmarkTest is BaseTest {
// drop.setClaimConditions(_tokenId, conditions, false);
// }

// function test_bechmark_dropERC1155_setClaimConditions_two_conditions() public {
// function test_benchmark_dropERC1155_setClaimConditions_two_conditions() public {
// vm.pauseGasMetering();
// uint256 _tokenId = 0;
// string[] memory inputs = new string[](5);
Expand Down Expand Up @@ -235,7 +235,7 @@ contract DropERC1155BenchmarkTest is BaseTest {
// drop.setClaimConditions(_tokenId, conditions, false);
// }

// function test_bechmark_dropERC1155_setClaimConditions_three_conditions() public {
// function test_benchmark_dropERC1155_setClaimConditions_three_conditions() public {
// vm.pauseGasMetering();
// uint256 _tokenId = 0;
// string[] memory inputs = new string[](5);
Expand Down
10 changes: 5 additions & 5 deletions src/test/benchmark/DropERC20Benchmark.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract DropERC20BenchmarkTest is BaseTest {
DropERC20 benchmark
//////////////////////////////////////////////////////////////*/

function test_bechmark_dropERC20_setClaimConditions_five_conditions() public {
function test_benchmark_dropERC20_setClaimConditions_five_conditions() public {
vm.pauseGasMetering();
string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -80,7 +80,7 @@ contract DropERC20BenchmarkTest is BaseTest {
drop.setClaimConditions(conditions, false);
}

function test_bechmark_dropERC20_claim() public {
function test_benchmark_dropERC20_claim() public {
vm.pauseGasMetering();
string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -127,7 +127,7 @@ contract DropERC20BenchmarkTest is BaseTest {
drop.claim(receiver, 100 ether, address(erc20), 1 ether, alp, "");
}

// function test_bechmark_dropERC20_setClaimConditions_one_condition() public {
// function test_benchmark_dropERC20_setClaimConditions_one_condition() public {
// vm.pauseGasMetering();
// string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -167,7 +167,7 @@ contract DropERC20BenchmarkTest is BaseTest {
// drop.setClaimConditions(conditions, false);
// }

// function test_bechmark_dropERC20_setClaimConditions_two_conditions() public {
// function test_benchmark_dropERC20_setClaimConditions_two_conditions() public {
// vm.pauseGasMetering();
// string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -211,7 +211,7 @@ contract DropERC20BenchmarkTest is BaseTest {
// drop.setClaimConditions(conditions, false);
// }

// function test_bechmark_dropERC20_setClaimConditions_three_conditions() public {
// function test_benchmark_dropERC20_setClaimConditions_three_conditions() public {
// vm.pauseGasMetering();
// string[] memory inputs = new string[](5);

Expand Down
16 changes: 8 additions & 8 deletions src/test/benchmark/DropERC721Benchmark.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract DropERC721BenchmarkTest is BaseTest {
DropERC721 benchmark
//////////////////////////////////////////////////////////////*/

function test_bechmark_dropERC721_claim_five_tokens() public {
function test_benchmark_dropERC721_claim_five_tokens() public {
vm.pauseGasMetering();
string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -80,7 +80,7 @@ contract DropERC721BenchmarkTest is BaseTest {
drop.claim(receiver, 5, address(erc20), 5, alp, "");
}

function test_bechmark_dropERC721_setClaimConditions_five_conditions() public {
function test_benchmark_dropERC721_setClaimConditions_five_conditions() public {
vm.pauseGasMetering();
string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -171,7 +171,7 @@ contract DropERC721BenchmarkTest is BaseTest {
drop.reveal(0, key);
}

// function test_bechmark_dropERC721_claim_one_token() public {
// function test_benchmark_dropERC721_claim_one_token() public {
// vm.pauseGasMetering();
// string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -222,7 +222,7 @@ contract DropERC721BenchmarkTest is BaseTest {
// drop.claim(receiver, 1, address(erc20), 5, alp, "");
// }

// function test_bechmark_dropERC721_claim_two_tokens() public {
// function test_benchmark_dropERC721_claim_two_tokens() public {
// vm.pauseGasMetering();
// string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -273,7 +273,7 @@ contract DropERC721BenchmarkTest is BaseTest {
// drop.claim(receiver, 2, address(erc20), 5, alp, "");
// }

// function test_bechmark_dropERC721_claim_three_tokens() public {
// function test_benchmark_dropERC721_claim_three_tokens() public {
// vm.pauseGasMetering();
// string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -324,7 +324,7 @@ contract DropERC721BenchmarkTest is BaseTest {
// drop.claim(receiver, 3, address(erc20), 5, alp, "");
// }

// function test_bechmark_dropERC721_setClaimConditions_one_condition() public {
// function test_benchmark_dropERC721_setClaimConditions_one_condition() public {
// vm.pauseGasMetering();
// string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -364,7 +364,7 @@ contract DropERC721BenchmarkTest is BaseTest {
// drop.setClaimConditions(conditions, false);
// }

// function test_bechmark_dropERC721_setClaimConditions_two_conditions() public {
// function test_benchmark_dropERC721_setClaimConditions_two_conditions() public {
// vm.pauseGasMetering();
// string[] memory inputs = new string[](5);

Expand Down Expand Up @@ -408,7 +408,7 @@ contract DropERC721BenchmarkTest is BaseTest {
// drop.setClaimConditions(conditions, false);
// }

// function test_bechmark_dropERC721_setClaimConditions_three_conditions() public {
// function test_benchmark_dropERC721_setClaimConditions_three_conditions() public {
// vm.pauseGasMetering();
// string[] memory inputs = new string[](5);

Expand Down
10 changes: 5 additions & 5 deletions src/test/benchmark/SignatureDropBenchmark.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ contract SignatureDropBenchmarkTest is BaseTest {
SignatureDrop benchmark
//////////////////////////////////////////////////////////////*/

function test_bechmark_signatureDrop_claim_five_tokens() public {
function test_benchmark_signatureDrop_claim_five_tokens() public {
vm.pauseGasMetering();
vm.warp(1);

Expand All @@ -80,7 +80,7 @@ contract SignatureDropBenchmarkTest is BaseTest {
sigdrop.claim(receiver, 5, address(0), 0, alp, "");
}

function test_bechmark_signatureDrop_setClaimConditions() public {
function test_benchmark_signatureDrop_setClaimConditions() public {
vm.pauseGasMetering();
vm.warp(1);
bytes32[] memory proofs = new bytes32[](0);
Expand Down Expand Up @@ -137,7 +137,7 @@ contract SignatureDropBenchmarkTest is BaseTest {
sigdrop.reveal(0, key);
}

// function test_bechmark_signatureDrop_claim_one_token() public {
// function test_benchmark_signatureDrop_claim_one_token() public {
// vm.pauseGasMetering();
// vm.warp(1);

Expand All @@ -162,7 +162,7 @@ contract SignatureDropBenchmarkTest is BaseTest {
// sigdrop.claim(receiver, 1, address(0), 0, alp, "");
// }

// function test_bechmark_signatureDrop_claim_two_tokens() public {
// function test_benchmark_signatureDrop_claim_two_tokens() public {
// vm.pauseGasMetering();
// vm.warp(1);

Expand All @@ -187,7 +187,7 @@ contract SignatureDropBenchmarkTest is BaseTest {
// sigdrop.claim(receiver, 2, address(0), 0, alp, "");
// }

// function test_bechmark_signatureDrop_claim_three_tokens() public {
// function test_benchmark_signatureDrop_claim_three_tokens() public {
// vm.pauseGasMetering();
// vm.warp(1);

Expand Down
4 changes: 2 additions & 2 deletions src/test/smart-wallet/utils/AABenchmarkArtifacts.sol

Large diffs are not rendered by default.

0 comments on commit 0370cac

Please sign in to comment.