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

Local testing fails with KeyError: 'development' #562

Closed
trentmc opened this issue May 10, 2023 · 3 comments
Closed

Local testing fails with KeyError: 'development' #562

trentmc opened this issue May 10, 2023 · 3 comments
Assignees
Labels
Priority: Critical Type: Bug Something isn't working

Comments

@trentmc
Copy link
Member

trentmc commented May 10, 2023

Background / motivation

When I follow the usual flow to (a) get barge going, then (b) run any test on df-py, in (b) I immediately get KeyError: 'development'.

Digging further, it seems that barge is the culprit, not df-py. I'm putting here in df-py because it's blocking me in df-py work.

By default, barge is supposed to...

  1. compile contracts
  2. create address.json in ~/.ocean/ocean-contracts/artifacts/
  3. deploy Ocean contracts to ganache
  4. update address.json with info from (3), with top-level key "development"

It does (1) and (2), good. But not (3) and (4). Even if I wait 15+ minutes.

It's easy to inspect: just run barge, and see that it's missing "development" in address.json.

Here's my output, from when I run barge via ./start_ocean.sh --with-thegraph 1>out.txt 2>&1 &).

Here's a log from a second run - out2.txt. I'd done all the cleaning, including rebooting my laptop.

Here's some interesting output in both logs.

  • Note that right after "Deploying OceanToken" it says "NomicLabsHardhatPluginError: You are trying to create a contract factory from an artifact, but you have not passed a valid artifact parameter".
  • Also note what's missing: if it had deployed the addresses, it would have outptu them to the log (iirc)
ocean-contracts_1  | deploy contracts is true
...
ocean-contracts_1  | Using RPC: http://172.15.0.3:8545
ocean-contracts_1  | Using chain 8996
ocean-contracts_1  | Use existing addresses:{}
ocean-contracts_1  | Deploying OceanToken
ocean-contracts_1  | NomicLabsHardhatPluginError: You are trying to create a contract factory from an artifact, but you have not passed a valid artifact parameter.
ocean-contracts_1  |     at getContractFactoryFromArtifact (/ocean-contracts/node_modules/@nomiclabs/hardhat-ethers/internal/helpers.js:73:15)
ocean-contracts_1  |     at getContractFactory (/ocean-contracts/node_modules/@nomiclabs/hardhat-ethers/internal/helpers.js:56:16)
ocean-contracts_1  |     at async main (/ocean-contracts/scripts/deploy-contracts.js:237:19)
subgraph_1         | Using custom ADDRESS_FILE instead of ocean-contracts npm dep
@trentmc
Copy link
Member Author

trentmc commented May 10, 2023

Related: #547 is a similar issue but for CI. It seems to be sporadic, though. (Whereas this issue hits me all the time.)

@trentmc
Copy link
Member Author

trentmc commented May 10, 2023

I tried locally checking out the old barge (and doing related cleanup). It didn't help :(

To use a "branch" for old barge:

git checkout 9cc3a9342a47857a0495309e787462d6c60979e6

This time I also ran with more components turned off (now identical to github actions in df-py):

./start_ocean.sh --no-aquarius --no-elasticsearch --no-provider --no-dashboard --with-thegraph > out.txt 2>

Result: log.

@trentmc
Copy link
Member Author

trentmc commented May 10, 2023

The fix: delete ~/.ocean

:)

@trentmc trentmc closed this as completed May 10, 2023
trentmc added a commit that referenced this issue May 11, 2023
[df-py#562] "Local testing fails with KeyError: 'development'" was actually a barge error. The problem is, when this error is hit, it can take nontrivial time to realize that issue. 

This change makes it easier to tell where specifically the issue is, and that Barge is the likely culprit.
trentmc added a commit that referenced this issue May 11, 2023
Issues #546, #562 and more had issues related to cleanup of the cache. There are tactics to try to address this. This commit lists those tactics, to streamline handling similar issues in the future, which we will inevitably encounter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Critical Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants