|
|
@ -115,29 +115,43 @@ Avoid variables in the proxy. If a variable is in the proxy, ensure it has the s |
|
|
|
def _check(self) -> List[Output]: |
|
|
|
def _check(self) -> List[Output]: |
|
|
|
contract1 = self._contract1() |
|
|
|
contract1 = self._contract1() |
|
|
|
contract2 = self._contract2() |
|
|
|
contract2 = self._contract2() |
|
|
|
order1 = contract1.stored_state_variables_ordered |
|
|
|
|
|
|
|
order2 = contract2.stored_state_variables_ordered |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
results: List[Output] = [] |
|
|
|
results: List[Output] = [] |
|
|
|
for idx, _ in enumerate(order1): |
|
|
|
|
|
|
|
if len(order2) <= idx: |
|
|
|
def _check_internal( |
|
|
|
# Handle by MissingVariable |
|
|
|
contract1: Contract, contract2: Contract, results: List[Output], is_transient: bool |
|
|
|
return results |
|
|
|
): |
|
|
|
|
|
|
|
if is_transient: |
|
|
|
variable1 = order1[idx] |
|
|
|
order1 = contract1.transient_variables_ordered |
|
|
|
variable2 = order2[idx] |
|
|
|
order2 = contract2.transient_variables_ordered |
|
|
|
if (variable1.name != variable2.name) or (variable1.type != variable2.type): |
|
|
|
else: |
|
|
|
info: CHECK_INFO = [ |
|
|
|
order1 = contract1.storage_variables_ordered |
|
|
|
"Different variables between ", |
|
|
|
order2 = contract2.storage_variables_ordered |
|
|
|
contract1, |
|
|
|
|
|
|
|
" and ", |
|
|
|
for idx, _ in enumerate(order1): |
|
|
|
contract2, |
|
|
|
if len(order2) <= idx: |
|
|
|
"\n", |
|
|
|
# Handle by MissingVariable |
|
|
|
] |
|
|
|
return |
|
|
|
info += ["\t ", variable1, "\n"] |
|
|
|
|
|
|
|
info += ["\t ", variable2, "\n"] |
|
|
|
variable1 = order1[idx] |
|
|
|
json = self.generate_result(info) |
|
|
|
variable2 = order2[idx] |
|
|
|
results.append(json) |
|
|
|
if (variable1.name != variable2.name) or (variable1.type != variable2.type): |
|
|
|
|
|
|
|
info: CHECK_INFO = [ |
|
|
|
|
|
|
|
"Different variables between ", |
|
|
|
|
|
|
|
contract1, |
|
|
|
|
|
|
|
" and ", |
|
|
|
|
|
|
|
contract2, |
|
|
|
|
|
|
|
"\n", |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
info += ["\t ", variable1, "\n"] |
|
|
|
|
|
|
|
info += ["\t ", variable2, "\n"] |
|
|
|
|
|
|
|
json = self.generate_result(info) |
|
|
|
|
|
|
|
results.append(json) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Checking state variables with storage location |
|
|
|
|
|
|
|
_check_internal(contract1, contract2, results, False) |
|
|
|
|
|
|
|
# Checking state variables with transient location |
|
|
|
|
|
|
|
_check_internal(contract1, contract2, results, True) |
|
|
|
|
|
|
|
|
|
|
|
return results |
|
|
|
return results |
|
|
|
|
|
|
|
|
|
|
@ -236,22 +250,35 @@ Avoid variables in the proxy. If a variable is in the proxy, ensure it has the s |
|
|
|
def _check(self) -> List[Output]: |
|
|
|
def _check(self) -> List[Output]: |
|
|
|
contract1 = self._contract1() |
|
|
|
contract1 = self._contract1() |
|
|
|
contract2 = self._contract2() |
|
|
|
contract2 = self._contract2() |
|
|
|
order1 = contract1.stored_state_variables_ordered |
|
|
|
|
|
|
|
order2 = contract2.stored_state_variables_ordered |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
results = [] |
|
|
|
results: List[Output] = [] |
|
|
|
|
|
|
|
|
|
|
|
if len(order2) <= len(order1): |
|
|
|
def _check_internal( |
|
|
|
return [] |
|
|
|
contract1: Contract, contract2: Contract, results: List[Output], is_transient: bool |
|
|
|
|
|
|
|
): |
|
|
|
|
|
|
|
if is_transient: |
|
|
|
|
|
|
|
order1 = contract1.transient_variables_ordered |
|
|
|
|
|
|
|
order2 = contract2.transient_variables_ordered |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
order1 = contract1.storage_variables_ordered |
|
|
|
|
|
|
|
order2 = contract2.storage_variables_ordered |
|
|
|
|
|
|
|
|
|
|
|
idx = len(order1) |
|
|
|
if len(order2) <= len(order1): |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
while idx < len(order2): |
|
|
|
idx = len(order1) |
|
|
|
variable2 = order2[idx] |
|
|
|
|
|
|
|
info: CHECK_INFO = ["Extra variables in ", contract2, ": ", variable2, "\n"] |
|
|
|
while idx < len(order2): |
|
|
|
json = self.generate_result(info) |
|
|
|
variable2 = order2[idx] |
|
|
|
results.append(json) |
|
|
|
info: CHECK_INFO = ["Extra variables in ", contract2, ": ", variable2, "\n"] |
|
|
|
idx = idx + 1 |
|
|
|
json = self.generate_result(info) |
|
|
|
|
|
|
|
results.append(json) |
|
|
|
|
|
|
|
idx = idx + 1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Checking state variables with storage location |
|
|
|
|
|
|
|
_check_internal(contract1, contract2, results, False) |
|
|
|
|
|
|
|
# Checking state variables with transient location |
|
|
|
|
|
|
|
_check_internal(contract1, contract2, results, True) |
|
|
|
|
|
|
|
|
|
|
|
return results |
|
|
|
return results |
|
|
|
|
|
|
|
|
|
|
|