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

ci: update gas benchmark CI to display gas diffs as well as the figures #731

Merged
merged 4 commits into from
Sep 29, 2023

Conversation

CJ42
Copy link
Member

@CJ42 CJ42 commented Sep 26, 2023

What does this PR introduce?

📦 Build

Create new hardhat task hardhat gas-benchmark to generate a table with a gas diff, based on the pre-defined scenarios set in the test file Benchmark.test.ts.

📄 Documentation

  • Add basic documentation for the how to use the new hardhat task created.

🤖 CI

Update the CI to generate the gas report by comparing the gas figures of the base vs target branch.

PR Checklist

  • Wrote Tests
  • Wrote & Generated Documentation (readme/natspec/dodoc)
  • Ran npm run lint && npm run lint:solidity (solhint)
  • Ran npm run format (prettier)
  • Ran npm run build
  • Ran npm run test

@Hugoo
Copy link
Contributor

Hugoo commented Sep 26, 2023

@CJ42 CJ42 marked this pull request as draft September 26, 2023 15:41
@CJ42 CJ42 force-pushed the DEV-5903 branch 2 times, most recently from 9a73464 to 56accfa Compare September 28, 2023 13:03
@CJ42 CJ42 force-pushed the DEV-5903 branch 3 times, most recently from 5232bf8 to 3a04ac8 Compare September 28, 2023 15:37
Copy link
Contributor

@richtera richtera left a comment

Choose a reason for hiding this comment

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

Lgtm

uses: actions/checkout@v3
# Do not run `git clean -ffdx && git reset --hard HEAD` to prevent removing `gas_benchmark_before.json`
with:
clean: false
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice!

@github-actions
Copy link
Contributor

Changes to gas cost

Generated at commit: 5c32d8c1279b0fd6fd926ef565936adbc26f8c2b, compared to commit: b8eca3c5696acf85239130ef67edec9e8c134bfa

🧾 Summary (10% most significant diffs)

Contract Method Avg (+/-) %
LSP6ExecuteRestrictedController transferLYXToUP +3,532 ❌ +11.21%
LSP6ExecuteUnrestrictedController transferLYXToUP +3,532 ❌ +10.54%
LSP6SetDataRestrictedController execute +1,958 ❌ +6.86%
LSP6SetDataUnrestrictedController execute +1,958 ❌ +6.86%

Full diff report 👇
Contract Deployment Cost (+/-) Method Min (+/-) % Avg (+/-) % Median (+/-) % Max (+/-) % # Calls (+/-)
LSP6ExecuteRestrictedController 2,875,309 (-382) lsp20VerifyCall
transferLYXToEOA
transferLYXToUP
transferNFTToRandomEOA
transferNFTToRandomUP
transferTokensToRandomEOA
transferTokensToRandomUP
14,652 (-244)
58,136 (+1,971)
35,028 (+3,532)
132,444 (+1,675)
240,972 (+1,658)
75,686 (+1,994)
211,131 (+1,972)
-1.64%
+3.51%
+11.21%
+1.28%
+0.69%
+2.71%
+0.94%
16,851 (-181)
58,136 (+1,971)
35,028 (+3,532)
132,444 (+1,675)
240,972 (+1,658)
75,686 (+1,994)
211,131 (+1,972)
-1.06%
+3.51%
+11.21%
+1.28%
+0.69%
+2.71%
+0.94%
17,584 (-161)
58,136 (+1,971)
35,028 (+3,532)
132,444 (+1,675)
240,972 (+1,658)
75,686 (+1,994)
211,131 (+1,972)
-0.91%
+3.51%
+11.21%
+1.28%
+0.69%
+2.71%
+0.94%
17,584 (-161)
58,136 (+1,971)
35,028 (+3,532)
132,444 (+1,675)
240,972 (+1,658)
75,686 (+1,994)
211,131 (+1,972)
-0.91%
+3.51%
+11.21%
+1.28%
+0.69%
+2.71%
+0.94%
8 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
LSP6ExecuteUnrestrictedController 2,875,309 (-382) lsp20VerifyCall
transferLYXToEOA
transferLYXToUP
transferNFTToRandomEOA
transferNFTToRandomUP
transferTokensToRandomEOA
transferTokensToRandomUP
14,652 (-244)
58,766 (+1,971)
37,028 (+3,532)
131,193 (+1,675)
239,720 (+1,657)
74,122 (+1,994)
209,567 (+1,972)
-1.64%
+3.47%
+10.54%
+1.29%
+0.70%
+2.76%
+0.95%
16,851 (-181)
58,766 (+1,971)
37,028 (+3,532)
131,193 (+1,675)
239,720 (+1,657)
74,122 (+1,994)
209,567 (+1,972)
-1.06%
+3.47%
+10.54%
+1.29%
+0.70%
+2.76%
+0.95%
17,584 (-161)
58,766 (+1,971)
37,028 (+3,532)
131,193 (+1,675)
239,720 (+1,657)
74,122 (+1,994)
209,567 (+1,972)
-0.91%
+3.47%
+10.54%
+1.29%
+0.70%
+2.76%
+0.95%
17,584 (-161)
58,766 (+1,971)
37,028 (+3,532)
131,193 (+1,675)
239,720 (+1,657)
74,122 (+1,994)
209,567 (+1,972)
-0.91%
+3.47%
+10.54%
+1.29%
+0.70%
+2.76%
+0.95%
8 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
1 (0)
LSP6SetDataRestrictedController 2,860,086 (-382) execute
givePermissionsToController
restrictControllerToERC725YKeys
20,461 (+1,971)
122,944 (+2,310)
141,194 (+2,310)
+10.66%
+1.91%
+1.66%
30,493 (+1,958)
122,944 (+2,310)
141,194 (+2,310)
+6.86%
+1.91%
+1.66%
30,493 (+1,958)
122,944 (+2,310)
141,194 (+2,310)
+6.86%
+1.91%
+1.66%
40,526 (+1,945)
122,944 (+2,310)
141,194 (+2,310)
+5.04%
+1.91%
+1.66%
2 (0)
1 (0)
1 (0)
LSP6SetDataUnrestrictedController 2,860,086 (-382) execute
givePermissionsToController
restrictControllerToERC725YKeys
20,461 (+1,971)
128,944 (+2,310)
149,694 (+2,310)
+10.66%
+1.82%
+1.57%
30,493 (+1,958)
128,944 (+2,310)
149,694 (+2,310)
+6.86%
+1.82%
+1.57%
30,493 (+1,958)
128,944 (+2,310)
149,694 (+2,310)
+6.86%
+1.82%
+1.57%
40,526 (+1,945)
128,944 (+2,310)
149,694 (+2,310)
+5.04%
+1.82%
+1.57%
2 (0)
1 (0)
1 (0)

@CJ42 CJ42 marked this pull request as ready for review September 29, 2023 15:39
@CJ42 CJ42 merged commit d62239e into develop Sep 29, 2023
25 checks passed
@CJ42 CJ42 deleted the DEV-5903 branch September 29, 2023 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants