Skip to content

Commit

Permalink
fixing profiler + upgrade gas report
Browse files Browse the repository at this point in the history
  • Loading branch information
gaetbout committed Jun 10, 2024
1 parent 0859e8a commit dd4727e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
16 changes: 8 additions & 8 deletions gas-report.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ Summary:
┌───────────────────────┬─────────────────────┬─────────┬────────────────┬────────────────┬─────────────────┬───────────┬──────────────┬──────────────────────────────┬───────────────┬────────┬─────────┐
│ (index) │ Actual fee │ Fee usd │ Fee without DA │ Gas without DA │ Computation gas │ Event gas │ Calldata gas │ Max computation per Category │ Storage diffs │ DA fee │ DA mode │
├───────────────────────┼─────────────────────┼─────────┼────────────────┼────────────────┼─────────────────┼───────────┼──────────────┼──────────────────────────────┼───────────────┼────────┼─────────┤
│ Deposit (txV3: false) │ '1.116.000.000.352' │ 0.004411160000000003130 │ 4 │ 1 │ 'steps' │ 4 │ 352 │ 'BLOB' │
│ Claim (txV3: false) │ '1.260.000.000.192' │ 0.00512600000000003534 │ 2 │ 1 │ 'steps' │ 3 │ 192 │ 'BLOB' │
│ Deposit (txV3: true) │ '1.116.000.000.480' │ 0.004411160000000003130 │ 4 │ 1 │ 'steps' │ 5 │ 480 │ 'BLOB' │
│ Claim (txV3: true) │ '1.260.000.000.192' │ 0 │ 12600000000003534 │ 2 │ 1 │ 'steps' │ 3 │ 192 │ 'BLOB' │
│ Deposit (txV3: false) │ '1.152.000.000.352' │ 0.004611520000000003231 │ 4 │ 1 │ 'steps' │ 4 │ 352 │ 'BLOB' │
│ Claim (txV3: false) │ '1.332.000.000.192' │ 0.005313320000000003735 │ 2 │ 2 │ 'steps' │ 3 │ 192 │ 'BLOB' │
│ Deposit (txV3: true) │ '1.152.000.000.480' │ 0.004611520000000003231 │ 4 │ 1 │ 'steps' │ 5 │ 480 │ 'BLOB' │
│ Claim (txV3: true) │ '1.332.000.000.192' │ 0 │ 13320000000003735 │ 2 │ 2 │ 'steps' │ 3 │ 192 │ 'BLOB' │
└───────────────────────┴─────────────────────┴─────────┴────────────────┴────────────────┴─────────────────┴───────────┴──────────────┴──────────────────────────────┴───────────────┴────────┴─────────┘
Resources:
┌───────────────────────┬─────────┬───────┬───────┬────────┬──────────┬──────────┬─────────────┬───────┐
│ (index) │ bitwise │ ec_op │ ecdsa │ keccak │ pedersen │ poseidon │ range_check │ steps │
├───────────────────────┼─────────┼───────┼───────┼────────┼──────────┼──────────┼─────────────┼───────┤
│ Deposit (txV3: false) │ 0 │ 3 │ 0 │ 0 │ 38 │ 0 │ 27311991
│ Claim (txV3: false) │ 0 │ 3 │ 0 │ 0 │ 71 │ 0 │ 45613228
│ Deposit (txV3: true) │ 0 │ 3 │ 0 │ 0 │ 38 │ 0 │ 27311992
│ Claim (txV3: true) │ 0 │ 3 │ 0 │ 0 │ 71 │ 0 │ 49013426
│ Deposit (txV3: false) │ 0 │ 3 │ 0 │ 0 │ 39 │ 0 │ 28112154
│ Claim (txV3: false) │ 0 │ 3 │ 0 │ 0 │ 75 │ 0 │ 47513657
│ Deposit (txV3: true) │ 0 │ 3 │ 0 │ 0 │ 39 │ 0 │ 28112155
│ Claim (txV3: true) │ 0 │ 3 │ 0 │ 0 │ 75 │ 0 │ 50913855
└───────────────────────┴─────────┴───────┴───────┴────────┴──────────┴──────────┴─────────────┴───────┘
13 changes: 8 additions & 5 deletions scripts/profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { LegacyStarknetKeyPair, deployer, manager } from "../lib";
import { newProfiler } from "../lib/gas";

// TODO add this in CI, skipped atm to avoid false failing tests
// TODO Add possibility to "mix" gift_token and fee_token

const profiler = newProfiler(manager);

Expand All @@ -29,26 +30,28 @@ for (const useTxV3 of [false, true]) {
await tokenContract.approve(factory.address, amount + maxFee);
await profiler.profile(
`Deposit (txV3: ${useTxV3})`,
await factory.deposit(amount, maxFee, tokenContract.address, claimPubkey),
await factory.deposit(tokenContract.address, amount, tokenContract.address, maxFee, claimPubkey),
);

// Ensure there is a contract for the claim
const claimAddress = await factory.get_claim_address(
claimAccountClassHash,
deployer.address,
tokenContract.address,
amount,
maxFee,
tokenContract.address,
maxFee,
claimPubkey,
);

const claim = {
factory: factory.address,
class_hash: claimAccountClassHash,
sender: deployer.address,
amount: uint256.bnToUint256(amount),
max_fee: maxFee,
token: tokenContract.address,
gift_token: tokenContract.address,
gift_amount: uint256.bnToUint256(amount),
fee_token: tokenContract.address,
fee_amount: maxFee,
claim_pubkey: claimPubkey,
};

Expand Down

0 comments on commit dd4727e

Please sign in to comment.