status-im / liquid-funding

Dapp for delegating donations to projects
https://assemble.fund/
GNU General Public License v3.0
19 stars 9 forks source link

Fix IPFS errors when loading projects #129

Open jakubgs opened 2 years ago

jakubgs commented 2 years ago

Currently project pages do not load due to IPFS Websocket errors:

client.js:19 WebSocket connection to 'wss://ams-1.bootstrap.libp2p.io/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd' failed: 
client.js:19 WebSocket connection to 'wss://lon-1.bootstrap.libp2p.io/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3' failed: 
client.js:19 WebSocket connection to 'wss://sfo-3.bootstrap.libp2p.io/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM' failed: 
client.js:19 WebSocket connection to 'wss://sgp-1.bootstrap.libp2p.io/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu' failed: 
client.js:19 WebSocket connection to 'wss://nyc-2.bootstrap.libp2p.io/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64' failed: 
client.js:19 WebSocket connection to 'wss://nyc-1.bootstrap.libp2p.io/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm' failed: 

This is most probably due to IPFS API changes.

jakubgs commented 2 years ago

It looks like the domains are just gone:

 > cat <<EOF | xargs -n1 host
ams-1.bootstrap.libp2p.io
lon-1.bootstrap.libp2p.io
nyc-1.bootstrap.libp2p.io
nyc-2.bootstrap.libp2p.io
sfo-3.bootstrap.libp2p.io
sgp-1.bootstrap.libp2p.io
EOF                      
Host ams-1.bootstrap.libp2p.io not found: 3(NXDOMAIN)
Host lon-1.bootstrap.libp2p.io not found: 3(NXDOMAIN)
Host nyc-1.bootstrap.libp2p.io not found: 3(NXDOMAIN)
Host nyc-2.bootstrap.libp2p.io not found: 3(NXDOMAIN)
Host sfo-3.bootstrap.libp2p.io not found: 3(NXDOMAIN)
Host sgp-1.bootstrap.libp2p.io not found: 3(NXDOMAIN)
jakubgs commented 2 years ago

I believe the package that controls these addresses is: https://github.com/libp2p/js-libp2p-bootstrap https://github.com/status-im/liquid-funding/blob/3e7ed35fd30a4fb5af9671515c7a05b35a4dfbcc/yarn.lock#L13904-L13905 Which is already at 2.0.0 and we are still on 0.9.7: https://github.com/libp2p/js-libp2p-bootstrap/releases/tag/v2.0.0

jakubgs commented 2 years ago

We have a CI build for assembe.fund but it hasn't been used in ages: https://ci.status.im/job/website/job/assemble.fund/ And there is a Jenkinsfile. So this should be fairly simple to fix: https://github.com/status-im/liquid-funding/blob/master/Jenkinsfile

jakubgs commented 2 years ago

Unfortunately yarn install doesn't work and explodes with:

error Command failed.
Exit code: 128
Command: git
Arguments: ls-remote --tags --heads git://github.com/frozeman/WebSocket-Node.git
Directory: /home/jakubgs/work/liquid-funding
Output:
fatal: unable to connect to github.com:
github.com[0: 140.82.121.3]: errno=Connection timed out

Where WebSocket-Node is a dependency from embark, specifically: https://github.com/status-im/liquid-funding/blob/3e7ed35fd30a4fb5af9671515c7a05b35a4dfbcc/package.json#L106 Merciful Christ protect me...

jakubgs commented 2 years ago

The way the dependency is specified in yarn.lock is kinda weird: https://github.com/status-im/liquid-funding/blob/3e7ed35fd30a4fb5af9671515c7a05b35a4dfbcc/yarn.lock#L23468-L23475

jakubgs commented 2 years ago

This appears to be the relevant issue:

And the suggested solution is:

git config --global url.https://github.com/.insteadOf git://github.com/

Which creates an entry like this:

 > grep -A1 github ~/.gitconfig   
[url "https://github.com/"]
    insteadOf = git://github.com/
jakubgs commented 2 years ago

And it does indeed fix that issue, but we have another:

error embark@4.1.1: The engine "node" is incompatible with this module. Expected version ">=8.12.0 <12.0.0". Got "16.15.0"

So I guess I will need to somehow get Node 11, possibly via Nix.

jakubgs commented 2 years ago

Looks like Node.js 10 was remove from nixpkgs 2 months ago: https://github.com/NixOS/nixpkgs/commit/0bb08246

But we can lock nixpkgs at an older version.

jakubgs commented 2 years ago

Looks like libp2p-bootstrap is published as two different packages on NPM:

But even using 0.14.0 causes issues:

error libp2p-bootstrap@0.14.0: The engine "node" is incompatible with this module. Expected version ">=15.0.0". Got "10.24.1"

Just end me...

jakubgs commented 2 years ago

Looks like the highest I can go with NodeJS 10 is libp2p-bootstrap@0.11.0. And the highest version of IPFS library I can get is ipfs@0.49.1. Which pulls in libp2p-bootstrap@0.11.0.

Not sure if that's going to be enough, since that version is from 21st of April 2022, but lets see.

jakubgs commented 2 years ago

Whelp, I upgraded both, but now I get this:

  > yarn run build
...
$ node scripts/build.js
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
Failed to compile.

./src/dapp.js
Cannot find file './embarkArtifacts/embarkjs' in './src'.

error Command failed with exit code 1.

this is why we can't have nice things

jakubgs commented 2 years ago

Apparently the solution for the browserlist error is:

npx browserslist@latest --update-db
jakubgs commented 2 years ago

I tried running node_modules/.bin/embark build but it just gets stuck on these lines:

...
assuming ERCProxy to be an interface
assuming ERC20 to be an interface
assuming ERC20Basic to be an interface
To get more details on interface Smart contracts, go here: https://embark.status.im/docs/troubleshooting.html#Assuming-Contract-to-be-an-interface
LiquidPledging has code associated to it but it's configured as an instanceOf LiquidPledgingMock

And nothing happens.

jakubgs commented 2 years ago

Apparently I should be using embark build livenet based on this config: https://github.com/status-im/liquid-funding/blob/3e7ed35fd30a4fb5af9671515c7a05b35a4dfbcc/embarkConfig/contracts.js#L223 But when I do I see errors like these:

Unsupported account configuration: {}
Check the docs at https://embark.status.im/docs/contracts_deployment.html#Using-accounts-in-a-wallet
Error initiating Web3 provider Error getting the account

And it gets stuck as well.

jakubgs commented 2 years ago

Using strace shows it being stuck on epoll_wait:

 > strace -f -p $(pgrep -f 'node node_modules/.bin/embark build livenet')
strace: Process 1113465 attached with 11 threads
[pid 1113476] futex(0x7fbef80f1228, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 1113475] futex(0x7fbef80f1228, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 1113474] futex(0x7fbef80f1228, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 1113473] futex(0x7fbef80f1228, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 1113471] futex(0x1997580, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 1113470] futex(0x38df188, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 1113469] futex(0x38df188, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 1113468] futex(0x38df188, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 1113467] futex(0x38df188, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, FUTEX_BITSET_MATCH_ANY <unfinished ...>
[pid 1113466] epoll_wait(13,  <unfinished ...>
[pid 1113465] epoll_wait(3, 
jakubgs commented 2 years ago

According to @john-44 this isn't worth fixing currently, so I'm going to leave it be fore now.

The partially working PR is open as a draft, maybe it will help someone in the future get this done: