trufflesuite / truffle

:warning: The Truffle Suite is being sunset. For information on ongoing support, migration options and FAQs, visit the Consensys blog. Thank you for all the support over the years.
https://consensys.io/blog/consensys-announces-the-sunset-of-truffle-and-ganache-and-new-hardhat?utm_source=github&utm_medium=referral&utm_campaign=2023_Sep_truffle-sunset-2023_announcement_
MIT License
14.02k stars 2.32k forks source link

Cannot publish ethpm package with dependencies #699

Closed alex-miller-0 closed 6 years ago

alex-miller-0 commented 6 years ago

Issue

Publishing an ethpm package (truffle publish) works nicely with self-contained contracts (i.e. those that do not import any other contracts), but I can't get it to work with contract imports.

Steps to Reproduce

I am importing a Token contract here:

import "./Token.sol"; 

Note: importing from an ethpm install (i.e. import "tokens/Token.sol") has the same effect.

I instantiate a token in a function call here:

Token t;
t = Token(tokenAddress);

truffle compile, truffle migrate, and truffle deploy all work fine.

Expected Behavior

truffle publish should publish this package to ethpm

Actual Results

I get the following error:

ParsedContract.sol:64:5: DeclarationError: Identifier not found or not unique.
    Token t;
    ^---^

Environment

Vourhey commented 6 years ago

I'm having the same error! Still no response? as OP said compile works fine, but it's impossible to publish

Kubuntu 16.04 Truffle v4.0.4 (core: 4.0.4) Solidity v0.4.18 (solc-js)

frangio commented 6 years ago

We're getting the same error in the OpenZeppelin repository. It started happening around version 1.4.0.

Does anyone from the Truffle team have any clue as to what could be happening?

cgewecke commented 6 years ago

@frangio Are you seeing this when trying publish Zeppelin itself, or when trying to publish something that imports contracts from an npm installed Zeppelin? Or from ethpm installed Zeppelin?

There is a recent fix for this that's pending release (early next week) but it really only addresses the case of contracts that rely on ethpm dependencies.

If you have reproduction steps for the Zeppelin case, will investigate.

frangio commented 6 years ago

When trying to publish OpenZeppelin itself. Can you try running truffle publish on the OpenZeppelin/zeppelin-solidity repo on your machine and see if that fails?

cgewecke commented 6 years ago

@frangio Yes I can see it failing and see why in the code as well. We'll try to fix this ASAP, thanks for pinging this.

frangio commented 6 years ago

@cgewecke Thanks to you for the quick response as always! ♥️

cgewecke commented 6 years ago

@alex-miller-0 @frangio This should be fixed in 4.1.5. Please report back if you continue to see this or have other issues publishing to ethpm.

Thanks!!