Skip to content

Conversation

@Stevengre
Copy link
Contributor

Add a K rule to directly simplify the rent exemption threshold pattern (int)((float)PRODUCT * 2.0) to PRODUCT * 2, avoiding intermediate float thunks during symbolic execution.

Add a K rule to directly simplify the rent exemption threshold pattern
`(int)((float)PRODUCT * 2.0)` to `PRODUCT * 2`, avoiding intermediate
float thunks during symbolic execution.
@Stevengre Stevengre self-assigned this Dec 19, 2025
Comment on lines 545 to 548
thunk(#cast(Integer(PRODUCT:Int, 64, false), castKindIntToFloat, _TY1, _TY2)),
Float(0.20000000000000000e1, 64),
false)),
castKindFloatToInt, _TY3, _TY4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the TY s could be connected here? Would it usually be a round-trip cast? (I guess so because the Ints will typically all be u64 in this codebase)

Suggested change
thunk(#cast(Integer(PRODUCT:Int, 64, false), castKindIntToFloat, _TY1, _TY2)),
Float(0.20000000000000000e1, 64),
false)),
castKindFloatToInt, _TY3, _TY4)
thunk(#cast(Integer(PRODUCT:Int, 64, false), castKindIntToFloat, INT_TY, FLOAT_TY)),
Float(0.20000000000000000e1, 64),
false)),
castKindFloatToInt, FLOAT_TY, INT_TY)

FLOAT_TY should definitely be the same here. INT_TY could be different but I don't think it will be in practice

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can add it, but I don't think it's necessary. It's a specific rule for spl-token.

@Stevengre Stevengre merged commit f4bbb38 into feature/p-token Dec 19, 2025
1 check passed
@Stevengre Stevengre deleted the jh/spl/simplify-balance branch December 19, 2025 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants