0xMiden / 0xMiden/protocol

`verify_u256_to_native_amount_conversion` accepts amounts up to 2^128, but only ~2^123 are claimable

Đang mở
#3,084 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
agglayer
Ngôn ngữ chính
Rust
Star
132
Fork
167
Merge trung bình
1 ngày 23 giờ
Pull request đã merge (30 ngày)
110

Mô tả

> Tracking issue for the Cantina finding linked below; confirmed against the current `next` code.

The bridge-in CLAIM amount gate `verify_u256_to_native_amount_conversion` ([`asset_conversion.masm:385-387`](https://github.com/0xMiden/protocol/blob/next/crates/miden-agglayer/asm/agglayer/common/asset_conversion.masm#L385-L387)) only rejects amounts ≥ 2^128 (it asserts the upper 128 bits are zero), but `y ≤ FUNGIBLE_ASSET_MAX_AMOUNT` and `scale ≤ 18` cap the largest scalable value at ~2^122.79, so any amount in `[~2^123, 2^128)` passes the gate and then always panics deep in `verify_u128_to_native_amount_conversion` with a misleading `ERR_UNDERFLOW` instead of a clear "amount too large". Severity: low (informational / spec-fidelity) — structurally unreachable for any realistic token, no double-spend, just a confusing failure path.

Cantina finding: https://cantina.xyz/code/b4ccbfb3-665e-4169-837d-3c7b2f0be458/findings?finding=12

PR status: no open PR. Fix is a one-line gate tightening (additionally assert `x3 < 2^27`).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.