[CL-MEGA-W] fix(token): floor burn-deposit кредита до целых центов (BE-DEFI-04) #932
Closed
andrei
wants to merge 0 commits from
feature/claude-mega-audit-w-20260629 into master
pull from: feature/claude-mega-audit-w-20260629
merge into: europa-tech-srl:master
europa-tech-srl:master
europa-tech-srl:agent/devops/pix-15311
europa-tech-srl:agent/devops/pix-15306
europa-tech-srl:agent/cto/pix-15177
europa-tech-srl:main
europa-tech-srl:agent-fullstack/pix-8664
europa-tech-srl:feature/claude-cl1176-payout-e2e
europa-tech-srl:feature/claude-cl1176-guard-dbname-fix
europa-tech-srl:feature/claude-cl1176-e2e-in-ci
europa-tech-srl:feature/claude-cl1176-conditional-prisma-mock
europa-tech-srl:feature/claude-cl1176-exchange-buyback-e2e
europa-tech-srl:agent/devops/pix-14678
europa-tech-srl:feature/claude-cl1176-webhook-distribution-e2e
europa-tech-srl:feature/claude-cl1176-type-honesty
europa-tech-srl:feature/claude-cl1176-cancel-expire-e2e
europa-tech-srl:fix/sentry-lenis-empty-touch
europa-tech-srl:agent/fullstack/pix-13735-news-title-scope
europa-tech-srl:agent/fullstack/pix-13735-newsai-fixtures
europa-tech-srl:agent/fullstack/pix-13735-news-safelist
europa-tech-srl:fix/low-audit-20260719
europa-tech-srl:chore/monthly-deps-20260719
europa-tech-srl:agent/compliance/pix-13735
europa-tech-srl:agent/fullstack/pix-14259
europa-tech-srl:fix/blog-properties-links-20260718
europa-tech-srl:fix/news-sitemap-public-parity-20260718
europa-tech-srl:fix/nowpayments-probe-alert-hygiene-20260718
europa-tech-srl:agent/sentry/pix-14176
europa-tech-srl:agent/cto/pix-14168
europa-tech-srl:agent/fullstack/pix-14161
europa-tech-srl:agent/cto/pix-14162
europa-tech-srl:codex/react-doctor-suppression-20260717
europa-tech-srl:agent/fullstack/pix-14153
europa-tech-srl:agent/cto/pix-14151
europa-tech-srl:agent/fullstack/pix-14150
europa-tech-srl:agent/fullstack/pix-14132
europa-tech-srl:agent/fullstack/pix-14144
europa-tech-srl:deploy/pix-14136
europa-tech-srl:agent/fullstack/pix-14136
europa-tech-srl:codex/docs-audit-status-20260717
europa-tech-srl:codex/fix-ma0710-m2-lending-confirmations-20260717
europa-tech-srl:codex/fix-ma0710-m1-lazy-hydrate-accessibility-20260717
europa-tech-srl:codex/fix-ma0710-h5-timelock-bootstrap-contract-20260717
europa-tech-srl:codex/fix-ma0710-h4-eurt-timeout-reconciliation-20260717
europa-tech-srl:codex/fix-ma0710-h3-purchase-accounting-20260717
europa-tech-srl:codex/fix-ma0710-h2-stripe-post-actions-20260716
europa-tech-srl:agent/fullstack/pix-14122
europa-tech-srl:agent/fullstack/pix-14118
europa-tech-srl:agent/cto/pix-14065
europa-tech-srl:codex/fix-hero-fallback-copy-20260716
europa-tech-srl:agent/fullstack/pix-14030
europa-tech-srl:codex/fix-react-doctor-lazyhydrate-20260716
europa-tech-srl:agent/fullstack/pix-13809
europa-tech-srl:codex/stripe-payment-create-atomic-20260714
europa-tech-srl:agent/devops/pix-13984
europa-tech-srl:agent/cto/pix-13978
europa-tech-srl:agent/compliance/pix-13968
europa-tech-srl:agent/fullstack/pix-13935
europa-tech-srl:agent/fullstack/pix-13886
europa-tech-srl:agent/fullstack/pix-13744
europa-tech-srl:fix/pix-13874-zod-record-schema
europa-tech-srl:agent/fullstack/pix-13760-v2
europa-tech-srl:fix/pix-13839-compliance-locale
europa-tech-srl:agent/fullstack/pix-13846
europa-tech-srl:agent/fullstack/pix-13760
europa-tech-srl:fix/pix-13844-cabinet-meta
europa-tech-srl:agent/devops/pix-13833-pr1074
europa-tech-srl:fix/PIX-13775-rooms-share-price
europa-tech-srl:fix/pix-13738-compliance-copy
europa-tech-srl:agent/cto/pix-13726
europa-tech-srl:codex/institutional-bulk-lock-order-20260711
europa-tech-srl:codex/payment-lock-legacy-audit-20260711
europa-tech-srl:codex/payment-lock-order-20260711
europa-tech-srl:codex/idempotency-legacy-compat-20260710
europa-tech-srl:codex/idempotency-fingerprint-conflict-20260710
europa-tech-srl:codex/stripe-fallback-idempotency-20260710
europa-tech-srl:codex/payout-serialization-retry-20260710
europa-tech-srl:codex/tg-balance-idempotency-20260710
europa-tech-srl:codex/lending-repay-race-20260710
europa-tech-srl:feature/claude-vault-withdraw-failclosed-20260710
europa-tech-srl:feature/claude-mega-audit-20260710-5
europa-tech-srl:feature/claude-mega-audit-20260710-4
europa-tech-srl:feature/claude-mega-audit-20260710-3
europa-tech-srl:feature/claude-mega-audit-20260710-2
europa-tech-srl:fix/qa-password-reset-email
europa-tech-srl:feature/claude-api-eaddrinuse-retry
No reviewers
No labels
ci-failing
duplicate
needs-rebase
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
europa-tech-srl/europatech!932
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/claude-mega-audit-w-20260629"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Что сделано
api/src/services/token.query.service.ts,depositFromChain): кредит on-chain EURT-burn считался черезroundEur(round-half-up). Заменён наweiToEurDecimal(amountWei)— floor, точная bigint-арифметика (без float, без half-up), parity с уже закалённымvault/operations.ts(BE-DEFI-01). Sub-cent-only burns floor → 0.00 → отклоняются guard'омamountEur <= 0.50000→49999.99, fractional 1.999 EURT2→1.99).docs/vault/reviews/mega-audit-w-2026-06-29.md+ обновлёнdocs/vault/AUDIT-STATUS.md.Зачем
roundEurокруглял вверх на половине → burn 0.005 EURT (5e15 wei) кредитил 0.01 EUR, майня до ~0.005 EUR/tx небеспеченного off-chaincoinBalance. Нарушение инварианта MiCA EMT 1:1 backing («EUR-кредит ≤ on-chain сожжённое»). Attacker-tunable, систематично (уникальный txHash обходит@unique); capается <0.005 EUR/tx + требует жечь реальный EURT + газ → LOW.План тестирования
npx vitest run src/services/__tests__/token.query.service.test.ts→ 54/54 PASSnpx eslint ... --max-warnings 0→ 0 ·npx tsc --noEmit→ 0Где могу ошибаться
Number(weiToEurDecimal(...)): 2-decimal строка → точно до cap 50k (cents ≤ 2^53; проверено тестом 49999.99).8227df4e7e19756dee2e⚠️ Конфликт с master — ветку нужно перебазировать вручную. Изменения в master перекрыли затронутые строки.
d254ad40f46e19134f7b6e19134f7b49a1f6e9afPull request closed