Skip to content
This repository was archived by the owner on Dec 16, 2020. It is now read-only.

Panic in DefinitionSorter::run #16

Open
smoelius opened this issue Feb 21, 2020 · 1 comment
Open

Panic in DefinitionSorter::run #16

smoelius opened this issue Feb 21, 2020 · 1 comment

Comments

@smoelius
Copy link

The panic occurs at the unwrap in the following lines:
https://github.com/trailofbits/x-audit-blockstack-core/blob/e2d3d5bae539d242851620e28129af6c4a9de642/src/vm/analysis/definition_sorter/mod.rs#L60-L63
The panic can be witnessed by adding the line

(a 0)

at the end of the following test contract:
https://github.com/trailofbits/x-audit-blockstack-core/blob/e2d3d5bae539d242851620e28129af6c4a9de642/src/vm/analysis/definition_sorter/tests.rs#L58-L62
The problem appears to be: get_cycling_dependencies identifies the line (a 0) as contributing to a cycle, but the following line expects all such contributors to parse as definitions:
https://github.com/trailofbits/x-audit-blockstack-core/blob/e2d3d5bae539d242851620e28129af6c4a9de642/src/vm/analysis/definition_sorter/mod.rs#L203
One way to resolve this issue is to remove the unwrap and change the above map to a filter_map.

@lgalabru
Copy link
Collaborator

Ha! I found out about this panic while working on the implementation of the traits, and fixed it.
I just added and pushed a test case here: stacks-network/stacks-core@0cc0da6

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants