livepeer / protocol

Livepeer protocol
MIT License
154 stars 45 forks source link

fix SortedDoublyLL link when using unitTest network #389

Closed kyriediculous closed 4 years ago

kyriediculous commented 4 years ago

386 skips migrations when using the unitTest network, but it also skips linking DoublySortedLL to the BondingManager.

This PR fixes the linking when using the unitTest network.

To reproduce the issue check out #386 and run ./node_modules/.bin/truffle test test/unit/BondingManager.js --network=unitTest

The following error will be returned

  1) Contract: BondingManager
       "before all" hook in "Contract: BondingManager":
     Error: BondingManager contains unresolved libraries. You must deploy and link the following libraries before you can deploy a new version of BondingManager: SortedDoublyLL
coveralls commented 4 years ago

Pull Request Test Coverage Report for Build e0598a7a-4c3b-4b32-aa34-7e2f51a173be


Totals Coverage Status
Change from base Build e4adf4e1-3d95-4969-8f2a-f80ae94a960a: 0.0%
Covered Lines: 711
Relevant Lines: 711

💛 - Coveralls
kyriediculous commented 4 years ago

So the trufflecontract wrapper does have the notion of linking, but it's impossible to replace an existing library address which would be happening if we run the BondingManager.js tests on a network that isn't "unitTest" which is why CI fails.

This is due to the fact that the placeholder in the bytecode is replaced by the address; but this can only happen once.

And as far as I know the truffle wrapper around mocha doesn't give access to the network name used even though it's been requested a couple of times.

I propose keeping the original solution of ignoring the network name in the library migrations file despite it deploying that contract before every test.