Skip to content
This repository was archived by the owner on Feb 17, 2024. It is now read-only.

Mobile discovery#28

Merged
tkporter merged 13 commits intomasterfrom
trevor/disc
Sep 2, 2020
Merged

Mobile discovery#28
tkporter merged 13 commits intomasterfrom
trevor/disc

Conversation

@tkporter
Copy link
Copy Markdown

@tkporter tkporter commented Aug 7, 2020

This should be merged when celo-org/celo-blockchain#1132 is merged

  • Allows configuration of noDiscovery and bootnodeEnodes to enable discovery
  • Allows configuration of HTTP RPC server related values
  • Adds logFile and logFileLogLevel configuration for iOS, which did not exist previously

@tkporter tkporter requested a review from cmcewen August 7, 2020 18:30
Copy link
Copy Markdown

@nategraf nategraf left a comment

Choose a reason for hiding this comment

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

Looks like you are also going to solve what I had in mind for celo-org/celo-monorepo#4439
This is super useful! 🙌

Comment thread README.md Outdated
noDiscovery: false, // --nodiscover / determines if the node will not participate in p2p discovery (v5)
syncMode: 5, // the number associated with a sync mode in `celo-blockchain/mobile/geth.go`
// HTTP RPC server - only intended for development & debugging
httpHost: '0.0.0.0', // host of the server
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think we should suggest opening RPC on 0.0.0.0:8545 because that could allow anyone on the local network to access the node and completely compromise the node, possible also attacking the device through the javascript execution features allowed by the debug API. Opening on 127.0.0.1:8545 is better. With this, we should definitely add a stronger warning here about only using this in debug mode because opening the network socket allows any app on the device to access the node with full permissions.

Comment thread ios/RNGeth.swift
nodeconfig.setValue(ipcPath, forKey: "IPCPath")
assert(nodeconfig.ipcPath == ipcPath)
}
if let logFile = config?["logFile"] as? String {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍 I actually wanted to bring this up, I noticed it was happening only on android.

Copy link
Copy Markdown
Contributor

@jmrossy jmrossy left a comment

Choose a reason for hiding this comment

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

LGTM!

Comment thread README.md Outdated
Comment thread README.md Outdated
networkID: networkID, // --networkid / Network identifier (integer, 0=Olympic (disused), 1=Frontier, 2=Morden (disused), 3=Ropsten) (default: 1)
maxPeers: 0, // --maxpeers / Maximum number of network peers (network disabled if set to 0) (default: 25)
genesis: genesis, // genesis.json file
nodeDir: '.private-ethereum', // --datadir / Data directory for the databases and keystore
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Not a new change but at some point can update to celo

Copy link
Copy Markdown

@annakaz annakaz left a comment

Choose a reason for hiding this comment

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

Looking ready to ship

Comment thread README.md
"enode://YYYY@Y[::]:YYYY"
],
"networkID": networkID, // --networkid / Network identifier (integer, 0=Olympic (disused), 1=Frontier, 2=Morden (disused), 3=Ropsten) (default: 1)
"networkID": networkID, // --networkid / Network identifier (integer, 42220=mainnet, 62320=baklava (testnet), 44787=alfajores (testnet)) (default: 1)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread README.md
"maxPeers": 0, // --maxpeers / Maximum number of network peers (network disabled if set to 0) (default: 25)
"genesis": genesis, // genesis.json file
"nodeDir": ".private-ethereum", // --datadir / Data directory for the databases and keystore
"nodeDir": ".celo", // --datadir / Data directory for the databases and keystore
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thinking out loud, we'll want to make sure an update from Valora 1.0.1 to 1.1.0 with these changes doesn't throw errors due to the changed nodeDir. Agree we should make this change here though 👍

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fwiw the approach the app does is specifying .${DEFAULT_TESTNET} as the nodeDir, I think (not totally sure) it tolerates a change well

@tkporter tkporter merged commit 1caec12 into master Sep 2, 2020
@tkporter tkporter deleted the trevor/disc branch September 2, 2020 00:19
mergify Bot pushed a commit to celo-org/celo-monorepo that referenced this pull request Sep 2, 2020
### Description

Should not be merged until valora-xyz/react-native-geth#28 is merged (which itself relies upon celo-org/celo-blockchain#1132), and then the react-native-geth version in this PR will be updated.

This uses the enodes that are used for static nodes as bootnodes for discovery. The current bootnodes that are deployed do not support the type of discovery required by mobile clients (discovery v5), but the static nodes do. Having more nodes as bootnodes will also help with discovery speed & diversity of the nodes discovered.

When testing on baklava with both static nodes and discovery enabled, peering was nearly immediate. When only testing with discovery enabled and no static nodes, peering was very quick (< a few seconds). A few times I found when only relying upon discovery that no peers would be found, so I recommend keeping static nodes & discovery for the time being.

### Other changes

I added some instructions on how to attach to the geth instance on the app.

### Tested

Ran a lot on android & iOS devices

### Related issues

### Backwards compatibility

Requires updates from react-native-geth (valora-xyz/react-native-geth#28) and celo-blockchain (celo-org/celo-blockchain#1132) to work as intended
ewilz pushed a commit to ewilz/celo-monorepo that referenced this pull request Sep 29, 2020
### Description

Should not be merged until valora-xyz/react-native-geth#28 is merged (which itself relies upon celo-org/celo-blockchain#1132), and then the react-native-geth version in this PR will be updated.

This uses the enodes that are used for static nodes as bootnodes for discovery. The current bootnodes that are deployed do not support the type of discovery required by mobile clients (discovery v5), but the static nodes do. Having more nodes as bootnodes will also help with discovery speed & diversity of the nodes discovered.

When testing on baklava with both static nodes and discovery enabled, peering was nearly immediate. When only testing with discovery enabled and no static nodes, peering was very quick (< a few seconds). A few times I found when only relying upon discovery that no peers would be found, so I recommend keeping static nodes & discovery for the time being.

### Other changes

I added some instructions on how to attach to the geth instance on the app.

### Tested

Ran a lot on android & iOS devices

### Related issues

### Backwards compatibility

Requires updates from react-native-geth (valora-xyz/react-native-geth#28) and celo-blockchain (celo-org/celo-blockchain#1132) to work as intended
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.

6 participants