mirror of https://github.com/crytic/slither
parent
010d84125a
commit
4319bb3605
@ -1,65 +1,76 @@ |
|||||||
from slither.tools.properties.properties.properties import Property, PropertyType, PropertyReturn, PropertyCaller |
from slither.tools.properties.properties.properties import ( |
||||||
|
Property, |
||||||
|
PropertyType, |
||||||
|
PropertyReturn, |
||||||
|
PropertyCaller, |
||||||
|
) |
||||||
|
|
||||||
ERC20_CONFIG = [ |
ERC20_CONFIG = [ |
||||||
|
Property( |
||||||
Property(name='init_total_supply()', |
name="init_total_supply()", |
||||||
description='The total supply is correctly initialized.', |
description="The total supply is correctly initialized.", |
||||||
content=''' |
content=""" |
||||||
\t\treturn this.totalSupply() >= 0 && this.totalSupply() == initialTotalSupply;''', |
\t\treturn this.totalSupply() >= 0 && this.totalSupply() == initialTotalSupply;""", |
||||||
type=PropertyType.CODE_QUALITY, |
type=PropertyType.CODE_QUALITY, |
||||||
return_type=PropertyReturn.SUCCESS, |
return_type=PropertyReturn.SUCCESS, |
||||||
is_unit_test=True, |
is_unit_test=True, |
||||||
is_property_test=False, |
is_property_test=False, |
||||||
caller=PropertyCaller.ANY), |
caller=PropertyCaller.ANY, |
||||||
|
), |
||||||
Property(name='init_owner_balance()', |
Property( |
||||||
|
name="init_owner_balance()", |
||||||
description="Owner's balance is correctly initialized.", |
description="Owner's balance is correctly initialized.", |
||||||
content=''' |
content=""" |
||||||
\t\treturn initialBalance_owner == this.balanceOf(crytic_owner);''', |
\t\treturn initialBalance_owner == this.balanceOf(crytic_owner);""", |
||||||
type=PropertyType.CODE_QUALITY, |
type=PropertyType.CODE_QUALITY, |
||||||
return_type=PropertyReturn.SUCCESS, |
return_type=PropertyReturn.SUCCESS, |
||||||
is_unit_test=True, |
is_unit_test=True, |
||||||
is_property_test=False, |
is_property_test=False, |
||||||
caller=PropertyCaller.ANY), |
caller=PropertyCaller.ANY, |
||||||
|
), |
||||||
Property(name='init_user_balance()', |
Property( |
||||||
|
name="init_user_balance()", |
||||||
description="User's balance is correctly initialized.", |
description="User's balance is correctly initialized.", |
||||||
content=''' |
content=""" |
||||||
\t\treturn initialBalance_user == this.balanceOf(crytic_user);''', |
\t\treturn initialBalance_user == this.balanceOf(crytic_user);""", |
||||||
type=PropertyType.CODE_QUALITY, |
type=PropertyType.CODE_QUALITY, |
||||||
return_type=PropertyReturn.SUCCESS, |
return_type=PropertyReturn.SUCCESS, |
||||||
is_unit_test=True, |
is_unit_test=True, |
||||||
is_property_test=False, |
is_property_test=False, |
||||||
caller=PropertyCaller.ANY), |
caller=PropertyCaller.ANY, |
||||||
|
), |
||||||
Property(name='init_attacker_balance()', |
Property( |
||||||
|
name="init_attacker_balance()", |
||||||
description="Attacker's balance is correctly initialized.", |
description="Attacker's balance is correctly initialized.", |
||||||
content=''' |
content=""" |
||||||
\t\treturn initialBalance_attacker == this.balanceOf(crytic_attacker);''', |
\t\treturn initialBalance_attacker == this.balanceOf(crytic_attacker);""", |
||||||
type=PropertyType.CODE_QUALITY, |
type=PropertyType.CODE_QUALITY, |
||||||
return_type=PropertyReturn.SUCCESS, |
return_type=PropertyReturn.SUCCESS, |
||||||
is_unit_test=True, |
is_unit_test=True, |
||||||
is_property_test=False, |
is_property_test=False, |
||||||
caller=PropertyCaller.ANY), |
caller=PropertyCaller.ANY, |
||||||
|
), |
||||||
Property(name='init_caller_balance()', |
Property( |
||||||
|
name="init_caller_balance()", |
||||||
description="All the users have a positive balance.", |
description="All the users have a positive balance.", |
||||||
content=''' |
content=""" |
||||||
\t\treturn this.balanceOf(msg.sender) >0 ;''', |
\t\treturn this.balanceOf(msg.sender) >0 ;""", |
||||||
type=PropertyType.CODE_QUALITY, |
type=PropertyType.CODE_QUALITY, |
||||||
return_type=PropertyReturn.SUCCESS, |
return_type=PropertyReturn.SUCCESS, |
||||||
is_unit_test=True, |
is_unit_test=True, |
||||||
is_property_test=False, |
is_property_test=False, |
||||||
caller=PropertyCaller.ALL), |
caller=PropertyCaller.ALL, |
||||||
|
), |
||||||
# Note: there is a potential overflow on the addition, but we dont consider it |
# Note: there is a potential overflow on the addition, but we dont consider it |
||||||
Property(name='init_total_supply_is_balances()', |
Property( |
||||||
|
name="init_total_supply_is_balances()", |
||||||
description="The total supply is the user and owner balance.", |
description="The total supply is the user and owner balance.", |
||||||
content=''' |
content=""" |
||||||
\t\treturn this.balanceOf(crytic_owner) + this.balanceOf(crytic_user) + this.balanceOf(crytic_attacker) == this.totalSupply();''', |
\t\treturn this.balanceOf(crytic_owner) + this.balanceOf(crytic_user) + this.balanceOf(crytic_attacker) == this.totalSupply();""", |
||||||
type=PropertyType.CODE_QUALITY, |
type=PropertyType.CODE_QUALITY, |
||||||
return_type=PropertyReturn.SUCCESS, |
return_type=PropertyReturn.SUCCESS, |
||||||
is_unit_test=True, |
is_unit_test=True, |
||||||
is_property_test=False, |
is_property_test=False, |
||||||
caller=PropertyCaller.ANY), |
caller=PropertyCaller.ANY, |
||||||
|
), |
||||||
] |
] |
@ -1,13 +1,20 @@ |
|||||||
from slither.tools.properties.properties.properties import PropertyType, PropertyReturn, Property, PropertyCaller |
from slither.tools.properties.properties.properties import ( |
||||||
|
PropertyType, |
||||||
|
PropertyReturn, |
||||||
|
Property, |
||||||
|
PropertyCaller, |
||||||
|
) |
||||||
|
|
||||||
ERC20_NotMintable = [ |
ERC20_NotMintable = [ |
||||||
Property(name='crytic_supply_constant_ERC20PropertiesNotMintable()', |
Property( |
||||||
description='The total supply does not increase.', |
name="crytic_supply_constant_ERC20PropertiesNotMintable()", |
||||||
content=''' |
description="The total supply does not increase.", |
||||||
\t\treturn initialTotalSupply >= totalSupply();''', |
content=""" |
||||||
|
\t\treturn initialTotalSupply >= totalSupply();""", |
||||||
type=PropertyType.MEDIUM_SEVERITY, |
type=PropertyType.MEDIUM_SEVERITY, |
||||||
return_type=PropertyReturn.SUCCESS, |
return_type=PropertyReturn.SUCCESS, |
||||||
is_unit_test=True, |
is_unit_test=True, |
||||||
is_property_test=True, |
is_property_test=True, |
||||||
caller=PropertyCaller.ANY), |
caller=PropertyCaller.ANY, |
||||||
|
), |
||||||
] |
] |
||||||
|
@ -1,14 +1,20 @@ |
|||||||
from slither.tools.properties.properties.properties import Property, PropertyType, PropertyReturn, PropertyCaller |
from slither.tools.properties.properties.properties import ( |
||||||
|
Property, |
||||||
|
PropertyType, |
||||||
|
PropertyReturn, |
||||||
|
PropertyCaller, |
||||||
|
) |
||||||
|
|
||||||
ERC20_NotMintableNotBurnable = [ |
ERC20_NotMintableNotBurnable = [ |
||||||
|
Property( |
||||||
Property(name='crytic_supply_constant_ERC20PropertiesNotMintableNotBurnable()', |
name="crytic_supply_constant_ERC20PropertiesNotMintableNotBurnable()", |
||||||
description='The total supply does not change.', |
description="The total supply does not change.", |
||||||
content=''' |
content=""" |
||||||
\t\treturn initialTotalSupply == this.totalSupply();''', |
\t\treturn initialTotalSupply == this.totalSupply();""", |
||||||
type=PropertyType.MEDIUM_SEVERITY, |
type=PropertyType.MEDIUM_SEVERITY, |
||||||
return_type=PropertyReturn.SUCCESS, |
return_type=PropertyReturn.SUCCESS, |
||||||
is_unit_test=True, |
is_unit_test=True, |
||||||
is_property_test=True, |
is_property_test=True, |
||||||
caller=PropertyCaller.ANY), |
caller=PropertyCaller.ANY, |
||||||
|
), |
||||||
] |
] |
@ -1,11 +1,23 @@ |
|||||||
from .initialization import (InitializablePresent, InitializableInherited, |
from .initialization import ( |
||||||
InitializableInitializer, MissingInitializerModifier, MissingCalls, MultipleCalls, InitializeTarget) |
InitializablePresent, |
||||||
|
InitializableInherited, |
||||||
|
InitializableInitializer, |
||||||
|
MissingInitializerModifier, |
||||||
|
MissingCalls, |
||||||
|
MultipleCalls, |
||||||
|
InitializeTarget, |
||||||
|
) |
||||||
|
|
||||||
from .functions_ids import IDCollision, FunctionShadowing |
from .functions_ids import IDCollision, FunctionShadowing |
||||||
|
|
||||||
from .variable_initialization import VariableWithInit |
from .variable_initialization import VariableWithInit |
||||||
|
|
||||||
from .variables_order import (MissingVariable, DifferentVariableContractProxy, |
from .variables_order import ( |
||||||
DifferentVariableContractNewContract, ExtraVariablesProxy, ExtraVariablesNewContract) |
MissingVariable, |
||||||
|
DifferentVariableContractProxy, |
||||||
|
DifferentVariableContractNewContract, |
||||||
|
ExtraVariablesProxy, |
||||||
|
ExtraVariablesNewContract, |
||||||
|
) |
||||||
|
|
||||||
from .constant import WereConstant, BecameConstant |
from .constant import WereConstant, BecameConstant |
Loading…
Reference in new issue