vacuumlabs / name-bazaar

A peer-to-peer marketplace for the exchange of names registered via the Ethereum Name Service
Eclipse Public License 1.0
0 stars 0 forks source link

Large refactor in case we need to update web3 #35

Open Siegrift opened 3 years ago

Siegrift commented 3 years ago

This is gonna be a longer description of this error which can be seen in current version of the project, which I thought required an update of web3. I tried updating web3, but ran into many issues and the whole process of updating web3 will be challenging. This is just a sneak peak of changes that we need to do.

Original error

The error in the devtools looks like this: devtools_error (The error is intended. We try to resolve a name from an address using PublicResolver. https://docs.ens.domains/dapp-developer-guide/resolving-names#reverse-resolution. Not sure if this should error out, but even if no, this error is handled in the app)

This error lead me to following chain of resources:

Current state

As mentioned, we use web3 version 0.19.0 and it's a dependency of the following libraries:

Updating to newer web3

Some of the libraries we use have changed significantly and stopped using cljs-web3 in favor of cljs-web3-next, which uses web3 version 1.2.0.

When I tried updating district0x/district-server-web3 to latest version another error in district0x/district-server-smart-contracts I found a small issue (https://github.com/district0x/district-server-web3/pull/10), which can be fixed in our codebase by providing :host explicitly in our config.

The problem is that updating this dependency, causes an error in district-server-smart-contracts, which is probably because it should be web3.eth.Contract instead of web3.eth.contract. The full stack trace is:

district.server.smart-contracts/start (called via mount)
district.server.smart-contracts/load-contract-files
cljs-web3.eth/web3-eth/contract-at
cljs-web3.eth/contract
cljs-web3.utils/js-apply

However district0x/district-server-smart-contracts has many breaking changes (see e.g. PR for updating to version 1.1.0 https://github.com/district0x/district-server-smart-contracts/commit/f3350f3c378b5432226a35afbfebc7266745b96b), most of the functions we use in Namebazaar have been removed and others refactored. This library is used for deploying smart contracts in dev mode and tests as well as call in syncer.cljs.

Siegrift commented 3 years ago

The update is costly and we should avoid it if possible.

ladislavdubravsky commented 3 years ago

Server-side web3 was updated in https://github.com/district0x/name-bazaar/pull/175. For ui-side upgrade, work would first need to be done outside of the namebazaar project, in https://github.com/district0x/cljs-web3-next and in the numerous district-ui-* libraries.