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

Add default trinity locations to IPC path guesser #1121

Merged
merged 1 commit into from
Oct 28, 2018

Conversation

carver
Copy link
Collaborator

@carver carver commented Oct 22, 2018

What was wrong?

web3py wasn't auto-detecting trinity path

How was it fixed?

Added the trinity paths for mac & linux.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@@ -91,6 +93,14 @@ def get_default_ipc_path(testnet=False):
if os.path.exists(ipc_path):
return ipc_path

base_trinity_path = Path('~').expanduser() / 'Library' / 'Application Support' / 'trinity'
if testnet:
ipc_path = base_trinity_path / 'ropsten' / 'jsonrpc.ipc'
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems problematic. What happens when trinity adds supports for other networks like rinkeby?. A boolean testnet won't be sufficient to guess the path.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can, of course, try all possible paths and check if the path exists?
But what happens when a machine is running both ropsten and rinkeby? :D
It will always pick the first path it comes across!

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, that's problematic. Wondering if we should do something like:

  1. mainnet remains special (and we can also implement some checks to validate that we are indeed connected to the mainnet
  2. use a name-based pattern for all the other networks (rinkeby/kovan/ropsten) and somehow namespace the imports as from web3.auto.ropsten import ...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, I am pretty happy with the idea of dropping support for implicitly detecting the testnet IPC (where from web3.auto.ropsten import w3 is the next-best option for users).

Copy link
Member

Choose a reason for hiding this comment

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

v5 breaking changes...

@@ -91,6 +93,14 @@ def get_default_ipc_path(testnet=False):
if os.path.exists(ipc_path):
return ipc_path

base_trinity_path = Path('~').expanduser() / 'Library' / 'Application Support' / 'trinity'
Copy link
Member

Choose a reason for hiding this comment

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

Is this really where XDG directories end up for osx users?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure, I was cribbing off of Parity since I don't have a Mac to test with.

According to this stackoverflow post it might actually be ~/Library/trinity instead.

We might want to use a more unique namespace on the trinity side, actually, like ~/Library/org.ethereum.trinity. For Mac, Linux, everything.

Copy link
Contributor

Choose a reason for hiding this comment

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

@carver Below is the path on my mac machine:
/Users/voith/.local/share/trinity/mainnet/jsonrpc.ipc

Copy link
Contributor

@voith voith Oct 22, 2018

Choose a reason for hiding this comment

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

However for parity, the path is:
/Users/voith/Library/Application Support/io.parity.ethereum/jsonrpc.ipc

Copy link
Collaborator Author

@carver carver Oct 22, 2018

Choose a reason for hiding this comment

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

Weird, I think I might call that a trinity bug. But I don't know Mac well enough to say whether the Mac convention should override the ~/.local/share default described by https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html for XDG_DATA_HOME.

Copy link
Member

Choose a reason for hiding this comment

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

@carver I'm ok considering the move, but only in the face of an objective reason to do so. I really like the simplicity of XDG and it seems like an easier to find location for most developers.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

but only in the face of an objective reason to do so

Fair enough, and I don't think I can speak for our Mac users preferences here, so I'll drop it for now. I'll make the change in this PR to look in the ~/.local location on Mac.

@carver carver merged commit 4c52f0d into ethereum:master Oct 28, 2018
@carver carver deleted the trinity-auto-ipc branch October 28, 2018 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants