Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
zerosnacks committed Jun 30, 2023
1 parent def293d commit 8ebbd8c
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 68 deletions.
77 changes: 37 additions & 40 deletions reports/REENTRANCY_LAYOUT.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@
"name": "transferOwnership",
"modifiers": [
{
"id": 27636,
"id": 27674,
"kind": "modifierInvocation",
"modifierName": {
"id": 27635,
"id": 27673,
"name": "onlyOwner",
"nameLocations": [
"1086:9:23"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 28053,
"referencedDeclaration": 28091,
"src": "1086:9:23"
},
"nodeType": "ModifierInvocation",
"src": "1086:9:23"
},
{
"id": 27638,
"id": 27676,
"kind": "modifierInvocation",
"modifierName": {
"id": 27637,
"id": 27675,
"name": "nonReentrant",
"nameLocations": [
"1096:12:23"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 27027,
"referencedDeclaration": 27065,
"src": "1096:12:23"
},
"nodeType": "ModifierInvocation",
Expand All @@ -60,16 +60,16 @@
"name": "acceptOwnership",
"modifiers": [
{
"id": 27668,
"id": 27706,
"kind": "modifierInvocation",
"modifierName": {
"id": 27667,
"id": 27705,
"name": "nonReentrant",
"nameLocations": [
"1404:12:23"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 27027,
"referencedDeclaration": 27065,
"src": "1404:12:23"
},
"nodeType": "ModifierInvocation",
Expand All @@ -81,32 +81,32 @@
"name": "renounceOwnership",
"modifiers": [
{
"id": 27711,
"id": 27749,
"kind": "modifierInvocation",
"modifierName": {
"id": 27710,
"id": 27748,
"name": "onlyOwner",
"nameLocations": [
"1868:9:23"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 28053,
"referencedDeclaration": 28091,
"src": "1868:9:23"
},
"nodeType": "ModifierInvocation",
"src": "1868:9:23"
},
{
"id": 27713,
"id": 27751,
"kind": "modifierInvocation",
"modifierName": {
"id": 27712,
"id": 27750,
"name": "nonReentrant",
"nameLocations": [
"1878:12:23"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 27027,
"referencedDeclaration": 27065,
"src": "1878:12:23"
},
"nodeType": "ModifierInvocation",
Expand All @@ -118,32 +118,32 @@
"name": "addModules",
"modifiers": [
{
"id": 27752,
"id": 27790,
"kind": "modifierInvocation",
"modifierName": {
"id": 27751,
"id": 27789,
"name": "onlyOwner",
"nameLocations": [
"2278:9:23"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 28053,
"referencedDeclaration": 28091,
"src": "2278:9:23"
},
"nodeType": "ModifierInvocation",
"src": "2278:9:23"
},
{
"id": 27754,
"id": 27792,
"kind": "modifierInvocation",
"modifierName": {
"id": 27753,
"id": 27791,
"name": "nonReentrant",
"nameLocations": [
"2288:12:23"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 27027,
"referencedDeclaration": 27065,
"src": "2288:12:23"
},
"nodeType": "ModifierInvocation",
Expand All @@ -155,32 +155,32 @@
"name": "upgradeModules",
"modifiers": [
{
"id": 27851,
"id": 27889,
"kind": "modifierInvocation",
"modifierName": {
"id": 27850,
"id": 27888,
"name": "onlyOwner",
"nameLocations": [
"3621:9:23"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 28053,
"referencedDeclaration": 28091,
"src": "3621:9:23"
},
"nodeType": "ModifierInvocation",
"src": "3621:9:23"
},
{
"id": 27853,
"id": 27891,
"kind": "modifierInvocation",
"modifierName": {
"id": 27852,
"id": 27890,
"name": "nonReentrant",
"nameLocations": [
"3631:12:23"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 27027,
"referencedDeclaration": 27065,
"src": "3631:12:23"
},
"nodeType": "ModifierInvocation",
Expand Down Expand Up @@ -215,16 +215,16 @@
"name": "performBatchCall",
"modifiers": [
{
"id": 28548,
"id": 28590,
"kind": "modifierInvocation",
"modifierName": {
"id": 28547,
"id": 28589,
"name": "reentrancyAllowed",
"nameLocations": [
"1053:17:32"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 27001,
"referencedDeclaration": 27039,
"src": "1053:17:32"
},
"nodeType": "ModifierInvocation",
Expand All @@ -236,16 +236,16 @@
"name": "simulateBatchCallRevert",
"modifiers": [
{
"id": 28617,
"id": 28659,
"kind": "modifierInvocation",
"modifierName": {
"id": 28616,
"id": 28658,
"name": "reentrancyAllowed",
"nameLocations": [
"1747:17:32"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 27001,
"referencedDeclaration": 27039,
"src": "1747:17:32"
},
"nodeType": "ModifierInvocation",
Expand All @@ -257,16 +257,16 @@
"name": "simulateBatchCallReturn",
"modifiers": [
{
"id": 28701,
"id": 28743,
"kind": "modifierInvocation",
"modifierName": {
"id": 28700,
"id": 28742,
"name": "reentrancyAllowed",
"nameLocations": [
"2611:17:32"
],
"nodeType": "IdentifierPath",
"referencedDeclaration": 27001,
"referencedDeclaration": 27039,
"src": "2611:17:32"
},
"nodeType": "ModifierInvocation",
Expand All @@ -279,8 +279,5 @@
**MockImplementationDispatcher**

```json
{
"name": "setImplementationState0",
"modifiers": []
}

```
56 changes: 28 additions & 28 deletions reports/SLITHER_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Impact: Low
Confidence: Medium

- [ ] ID-0
[ReflexBatch.\_performBatchAction(address,IReflexBatch.BatchAction)](../src/periphery/ReflexBatch.sol#L144-L162) has external calls inside a loop: [(success*,returnData*) = moduleImplementation.delegatecall(abi.encodePacked(action*.callData,uint160(messageSender*),uint160(endpointAddress)))](../src/periphery/ReflexBatch.sol#L159-L161)
[ReflexBatch.\_performBatchAction(address,IReflexBatch.BatchAction)](../src/periphery/ReflexBatch.sol#L141-L159) has external calls inside a loop: [(success*,returnData*) = moduleImplementation.delegatecall(abi.encodePacked(action*.callData,uint160(messageSender*),uint160(endpointAddress)))](../src/periphery/ReflexBatch.sol#L156-L158)

../src/periphery/ReflexBatch.sol#L144-L162
../src/periphery/ReflexBatch.sol#L141-L159

- [ ] ID-1
[ReflexInstaller.upgradeModules(address[])](../src/ReflexInstaller.sol#L117-L163) has external calls inside a loop: [! IReflexModule(_REFLEX_STORAGE().modules[moduleSettings_.moduleId]).moduleUpgradeable()](../src/ReflexInstaller.sol#L130)
Expand Down Expand Up @@ -48,39 +48,39 @@ Impact: Informational
Confidence: High

- [ ] ID-6
[ReflexState.\_REFLEX_STORAGE()](../src/ReflexState.sol#L60-L69) uses assembly - [INLINE ASM](../src/ReflexState.sol#L61-L68)
[ReflexDispatcher.constructor(address,address)](../src/ReflexDispatcher.sol#L28-L77) uses assembly - [INLINE ASM](../src/ReflexDispatcher.sol#L54-L64)

../src/ReflexState.sol#L60-L69
../src/ReflexDispatcher.sol#L28-L77

- [ ] ID-7
[ReflexDispatcher.constructor(address,address)](../src/ReflexDispatcher.sol#L28-L77) uses assembly - [INLINE ASM](../src/ReflexDispatcher.sol#L54-L64)
[ReflexBatch.simulateBatchCallReturn(IReflexBatch.BatchAction[])](../src/periphery/ReflexBatch.sol#L91-L112) uses assembly - [INLINE ASM](../src/periphery/ReflexBatch.sol#L107-L109)

../src/ReflexDispatcher.sol#L28-L77
../src/periphery/ReflexBatch.sol#L91-L112

- [ ] ID-8
[ReflexDispatcher.fallback()](../src/ReflexDispatcher.sol#L112-L151) uses assembly - [INLINE ASM](../src/ReflexDispatcher.sol#L127-L150)

../src/ReflexDispatcher.sol#L112-L151

- [ ] ID-9
[ReflexBase.\_revertBytes(bytes)](../src/ReflexBase.sol#L171-L179) uses assembly - [INLINE ASM](../src/ReflexBase.sol#L173-L175)
[ReflexState.\_REFLEX_STORAGE()](../src/ReflexState.sol#L72-L76) uses assembly - [INLINE ASM](../src/ReflexState.sol#L73-L75)

../src/ReflexBase.sol#L171-L179
../src/ReflexState.sol#L72-L76

- [ ] ID-10
[ReflexBase.\_unpackTrailingParameters()](../src/ReflexBase.sol#L154-L165) uses assembly - [INLINE ASM](../src/ReflexBase.sol#L161-L164)
[ReflexBase.\_unpackTrailingParameters()](../src/ReflexBase.sol#L155-L166) uses assembly - [INLINE ASM](../src/ReflexBase.sol#L162-L165)

../src/ReflexBase.sol#L154-L165
../src/ReflexBase.sol#L155-L166

- [ ] ID-11
[ReflexBase.\_unpackEndpointAddress()](../src/ReflexBase.sol#L142-L147) uses assembly - [INLINE ASM](../src/ReflexBase.sol#L144-L146)
[ReflexBase.\_unpackMessageSender()](../src/ReflexBase.sol#L132-L137) uses assembly - [INLINE ASM](../src/ReflexBase.sol#L134-L136)

../src/ReflexBase.sol#L142-L147
../src/ReflexBase.sol#L132-L137

- [ ] ID-12
[ReflexBase.\_unpackMessageSender()](../src/ReflexBase.sol#L131-L136) uses assembly - [INLINE ASM](../src/ReflexBase.sol#L133-L135)
[ReflexBase.\_unpackEndpointAddress()](../src/ReflexBase.sol#L143-L148) uses assembly - [INLINE ASM](../src/ReflexBase.sol#L145-L147)

../src/ReflexBase.sol#L131-L136
../src/ReflexBase.sol#L143-L148

- [ ] ID-13
[ReflexBase.\_createEndpoint(uint32,uint16,address)](../src/ReflexBase.sol#L68-L102) uses assembly - [INLINE ASM](../src/ReflexBase.sol#L81-L91)
Expand All @@ -93,14 +93,14 @@ Confidence: High
../src/ReflexEndpoint.sol#L50-L132

- [ ] ID-15
[ReflexBatch.performStaticCall(address,bytes)](../src/periphery/ReflexBatch.sol#L24-L34) uses assembly - [INLINE ASM](../src/periphery/ReflexBatch.sol#L31-L33)
[ReflexBase.\_revertBytes(bytes)](../src/ReflexBase.sol#L172-L180) uses assembly - [INLINE ASM](../src/ReflexBase.sol#L174-L176)

../src/periphery/ReflexBatch.sol#L24-L34
../src/ReflexBase.sol#L172-L180

- [ ] ID-16
[ReflexBatch.simulateBatchCallReturn(IReflexBatch.BatchAction[])](../src/periphery/ReflexBatch.sol#L91-L115) uses assembly - [INLINE ASM](../src/periphery/ReflexBatch.sol#L110-L112)
[ReflexBatch.performStaticCall(address,bytes)](../src/periphery/ReflexBatch.sol#L24-L34) uses assembly - [INLINE ASM](../src/periphery/ReflexBatch.sol#L31-L33)

../src/periphery/ReflexBatch.sol#L91-L115
../src/periphery/ReflexBatch.sol#L24-L34

## solc-version

Expand Down Expand Up @@ -191,24 +191,24 @@ Impact: Informational
Confidence: High

- [ ] ID-33
Low level call in [ReflexBatch.performStaticCall(address,bytes)](../src/periphery/ReflexBatch.sol#L24-L34): - [(success,result) = contractAddress*.staticcall(callData*)](../src/periphery/ReflexBatch.sol#L27)
Low level call in [ReflexBase.\_callInternalModule(uint32,bytes)](../src/ReflexBase.sol#L119-L126): - [(success,result) = _REFLEX_STORAGE().modules[moduleId_].delegatecall(input\_)](../src/ReflexBase.sol#L121)

../src/periphery/ReflexBatch.sol#L24-L34
../src/ReflexBase.sol#L119-L126

- [ ] ID-34
Low level call in [ReflexBase.\_callInternalModule(uint32,bytes)](../src/ReflexBase.sol#L119-L125): - [(success,result) = _REFLEX_STORAGE().modules[moduleId_].delegatecall(input\_)](../src/ReflexBase.sol#L120)
Low level call in [ReflexBatch.performStaticCall(address,bytes)](../src/periphery/ReflexBatch.sol#L24-L34): - [(success,result) = contractAddress*.staticcall(callData*)](../src/periphery/ReflexBatch.sol#L27)

../src/ReflexBase.sol#L119-L125
../src/periphery/ReflexBatch.sol#L24-L34

- [ ] ID-35
Low level call in [ReflexBatch.\_performBatchAction(address,IReflexBatch.BatchAction)](../src/periphery/ReflexBatch.sol#L144-L162): - [(success*,returnData*) = moduleImplementation.delegatecall(abi.encodePacked(action*.callData,uint160(messageSender*),uint160(endpointAddress)))](../src/periphery/ReflexBatch.sol#L159-L161)
Low level call in [ReflexBatch.\_performBatchAction(address,IReflexBatch.BatchAction)](../src/periphery/ReflexBatch.sol#L141-L159): - [(success*,returnData*) = moduleImplementation.delegatecall(abi.encodePacked(action*.callData,uint160(messageSender*),uint160(endpointAddress)))](../src/periphery/ReflexBatch.sol#L156-L158)

../src/periphery/ReflexBatch.sol#L144-L162
../src/periphery/ReflexBatch.sol#L141-L159

- [ ] ID-36
Low level call in [ReflexBatch.simulateBatchCallReturn(IReflexBatch.BatchAction[])](../src/periphery/ReflexBatch.sol#L91-L115): - [(success,result) = _REFLEX_STORAGE().modules[\_moduleId].delegatecall(abi.encodePacked(abi.encodeWithSelector(IReflexBatch.simulateBatchCallRevert.selector,actions_),uint160(\_unpackMessageSender()),uint160(\_unpackEndpointAddress())))](../src/periphery/ReflexBatch.sol#L98-L104)
Low level call in [ReflexBatch.simulateBatchCallReturn(IReflexBatch.BatchAction[])](../src/periphery/ReflexBatch.sol#L91-L112): - [(success,result) = _REFLEX_STORAGE().modules[\_moduleId].delegatecall(abi.encodePacked(abi.encodeWithSelector(IReflexBatch.simulateBatchCallRevert.selector,actions_),uint160(\_unpackMessageSender()),uint160(\_unpackEndpointAddress())))](../src/periphery/ReflexBatch.sol#L95-L101)

../src/periphery/ReflexBatch.sol#L91-L115
../src/periphery/ReflexBatch.sol#L91-L112

## naming-convention

Expand All @@ -221,9 +221,9 @@ Confidence: High
../src/ReflexModule.sol#L24

- [ ] ID-38
Function [ReflexState.\_REFLEX_STORAGE()](../src/ReflexState.sol#L60-L69) is not in mixedCase
Function [ReflexState.\_REFLEX_STORAGE()](../src/ReflexState.sol#L72-L76) is not in mixedCase

../src/ReflexState.sol#L60-L69
../src/ReflexState.sol#L72-L76

- [ ] ID-39
Variable [ReflexEndpoint.\_deployer](../src/ReflexEndpoint.sol#L26) is not in mixedCase
Expand Down
1 change: 1 addition & 0 deletions src/ReflexState.sol
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ abstract contract ReflexState is IReflexState, ReflexConstants {
* @dev Get the Reflex storage pointer.
* @return storage_ Pointer to the Reflex storage state.
*/
// solhint-disable-next-line func-name-mixedcase
function _REFLEX_STORAGE() internal pure returns (ReflexStorage storage storage_) {
assembly {
storage_.slot := _REFLEX_STORAGE_SLOT
Expand Down
2 changes: 2 additions & 0 deletions test/ImplementationState.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ contract ImplementationStateTest is ImplementationFixture {
MockImplementationModule public exampleModuleImplementation;
MockImplementationModule public exampleModuleEndpoint;

// solhint-disable-next-line var-name-mixedcase
bytes32 public REFLEX_STORAGE_SLOT;
// solhint-disable-next-line var-name-mixedcase
bytes32 public IMPLEMENTATION_STORAGE_SLOT;

// =====
Expand Down
Loading

0 comments on commit 8ebbd8c

Please sign in to comment.