Skip to content

refactor: make algopy.Contract an alias of algopy.arc4.ARC4Contract#598

Open
boblat wants to merge 10 commits intomainfrom
refactor/arc4-contract
Open

refactor: make algopy.Contract an alias of algopy.arc4.ARC4Contract#598
boblat wants to merge 10 commits intomainfrom
refactor/arc4-contract

Conversation

@boblat
Copy link
Contributor

@boblat boblat commented Nov 5, 2025

Proposed Changes

  • renamed algopy.Contract to be algopy.BaseContract
  • added algopy.Contract as an alias of algopy.arc4.ARC4Contract

@engineering-ci
Copy link

engineering-ci bot commented Nov 5, 2025

Name Status O0 bytes O1 bytes O2 bytes O0 ops O1 ops O2 ops

@engineering-ci
Copy link

engineering-ci bot commented Nov 5, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/puya
   __main__.py36489%45, 71–72, 78
   arc32.py891583%74, 96–97, 107–132
   arc56.py81495%285–287, 297
   artifact_sorter.py57296%32, 89
   compile.py210797%98–99, 173–174, 182, 343, 401
   context.py52198%39
   errors.py41198%59
   log.py2695679%83, 93–94, 99–106, 121–129, 151, 187–188, 231–233, 236–238, 240, 253–269, 298, 304, 314–319, 322, 390–391, 448–450, 453–455, 484
   main.py42783%31, 52–57
   parse.py83396%31, 40, 50
   program_refs.py28293%45, 56
   utils.py2261494%37, 196, 201–204, 222–224, 258, 265, 288, 290, 309, 348
src/puya/awst
   function_traverser.py336399%66, 76, 420
   nodes.py13196395%113, 117–120, 160, 164–167, 462, 527, 700, 769, 795, 853, 873, 896, 935, 980, 1009–1010, 1032, 1036, 1105, 1126, 1157–1158, 1185, 1188–1190, 1208, 1242, 1245, 1283, 1288, 1415, 1441, 1474, 1506, 1532, 1537, 1801, 1945, 1964, 2030, 2068, 2077, 2296, 2345, 2363, 2367, 2485, 2634, 2639, 2644, 2652, 2657, 2662, 2699–2700, 2710
   serialize.py761284%21–25, 49, 94–100, 117, 121
   to_code_visitor.py4911198%149, 260, 297, 343, 380, 495–498, 688, 716, 720
   txn_fields.py101199%53
   wtypes.py381898%233, 373, 386, 397, 402–403, 444, 473
src/puya/awst/validation
   base_invoker.py47491%55, 62, 72–76
   immutable.py33294%29, 37
   inner_transactions.py196199%168
   labels.py31487%26–27, 38–41
src/puya/ir
   _arc4_default_args.py1101586%63–64, 79, 92, 94, 96, 98, 100, 102, 108, 115, 136–137, 232, 239
   contract_metadata.py229797%56, 206–210, 308–314
   arc4_router.py259598%169, 233, 335, 353, 519
   arc4_types.py1621988%26–27, 46, 50, 54, 58, 62, 70, 96, 103, 110, 117, 129, 135, 139, 151, 211, 215, 230
   avm_ops.py324199%46
   avm_ops_models.py37295%15, 23
   context.py113695%79, 91, 98, 101, 103, 112
   encodings.py204598%230, 233, 239, 294, 298
   main.py2241494%117, 126–132, 142–148, 174, 342–343, 355, 363
   models.py8332897%211, 218, 413, 435, 459, 490, 556, 574, 578, 694–695, 819–820, 825, 831–835, 905, 935, 991, 1052, 1097, 1182, 1226, 1241, 1253, 1280, 1348–1349
   mutating_register_context.py87397%48–49, 51
   op_utils.py163299%212–219
   ssa.py151299%52–53
   types.py3603889%57, 60, 63, 76, 81–83, 87–89, 129, 143, 182, 249, 252, 263, 272, 276, 279, 297, 303, 401–405, 516–517, 521, 524, 533, 543–544, 571, 580, 583, 586, 596–597, 614
   visitor.py195597%190, 299, 320, 326, 378
   visitor_mutator.py237797%89–92, 94, 209, 250
