Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove jsonrpc dependency from PortalnetProtocol struct and change default folder name #80

Merged
merged 2 commits into from
Aug 24, 2021

Conversation

ogenev
Copy link
Member

@ogenev ogenev commented Aug 21, 2021

Sometimes, we may want to initialize a portal net protocol without jsonrpc support (for example when running tests or creating "dummy" node).

It will be also good if we can run multiple portal protocol instances simultaneously (for testing req/resp network calls). The current default db folder structure prevent this, because there is a db collusion between the different instances.

This PR removes jsonrpc dependency from PortalnetProtocol struct and adds last 8 chars from local base64 encoded Enr as a suffix to the default data application folder.

@ogenev ogenev force-pushed the refactor-portal-protocol branch from 5d4df7b to 562e763 Compare August 21, 2021 13:08
@ogenev ogenev force-pushed the refactor-portal-protocol branch from 562e763 to 6333f07 Compare August 23, 2021 05:33
@ogenev ogenev changed the title Remove jsonrpc dependency from PortalnetProtocol struct Remove jsonrpc dependency from PortalnetProtocol struct and change default folder name Aug 23, 2021
Copy link
Collaborator

@carver carver 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 on lines +235 to +237
let proto = Self {
discovery: discovery.clone(),
overlay: overlay.clone(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Was there anything important about the move of let proto? It's helpful to me as a reviewer when a PR avoids moving code if the move has no effect, to make the diff smaller and quicker to review.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's right, I will refrain from such moves in the future.

Comment on lines +58 to +61
// Append last 8 enr base64 encoded chars to application dir name
let mut application_string = "Trin_".to_owned();
let len = &local_enr.to_base64().len();
let suffix = &local_enr.to_base64()[len - 8..];
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I were new to trin, and found a directory named like this, I would expect it to be the first few characters of the as-displayed node-id. I understand if that feels like a tangent to you right now, and if so you want to skip it. In that case, maybe you could add a "good first issue" with that suggestion? Seems like a nice bite-size chunk for a newbie who wants to get started.

@ogenev ogenev merged commit d99232f into master Aug 24, 2021
@ogenev ogenev deleted the refactor-portal-protocol branch August 24, 2021 06:41
@ogenev ogenev mentioned this pull request Sep 23, 2021
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants