Skip to content

Commit 9239269

Browse files
authored
Merge pull request #849 from crytic/dev-fix-var-printer
Fix variable order printer
2 parents 4b55839 + f5f456e commit 9239269

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

scripts/ci_test_printers.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,24 @@
22

33
### Test printer
44

5-
# Needed for evm printer
6-
pip install evm-cfg-builder
5+
cd tests/ast-parsing/compile || exit
76

8-
if ! slither "tests/*.json" --print all --json -; then
9-
echo "Printer tests failed"
7+
# Do not test the evm printer,as it needs a refactoring
8+
ALL_PRINTERS="cfg,constructor-calls,contract-summary,data-dependency,echidna,function-id,function-summary,modifiers,call-graph,human-summary,inheritance,inheritance-graph,slithir,slithir-ssa,vars-and-auth,require,variable-order"
9+
10+
# Only test 0.5.17 to limit test time
11+
for file in *0.5.17-compact.zip; do
12+
if ! slither "$file" --print "$ALL_PRINTERS" > /dev/null 2>&1 ; then
13+
echo "Printer failed"
14+
echo "$file"
1015
exit 1
11-
fi
16+
fi
17+
done
1218

19+
cd ../../.. || exit
20+
# Needed for evm printer
21+
pip install evm-cfg-builder
1322
solc-select use "0.5.1"
14-
15-
slither examples/scripts/test_evm_api.sol --print evm
23+
if ! slither examples/scripts/test_evm_api.sol --print evm; then
24+
echo "EVM printer failed"
25+
fi

slither/printers/summary/variable_order.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def output(self, _filename):
2929
table = MyPrettyTable(["Name", "Type", "Slot", "Offset"])
3030
for variable in contract.state_variables_ordered:
3131
if not variable.is_constant:
32-
slot, offset = self.slither.storage_layout_of(contract, variable)
32+
slot, offset = contract.compilation_unit.storage_layout_of(contract, variable)
3333
table.add_row([variable.canonical_name, str(variable.type), slot, offset])
3434

3535
all_tables.append((contract.name, table))

0 commit comments

Comments
 (0)