forked from bgd-labs/aave-token-v3
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from Certora/certora_squash_2
Certora Review CVL2
- Loading branch information
Showing
20 changed files
with
415 additions
and
458 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,7 @@ | ||
diff -ruN .gitignore .gitignore | ||
--- .gitignore 1970-01-01 02:00:00 | ||
+++ .gitignore 2023-03-29 13:05:55 | ||
--- .gitignore 1970-01-01 02:00:00.000000000 +0200 | ||
+++ .gitignore 2023-06-29 18:12:58.710152977 +0300 | ||
@@ -0,0 +1,2 @@ | ||
+* | ||
+!.gitignore | ||
\ No newline at end of file | ||
diff -ruN src/AaveTokenV3.sol src/AaveTokenV3.sol | ||
--- src/AaveTokenV3.sol 2023-03-29 13:12:02 | ||
+++ src/AaveTokenV3.sol 2023-03-29 13:07:15 | ||
@@ -215,7 +215,7 @@ | ||
fromBalanceAfter = fromUserState.balance - uint104(amount); | ||
} | ||
_balances[from].balance = fromBalanceAfter; | ||
- if (fromUserState.delegationState != DelegationState.NO_DELEGATION) { | ||
+ if (fromUserState.delegationState != uint8(DelegationState.NO_DELEGATION)) { | ||
_governancePowerTransferByType( | ||
fromUserState.balance, | ||
fromBalanceAfter, | ||
@@ -237,7 +237,7 @@ | ||
toUserState.balance = toBalanceBefore + uint104(amount); | ||
_balances[to] = toUserState; | ||
|
||
- if (toUserState.delegationState != DelegationState.NO_DELEGATION) { | ||
+ if (toUserState.delegationState != uint8(DelegationState.NO_DELEGATION)) { | ||
_governancePowerTransferByType( | ||
toBalanceBefore, | ||
toUserState.balance, | ||
@@ -293,7 +293,7 @@ | ||
: address(0); | ||
} | ||
return | ||
- userState.delegationState >= DelegationState.PROPOSITION_DELEGATED | ||
+ userState.delegationState >= uint8(DelegationState.PROPOSITION_DELEGATED) | ||
? _propositionDelegateeV2[delegator] | ||
: address(0); | ||
} | ||
@@ -330,16 +330,12 @@ | ||
) internal pure returns (DelegationAwareBalance memory) { | ||
if (willDelegate) { | ||
// Because GovernancePowerType starts from 0, we should add 1 first, then we apply bitwise OR | ||
- userState.delegationState = DelegationState( | ||
- uint8(userState.delegationState) | (uint8(delegationType) + 1) | ||
- ); | ||
+ userState.delegationState = userState.delegationState | (uint8(delegationType) + 1); | ||
} else { | ||
// First bitwise NEGATION, ie was 01, after XOR with 11 will be 10, | ||
// then bitwise AND, which means it will keep only another delegation type if it exists | ||
- userState.delegationState = DelegationState( | ||
- uint8(userState.delegationState) & | ||
- ((uint8(delegationType) + 1) ^ uint8(DelegationState.FULL_POWER_DELEGATED)) | ||
- ); | ||
+ userState.delegationState = userState.delegationState & | ||
+ ((uint8(delegationType) + 1) ^ uint8(DelegationState.FULL_POWER_DELEGATED)); | ||
} | ||
return userState; | ||
} | ||
diff -ruN src/BaseAaveToken.sol src/BaseAaveToken.sol | ||
--- src/BaseAaveToken.sol 2023-03-29 13:12:02 | ||
+++ src/BaseAaveToken.sol 2023-03-29 13:07:15 | ||
@@ -18,7 +18,7 @@ | ||
uint104 balance; | ||
uint72 delegatedPropositionBalance; | ||
uint72 delegatedVotingBalance; | ||
- DelegationState delegationState; | ||
+ uint8 delegationState; // refactored from enum | ||
} | ||
|
||
mapping(address => DelegationAwareBalance) internal _balances; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/AaveTokenV3HarnessCommunity.sol:AaveTokenV3Harness" | ||
], | ||
"optimistic_loop": true, | ||
"packages": [ | ||
"openzeppelin-contracts=lib/openzeppelin-contracts" | ||
], | ||
"cloud": "", | ||
"process": "emv", | ||
"solc": "solc8.13", | ||
"verify": "AaveTokenV3Harness:certora/specs/community.spec", | ||
"msg": "AaveTokenV3HarnessCommunity:community.spec " | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/AaveTokenV3Harness.sol:AaveTokenV3Harness" | ||
], | ||
"cloud": "", | ||
"optimistic_loop": true, | ||
"packages": [ | ||
"openzeppelin-contracts=lib/openzeppelin-contracts" | ||
], | ||
"process": "emv", | ||
"solc": "solc8.13", | ||
"verify": "AaveTokenV3Harness:certora/specs/delegate.spec", | ||
"msg": "AaveTokenV3Harness:delegate.spec " | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/AaveTokenV3Harness.sol:AaveTokenV3Harness" | ||
], | ||
"packages": [ | ||
"openzeppelin-contracts=lib/openzeppelin-contracts" | ||
], | ||
"cloud": "", | ||
"optimistic_loop": true, | ||
"process": "emv", | ||
"solc": "solc8.13", | ||
"verify": "AaveTokenV3Harness:certora/specs/erc20.spec", | ||
"msg": "AaveTokenV3:erc20.spec " | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"files": [ | ||
"certora/harness/AaveTokenV3HarnessStorage.sol:AaveTokenV3Harness" | ||
], | ||
"packages": [ | ||
"openzeppelin-contracts=lib/openzeppelin-contracts" | ||
], | ||
"cloud": "", | ||
"optimistic_loop": true, | ||
"process": "emv", | ||
"prover_args": [" -smt_bitVectorTheory true"], | ||
"solc": "solc8.13", | ||
"verify": "AaveTokenV3Harness:certora/specs/general.spec", | ||
"msg": "AaveTokenV3:general.spec " | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.