Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix variable order printer #849

Merged
merged 4 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions scripts/ci_test_printers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@

### Test printer

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

if ! slither "tests/*.json" --print all --json -; then
echo "Printer tests failed"
# Do not test the evm printer,as it needs a refactoring
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"

# Only test 0.5.17 to limit test time
for file in *0.5.17-compact.zip; do
if ! slither "$file" --print "$ALL_PRINTERS" > /dev/null 2>&1 ; then
echo "Printer failed"
echo "$file"
exit 1
fi
fi
done

cd ../../.. || exit
# Needed for evm printer
pip install evm-cfg-builder
solc-select use "0.5.1"

slither examples/scripts/test_evm_api.sol --print evm
if ! slither examples/scripts/test_evm_api.sol --print evm; then
echo "EVM printer failed"
fi
2 changes: 1 addition & 1 deletion slither/printers/summary/variable_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def output(self, _filename):
table = MyPrettyTable(["Name", "Type", "Slot", "Offset"])
for variable in contract.state_variables_ordered:
if not variable.is_constant:
slot, offset = self.slither.storage_layout_of(contract, variable)
slot, offset = contract.compilation_unit.storage_layout_of(contract, variable)
table.add_row([variable.canonical_name, str(variable.type), slot, offset])

all_tables.append((contract.name, table))
Expand Down