Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Contract deployment doesn't support libraries #3805

Closed
boukestam opened this issue Dec 4, 2020 · 5 comments
Closed

Contract deployment doesn't support libraries #3805

boukestam opened this issue Dec 4, 2020 · 5 comments
Labels
Investigate P2 Medium severity bugs Stale Has not received enough activity

Comments

@boukestam
Copy link

boukestam commented Dec 4, 2020

While trying to deploy a smart contract we got the following error The data field must be HEX encoded data.
After a lot of debugging I found out that this is caused because the isHex function in utils.js only supports characters 0-9 and a-f.

But when using a linked library solidity includes this in the outputted JSON

"linkReferences": {
	"AllianceBlock/PercentageCalculator.sol": {
		"PercentageCalculator": [
			{
				"length": 20,
				"start": 13575
			}
		]
	}
}

And adds dollar signs and underscores in the bytecode to indicate the location of the library
image

This is according to the solidity github found here ethereum/solidity#635

How can we deploy this contract? We couldn't find any way to change the compiler settings to not include these characters

@github-actions
Copy link

github-actions bot commented Feb 3, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions bot added the Stale Has not received enough activity label Feb 3, 2021
@sensati0n
Copy link

sensati0n commented Feb 15, 2021

I've came accross a similar issue.

My steps:

  1. Compiling the Library.
  2. Deploying the Library.
  3. Compiling the Contract.
  4. Linking the Library with the Contract.
  5. Deploying the Contract. *ERROR: The data field must be HEX encoded data.

As @boukestam mentioned, this is because of 'foreign' characters in the bytecode.

Currently, I am unable to deploy my contract containing a link to my library...

Is there any update to this issue?

UPDATE:

Reading this issue it seems like this is still part of the hashed Library-Name, indicating that the linking did not work as expected.

@github-actions github-actions bot removed the Stale Has not received enough activity label Feb 16, 2021
@spacesailor24 spacesailor24 added Investigate P2 Medium severity bugs labels Mar 5, 2021
@spacesailor24
Copy link
Contributor

Hi there, wanting to know if this is still an issue for you?

If so, could provide a test repository for this?

@visopsys
Copy link

visopsys commented Apr 1, 2021

I also have this issue when using with a library. If I move a function from library to inner contract, then it compiles successfully.

@github-actions
Copy link

github-actions bot commented Jun 1, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. If you believe this was a mistake, please comment.

@github-actions github-actions bot added the Stale Has not received enough activity label Jun 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Investigate P2 Medium severity bugs Stale Has not received enough activity
Projects
None yet
Development

No branches or pull requests

4 participants