Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Add UPnP Support #1334

Merged
merged 211 commits into from
Jul 6, 2019
Merged

Add UPnP Support #1334

merged 211 commits into from
Jul 6, 2019

Conversation

notlesh
Copy link
Contributor

@notlesh notlesh commented Apr 25, 2019

This begins work on Consensys/protocol-BountiedWork#1

PR description

My initial work to wrap jupnp functionality. This is largely pulled from my repository at https://github.com/notlesh/jupnp-igd-tools where I developed and tested this code.

This is currently a work-in-progress.

@CLAassistant
Copy link

CLAassistant commented Apr 25, 2019

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

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

This is a good start. Before committing it to the main repository we will need to see it wired into the startup of Pantheon and see it mapping ports.

* @param type is the type descriptor of the desired service
* @return the first instance of the given type, or null if none
*/
@SuppressWarnings("rawtypes")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the code so that it won't throw raw type warnings. This is not a warning we generally suppress.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The problem here is that the underlying library (jupnp) returns raw types itself. If you have a good solution, I'll gladly implement it.

Example: the registry listener "bleeds" this rawtype through an interface method: https://github.com/jupnp/jupnp/blob/ca13ee84ae4a03be93c6bb109b27668d5406c1c5/bundles/org.jupnp/src/main/java/org/jupnp/registry/DefaultRegistryListener.java#L85

And, for reference, Device: https://github.com/jupnp/jupnp/blob/master/bundles/org.jupnp/src/main/java/org/jupnp/model/meta/Device.java

@notlesh notlesh changed the title Initial commit of UPnP functionality using jupnp WIP: Initial commit of UPnP functionality using jupnp May 3, 2019
notlesh and others added 23 commits May 3, 2019 00:56
* Make the contract size limit configurable in the genesis config, making it possible to override milestone based configurations in a private network.
…SysEng#1224)

* [PIE-1224] Different request limits for different request types

- create `EthLimits` with max size of response according to geth (https://github.com/ethereum/go-ethereum/blob/master/eth/downloader/downloader.go)
- update `EthServer` to use those constants limits instead of the default one
- remove requestLimit from EthServer and EthProtocolManager constructor
fix PIE-1224

* eth wire protocol request limits

- add fields in `SynchronizerConfiguration` to configure per type request limit
- update `EthServer` constructor to add new fields
- update `EthProtocolManager` and subclasses to support new fields
- update unit tests accordingly

* Update SynchronizerConfiguration.java

* Update EthProtocolManagerTestUtil.java

* Update EthServerTest.java

* Update EthProtocolManagerTest.java

* Update EthServerTest.java

* fix after review discussion

- remove per type request limit configuration from `SynchronizerConfiguration`.
- add `EthServer` constructor without new fields that use default values.
- update unit tests accordingly
- update instanciation of different `PantheonController` accordingly

* Update EthServerTest.java

* fix review

- spotless
- fix clean up review comment

* spotlessApply
)

* Add clarity to error messages in eea_sendRawTransaction

* Refactor private acceptance tests and add tests for exception
- change option name
- update warning condition on dependency check
…egaSysEng#1226)

* [PRIV-41] Use metrics system for private state db

- Use PrivacyParametersBuilder to build PrivacyParameters
- refactor PrivacyParameters to expose default options
- refactor test builders to use PrivacyParameters.DEFAULT
- Use URI in Enclave

* Fix: enclave tests from bad merge

* Fix privacy acceptance tests after db configuration changes

* Switch to use nested class for PrivacyParametersBuilder
There is no need to keep entire blocks during import after they have
been imported.  Keep just the hashes instead.
* EWP options management

- create `EthereumWireProtocolConfiguration` object to hold per request limits
- add `EthereumWireProtocolConfiguration` in `SynchronizerConfiguration`
- create `PositiveNumber` class to handle command line options representing a positive number (a request limit for example)
- add unit tests to cover the new options
fixes PIE-1502

* Update EthereumWireProtocolConfiguration.java

* Update PantheonCommandTest.java

* fix tests

* spotlessApply

* fix tests and javadoc

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <[email protected]>

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <[email protected]>

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <[email protected]>

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <[email protected]>

* fix

* fix PR discussion

* Update EthereumWireProtocolConfiguration.java
* EWP options management

- create `EthereumWireProtocolConfiguration` object to hold per request limits
- add `EthereumWireProtocolConfiguration` in `SynchronizerConfiguration`
- create `PositiveNumber` class to handle command line options representing a positive number (a request limit for example)
- add unit tests to cover the new options
fixes PIE-1502

* Update EthereumWireProtocolConfiguration.java

* Update PantheonCommandTest.java

* fix tests

* spotlessApply

* fix tests and javadoc

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <[email protected]>

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <[email protected]>

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <[email protected]>

* Update pantheon/src/main/java/tech/pegasys/pantheon/cli/PantheonCommand.java

Co-Authored-By: abdelhamidbakhta <[email protected]>

* fix

* fix PR discussion

* Update EthereumWireProtocolConfiguration.java

* fix PR 1246 discussion

PegaSysEng#1246 (comment)
@mbaxter
Copy link
Contributor

mbaxter commented Jun 28, 2019

Hey @notlesh - can you ping me with a top-level comment when you're ready for another review?

@notlesh
Copy link
Contributor Author

notlesh commented Jul 2, 2019

@mbaxter I have a couple questions regarding your PR review, and beyond that the only outstanding item is moving the upnp package. Can you take a quick look at the non-resolved conversations (where you'll find my questions)?

You can also find me in gitter if you'd like -- I may be quiet, but I'll respond to PMs.

@notlesh
Copy link
Contributor Author

notlesh commented Jul 3, 2019

@mbaxter I believe I've addressed all of your feedback from your last review, please feel free to re-review. Thanks!

@mbaxter
Copy link
Contributor

mbaxter commented Jul 3, 2019

Pushed up a few small changes here. I think once those are in this should be merge ready!

@mbaxter mbaxter changed the title WIP: Initial commit of UPnP functionality using jupnp Add UPnP Support Jul 3, 2019
@notlesh
Copy link
Contributor Author

notlesh commented Jul 3, 2019

Looks good to me.

@shemnon
Copy link
Contributor

shemnon commented Jul 4, 2019

Talked with Meredith and it looks good to go once we fix the unit test failure.

Generally we don't throw exceptions during start and stop. If we are already started we just return immediately (from a guard block) and same with stop if we are not started. In both cases we LOG.warn our failures. The impact is that this is hard to unit test the logging with Log4J2, the log results tend to be flakey. So if we fixed the start and stop methods to match the pattern in other services then the two unit tests turn into don't throw tests, verifying startup (with the two start) and no startup (with the stop before start) with the mocks.

@shemnon
Copy link
Contributor

shemnon commented Jul 6, 2019

LGTM. The build error has to do with the reference tests that were updated, there is a git submodule that may be breaking it. Those look to be unrelated to your changes and possibly may be a Jenkins issue, so I'll take the tasks to see what needs to be done to fix it. Hopefully this is the last hurdle.

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.