From 6aac56d866fc18c967333d0ee89223bd49330688 Mon Sep 17 00:00:00 2001 From: Domen Grabec Date: Mon, 9 Sep 2024 14:39:41 +0200 Subject: [PATCH 1/2] add a check for the state of LP tokens --- .DS_Store | Bin 0 -> 6148 bytes templates/Contract-Code-Review.md | 1 + 2 files changed, 1 insertion(+) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..549652b0dae05cb5c7d2c1e07620a995aa4f4ba3 GIT binary patch literal 6148 zcmeHK%TB{U478z#B81c<$NdHVU{#eb=no(oKuA>hnK4v9qmw7;WiP|~dQyEpVcaWu1#5$N#NYMX z*1yEbaw9vO{D#<2b3pAL)eWrSxf?c*t!>XA&ny+70#twsPys6NLjm+`v-x!(BNdTp%mH-w@0BhnHhzv}F3Jj{|h@nA8zGPiZ90P+c z>Nn$@yjgQXQNJDe;^m?>kdX>dfl~!8W4W;Ye-Hm<{y!ygMFpt9zfwSFtMzJ$SIXWx yc{%H~1^xj4GSqrGg12Izw_+@;72h7!6??{hO&kNAj=a->{1Gr+XjI@Y6!-*hjvdAT literal 0 HcmV?d00001 diff --git a/templates/Contract-Code-Review.md b/templates/Contract-Code-Review.md index 746a35e..724b704 100644 --- a/templates/Contract-Code-Review.md +++ b/templates/Contract-Code-Review.md @@ -104,6 +104,7 @@ _Remove this section if the code being reviewed is not a strategy._ - [ ] All reward tokens are collected - [ ] The harvester can sell all reward tokens - [ ] No funds are left in the contract that should not be as a result of depositing or withdrawing +- [ ] If the strategy deals with staking LP tokens any liquidity altering function: deposit, depositAll, withdraw, withdrawAll or custom (e.g. rebalance) should result in a state where all LP tokens owned by the contract remain staked - [ ] All funds can be recovered from the strategy by some combination of depositAll, withdraw, or withdrawAll() - [ ] WithdrawAll() can always withdraw an amount equal to or larger than checkBalances report, even in spite of attacker manipulation. - [ ] WithdrawAll() cannot be MEV'd From ed55d34fdfa908ce286068b52eadeae22e971adc Mon Sep 17 00:00:00 2001 From: Domen Grabec Date: Mon, 9 Sep 2024 22:07:26 +0200 Subject: [PATCH 2/2] add a more generalized rule for external contracts --- templates/Contract-Code-Review.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/Contract-Code-Review.md b/templates/Contract-Code-Review.md index 724b704..075bc7a 100644 --- a/templates/Contract-Code-Review.md +++ b/templates/Contract-Code-Review.md @@ -127,6 +127,9 @@ _Remove this section if the code being reviewed is not a strategy._ _Are there things that must be done on deploy, or in the wider ecosystem for this code to work. Are they done?_ +#### Resource usage +- Identify if the contract interacts with any external contracts and alters their state. If there is an expectation of the external contract's state confirm that any/all operations meet it. + #### Internal State - What can be always said about relationships between stored state