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

Files without contracts cause the Truffle plugin to fail #826

Open
frangio opened this issue Jun 21, 2023 · 0 comments
Open

Files without contracts cause the Truffle plugin to fail #826

frangio opened this issue Jun 21, 2023 · 0 comments

Comments

@frangio
Copy link
Contributor

frangio commented Jun 21, 2023

As reported in the forum, using the Truffle plugin with the following contract that uses operator-filter-registry fails:

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.17;

import "operator-filter-registry/src/DefaultOperatorFilterer.sol";

contract Vox is DefaultOperatorFilterer {}

The error is something like Error: No node with id 645 of type ContractDefinition.


I traced this issue to this line where the AST for the DefaultOperatorFilterer contract is deleted from the reconstructed compiler output.:

This is roughly due to:

// 2. An imported file has only other import statements without an actual contract/library/interface.

Specifically, because of the Constants.sol file which doesn't have a contract in it.

tl;dr: A heuristic we use is failing.

I realize now that we could use a much more direct way to recognize contracts that need to be deleted from the reconstructed compiler output. We should find all contracts that are reachable through imports from files in the user's own contracts directory, and delete anything else.

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

No branches or pull requests

1 participant