pull/507/head
samczsun 4 years ago
parent f3485c5f62
commit 075db34267
  1. 6
      slither/core/slither_core.py
  2. 4
      slither/core/solidity_types/array_type.py
  3. 4
      slither/core/solidity_types/elementary_type.py
  4. 4
      slither/core/solidity_types/function_type.py
  5. 4
      slither/core/solidity_types/mapping_type.py
  6. 4
      slither/core/solidity_types/user_defined_type.py

@ -7,7 +7,7 @@ import json
import re
import math
from collections import defaultdict
from typing import Optional, Dict, List, Set, Union
from typing import Optional, Dict, List, Set, Union, Tuple
from crytic_compile import CryticCompile
@ -57,7 +57,7 @@ class SlitherCore(Context):
self._contract_name_collisions = defaultdict(list)
self._contract_with_missing_inheritance = set()
self._storage_layouts = {}
self._storage_layouts: Dict[str, Dict[str, Tuple[int, int]]] = {}
###################################################################################
###################################################################################
@ -380,6 +380,6 @@ class SlitherCore(Context):
else:
offset += size
def storage_layout_of(self, contract, var):
def storage_layout_of(self, contract, var) -> Tuple[int, int]:
return self._storage_layouts[contract.name][var.canonical_name]
# endregion

@ -1,4 +1,4 @@
from typing import Optional
from typing import Optional, Tuple
from slither.core.expressions import Literal
from slither.core.expressions.expression import Expression
@ -38,7 +38,7 @@ class ArrayType(Type):
return self._length_value
@property
def storage_size(self):
def storage_size(self) -> Tuple[int, bool]:
if self._length_value:
elem_size, _ = self._type.storage_size
return elem_size * int(self._length_value.value), True

@ -1,5 +1,5 @@
import itertools
from typing import Optional
from typing import Optional, Tuple
from slither.core.solidity_types.type import Type
@ -173,7 +173,7 @@ class ElementaryType(Type):
return None
@property
def storage_size(self):
def storage_size(self) -> Tuple[int, bool]:
if self._type == 'string' or self._type == 'bytes':
return 32, True

@ -1,4 +1,4 @@
from typing import List
from typing import List, Tuple
from slither.core.solidity_types.type import Type
from slither.core.variables.function_type_variable import FunctionTypeVariable
@ -27,7 +27,7 @@ class FunctionType(Type):
return [x.type for x in self.return_values]
@property
def storage_size(self):
def storage_size(self) -> Tuple[int, bool]:
return 24, False
def __str__(self):

@ -1,3 +1,5 @@
from typing import Tuple
from slither.core.solidity_types.type import Type
@ -18,7 +20,7 @@ class MappingType(Type):
return self._to
@property
def storage_size(self):
def storage_size(self) -> Tuple[int, bool]:
return 32, True
def __str__(self):

@ -1,4 +1,4 @@
from typing import Union, TYPE_CHECKING
from typing import Union, TYPE_CHECKING, Tuple
import math
from slither.core.solidity_types.type import Type
@ -24,7 +24,7 @@ class UserDefinedType(Type):
return self._type
@property
def storage_size(self):
def storage_size(self) -> Tuple[int, bool]:
from slither.core.declarations.structure import Structure
from slither.core.declarations.enum import Enum
from slither.core.declarations.contract import Contract

Loading…
Cancel
Save