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

fix: accept address or index param for VoterParamsGet methods #369

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

boblat
Copy link
Contributor

@boblat boblat commented Jan 9, 2025

Proposed Changes

According to the doc, the stack arg A of voter_params_get op code is an Account which is the same as the stack arg A of acct_params_get op code.

This PR changes the type of parameter a for the methods of VoterParamsGet class to be Account | UInt64 | int to be inline with AcctParamsGet class.

@boblat boblat force-pushed the fix/voter-params branch 2 times, most recently from e8b430c to 21b2c4b Compare January 9, 2025 09:53
Copy link

github-actions bot commented Jan 9, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/puya_lib
   arc4.py1261260%1–332
   bytes.py990%1–15
   util.py16160%1–33
src/puya
   __main__.py34340%1–57
   arc32.py71297%78, 104
   arc56.py78297%279, 285
   artifact_sorter.py57296%32, 89
   compile.py165995%93–94, 102, 123–124, 163–168, 304, 352
   context.py52198%47
   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
   models.py188299%53, 64
   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.py292399%76, 372, 378
   nodes.py9964096%100, 104–107, 147, 151–154, 365, 561, 577, 611, 652, 681–682, 732, 759–760, 908, 930, 962, 988, 993, 1148, 1233, 1249, 1298, 1375, 1456, 1510, 1514, 1638, 1783, 1788, 1793, 1801, 1806, 1811
   serialize.py681184%24, 84–89, 95–98
   to_code_visitor.py4341297%131, 242, 279, 325, 579, 586–589, 619, 647, 651
   txn_fields.py98199%48
   wtypes.py3301895%174, 178–181, 195–196, 200, 230, 243, 254, 259–260, 294, 332, 346, 396, 519
src/puya/awst/validation
   arc4_copy.py113199%38
   base_invoker.py47491%55, 62, 72–76
   immutable.py31294%26, 34
   inner_transactions.py187199%161
   labels.py30873%25–27, 32, 36–41
   scratch_slots.py38489%18, 32, 47, 49
src/puya/ir
   arc4_router.py2811993%101, 164, 220, 300, 348, 420, 433, 491–492, 504, 509, 514, 519, 524, 529, 549–553, 689, 726
   avm_ops.py323199%46
   avm_ops_models.py50394%21, 30, 38
   context.py101892%68, 75, 78, 80, 118–119, 129, 135
   main.py4031596%90–96, 106–112, 138, 151, 179, 199, 584, 817–821
   models.py5132396%76, 184, 191, 339, 410–411, 416, 422–426, 439, 483, 512, 568, 610, 678, 727, 730, 818–819, 845, 929–931, 949
   ssa.py137398%51–52, 150
   to_text_visitor.py167299%144, 212
   types_.py1011090%50, 57, 91–95, 116, 152, 157–159
   visitor.py1271588%145, 203, 224, 237, 240, 246, 249, 260, 263, 266, 269, 272, 275, 278, 281
   visitor_mutator.py89298%126–127
   vla.py72199%87
src/puya/ir/builder
   _utils.py136596%229–231, 293–300
   arc4.py5002196%175–180, 479, 482, 540–543, 815–816, 1062, 1086, 1167, 1174, 1210, 1258, 1268, 1323, 1368, 1387, 1407
   assignment.py94793%100, 115, 189, 208, 225–226, 271
   blocks.py140795%55, 92–96, 158, 166, 231
   bytes.py641478%13–45, 129
   callsub.py81594%32–33, 58, 108–109
   flow_control.py94199%55
   iteration.py198597%90–91, 106, 143, 205
   itxn.py3233789%139–140, 142, 156, 164–169, 197, 204, 226–227, 560, 579–597, 666, 670, 684, 693–706
   main.py5997088%128, 268, 272, 277–296, 301–320, 375, 399, 420, 438–439, 441, 449, 491, 578–579, 691, 723, 736–737, 785, 810, 847–849, 860, 925, 1003, 1016, 1057, 1122, 1125, 1133, 1136, 1144, 1175, 1201, 1210, 1334, 1351, 1394–1404
   storage.py83298%101, 154
src/puya/ir/destructure
   coalesce_locals.py951980%113, 122–123, 126–129, 132–141, 153–156
   parcopy.py73297%81, 117
src/puya/ir/optimize
   _call_graph.py32197%42
   _utils.py14286%17–19
   collapse_blocks.py94199%68
   compiled_reference.py81594%53, 85, 166–171
   control_op_simplification.py851088%35–36, 80–109
   inlining.py2321195%32–41, 45, 52, 393, 397, 401, 411, 415
   inner_txn.py30293%36–37
   intrinsic_simplification.py6032895%462, 474, 502, 513–514, 582–583, 607, 676, 820, 872, 874, 884, 924, 947, 961, 986, 992, 994, 996, 1001, 1003, 1005, 1007, 1009, 1061–1062, 1069
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
src/puya/mir
   aligned_writer.py63297%21, 61
   builder.py1591392%77–79, 169, 271–272, 301, 304, 307, 310, 313, 316, 319
   models.py499898%121, 174, 177, 225, 269, 335, 352, 408
   output.py54198%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.py160299%107, 139
   models.py447299%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.py127497%128, 162, 230, 251
   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%65–66, 84–88, 92, 205, 212–213, 233
   compile.py1502285%59–68, 82, 164–165, 176, 183–184, 201–211, 221–223, 228, 244
   models.py99496%65, 77–79
   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%32, 91–92, 102, 104, 119–120, 187
   arc4_utils.py2814684%46, 49–50, 52, 57–64, 81–85, 101, 103, 106–107, 130, 173–175, 184, 189, 194–195, 221, 225, 237, 244, 246, 260–261, 264–268, 273–274, 280–283, 291, 299, 316, 328, 336, 438, 443, 462
   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.py3223390%128, 180, 195–199, 239, 241, 245, 249, 257, 269, 271, 291, 347, 350, 362, 370, 373, 376, 379, 382, 385, 388, 391, 394, 397, 457–461, 510–514, 608–612, 684, 707
   intrinsic_models.py49198%55
   main.py36197%30
   module.py4315986%124, 146, 152–156, 171–172, 179, 188–189, 197–201, 223, 252, 272–273, 284, 306–309, 319–321, 327, 344–347, 360, 394, 401, 423–424, 447–452, 506–507, 535, 546, 549, 555, 561, 571, 577, 580, 592, 595, 618, 638, 643, 647, 656–660, 752, 760, 762
   pytypes.py5946090%87, 97–99, 104, 111, 116–118, 122–124, 151–152, 192, 210–216, 239, 259, 301, 339–341, 370, 436, 445, 464, 484, 506–507, 648–650, 664–665, 732–733, 837, 848–849, 898–899, 904, 957–958, 981–982, 1133–1134, 1158, 1186, 1222–1224, 1264, 1274–1275
   subroutine.py6025291%139, 258, 264, 322–325, 331, 382, 387, 390–396, 487, 507, 662, 664–665, 683, 685, 695–696, 705–706, 710, 731, 793, 800, 820–821, 907, 933–934, 951, 967, 991, 999, 1010, 1036–1039, 1145–1146, 1166, 1176, 1178, 1187, 1205, 1213, 1227, 1230, 1233, 1236, 1239
   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.py1442980%43, 72, 91, 120, 137, 151, 155, 159–165, 175–189, 194
   _type_registry.py40490%251–252, 264–265
   utils.py47394%28–30, 100
   array.py26965%23, 28–33, 43, 47
   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
   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, 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.py3171994%118, 124, 145, 215, 228–229, 310, 322, 380, 403, 434, 453–454, 513, 549, 623, 708–709, 726
   address.py73297%57, 116
   bool.py58395%42, 87–88
   dynamic_array.py120992%56, 123–124, 145, 221, 241–242, 245–248
   dynamic_bytes.py68396%99–101
   emit.py34197%36
   static_array.py62198%44
   string.py98793%54–55, 103, 124, 129–132
   struct.py49198%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
TOTAL23513176492% 

Tests Skipped Failures Errors Time
839 2 💤 0 ❌ 0 🔥 4m 33s ⏱️

@achidlow
Copy link
Contributor

achidlow commented Jan 10, 2025

The fix itself looks good but the stubs version will need to be bumped also. Take a look at the Versioning section of the stubs README.md.

The question is whether we treat this as a breaking change or as a bug-fix.

Technically, since there could exist contracts which will fail to type-check and thus compile after this change, it is a breaking change.
However, the stubs were actually incorrect before this fix, so from that lens, it's a bug-fix.
Additionally, this is a v11 op code, so not on main-net yet, so from that perspective there can't be any production contracts that will break with this change.

@boblat
Copy link
Contributor Author

boblat commented Jan 13, 2025

The stubs version has been bumped from 2.4.0 to 2.4.1 as the change is considered to be a bug fix and not a breaking change.

@boblat boblat merged commit 8cb9ffc into main Jan 13, 2025
4 checks passed
@boblat boblat deleted the fix/voter-params branch January 13, 2025 02:09
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