Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/check-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,14 @@ jobs:

- name: Audit with pip-audit
run: |
# GHSA-4xh5-x5gv-qwph is safe to ignore since we are using a python version that is not affected
# can remove once pip has fix
# audit non dev dependencies, no exclusions
poetry export --without=dev > requirements.txt && poetry run pip-audit -r requirements.txt --ignore-vuln GHSA-4xh5-x5gv-qwph
poetry export --without=dev > requirements.txt && poetry run pip-audit -r requirements.txt

# audit all dependencies, with exclusions.
# If a vulnerability is found in a dev dependency without an available fix,
# it can be temporarily ignored by adding --ignore-vuln e.g.
# --ignore-vuln "GHSA-hcpj-qp55-gfph" # GitPython vulnerability, dev only dependency
poetry run pip-audit --ignore-vuln GHSA-4xh5-x5gv-qwph
poetry run pip-audit --ignore-vuln GHSA-4xh5-x5gv-qwph

- name: Check formatting with Ruff
run: |
Expand Down
16 changes: 8 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/algokit_utils/applications/app_deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ def deploy(self, deployment: AppDeployParams) -> AppDeployResult:

existing_approval = base64.b64encode(existing_app_record.approval_program).decode()
existing_clear = base64.b64encode(existing_app_record.clear_state_program).decode()
existing_extra_pages = calculate_extra_program_pages(
existing_app_record.approval_program, existing_app_record.clear_state_program
)
extra_pages = existing_app_record.extra_program_pages or 0

calculate_extra_program_pages(existing_app_record.approval_program, existing_app_record.clear_state_program)

new_approval = base64.b64encode(approval_program).decode()
new_clear = base64.b64encode(clear_program).decode()
Expand All @@ -335,7 +335,7 @@ def deploy(self, deployment: AppDeployParams) -> AppDeployResult:
< (deployment.create_params.schema.get("local_byte_slices", 0) if deployment.create_params.schema else 0)
or existing_app_record.global_byte_slices
< (deployment.create_params.schema.get("global_byte_slices", 0) if deployment.create_params.schema else 0)
or existing_extra_pages < new_extra_pages
or extra_pages < new_extra_pages
)

if is_schema_break:
Expand Down
32 changes: 31 additions & 1 deletion tests/applications/test_app_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def test_deploy_app_update(factory: AppFactory) -> None:
assert update_deploy_result.app.updated_round == confirmed_round


def test_deploy_app_update_detects_extra_pages_as_breaking_change(
def test_deploy_app_update_detects_extra_page_deficit_as_breaking_change(
algorand: AlgorandClient, funded_account: SigningAccount
) -> None:
small_app_spec = (Path(__file__).parent.parent / "artifacts" / "extra_pages_test" / "small.arc56.json").read_text()
Expand Down Expand Up @@ -271,6 +271,36 @@ def test_deploy_app_update_detects_extra_pages_as_breaking_change(
assert small_client.app_id != large_client.app_id


def test_deploy_app_update_detects_extra_page_surplus_as_non_breaking_change(
algorand: AlgorandClient, funded_account: SigningAccount
) -> None:
small_app_spec = (Path(__file__).parent.parent / "artifacts" / "extra_pages_test" / "small.arc56.json").read_text()
large_app_spec = (Path(__file__).parent.parent / "artifacts" / "extra_pages_test" / "large.arc56.json").read_text()
factory = algorand.client.get_app_factory(
app_spec=small_app_spec,
default_sender=funded_account.address,
)
small_client, create_deploy_result = factory.deploy(
compilation_params={
"updatable": True,
},
create_params=AppClientBareCallCreateParams(extra_program_pages=1),
)
assert create_deploy_result.operation_performed == OperationPerformed.Create
assert create_deploy_result.create_result

factory._app_spec = Arc56Contract.from_json(large_app_spec) # noqa: SLF001
large_client, update_deploy_result = factory.deploy(
compilation_params={
"updatable": True,
},
on_schema_break=OnSchemaBreak.AppendApp,
on_update=OnUpdate.UpdateApp,
)
assert update_deploy_result.operation_performed == OperationPerformed.Update
assert small_client.app_id == large_client.app_id


def test_deploy_app_update_abi(factory: AppFactory) -> None:
_, create_deploy_result = factory.deploy(
compilation_params={
Expand Down
Loading