Skip to content

CSE for real-world contracts #922

Open
@Stevengre

Description

@Stevengre

Before finishing this PR #889, we want to make sure the basic CSE work for Lido code. However, we found the following issues to be solved.

I think I found why CSE doesn’t work for activateNextState. Here is the print for find_function_calls for activateNextState, showing that the contract_type is UnkownContractType. I think it might be a problem caused by the version of foundry or solc if it works before.

Method:  activateNextState()
Contract:  contracts%DualGovernance
Function call found
exploring expression
contract_type_string:  struct DualGovernanceStateMachine.Context storage ref
contract_type:  UnknownContractType
function_name:  activateNextState
arg_types:  function (struct DualGovernanceStateMachine.Context storage pointer,contract IEscrow)
args:  (struct
method_ast:  {'id': 483, 'nodeType': 'FunctionDefinition', 'src': '15709:106:2', 'nodes': [], 'body': {'id': 482, 'nodeType': 'Block', 'src': '15747:68:2', 'nodes': [], 'statements': [{'expression': {'arguments': [{'id': 479, 'name': 'ESCROW_MASTER_COPY', 'nodeType': 'Identifier', 'overloadedDeclarations': [], 'referencedDeclaration': 184, 'src': '15789:18:2', 'typeDescriptions': {'typeIdentifier': 't_contract$_IEscrow_$6009', 'typeString': 'contract IEscrow'}}], 'expression': {'argumentTypes': [{'typeIdentifier': 't_contract$_IEscrow_$6009', 'typeString': 'contract IEscrow'}], 'expression': {'id': 476, 'name': '_stateMachine', 'nodeType': 'Identifier', 'overloadedDeclarations': [], 'referencedDeclaration': 196, 'src': '15757:13:2', 'typeDescriptions': {'typeIdentifier': 't_struct$_Context_$8387_storage', 'typeString': 'struct DualGovernanceStateMachine.Context storage ref'}}, 'id': 478, 'isConstant': False, 'isLValue': True, 'isPure': False, 'lValueRequested': False, 'memberLocation': '15771:17:2', 'memberName': 'activateNextState', 'nodeType': 'MemberAccess', 'referencedDeclaration': 8673, 'src': '15757:31:2', 'typeDescriptions': {'typeIdentifier': 't_function_internal_nonpayable$_t_struct$_Context_$8387_storage_ptr_$_t_contract$_IEscrow_$6009_$returns$__$attached_to$_t_struct$_Context_$8387_storage_ptr_$', 'typeString': 'function (struct DualGovernanceStateMachine.Context storage pointer,contract IEscrow)'}}, 'id': 480, 'isConstant': False, 'isLValue': False, 'isPure': False, 'kind': 'functionCall', 'lValueRequested': False, 'nameLocations': [], 'names': [], 'nodeType': 'FunctionCall', 'src': '15757:51:2', 'tryCall': False, 'typeDescriptions': {'typeIdentifier': 't_tuple$__$', 'typeString': 'tuple()'}}, 'id': 481, 'nodeType': 'ExpressionStatement', 'src': '15757:51:2'}]}, 'baseFunctions': [5579], 'documentation': {'id': 473, 'nodeType': 'StructuredDocumentation', 'src': '15359:345:2', 'text': '@notice Updates the state of the Dual Governance State Machine if a state transition is possible.\n @dev This function should be called when the `persisted` and `effective` states of the system are not equal.\n     If the states are already synchronized, the function will complete without making any changes to the system state.'}, 'functionSelector': '2ca7d9fa', 'implemented': True, 'kind': 'function', 'modifiers': [], 'name': 'activateNextState', 'nameLocation': '15718:17:2', 'parameters': {'id': 474, 'nodeType': 'ParameterList', 'parameters': [], 'src': '15735:2:2'}, 'returnParameters': {'id': 475, 'nodeType': 'ParameterList', 'parameters': [], 'src': '15747:0:2'}, 'scope': 1010, 'stateMutability': 'nonpayable', 'virtual': False, 'visibility': 'external'}
fields:  (StorageField(label='_proposers', data_type='struct Proposers.Context', slot=0, offset=0, linked_interface=None), StorageField(label='_tiebreaker', data_type='struct Tiebreaker.Context', slot=3, offset=0, linked_interface=None), StorageField(label='_stateMachine', data_type='struct DualGovernanceStateMachine.Context', slot=6, offset=0, linked_interface=None), StorageField(label='_resealer', data_type='struct Resealer.Context', slot=9, offset=0, linked_interface=None), StorageField(label='_proposalsCanceller', data_type='address', slot=11, offset=0, linked_interface=None))
Method calls:  []

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcse

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions