atomicDEX-API icon indicating copy to clipboard operation
atomicDEX-API copied to clipboard

Consider updating `web3` crate

Open sergeyboyko0791 opened this issue 3 years ago • 4 comments

I tried to update web3 crate to use its web3::transport::Eip1193 as we discussed https://github.com/KomodoPlatform/atomicDEX-API/pull/1551#discussion_r1035946680

I seem to update the dependencies correctly by forking parity-ethereum repo. But then I faced too many compilation errors that should be handled on our side. They are mostly due to the changed relationship between ethereum-types, rlp and web3 crates. Errors: https://gist.github.com/sergeyboyko0791/b3d1f2b4736ae98c3434bd76deb0db3e

I think that the effort to update the web3 crate doesn't worth it taking also into account that web3::transport::Eip1193 should be wrapped into a Send + Sync structure (using event-driven pattern).

cc: @artemii235

sergeyboyko0791 avatar Dec 06 '22 14:12 sergeyboyko0791

A dev state (not to forget): https://github.com/KomodoPlatform/atomicDEX-API/commit/c87e84c056ff2ecc7608c7a8724c1b3df850abc2

sergeyboyko0791 avatar Dec 06 '22 14:12 sergeyboyko0791

I faced a problem when tried to send RPC requests using an out-of-dated web3 crate: they used an old ethereum_types::U256 type that requires the number to start with 0x prefix on deserialization, but MetaMask RPC sometimes returns without the prefix.

So I decided to finish updating web3 crate. What I've gotten: https://github.com/KomodoPlatform/atomicDEX-API/commit/476e53c2fed7fb0abcd6de9532eddd698a6e0d51

sergeyboyko0791 avatar Dec 08 '22 17:12 sergeyboyko0791

There is a statement in the web3 client that we use https://crates.io/crates/web3 that it is not actively maintained and for new projects it is recommended to use another client: https://github.com/gakonst/ethers-rs. Maybe we should consider changing it too

dimxy avatar Feb 01 '24 18:02 dimxy

https://github.com/gakonst/ethers-rs is being deprecated too. This is the alternative https://github.com/alloy-rs/alloy and this https://github.com/foundry-rs/foundry

dimxy avatar Feb 04 '24 14:02 dimxy