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: publish_source with crossing remmapings #1551

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bcdevwork
Copy link

@bcdevwork bcdevwork commented Jun 1, 2022

What I did

In projects with overlapping remappings publish_source returns an error:

FileNotFoundError: [Errno 2] No such file or directory: '/Users/user/.brownie/packages/OpenZeppelin/openzeppelin-contracts@4.4.2-upgradeable/contracts/token/ERC1155/IERC1155Upgradeable.sol'

The remap_import function checks the match in any order.

compiler:
    solc:
        version: 0.8.11
        optimizer:
            enabled: true
        remappings:
        - "@openzeppelin-upgradeable=OpenZeppelin/openzeppelin-contracts-upgradeable@4.4.2"
        - "@openzeppelin=OpenZeppelin/openzeppelin-contracts@4.4.2"

dependencies:
  - OpenZeppelin/openzeppelin-contracts-upgradeable@4.4.2
  - OpenZeppelin/openzeppelin-contracts@4.4.2 

How I did it

Sorted the list remappings by length in descending order, which allowed to exclude the crossing like openzeppelin in openzeppelin-upgradeable.

How to verify it

I could not find suitable tests for this part of the functionality. For check, it is necessary to pass verification with the configuration specified above.

Checklist

  • I have confirmed that my PR passes all linting checks
  • I have included test cases
  • I have updated the documentation
  • I have added an entry to the changelog

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

Successfully merging this pull request may close these issues.

None yet

1 participant