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

feat: add algopy.Array and algopy.ImmutableArray #386

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

Conversation

daniel-makerx
Copy link
Contributor

No description provided.

Copy link

github-actions bot commented Jan 31, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/puya_lib
   arc4.py1291290%1–336
   bytes.py990%1–15
   util.py16160%1–33
src/puya
   __main__.py34340%1–57
   arc32.py89693%74, 123–130
   arc56.py85594%282, 285–287, 297
   artifact_sorter.py57296%32, 89
   compile.py203996%98–99, 173–174, 182, 245–247, 356, 404
   context.py56296%39, 75
   errors.py35877%40–42, 44–46, 50–51
   log.py2376274%26–29, 45–48, 82, 92–93, 98–105, 120–128, 150, 178, 186–187, 229–231, 234–236, 238, 251–260, 285, 291, 296, 365–366, 375, 403–405, 418–432
   main.py36360%1–49
   parse.py87495%31, 40, 50, 56
   program_refs.py28293%45, 56
   utils.py2091792%50, 67–68, 77–78, 86–87, 177, 195–197, 231, 238, 261, 263, 286, 321
src/puya/awst
   function_traverser.py300399%76, 382, 388
   nodes.py10604396%89, 93–96, 136, 140–143, 354, 573, 589, 623, 664, 693–694, 744, 771–772, 922, 955, 987, 1013, 1018, 1178, 1263, 1279, 1328, 1405, 1486, 1540, 1544, 1668, 1815, 1820, 1825, 1833, 1838, 1843, 1880–1881, 1891
   serialize.py681184%24, 84–89, 95–98
   to_code_visitor.py4421198%141, 252, 289, 335, 596–599, 629, 657, 661
   txn_fields.py98199%48
   wtypes.py3381596%173, 177–180, 199, 242, 255, 266, 271–272, 306, 344, 358, 538
src/puya/awst/validation
   arc4_copy.py113298%34, 38
   base_invoker.py47491%55, 62, 72–76
   immutable.py31294%26, 34
   inner_transactions.py187199%161
   labels.py30873%25–27, 32, 36–41
src/puya/ir
   _arc4_default_args.py1221687%63–64, 88, 105, 118, 120, 122, 124, 126, 128, 131, 138, 159–160, 242, 249
   contract_metadata.py198398%50, 185–189
   arc4_router.py181597%98, 161, 215, 297, 421
   arc4_types.py59395%51, 58, 74
   avm_ops.py326199%46
   avm_ops_models.py37295%15, 23
   context.py106595%80, 95, 98, 100, 109
   main.py1901095%118, 127–133, 143–149, 175
   models.py6693695%222, 229, 424, 453–455, 463–467, 486, 499, 517, 539, 555, 572, 693–694, 699, 705–709, 722, 766, 795, 851, 893, 961, 1010, 1013, 1101–1102, 1128, 1204, 1220–1222, 1240
   ssa.py137398%51–52, 150
   to_text_visitor.py201299%190, 258
   types.py2533088%52, 59, 61, 67, 72–74, 78–80, 115, 128, 154, 170, 174, 181, 238, 241, 252, 261, 265, 269, 272, 300, 340, 356–360, 380, 401
   visitor.py1731691%177, 268, 289, 295, 305, 335, 341, 344, 355, 358, 361, 364, 367, 370, 373, 376
   visitor_mutator.py131298%184–185
   vla.py72199%87
src/puya/ir/builder
   _utils.py1391291%165–167, 219–226, 249–256, 278–285, 298–305, 393
   arc4.py4872196%181, 497, 504, 580–583, 911–912, 1127, 1174, 1198, 1278, 1285, 1323, 1373, 1382, 1437, 1482, 1496, 1504
   arrays.py691184%48, 62, 76–91, 105, 170–171
   assignment.py106892%96, 113, 198–199, 232, 249–250, 295
   blocks.py140795%55, 92–96, 158, 166, 231
   bytes.py671479%13–45, 129
   callsub.py81594%32–33, 58, 108–109
   flow_control.py94199%54
   iteration.py212598%91–92, 107, 146, 261
   itxn.py3233789%139–140, 142, 156, 164–169, 199, 206, 228–229, 564, 583–601, 670, 674, 688, 697–710
   lower_array.py192896%194, 271–272, 296–298, 308–309
   main.py6696590%278, 282, 287–306, 311–330, 385, 409, 430, 448–449, 451, 459, 501, 588–589, 701, 734, 760–761, 856, 940, 1005, 1098, 1139, 1208, 1211, 1219, 1222, 1284, 1335, 1341, 1367, 1376, 1500, 1517, 1563–1573
   storage.py83298%101, 154
src/puya/ir/destructure
   coalesce_locals.py951980%113, 122–123, 126–129, 132–141, 153–156
   parcopy.py72297%80, 116
src/puya/ir/optimize
   _call_graph.py32197%42
   _utils.py14286%17–19
   collapse_blocks.py94199%68
   compiled_reference.py82594%54, 86, 167–172
   control_op_simplification.py851088%35–36, 80–109
   inlining.py2301195%35–44, 48, 55, 391, 395, 399, 409, 413
   inner_txn.py30293%36–37
   intrinsic_simplification.py6303095%467, 479, 507, 518–519, 587–588, 612, 700, 853–856, 936, 938, 948, 988, 1011, 1025, 1050, 1056, 1058, 1060, 1065, 1067, 1069, 1071, 1073, 1125–1126, 1133
src/puya/ir/validation
   _base.py30197%28
   compile_reference_validator.py20290%24, 30
   min_avm_version_validator.py15473%16–20
   op_run_mode_validator.py19574%19–29
   slot_reservation.py18194%20
src/puya/mir
   aligned_writer.py63297%21, 61
   builder.py2092688%87–89, 144–146, 173–175, 193, 196, 199, 202, 205, 208, 264, 359–360, 392, 395, 398, 401, 404, 407, 410, 413
   main.py49198%47
   models.py497799%121, 174, 177, 269, 335, 352, 408
   output.py52198%20
   stack.py154199%90
src/puya/mir/stack_allocation
   f_stack.py86495%22, 57–66
   peephole.py44295%39, 41
   x_stack.py205399%32, 336–340
src/puya/teal
   builder.py181299%108, 140
   models.py446299%377, 438
src/puya/teal/optimize
   constant_block.py104496%63, 152, 189, 206
   constant_stack_shuffling.py90496%46–47, 69–70
   main.py140398%96, 170–171
   peephole.py129497%131, 165, 233, 254
   repeated_rotations.py51590%16, 52–55
   repeated_rotations_search.py90693%35, 41–42, 58, 68–69
src/puya/ussemble
   assemble.py174498%130, 198, 218, 262
   models.py25196%16
   op_spec_models.py22195%20
src/puyapy
   __main__.py641773%177, 189–203, 207
   client_gen.py1181191%62–63, 81–85, 89, 203, 210–211, 231
   compile.py1522286%61–70, 84, 166–167, 178, 185–186, 203–213, 223–225, 230, 246
   models.py101496%68, 80–82
   parse.py1801393%50–51, 87, 159–164, 168, 268, 272–273, 321, 333, 358
   template.py32875%10–11, 18–19, 27–28, 34, 37
   utils.py21576%16–17, 25–28
src/puyapy/awst_build
   arc4_client.py1042477%46–50, 58, 70, 76, 80, 109, 115–116, 122, 125, 128, 134, 137, 145, 148, 151, 154, 157, 160, 163, 166, 169, 172
   arc4_client_gen.py132894%30, 89–90, 100, 102, 117–118, 185
   arc4_decorators.py2194579%46, 89–90, 97–99, 120–122, 145, 157, 165, 179, 181, 211–212, 229–230, 243–244, 251, 255–261, 267, 272, 275, 294, 302, 306, 316–320, 336, 338, 341–342, 351, 354–355, 357
   arc4_utils.py114794%26–33, 141, 146, 165
   base_mypy_visitor.py1603876%77–83, 103, 112–125, 139, 141, 143, 156, 161, 166, 170, 174, 200, 204, 208, 217, 222, 226, 230, 235, 255, 260, 265, 270, 275, 280, 285, 290, 295, 300, 305, 310, 315
   context.py2174679%54, 57, 67–68, 86–87, 127, 187, 192, 198–202, 209, 218, 220, 223–225, 227, 234, 236, 247–248, 253–255, 258, 273, 285–286, 298, 312, 315–327
   contract.py3223390%123, 175, 190–194, 234, 236, 240, 244, 252, 264, 266, 286, 342, 345, 357, 365, 368, 371, 374, 377, 380, 383, 386, 389, 392, 452–456, 505–509, 603–607, 679, 702
   intrinsic_models.py49198%55
   main.py36197%30
   module.py4426885%131, 154, 160–181, 200–201, 208, 217–218, 226–230, 252, 281, 301–302, 313, 335–338, 348–350, 356, 373–376, 389, 423, 430, 452–453, 476–481, 535–536, 564, 575, 578, 584, 590, 600, 606, 609, 621, 624, 647, 667, 672, 676, 685–689, 781, 789, 791
   pytypes.py5966090%88, 98–100, 105, 112, 117–119, 123–125, 152–153, 193, 211–217, 240, 260, 302, 340–342, 371, 437, 446, 465, 485, 507–508, 649–651, 665–666, 733–734, 838, 849–850, 908–909, 914, 967–968, 991–992, 1143–1144, 1168, 1196, 1232–1234, 1274, 1284–1285
   subroutine.py6315392%160, 167, 187–188, 277, 303–304, 322, 339, 364, 372, 383, 410–413, 525–526, 538, 541, 544, 547, 550, 597, 725, 736, 738, 747, 765, 773, 805, 811, 869–872, 878, 929, 934, 937–943, 1034, 1054, 1209, 1211–1212, 1230, 1232, 1242–1243, 1252–1253, 1257, 1279, 1283
   utils.py1812984%30, 47–51, 69, 104–105, 107, 151–152, 203, 211, 216, 229–233, 238–241, 250, 254, 262, 296, 310–313
