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

Some summaries for swap. #57

Merged
merged 2 commits into from
Oct 7, 2024
Merged

Some summaries for swap. #57

merged 2 commits into from
Oct 7, 2024

Conversation

mariaKt
Copy link
Contributor

@mariaKt mariaKt commented Oct 4, 2024

This PR includes some summaries for swap. They do not cover all of the function yet.

The steps are reduced by 878 (from 19933 to 19055).

// Bind to getReserves call
rule <k> bind ( _STORE , ListItem(amount0Out) ListItem(amount1Out) ListItem(to) , ListItem(uint256) ListItem(uint256) ListItem(address) , v(V1, uint256), v(V2, uint256), v(V3, address), .TypedVals, .List, .List) ~> require ( amount0Out > 0 || amount1Out > 0 , "UniswapV2: INSUFFICIENT_OUTPUT_AMOUNT" , .TypedVals ) ; uint112 [ ] memory reserves = getReserves ( .TypedVals ) ; Ss:Statements => getReserves ( .TypedVals ) ~> freezerVariableDeclarationStatementA ( uint112 [ ] memory reserves ) ~> Ss ...</k>
<summarize> true </summarize>
<env> .Map => .Map (amount0Out |-> var(size(S), uint256))
Copy link
Contributor

Choose a reason for hiding this comment

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

I usually do ENV => ENV... to be more generic even when it starts as .Map on the --depth .... Is using .Map instead the right way to do it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, there is no right or wrong, it is just unneeded generality here that potentially can let mistakes through, so why let it through?
To elaborate, I agree with being as generic as possible. But, not when that might lead to matching something that is wrong. In this case, a non empty environment would be a mistake. Since we are at the beginning of a function call, <env> should always be empty. We would not want to be able to match if this ever was, for some reason, not empty.

Copy link
Contributor Author

@mariaKt mariaKt Oct 4, 2024

Choose a reason for hiding this comment

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

There are cases when <env> is empty but would not always be, in all executions. In those cases, ENV => ENV ... is definitely right.
At least, that is how I am thinking about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense! Thanks for the clarification!

src/uniswap-summaries.md Show resolved Hide resolved
@mariaKt mariaKt marked this pull request as ready for review October 7, 2024 17:50
Copy link
Contributor

@Robertorosmaninho Robertorosmaninho left a comment

Choose a reason for hiding this comment

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

LGTM

@mariaKt mariaKt merged commit 315faf1 into main Oct 7, 2024
1 check passed
@mariaKt mariaKt deleted the swap-summary branch October 7, 2024 18:13
@mariaKt mariaKt mentioned this pull request Oct 9, 2024
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.

2 participants