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

Added benchmarking test for sorting array #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

NindoK
Copy link
Contributor

@NindoK NindoK commented Dec 16, 2024

  • This PR adds initial benchmarking for getting big validators set and sort it
  • It's a proof of gas cost for specific scenarios

This PR should light a spark into understanding which should be the best way to go.

@NindoK NindoK marked this pull request as ready for review December 20, 2024 16:01
Copy link

> Coverage generated

Coverage after merging test/benchmark-for-sorted-array into main will be
38.44%▴ +0.95%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
script
   DeployCollateral.s.sol20%100%33.33%17.65%11–12, 23, 26–28, 30–31, 33, 35–38, 40
   DeploySymbiotic.s.sol61.46%100%50%61.63%147, 150, 153–158, 160, 327–330, 333–336, 338, 349–352, 354–358, 360, 362–366
   DeployTanssiEcosystem.s.sol0%0%0%0%105, 110–115, 117–119, 121–123, 126–127, 129–131, 133, 139, 143–144, 157, 157–158, 162, 162–163, 165–169, 172, 172–173, 175, 177–181, 183, 183–185, 185–186, 188, 190–194, 197, 197–198, 200, 203–204, 204–206, 208–209, 214–215, 220–221, 221–223, 225, 228–229, 239, 241–242, 242–244, 248, 250–254, 256, 256, 256, 258, 260, 262–264, 273–274, 276–293, 296, 299–301, 303–306, 309–316
   DeployVault.s.sol60%45.45%50%64.58%113, 113–114, 117, 117–118, 122, 150, 162, 174, 174–175, 216, 228, 230, 242, 244–246, 248, 88, 94–95
   HelperConfig.s.sol0%0%0%0%37–38, 38, 38–39, 41, 45–48, 51–52, 55–71, 73, 86–87, 89, 91
script/snowbridge-override
   DeployBeefyClient.s.sol0%100%0%0%28, 30–33, 37–40, 42, 47, 53–57, 59, 61
script/test
   Demo.s.sol0%100%0%0%100–101, 103–105, 107–108, 110, 113–114, 125–130, 132–133, 135–139, 141–143, 145–150, 153, 156–158, 161, 169–172, 174–178, 180–181, 183–189, 191, 194, 197, 200–203, 206, 209, 212, 221, 224, 226–229, 231–233, 235–239, 241–243, 245–251, 253–255, 257–259, 261–264, 266–268, 270–271, 273–275, 277–281, 284–288, 292, 87–93, 95–97, 99
   DeployTanssiEcosystemDemo.s.sol0%0%0%0%110–111, 111–112, 115–120, 122–124, 126–132, 134–135, 137–139, 141–142, 144, 144–145, 147, 151–152, 165, 165–166, 170, 170–171, 173–177, 180, 180–181, 183, 185–189, 191, 191–193, 193–194, 196, 198–202, 205, 205–206, 208, 211–212, 212–214, 216–217, 222–223, 228–234, 237–239, 242–243, 253, 255–256, 256–258, 262, 264–268, 270, 270, 270, 272, 274, 276, 278–281, 283–289, 291–296, 298–303, 305–306, 315, 318, 321, 324–327, 329–350, 353, 356–358, 360–363, 366–373
src/libraries
   MapWithTimeData.sol100%100%100%100%
   SimpleKeyRegistry32.sol100%100%100%100%
src/middleware
   Middleware.sol93.31%90%93.75%93.83%446, 449, 451–454, 457, 457–458, 461, 465, 469, 518–519, 548–549, 572–573
src/snowbridge-override
   Gateway.sol26.24%0%26.19%30.27%109–110, 110–111, 117, 120–121, 121–122, 135–136, 152, 157, 159, 162, 162–163, 169, 172–173, 176, 176–177, 182–183, 183–184, 187, 190, 190, 190–193, 195, 195, 195–198, 200, 200, 200–203, 205, 205, 205–208, 210, 210, 210–213, 215, 215, 215–218, 220, 220, 220–223, 225, 225, 225–228, 230, 230, 230–233, 235, 235, 235–238, 240, 240, 240–243, 245, 245–248, 254–255, 259, 262, 262–263, 266, 272–273, 276, 279–280, 283, 286–287, 296–298, 301–302, 310, 313, 315, 317, 317–318, 321–323, 323–325, 338–339, 361–362, 374, 377, 379, 382, 382–383, 386–387, 391, 394–395, 409, 412, 414, 416–417, 421, 424–429, 433, 436–441, 448, 451–452, 456, 459–460, 464, 467–469, 472, 475, 479–480, 484, 487, 491, 496, 500, 507, 511, 515, 518, 541–542, 546, 550, 554, 559–562, 566, 569–571, 613–614, 624–625, 634–635, 640, 643–644, 644–645, 650–652, 656–658, 662–663, 697–698
   Operators.sol84.62%50%100%90%35–36
src/snowbridge-override/libraries
   OSubstrateTypes.sol100%100%100%100%
test/mocks
   MapWithTimeDataContract.sol100%100%100%100%
   Token.sol100%100%100%100%
test/mocks/snowbridge-override
   MockOGateway.sol26.09%0%28.57%26.67%101, 104, 107, 110, 113, 26, 29, 38, 41, 50, 53, 62, 65, 74, 78, 78, 78–79, 82, 86, 89, 92,

Copy link
Contributor

@nanocryk nanocryk left a comment

Choose a reason for hiding this comment

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

Add unit test for the sorting function:

  • Create an unsorted array
  • Call sort function
  • Compare neighbors to verify they are sorted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants