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 ARC-56 support #330

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

feat: add ARC-56 support #330

wants to merge 5 commits into from

Conversation

daniel-makerx
Copy link
Contributor

@daniel-makerx daniel-makerx commented Oct 18, 2024

No description provided.

Copy link

github-actions bot commented Oct 18, 2024

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/puya_lib
   arc4.py1261260%1–332
   bytes.py990%1–15
   util.py16160%1–33
src/puya
   __main__.py30300%1–42
   arc32.py71297%78, 104
   arc56.py70297%269, 275
   artifact_sorter.py53198%84
   compile.py160895%92–93, 135–138, 158–161, 317, 365
   context.py31197%35
   errors.py35877%40–42, 44–46, 50–51
   log.py1994080%32–35, 69, 89, 123–124, 166–168, 171–173, 175, 188–197, 219, 288–289, 298, 326–328, 341–355
   main.py36360%1–49
   parse.py87594%31, 40, 50, 56, 87
   utils.py2011891%50, 67–68, 77–78, 86–87, 177, 195–197, 204, 212, 226, 249, 251, 274, 309
src/puya/awst
   function_traverser.py288399%76, 367, 373
   nodes.py9823996%99, 103–106, 146, 150–153, 351, 540, 556, 590, 631, 660–661, 711, 738–739, 888, 910, 942, 968, 973, 1128, 1213, 1229, 1278, 1351, 1432, 1486, 1490, 1747, 1752, 1757, 1765, 1770, 1775
   serialize.py681184%24, 84–89, 95–98
   to_code_visitor.py423898%131, 242, 279, 325, 581, 606, 634, 638
   txn_fields.py98199%48
   wtypes.py3261795%171–174, 188–189, 193, 225, 238, 249, 254–255, 289, 327, 341, 391, 513
src/puya/awst/validation
   arc4_copy.py102199%38
   base_invoker.py47491%55, 62, 72–76
   inner_transactions.py187199%160
   labels.py30873%25–27, 32, 36–41
   scratch_slots.py38489%18, 32, 47, 49
src/puya/ir
   arc4_router.py2841993%112, 175, 231, 309, 357, 428, 441, 499–500, 512, 517, 522, 527, 532, 537, 557–561, 694, 731
   avm_ops.py315199%46
   avm_ops_models.py48394%21, 30, 38
   context.py101892%68, 75, 78, 80, 118–119, 129, 135
   main.py3911496%77–83, 93–99, 125, 138, 166, 538, 773–777
   models.py5292296%74, 182, 189, 338, 408–409, 414, 420–424, 437, 481, 510, 566, 612, 692, 708, 749, 752, 759, 762, 851–852
   ssa.py130596%51–52, 150, 212, 223
   to_text_visitor.py152795%123, 212, 219–224
   types_.py1011090%50, 57, 91–95, 116, 152, 157–159
   visitor.py1291787%145, 193, 205, 220, 223, 236, 239, 245, 248, 259, 262, 265, 268, 271, 274, 277, 280
   visitor_mutator.py105298%174–175
   vla.py72199%87
src/puya/ir/builder
   _utils.py121596%175–177, 239–246
   arc4.py5012296%172–177, 457, 482, 485, 543–546, 808–809, 1055, 1079, 1160, 1167, 1203, 1251, 1261, 1316, 1361, 1380, 1400
   assignment.py83693%51, 98, 112, 186, 204, 220
   blocks.py140795%55, 92–96, 158, 166, 231
   bytes.py641478%13–45, 129
   callsub.py77594%30–31, 51, 101–102
   flow_control.py95199%56
   iteration.py198597%91–92, 107, 144, 206
   itxn.py3233789%139–140, 142, 156, 164–169, 197, 204, 226–227, 560, 579–597, 666, 670, 684, 693–706
   main.py5436588%103, 241, 245, 250–268, 273–291, 346, 370, 394–395, 433, 621, 653, 666–667, 723, 748, 785–787, 798, 863, 941, 954, 986, 1041, 1044, 1052, 1055, 1063, 1092, 1118, 1127, 1206, 1223, 1266–1276
   storage.py83298%101, 154
src/puya/ir/destructure
   coalesce_locals.py1011981%119, 128–129, 132–135, 138–147, 163–166
   parcopy.py84298%47, 83
src/puya/ir/optimize
   collapse_blocks.py92595%65–69
   compiled_reference.py79594%53, 87, 158–163
   control_op_simplification.py104793%47–48, 171, 245–252
   inner_txn.py36197%38
   intrinsic_simplification.py4833194%76, 166–168, 173, 255, 267, 302, 313–314, 338–339, 363, 430, 617, 619, 634, 674, 697, 727, 733, 735, 737, 742, 744, 746, 748, 750, 802–803, 810
   main.py87298%116–117
src/puya/ir/validation
   _base.py29197%24
   compile_reference_validator.py20290%24, 30
   min_avm_version_validator.py11191%15
   op_run_mode_validator.py19574%19–29
src/puya/mir
   aligned_writer.py63395%21, 61, 80
   builder.py1571392%71–73, 156, 268–269, 322, 325, 328, 331, 334, 337, 340
   models.py431699%97, 206, 250, 316, 333, 403
src/puya/mir/stack_allocation
   f_stack.py89298%23, 70
   peephole.py50394%41, 50, 52
   x_stack.py205399%32, 336–340
src/puya/teal
   models.py358299%367, 428
src/puya/teal/optimize
   constant_block.py104496%63, 152, 189, 206
   peephole.py127398%160, 166, 249
   repeated_rotations.py51198%16
   repeated_rotations_search.py90693%35, 41–42, 58, 68–69
src/puya/ussemble
   assemble.py171597%134, 202, 219–220, 260
   models.py25196%16
   op_spec_models.py22195%20
src/puyapy
   __main__.py641773%178, 190–204, 208
   client_gen.py118794%84–88, 92, 205, 231
   compile.py1502285%59–68, 82, 164–165, 176, 183–184, 201–211, 221–223, 228, 244
   models.py98496%64, 76–78
   parse.py1801393%49–50, 86, 158–163, 167, 265, 269–270, 317, 329, 354
   template.py32875%10–11, 18–19, 27–28, 34, 37
   utils.py21576%16–17, 25–28
src/puyapy/awst_build
   arc4_client.py1042675%46–50, 58, 70, 76, 80, 109, 115–116, 122, 125, 128, 134, 137, 140–145, 148, 151, 154, 157, 160, 163, 166, 169, 172
   arc4_client_gen.py123893%31, 91–92, 103, 105, 120–121, 176
   arc4_utils.py2914784%42, 45–46, 48, 53–60, 78, 89–93, 109, 111, 114–115, 138, 181–183, 192, 197, 202–203, 229, 233, 245, 252, 254, 268–269, 272–276, 281–282, 288–291, 299, 307, 324, 336, 344, 452, 457, 476
   base_mypy_visitor.py1273969%70–76, 94, 102–115, 129, 131, 133, 145, 150, 154, 157, 160, 166, 188, 191, 194, 201, 205, 208, 211, 215, 233, 237, 241, 245, 249, 253, 257, 261, 265, 269, 273, 277, 281
   context.py2184778%55, 58, 68–69, 87–88, 128, 188, 193, 199–203, 207, 210, 219, 221, 224–226, 228, 235, 237, 248–249, 254–256, 259, 274, 286–287, 299, 313, 316–328
   contract.py3183390%128, 179, 192–196, 235, 237, 241, 245, 253, 261, 263, 283, 338, 341, 353, 361, 364, 367, 370, 373, 376, 379, 382, 385, 388, 448–452, 501–505, 585–589, 660, 683
   intrinsic_models.py40198%49
   main.py36197%31
   module.py4085786%116, 130–132, 147–148, 155, 164–165, 173–177, 195–199, 209, 247–248, 259, 281–284, 294–296, 302, 319–322, 335, 369, 376, 398–399, 422–427, 481–482, 510, 521, 524, 530, 536, 546, 552, 555, 567, 570, 592, 612, 617, 621, 625–628, 696, 717, 725, 727
   pytypes.py5364891%85–87, 101–102, 142, 158–164, 187, 207, 249, 361, 370, 389, 409, 430–431, 475, 568–570, 584–585, 652–653, 759, 770–771, 816–817, 822, 871–872, 893–894, 1040–1041, 1065, 1093, 1127–1129, 1169, 1179–1180
   subroutine.py6045391%135, 247, 253, 311–314, 320, 372, 379, 382–388, 479, 499, 654, 656–657, 675, 677, 687–688, 697–698, 702, 723, 798, 805, 825–826, 908, 934–935, 952, 968, 992, 1000, 1011, 1036, 1141–1142, 1162, 1172, 1174, 1183, 1201, 1209, 1223, 1226, 1229, 1232, 1235, 1255–1257
   utils.py1742586%30, 47–51, 69, 104–105, 107, 151–152, 203, 211, 216, 229–233, 238–241, 250, 254, 262, 305
src/puyapy/awst_build/eb
   _base.py1311985%53, 58–60, 65, 72, 77, 82–84, 143, 154, 184, 189, 194, 199, 210, 225, 230–232
   _bytes_backed.py48296%30–31
   _expect.py1222183%26, 37, 87–90, 102–105, 108, 160–161, 219–222, 232–235
   _literals.py1442980%44, 73, 92, 121, 138, 152, 156, 160–166, 176–190, 195
   _type_registry.py40490%252–253, 265–266
   utils.py47394%29–31, 100
   array.py26965%23, 28–33, 43, 49
   biguint.py96694%56, 98, 135, 150–151, 153
   binary_bool_op.py104397%152, 160, 170
   bool.py56984%39–43, 59, 70, 85, 99
   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.py1293176%100, 104, 164, 168–171, 180–182, 205–208, 217, 221, 225–228, 243–255, 264–265
   contracts.py77890%55, 61, 63, 73, 99, 109, 111, 116
   dict.py27581%25, 33–35, 39
   ensure_budget.py31197%47
   interface.py90397%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, 140, 183, 190, 194, 206, 280–282, 302
   struct.py16569%14–16, 25, 31
   subroutine.py791680%46, 50–53, 68, 71–78, 93, 101–102, 104–107, 112
   template_variables.py37295%30, 58
   tuple.py3391396%85, 133, 149, 239–240, 252, 345–346, 465, 534, 545–546, 609
   uint64.py110595%57, 118–119, 167–168
   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.py91397%186–189, 200
   _utils.py1511093%102–103, 130, 138, 151, 191–194, 265, 269, 283
   abi_call.py3161994%118, 124, 145, 215, 228–229, 310, 321, 379, 402, 433, 452–453, 511, 548, 620, 705–706, 723
   address.py77396%57, 117–118
   bool.py57395%44, 86–87
   dynamic_array.py1271092%57, 126–127, 147, 149, 154, 228, 249, 255–258
   dynamic_bytes.py68396%97–99
   emit.py34197%36
   static_array.py66198%45
   string.py100793%54–55, 103, 126, 131–134
   struct.py49198%49
   tuple.py921683%46–48, 72, 90–93, 96–97, 133–136, 141, 145–146, 156, 166
   ufixed.py70297%43, 102
src/puyapy/awst_build/eb/reference_types
   account.py81298%65, 176
   application.py45198%40
   asset.py65198%48
src/puyapy/awst_build/eb/storage
   _common.py69396%107, 122–123
   _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.py148199%195
   global_state.py125596%104–105, 111, 163–164
   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.py50394%89–91
   inner_params.py77594%64, 74, 78, 138, 140
   itxn_args.py60198%72
TOTAL22467168493% 

Tests Skipped Failures Errors Time
869 2 💤 0 ❌ 0 🔥 6m 1s ⏱️

@daniel-makerx daniel-makerx marked this pull request as ready for review October 24, 2024 13:14
name: str
elements: Sequence[tuple[str, str]] = attrs.field(default=(), converter=_freeze_list_of_lists)
type: str
struct: str | None
Copy link
Contributor

Choose a reason for hiding this comment

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

What's this field for? 🤔

Copy link
Contributor Author

@daniel-makerx daniel-makerx Oct 28, 2024

Choose a reason for hiding this comment

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

ARC-56 is a backwards compatible extension of ARC-4, so type just defines the ARC4 encoding of an arg, which for a struct/named tuple will just be the tuple encoding with no field information.
If the arg is actually a struct, then the struct field defines the name of the struct, which can be looked up on the Contract structs mapping to get the full information

See https://github.com/algorandfoundation/ARCs/pull/258/files#diff-6eb6fa5a0cc74e7fa2334541fb86699840a16e2518c98275de9268945c3dcaadR164 for more context

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.

PuyaPy: ARC-56 support (when final)
2 participants