Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

feat: implement IPC transport support #260

Merged
merged 16 commits into from
Apr 8, 2021
Merged

Conversation

austinabell
Copy link
Contributor

@austinabell austinabell commented Apr 6, 2021

Motivation

#106 I'm just playing with it to learn more about IPC connections and Tokio

Solution

This is very rough as is. Just opening draft and I'll hopefully cleanup tomorrow and do more extensive testing. The connection seems to happen alright, but a warning is coming up that the method doesn't exist, so I'll look into that tomorrow too Basic requests are now functional, but will test subscription based requests later. Is there any specific workflow that's ideal to test this?

@austinabell austinabell changed the title Implement IPC transport support feat: implement IPC transport support Apr 6, 2021
@gakonst
Copy link
Owner

gakonst commented Apr 6, 2021

You can launch a geth instance like we do here, specify a temp ipc socket directory, connect to it via provider and test it that way. Ideally the socket file should be removed at the end of the test too!

ethers-providers/Cargo.toml Outdated Show resolved Hide resolved
@austinabell
Copy link
Contributor Author

Is there a reason I'm missing for why a BTreeMap is used for the request ID lookups in the ws impl? I don't understand why the BTreeMap overhead is needed for lookups. I'm going to use a regular HashMap, but happy to switch back if there is a good reason.

@@ -24,6 +24,7 @@ serde_json = { version = "1.0.64", default-features = false }
thiserror = { version = "1.0.24", default-features = false }
url = { version = "2.2.1", default-features = false }
auto_impl = { version = "0.4.1", default-features = false }
ahash = { version = "0.7", default-features = false, features = ["std"], optional = true }
Copy link

@tarcieri tarcieri Apr 6, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really need higher performance than SipHasher (I would suggest measuring), and don't care about hashDoS (the ahash crate is not designed to be hashDoS resistant, despite what the author might claim), I would suggest using the twox-hash crate which implements the XXHash algorithm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I'm aware of this, but figured this usage wouldn't require that property, but maybe I'm overlooking some concern. Thanks for the link, I'll look into that, but I'll just change to whatever @gakonst prefers since I don't have an opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've switched it to siphash as a default, but happy to switch to whatever is preferred :)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good. I think using what the standard library provides is a reasonable starting point, and if you need better performance, it would be good to measure whether a 3rd-party hashing crate actually provides an improvement.

@austinabell austinabell marked this pull request as ready for review April 6, 2021 16:38
@austinabell austinabell requested a review from gakonst April 6, 2021 16:40
ethers/examples/ipc.rs Outdated Show resolved Hide resolved
ethers-providers/src/transports/ws.rs Outdated Show resolved Hide resolved
@gakonst gakonst merged commit 42b10cc into gakonst:master Apr 8, 2021
@gakonst
Copy link
Owner

gakonst commented Apr 8, 2021

Merged, thank you! If you want to join, we're discussing the library in this chatroom.

meetmangukiya pushed a commit to meetmangukiya/ethers-rs that referenced this pull request Mar 21, 2022
This commit ports the `seth tx` command to `cast`.
It follows the implementation of `cast block` and includes
the feature to print a specific field in the transaction
as well as printing the result in JSON.

```
$ cast tx --rpc-url <url> <tx-hash> [field]
```

The flag `-j`/`--json` is used to print the result
as JSON.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants