Skip to content

[PR #27] SwapRoute.pool_fee sentinel 0 collides with valid fee tier — use Option<u32> #67

@obchain

Description

@obchain

PR: #27 (commit 4a9a6d3)
File: crates/charon-core/src/types.rs, lines 56-61

SwapRoute.pool_fee documented as "0 = not applicable." PancakeSwap V3 (correct BSC DEX) has a 100 bps fee tier. While 0 and 100 are distinguishable today, sentinel creates unenforced contract: zero-initialized struct or future Default derive silently produces pool_fee = 0, which executor may interpret as "no pool fee" rather than "100 bps pool."

Risk: Executor encodes wrong calldata for 100-bps pool routes, causing transaction revert.

Fix:

pub pool_fee: Option<u32>,
// None = fee-less route (e.g., Balancer); Some(500) = 0.05% PancakeSwap V3 pool.

Metadata

Metadata

Assignees

No one assigned

    Labels

    layer:rustRust crates (core / scanner / protocols / executor / cli)pr-reviewFindings from PR review processpriority:p1-coreCore MVP scope

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions