Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Bug fix: Fail inheritance search on bad base node type #2873

Merged
merged 2 commits into from
Mar 9, 2020
Merged

Conversation

haltman-at
Copy link
Contributor

This PR is a (partial?) fix for the reopened #2723. Basically, when going through the base contracts of a given contract to find where a given function is defined, I have code that says, give up if you fail to locate one of the base contracts. However, I didn't have code that said, give up if due to ID collisions the "base contract" you locate is not a contract at all. This caused an error when attempting to test @Amxx's project.

I'm actually still getting errors when I try to test his project, but they're unrelated errors and it's not clear they're our fault, so I'm putting up this PR as it is to just fix this one issue.

One thing worth noting: In the particular case at hand, the base contract we're trying to look up is actually the contract itself! Wondering if perhaps I should put in code so that for the first contract in the base contracts list (i.e. the contract itself) we don't do a lookup, so that this sort of error can't happen unless there's a collision in one of the actual base contracts other than the contract itself?

Also: It's really weird that there was a collision here at all! IDs are supposed to be unique within a compilation, I thought? @Amxx might want to report that to Solidity...

(Nonetheless this is still our fault because we ought to be able to recover gracefully from such collisions one way or another.)

@haltman-at
Copy link
Contributor Author

OK, I did end up making that lookup-skipping change after all. Also, I reviewed the code a bit more and found two more places where a nodeType check should be added, so I did that.

@haltman-at haltman-at merged commit b9c320a into develop Mar 9, 2020
@haltman-at haltman-at deleted the fixxx branch March 9, 2020 19:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants