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

Ignore unknown answers #831

Merged
merged 3 commits into from
Dec 23, 2022
Merged

Ignore unknown answers #831

merged 3 commits into from
Dec 23, 2022

Conversation

diegomrsantos
Copy link
Collaborator

No description provided.

Menduist
Menduist previously approved these changes Dec 23, 2022
libp2p/services/autonatservice.nim Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Dec 23, 2022

Codecov Report

Merging #831 (5b2cc8a) into unstable (676786b) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##           unstable     #831      +/-   ##
============================================
- Coverage     83.69%   83.67%   -0.02%     
============================================
  Files            82       82              
  Lines         14907    14908       +1     
============================================
- Hits          12476    12474       -2     
- Misses         2431     2434       +3     
Impacted Files Coverage Δ
libp2p/services/autonatservice.nim 92.63% <100.00%> (+2.20%) ⬆️
libp2p/protocols/secure/secure.nim 71.15% <0.00%> (-3.85%) ⬇️
libp2p/muxers/mplex/mplex.nim 88.23% <0.00%> (-0.85%) ⬇️
libp2p/transports/wstransport.nim 85.26% <0.00%> (ø)

alrevuelta
alrevuelta previously approved these changes Dec 23, 2022
Copy link
Contributor

@alrevuelta alrevuelta left a comment

Choose a reason for hiding this comment

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

lgtm! thanks!

We can leave it for another PR, but I think it would be nice to have a couple of simple tests wihtout the autonat stub, so using a real autonat. I would suggest just two tests:

  • 3 peers, all of them with autonat. peer1 connects to peer2/3. We can see its reachable with 100% confidence.
  • 3 peers, where peer2 supports autonat but peer3 does not. Here we should see that node1 is also labeled as Reachable with 100 confidence, since peer3 responses are dicarded due to not supporting autonat.

imho the stub is only useful for scenarios that we can't reproduce, like NotReachable. For the rest, the closer we get to a real scenario, the better.

@diegomrsantos
Copy link
Collaborator Author

lgtm! thanks!

We can leave it for another PR, but I think it would be nice to have a couple of simple tests wihtout the autonat stub, so using a real autonat. I would suggest just two tests:

  • 3 peers, all of them with autonat. peer1 connects to peer2/3. We can see its reachable with 100% confidence.
  • 3 peers, where peer2 supports autonat but peer3 does not. Here we should see that node1 is also labeled as Reachable with 100 confidence, since peer3 responses are dicarded due to not supporting autonat.

imho the stub is only useful for scenarios that we can't reproduce, like NotReachable. For the rest, the closer we get to a real scenario, the better.

I agree. That's how I started testing, but it was harder to know when to finish the test. I used sleepAsync which worked on Linux and Mac, but didn't with Nim 1.2 on Windows. Using sleepAsync doesn't seem like a reliable way to do that anyway. It was easier to solve it with the stub, but there might be another solution too.

Co-authored-by: Tanguy <tanguy@status.im>
@Menduist
Copy link
Contributor

Can't you wait for the callback to be called?

@diegomrsantos
Copy link
Collaborator Author

Can't you wait for the callback to be called?

Probably yes, a lot of refactoring happened since then.

@diegomrsantos diegomrsantos merged commit 9532bff into unstable Dec 23, 2022
@diegomrsantos diegomrsantos deleted the autonat-ignore-unknown-ans branch December 23, 2022 15:49
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