src/puyapy/awst_build/eb
   _base.py1281886%52, 57–59, 64, 71, 76, 81–83, 142, 153, 183, 188, 193, 198, 209, 223–225
   _bytes_backed.py48296%30–31
   _expect.py1222183%25, 36, 85–88, 100–103, 106, 158–159, 217–220, 230–233
   _literals.py1452980%43, 72, 91, 120, 137, 151, 155, 159–165, 175–189, 194
   _type_registry.py40490%255–256, 268–269
   utils.py47394%28–30, 100
   array.py1452086%61, 102–103, 133, 138, 158–159, 165–175, 179, 235, 276–280, 286–289
   biguint.py101694%56, 100, 139, 155–156, 158
   binary_bool_op.py105397%153, 161, 171
   bool.py55984%39–43, 59, 70, 83, 97
   bytes.py1681889%103–104, 131–132, 137–138, 144–145, 148, 156, 199, 234, 266, 270, 287–288, 303–304
   compiled.py70987%86–90, 127–131, 154
   conditional_literal.py1343475%98, 102, 162, 166–169, 178–180, 203–206, 215, 219, 223–226, 241–253, 262–263, 274–277
   contracts.py77890%55, 61, 63, 73, 99, 109, 111, 116
   dict.py27581%24, 32–34, 38
   ensure_budget.py31197%47
   immutable_array.py1312680%59, 100–101, 131, 136, 152–153, 159–164, 177, 247–248, 261–268, 272–277
   interface.py91397%314–316, 320
   intrinsics.py97694%43, 62, 69, 82, 89, 160
   log.py43491%46–47, 52, 61
   logicsig.py15193%26
   none.py27196%38
   string.py1441391%72, 116–117, 136, 141, 184, 191, 195, 207, 281–283, 303
   struct.py16569%14–16, 25, 29
   subroutine.py801680%47, 51–54, 69, 72–79, 94, 102–103, 105–108, 113
   template_variables.py37295%30, 58
   tuple.py3391396%86, 134, 150, 240–241, 253, 346–347, 466, 535, 546–547, 610
   uint64.py108694%57, 118–119, 167–168, 200
   uint64_enums.py40295%41, 46
   unsigned_builtins.py1552286%74, 81, 105, 129, 133, 137, 141, 149, 153, 157, 161, 165, 175, 179, 185, 196, 202, 208, 247, 279, 291, 303
src/puyapy/awst_build/eb/arc4
   _base.py92397%185–188, 199
   _utils.py141795%119, 127, 138, 178–181, 252, 256
   abi_call.py3181994%115, 121, 142, 212, 225–226, 307, 319, 377, 400, 431, 450–451, 510, 546, 620, 705–706, 723
   address.py73297%57, 116
   bool.py58395%42, 87–88
   dynamic_array.py119992%55, 121–122, 143, 219, 239–240, 243–246
   dynamic_bytes.py68396%99–101
   emit.py34197%36
   static_array.py62198%44
   string.py98793%54–55, 103, 124, 129–132
   struct.py75199%49
   tuple.py931683%45–47, 70, 88–91, 94–95, 134–137, 142, 146–147, 157, 167
   ufixed.py70297%43, 102
src/puyapy/awst_build/eb/reference_types
   account.py79199%175
   application.py45198%40
   asset.py65198%48
src/puyapy/awst_build/eb/storage
   _common.py69396%107, 120–121
   _storage.py1082081%58, 66, 70, 74, 78, 82, 86, 90, 94, 104, 108, 112, 116, 122, 133, 139, 145, 157–159
   _value_proxy.py55787%38, 42, 50, 54, 91, 99, 103
   box_map.py147199%194
   global_state.py127695%104–105, 114–115, 164–165
   local_state.py1371192%99–100, 104, 151, 155, 159, 169, 173, 197, 254, 278
src/puyapy/awst_build/eb/transaction
   base.py39295%23, 43
   group.py53198%48
   inner.py48296%91–92
   inner_params.py77594%64, 74, 78, 138, 140
   itxn_args.py60198%72
TOTAL25235189193% 

Tests Skipped Failures Errors Time
893 2 💤 0 ❌ 0 🔥 4m 51s ⏱️

@achidlow achidlow self-requested a review February 3, 2025 02:39
@daniel-makerx daniel-makerx changed the title feat: add scratch based Array support feat: add algopy.Array and algopy.ImmutableArray Feb 4, 2025
@daniel-makerx daniel-makerx force-pushed the mutable-array branch 2 times, most recently from 6fd754d to 720e45e Compare February 6, 2025 08:33
docs/lg-data-structures.md Outdated Show resolved Hide resolved
docs/lg-data-structures.md Outdated Show resolved Hide resolved
docs/lg-data-structures.md Outdated Show resolved Hide resolved
docs/lg-data-structures.md Outdated Show resolved Hide resolved
@achidlow achidlow force-pushed the mutable-array branch 3 times, most recently from b195a60 to 0b3e759 Compare February 7, 2025 08:59
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.

4 participants