Skip to content

Commit 1230660

Browse files
authored
Fix: cost_view (#472)
Problem: the cost view uses Mb instead of MiB and is configured for 3 Aleph/MB instead of 1 Aleph for 3MB.
1 parent a307bc1 commit 1230660

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

deployment/migrations/versions/0018_7bcb8e5fe186_fix_vm_cost_view.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def upgrade() -> None:
9393
JOIN files f ON file_pins.file_hash::text = f.hash::text
9494
WHERE file_pins.owner IS NOT NULL
9595
GROUP BY file_pins.owner) storage ON vm_prices.owner::text = storage.owner::text,
96-
LATERAL ( SELECT 3::numeric * storage.storage_size / 1048576::numeric AS total_storage_cost) sc,
96+
LATERAL ( SELECT storage.storage_size / (3 * 1024 * 1024) AS total_storage_cost) sc,
9797
LATERAL ( SELECT COALESCE(vm_prices.total_vm_cost, 0::double precision) +
9898
COALESCE(sc.total_storage_cost, 0::numeric)::double precision AS total_cost) tc
9999
"""

tests/api/test_balance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ async def test_get_balance(
2727
assert response.status == 200, await response.text()
2828
data = await response.json()
2929
assert data["balance"] == user_balance.balance
30-
assert data["locked_amount"] == 2726
30+
assert data["locked_amount"] == 2720.6666666666665

tests/db/test_cost.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,4 @@ def test_get_total_cost_for_address(
207207
total_cost: Decimal = get_total_cost_for_address(
208208
session=session, address=fixture_instance_message.sender
209209
)
210-
assert total_cost == Decimal(6)
210+
assert total_cost == Decimal(0.66666666666666662965923251249478198587894439697265625)

0 commit comments

Comments
 (0)