Skip to content

Commit 650c4a8

Browse files
committed
Fix variable order printer
Improve tests on printers
1 parent 4b55839 commit 650c4a8

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

scripts/ci_test_printers.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
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

13-
solc-select use "0.5.1"
1419

1520
slither examples/scripts/test_evm_api.sol --print evm

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)