Skip to content

AppFactory failed to replace an app that is created by a bare method call #174

@PatrickDinh

Description

@PatrickDinh

Subject of the issue

AppFactory failed to replace an app that is created by a bare method call

Your environment

timestamp: 2025-06-10T11:16:45+00:00
AlgoKit: 2.5.2 (latest: 2.7.0)
AlgoKit Python: 3.12.6 (main, Feb 28 2025, 22:26:59) [GCC 11.4.0] 
OS: Linux-6.6.87.1-microsoft-standard-WSL2-x86_64-with-glibc2.35
docker: 27.0.3
docker compose: 2.28.1-desktop.1
git: 2.34.1
python: 3.12.6
python3: 3.12.6
pipx: 1.7.1
poetry: 2.1.3
node: 22.14.0
npm: 10.9.2

Steps to reproduce

When I use AppFactory to replace the below contract. This contract supports an ABI method to delete the app and can be created with an bare method call.

class DeleteAbiWithInner(ARC4Contract):
    def _init_(self) -> None:
        self.greeting = TemplateVar[String]("GREETING")

    @arc4.abimethod(allow_actions=["DeleteApplication"])
    def delete(self, app_id: UInt64) -> None:
        arc4.abi_call("no_op", app_id=app_id)
        assert TemplateVar[bool]("DELETABLE")

To replace this contract, I call the factory as below

replace_deploy_result = factory.deploy(
            compilation_params={
                "deploy_time_params": 
{
                    "GREETING": "Hello!",
                }
,
                "deletable": True,
            },
            on_update=OnUpdate.ReplaceApp,
            create_params=AppClientBareCallCreateParams(max_fee=micro_algo(200_000)),
            delete_params=AppClientMethodCallParams(method="delete", args=[inner_app_id], max_fee=micro_algo(200_000)),
            send_params=
{"populate_app_call_resources": True, "cover_app_call_inner_transaction_fees": True}
,
        )

Expected behaviour

The app should be replaced

Actual behaviour

The code failed because

        elif cls is SendAppTransactionResult:
>           base_params["abi_return"] = result.returns[index] if result.returns else None  # type: ignore[assignment]
E           IndexError: list index out of range

Technical details

The reason is that in the app-deployer, this logic

        result = composer.send()
        create_result = SendAppCreateTransactionResult[ABIReturn].from_composer_result(result, create_txn_index)
        delete_result = SendAppTransactionResult[ABIReturn].from_composer_result(result, delete_txn_index)

assumes both create and delete are ABI method calls. Instead of this, it should only attempt to resolve ABIReturn for ABI method call.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions