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

Fix unintentional creation of defaultdict key by __getitem__ calls #1110

Merged
merged 2 commits into from
Nov 22, 2021

Conversation

ezdac
Copy link
Contributor

@ezdac ezdac commented Nov 19, 2021

Before, the whitelisting mechanism of the services had a bug:

Several __getitem__ calls meant to be readonly to the internal defaultdict that tracks the whitelisted user-addresses were unintentionally causing the address being added to the dict with a default-value.
This in the end let the address pass the whiltelisting check:

if address is None or not self.is_address_known(address):
return

Which can potentially lead to performance issues and heavy load on the matrix servers.

This PR fixes this issue.

@auto-assign auto-assign bot requested a review from konradkonrad November 19, 2021 12:04
@ezdac ezdac force-pushed the fix/defaultdict_getitem branch from 588d48e to fc683b5 Compare November 19, 2021 13:23
@codecov
Copy link

codecov bot commented Nov 19, 2021

Codecov Report

Merging #1110 (3e4004b) into master (091c6ca) will decrease coverage by 0.09%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1110      +/-   ##
==========================================
- Coverage   88.80%   88.71%   -0.10%     
==========================================
  Files          43       43              
  Lines        3449     3447       -2     
  Branches      430      429       -1     
==========================================
- Hits         3063     3058       -5     
- Misses        279      282       +3     
  Partials      107      107              
Impacted Files Coverage Δ
src/raiden_libs/user_address.py 74.70% <100.00%> (-0.20%) ⬇️
src/raiden_libs/blockchain.py 84.21% <0.00%> (-0.88%) ⬇️
src/pathfinding_service/api.py 93.63% <0.00%> (-0.64%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 091c6ca...3e4004b. Read the comment docs.

Copy link
Contributor

@palango palango left a comment

Choose a reason for hiding this comment

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

Nice find! 🏅

Can you, while you're at it also lower the codecov coverage target: https://github.com/raiden-network/raiden-services/blob/master/.codecov.yml#L6 to something we hit, e.g. 88?

@ezdac ezdac merged commit cce18ef into raiden-network:master Nov 22, 2021
@ezdac ezdac deleted the fix/defaultdict_getitem branch November 22, 2021 09:32
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.

2 participants