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 --min-version= option to gateway #13

Closed
tbrand opened this issue Oct 25, 2022 · 7 comments
Closed

Add --min-version= option to gateway #13

tbrand opened this issue Oct 25, 2022 · 7 comments
Assignees
Labels
gateway About gateway

Comments

@tbrand
Copy link
Contributor

tbrand commented Oct 25, 2022

Overview

This is a sub-task of #5

For security and stability issues, the gateway should be able to filter the minimum version of the node to be randomly selected. The --min-version option will result in a random selection of nodes from among nodes with versions newer than that version.

For example, If you do not want to target versions below version 0.1.5, specify this.

--min-version=0.1.5

Implementation

  • Nodes already return their version to the node pool and the node pool returns them to gateways. (Returning version #7)
  • Here is the version gateway received.

So all you have to do for this issue is

  • Add new option --min-version to this struct.
  • Filter the unselected nodes here. Remove the nodes below the version.
  • For version comparison, you can add semver crate.
@tbrand tbrand added the gateway About gateway label Oct 25, 2022
@Darth-Ness
Copy link
Contributor

Okay, I'm going to try to do this one.

@Darth-Ness
Copy link
Contributor

All right, I made an implementation. Would I test it by running
rustc main.rs then executing the binary?

@tbrand
Copy link
Contributor Author

tbrand commented Oct 26, 2022

Awesome. You should do cargo run -p negy-gateway to build and run the package. You can replace negy-gateway with negy-node or negy-node-pool if you edit those files. To confirm the behavior of the implementation, execute docker-compose up --build. After every container is up, execute curl https://example.com -x http://localhost:3000 and confirm the result.

Thanks!

@Darth-Ness
Copy link
Contributor

docker-compose up --build

Thanks for the instructions.
The cargo command works, but the
docker-compse up --build command outputs

Version in "./docker-compose.yml" is unsupported. You might be seeing this error because you're using the wrong Compose file version. Either specify a supported version (e.g "2.2" or "3.3") and place your service definitions under the services key, or omit the version key and place your service definitions at the root of the file to use version 1.
For more on the Compose file format versions, see https://docs.docker.com/compose/compose-file/

Does this have something to with my version of docker-compose?
If so docker-compse version outputs

docker-compose version 1.21.0, build unknown
docker-py version: 3.4.1
CPython version: 3.7.3
OpenSSL version: OpenSSL 1.1.1n 15 Mar 2022

@tbrand
Copy link
Contributor Author

tbrand commented Oct 27, 2022

Yes, you should update docker-compose version. 👍

@Darth-Ness
Copy link
Contributor

Now that this has been implemented in #22, you should be able to close this.

@tbrand tbrand closed this as completed Nov 1, 2022
@tbrand
Copy link
Contributor Author

tbrand commented Nov 1, 2022

awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gateway About gateway
Projects
None yet
Development

No branches or pull requests

2 participants