Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unused ternary param #1217

Closed
wants to merge 1 commit into from
Closed

Unused ternary param #1217

wants to merge 1 commit into from

Conversation

0xalpharush
Copy link
Contributor

Fixes #1153
I'm not sure if there's a better way to address unused tuple members, but this works.

slither 0xed3a954c0adfc8e3f85d92729c051ff320648e30 --print slithir

Expression: guni.token1() == DAI
                IRs:
                        TMP_121(address) = HIGH_LEVEL_CALL, dest:guni(IGUNIToken), function:token1, arguments:[]  
                        TMP_122(bool) = TMP_121 == DAI
                        CONDITION TMP_122
                Expression: (None,amount) = resolver.getRebalanceParams(address(guni),bal0,bal0,((((sqrtPriceX96 * sqrtPriceX96) >> 96) * 1e18) >> 96) * otherTokenTo18Conv)
                IRs:
                        TMP_123 = CONVERT guni to address
                        TMP_124(uint256) = sqrtPriceX96 * sqrtPriceX96
                        TMP_125(uint256) = TMP_124 >> 96
                        TMP_126(uint256) = TMP_125 * 1000000000000000000
                        TMP_127(uint256) = TMP_126 >> 96
                        TMP_128(uint256) = TMP_127 * otherTokenTo18Conv
                        TUPLE_4(bool,uint256) = HIGH_LEVEL_CALL, dest:resolver(IGUNIResolver), function:getRebalanceParams, arguments:['TMP_123', 'bal0', 'bal0', 'TMP_128']  
                        amount(uint256)= UNPACK TUPLE_4 index: 1 
                Expression: (None,amount) = resolver.getRebalanceParams(address(guni),0,0,((((sqrtPriceX96 * sqrtPriceX96) >> 96) * 1e18) >> 96) * otherTokenTo18Conv)
                IRs:
                        TMP_129 = CONVERT guni to address
                        TMP_130(uint256) = sqrtPriceX96 * sqrtPriceX96
                        TMP_131(uint256) = TMP_130 >> 96
                        TMP_132(uint256) = TMP_131 * 1000000000000000000
                        TMP_133(uint256) = TMP_132 >> 96
                        TMP_134(uint256) = TMP_133 * otherTokenTo18Conv
                        TUPLE_5(bool,uint256) = HIGH_LEVEL_CALL, dest:resolver(IGUNIResolver), function:getRebalanceParams, arguments:['TMP_129', '0', '0', 'TMP_134']  
                        amount(uint256)= UNPACK TUPLE_5 index: 1 

@0xalpharush 0xalpharush changed the base branch from master to dev May 26, 2022 01:09
@0xalpharush 0xalpharush force-pushed the unused-ternary-param branch from e298b85 to 878ea15 Compare May 26, 2022 01:15
@0xalpharush 0xalpharush mentioned this pull request Jun 22, 2022
17 tasks
@0xalpharush
Copy link
Contributor Author

0xalpharush commented Jun 27, 2022

If this fix is not acceptable, it would be nice for the changes proposed in #542 to be fleshed out i.e. providing further guidance on what would change/ how the IR would look afterward. Making that change may fix a lot of the corner cases around tuples that we have open issues for.

@0xalpharush 0xalpharush marked this pull request as ready for review July 27, 2022 13:29
# case of unused
# (, var) = func()
if not expression:
return

Choose a reason for hiding this comment

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

Wouldn't that mean Expression can be None, which means type of expression should be Optional[Expression] ?

@0xalpharush 0xalpharush closed this Dec 3, 2022
@0xalpharush 0xalpharush mentioned this pull request Dec 12, 2022
@0xalpharush 0xalpharush deleted the unused-ternary-param branch February 24, 2023 05:27
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.

[Bug-Candidate]: Ternary operation not handled None(<class 'NoneType'>)
2 participants