src/puya/ir/builder
   _utils.py89594%61, 63, 173, 177, 185
   assignment.py119794%63, 79, 190, 192–193, 220, 265
   blocks.py134795%55, 92–96, 158, 166, 231
   bytes.py701480%17–49, 138
   callsub.py1091091%35–36, 57–60, 73, 118–122
   dynamic_array.py160696%81–82, 135–136, 172, 217
   encoding_validation.py71199%121
   flow_control.py104298%53, 57
   iteration.py239598%103–104, 120, 152, 230
   itxn.py7175592%168–169, 171, 185, 223–224, 248–249, 362–365, 666, 782, 792, 835, 937–955, 986, 1075, 1099, 1114, 1121, 1125, 1161, 1173, 1177, 1191, 1203, 1209, 1215, 1219, 1223, 1243, 1307, 1317, 1321, 1325, 1341, 1353, 1381, 1387, 1391, 1395, 1399, 1417, 1428, 1439
   main.py7455093%172, 297, 309–328, 338–340, 407, 431, 455, 479–480, 504, 530, 572, 577–578, 589–590, 681, 754, 779–780, 812, 847, 928, 993, 1092–1096, 1179, 1247, 1250, 1403, 1429, 1457–1458, 1609, 1629, 1684–1686
   sequence.py133695%186–191, 212–215, 230–231
   storage.py208598%117, 335–339, 351
src/puya/ir/builder/aggregates
   arc4_codecs.py3192592%58, 94, 147–148, 203, 271, 322, 335, 353, 396, 414, 430–432, 446–448, 522, 539, 541, 558–559, 574–575, 604
   main.py108397%122, 148, 162
   sequence.py156199%144
src/puya/ir/destructure
   coalesce_locals.py1442185%198, 209, 213–224, 230–231, 246–251
   critical_edges.py32197%24
   parcopy.py72199%80
src/puya/ir/optimize
   _call_graph.py32197%42
   _utils.py54198%57
   add_box_extract_replace.py279598%235–236, 240, 276, 516
   assignments.py114496%48, 168, 184–185
   compiled_reference.py101595%56, 87, 168–173
   constant_propagation.py71199%90
   control_op_simplification.py77199%170
   inlining.py2441195%34–43, 47, 54, 417, 421, 425, 435, 439
   inner_txn.py36294%49–50
   intrinsic_simplification.py8094195%268, 514, 545, 556–557, 625–626, 647, 752, 833, 864–893, 1244–1246, 1325, 1351, 1353, 1426, 1440, 1471, 1477, 1479, 1481, 1486, 1488, 1490, 1568
   repeated_loads_elimination.py155299%156, 173
src/puya/ir/validation
   _base.py30197%28
   compile_reference_validator.py20290%24, 30
   min_avm_version_validator.py15473%16–20
   op_run_mode_validator.py19195%29
   slot_reservation.py18194%20
src/puya/mir
   aligned_writer.py63297%21, 61
   builder.py2112588%129–131, 159–161, 180, 183, 186, 189, 192, 195, 198, 201, 204, 260, 267, 407, 410, 413, 416, 419, 422, 425, 428
   main.py77199%37
   models.py499499%120, 255, 321, 727
   output.py61198%20
   visitor.py86199%175
src/puya/mir/stack_allocation
   f_stack.py95397%58–67
   l_stack.py117199%71
   peephole.py41393%38, 40, 43
   x_stack.py203399%33, 331–335
src/puya/teal
   builder.py200299%74, 114
   models.py470199%461
   stack_manipulations.py31197%42
src/puya/teal/optimize
   constant_block.py93496%43, 126, 163, 180
   constant_stack_shuffling.py94990%54–55, 77–78, 94–100
   main.py175498%145, 204, 231–232
   peephole.py137299%170, 295
   repeated_rotations.py51590%16, 52–55
   repeated_rotations_search.py90693%35, 41–42, 58, 68–69
src/puya/ussemble
   assemble.py201399%253, 273, 317
   models.py26196%16
   op_spec_models.py22195%20
src/puyapy
   __main__.py44686%161, 166–171, 212, 221
   client_gen.py1101190%59–60, 78–82, 86, 200, 207–208, 228
   compile.py911386%46, 62, 73, 77, 137–138, 146–149, 158–161
   find_sources.py97496%25, 46, 105, 124
   interpreter_data.py18289%32–33
   models.py103199%76
   parse.py2703587%115–120, 179, 189, 197, 209–210, 226–228, 239–244, 252–257, 261, 436, 440–441, 473–476, 480–481, 494–496, 501
   template.py32875%10–11, 18–19, 27–28, 34, 37
src/puyapy/awst_build
   arc4_client.py1012674%45–49, 57, 69, 75, 79, 96, 108, 111–112, 118, 121, 124, 130, 133, 136–141, 144, 147, 150, 153, 156, 159, 162, 165
   arc4_client_gen.py134894%30, 89–90, 100, 102, 117–118, 188
   arc4_decorators.py2475179%45, 90–91, 98–100, 111–115, 123–125, 146–148, 151, 180, 188, 202, 204, 237, 250–251, 265–266, 280–281, 288, 291–297, 302, 309, 330, 338, 342, 352–356, 372, 374, 377–378, 387, 390–391, 393
   arc4_utils.py115497%162, 169, 183, 211
   base_mypy_visitor.py1552882%59, 69, 92–100, 167–173, 191, 199–212, 226, 228, 230, 281, 285, 289, 291, 298–318
   context.py2706177%57, 60, 70–71, 89–90, 130, 177, 180–181, 183, 235, 240, 246–250, 257, 266, 268, 271–273, 275, 282, 284, 294–307, 319, 333, 336–348, 366, 384, 409, 418–424
   contract.py3283191%123, 175, 204–208, 248, 250, 254, 258, 266, 278, 280, 351, 354, 366, 374, 377, 380, 383, 386, 389, 392, 395, 398, 491–495, 544–548, 622–626, 684, 710
   intrinsic_factory.py26292%67–69
   intrinsic_models.py49198%55
   main.py42198%41
   module.py4286186%139, 159, 165–182, 199–200, 207, 216–217, 224–228, 250, 279, 299–300, 311, 333–336, 346–348, 354, 371–374, 387, 421, 450–451, 472–473, 529–530, 556, 567, 570, 576, 589, 595, 601, 621, 641, 646, 650, 659–663, 755, 763, 765
   pytypes.py6696790%87, 97–99, 104, 111, 116–118, 122–124, 151–152, 191, 205–211, 234, 258, 300, 338–340, 369, 436, 445, 464, 482, 486, 601–602, 686–688, 702–703, 770–771, 875, 886–887, 925–926, 973–974, 979, 1048–1049, 1072–1073, 1246–1247, 1282–1283, 1303–1304, 1332, 1360, 1396–1398, 1438, 1448–1449
   subroutine.py6404194%184–185, 282, 308–309, 327, 344, 369, 377, 388, 421–424, 537–538, 593, 726, 737, 739, 748, 766, 769, 801, 807, 868, 876–879, 885, 936, 941, 944–950, 1041, 1061, 1217, 1257, 1283, 1299–1300, 1309
   utils.py2032886%30, 47–51, 79–80, 102, 141–142, 144, 188–189, 240, 248, 253, 266–270, 275–278, 285, 329–332
src/puyapy/awst_build/eb
   _base.py1271588%52, 57–59, 64, 71, 80–82, 143, 184, 189, 199, 210, 224–226
   _bytes_backed.py48296%30–31
   _expect.py1221786%25, 36, 85–88, 107, 160–161, 219–222, 232–235
   _literals.py1563478%44, 65, 77, 96, 125, 142, 156–160, 164, 168–174, 184–198, 203
   _type_registry.py41393%277–278, 291
   utils.py62395%36–38, 108
   arc4_client.py30390%36, 42, 63
   biguint.py105694%57, 101, 142, 158–159, 161
   binary_bool_op.py105397%153, 161, 171
   bool.py55984%38–42, 58, 69, 82, 96
   bytes.py1731691%102–103, 130–131, 136–137, 143–144, 147, 155, 233, 271, 292–293, 313–314
   compiled.py70987%85–89, 126–130, 153
   conditional_literal.py1333474%97, 101, 161, 165–168, 177–179, 202–205, 214, 218, 222–225, 240–252, 261–262, 273–276
   contracts.py77890%55, 61, 63, 73, 99, 109, 111, 116
   dict.py27581%24, 32–34, 38
   ensure_budget.py31197%46
   fixed_bytes.py2741196%110–111, 142, 250, 335, 412, 464, 516, 522, 586–587
   interface.py91298%317–319
   intrinsics.py120893%55–56, 70, 91, 98, 111, 118, 210
   log.py43491%45–46, 51, 60
   logicsig.py15193%25
   none.py27485%17, 27–28, 37
   size_of.py25388%31–33
   string.py1441391%71, 115–116, 135, 140, 183, 190, 194, 206, 280–282, 302
   subroutine.py801680%46, 50–53, 68, 71–78, 93, 101–102, 104–107, 112
   template_variables.py37295%29, 57
   tuple.py3381296%87, 94, 135, 154, 257, 350–351, 470, 546, 557–558, 621
   uint64.py108595%57, 118–119, 167–168
   uint64_enums.py40295%40, 45
   unsigned_builtins.py1552286%73, 80, 104, 128, 132, 136, 140, 148, 152, 156, 160, 164, 174, 178, 184, 195, 201, 207, 246, 278, 290, 302
src/puyapy/awst_build/eb/arc4
   _base.py105595%183–186, 197, 227–228
   _utils.py123596%44, 103, 134, 197, 201
   abi_call.py3291895%172, 185–186, 268, 279, 359, 383, 416, 435–436, 455, 490, 534, 570, 637, 722–723, 740
   address.py73297%56, 115
   bool.py60198%42
   dynamic_array.py122993%109–110, 128, 152, 206, 221–222, 225–228
   dynamic_bytes.py68396%98–100
   emit.py53296%40–43
   string.py100793%54–55, 105, 126, 131–134
   struct.py82199%54
   tuple.py921287%51–53, 91–94, 97–98, 137–140, 145, 170
   ufixed.py74297%51, 110
   uint.py96298%101–106
src/puyapy/awst_build/eb/reference_types
   account.py82199%179
   application.py45198%39
   asset.py65198%47
src/puyapy/awst_build/eb/storage
   _storage.py1082081%58, 66, 70, 74, 78, 82, 86, 90, 94, 104, 108, 112, 116, 122, 133, 139, 145, 157–159
   _value_proxy.py55395%42, 50, 54
   box.py113199%174
   box_map.py164299%199, 265
   box_ref.py1111785%76–80, 89–93, 103, 111, 127, 135, 148, 153–162
   global_state.py127695%103–104, 113–114, 163–164
   local_state.py1371192%98–99, 103, 150, 154, 158, 168, 172, 196, 253, 277
src/puyapy/awst_build/eb/transaction
   abi_call.py215996%116, 181, 187, 227, 277, 313, 337–338, 359
   base.py39295%22, 42
   inner.py54296%96–97
   inner_params.py88594%65, 77, 81, 169, 171
   itxn_args.py60198%72
src/puyapy/lsp
   __main__.py17170%1–44
   analyse.py26819129%58–70, 76–183, 186–197, 201–216, 226–246, 249, 252–254, 265–281, 288–332, 349–373, 381, 385–386, 395–399, 404–411, 434–449, 461, 465, 467, 473, 482–487, 491
   log.py44440%1–89
   server.py1338238%62–70, 74–79, 86–136, 153–155, 158–162, 165–172, 179–197, 200, 203–208, 218–220
src/puyapy/validation
   arc4_copy.py130298%35, 39
TOTAL30799202593% 

Tests Skipped Failures Errors Time
1384 3 💤 0 ❌ 0 🔥 10m 47s ⏱️

@boblat boblat force-pushed the refactor/arc4-contract branch from 798a867 to c279a3e Compare November 21, 2025 09:24
@boblat boblat marked this pull request as ready for review November 21, 2025 09:25
@boblat boblat force-pushed the refactor/arc4-contract branch from c279a3e to b67d56e Compare November 24, 2025 07:57
@boblat boblat force-pushed the refactor/arc4-contract branch from b67d56e to bb02d8c Compare January 16, 2026 06:08
@@ -51,15 +51,15 @@ Your contract is vulnerable to the fixed-length argument overflow if the followi
Example 1: Fixed-Length Argument Overflow

```py
from algopy import arc4, UInt64
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should change these security documents, especially since arc4.ARC4Contract is still valid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The changes have been reverted in security folder.

@daniel-makerx
Copy link
Contributor

⚠️ No changelog fragment detected

Should have a changelog for this

@daniel-makerx
Copy link
Contributor

We could also reduce the "noise" of this PR by only changing a few test cases sufficient to have coverage and correctness, as I'm pretty sure the existing contracts should work the same without any changes in the majority of cases?

@boblat boblat force-pushed the refactor/arc4-contract branch 5 times, most recently from 277813e to 1dc373d Compare January 23, 2026 06:38
@boblat boblat force-pushed the refactor/arc4-contract branch from 1dc373d to 3482adb Compare January 30, 2026 01:52
@engineering-ci
Copy link

engineering-ci bot commented Jan 30, 2026

Checking stubs for changes and corresponding version bump in origin/refactor/arc4-contract

Last puyapy release: v5.7.1
This branch stubs version: 4.0.0
Last released stubs version: 3.4.0
Main stubs version: 3.4.0

💡 Stub version change: 3.4.0 -> 4.0.0
💡 Stub files changed:

  • init.pyi
  • _aliases.pyi
  • _base_contract.pyi
  • _compiled.pyi
  • _native.pyi
  • arc4.pyi

✅ Stub version updated.
✅ Stub check passed!

@boblat boblat force-pushed the refactor/arc4-contract branch from 3482adb to 9c823e0 Compare February 2, 2026 04:25
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