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

Levana Geoblocked Request is not cached locally [200 USDC Reward!] #3356

Closed
MaxMillington opened this issue Jun 18, 2024 · 4 comments
Closed
Labels
Bounty Anyone who can ship a fix to these issues will be awarded OSMO as a thank you!

Comments

@MaxMillington
Copy link
Collaborator

πŸ› Bug Bounty: Tree Shaking Optimization Needed! πŸ› οΈ
Reward: πŸ† 200 USDC πŸ†

We are thrilled to announce a special bug bounty for proficient third-party developers! This is an opportunity to showcase your expertise, make a significant impact, and earn a substantial reward.

Issue Description πŸ“„
Cache Levana Geoblocking Request

Current Behavior ❌
Try refreshing the frontend a few times with the cache enabled. You will see that the levana geoblocked request is not cached, and is remade on every request. This should ideally hit a local cache for the same input country code if you are coming from the same IP.

Expected Behavior πŸ’‘
On page refresh from the same IP address, the levana geoblocking request should not be rerun but instead be fetched from the cache

Requirements for the Bounty 🏁

Submit a pull request with a verified solution to optimize tree shaking.
Demonstrate a measurable decrease in the bundle size as a result of your optimization.
Ensure the fix does not introduce any new bugs or vulnerabilities.
Adhere to our project's coding style and contribution guidelines.
Your solution will undergo a thorough review by our team, and the bounty will be awarded upon approval.

How to Claim Your Bounty πŸ’°

Fork our repository.
Create a new branch dedicated to your optimization fix.
Submit a pull request to our main branch with comprehensive details of your optimization strategy and evidence of the reduced bundle size.

Upon review and approval, the 200 USDC will be transferred to your wallet.

Please Note: All bounty claimants must undergo a KYC (Know Your Customer) process with our finance team to receive the reward. This is a mandatory step to ensure compliance with financial regulations.

We eagerly await your innovative solutions and thank you for contributing to the efficiency and performance of our project!

@MaxMillington MaxMillington added the Bounty Anyone who can ship a fix to these issues will be awarded OSMO as a thank you! label Jun 18, 2024
@UkuLoskit
Copy link
Contributor

I'm not sure if this can be really implemented. How would the browser know the current IP? To go by location, you'd need to ask for location permissions, but that is based on the user's consent only.

@MaxMillington
Copy link
Collaborator Author

@UkuLoskit you could use something like https://api.ipify.org?format=json to get it, but this essentially would mean you have to make that call on every page load instead of the call to Levana. It would only be worth it if the call to https://api.ipify.org?format=json was substantially faster than the call to Levana.

@UkuLoskit how about this, could you run some benchmarking between https://api.ipify.org?format=json and the levana geoblock call? If you can demonstrate that it would not result in a speed increase to make the change, I'll still pay the bounty

@UkuLoskit
Copy link
Contributor

UkuLoskit commented Jun 26, 2024

Very simple benchmark:

for i in $(seq 1 10); do curl -o /dev/null -s -w 'Total: %{time_total}s\n' "https://geoblocked.levana.finance/"; done
Total: 0.222422s
Total: 0.284780s
Total: 0.274545s
Total: 0.239662s
Total: 0.229956s
Total: 0.288214s
Total: 0.277087s
Total: 0.274759s
Total: 0.242830s
Total: 0.287495s

for i in $(seq 1 10); do curl -o /dev/null -s -w 'Total: %{time_total}s\n' "https://api.ipify.org?format=json"; done 
Total: 0.252997s
Total: 0.225216s
Total: 0.245529s
Total: 0.296253s
Total: 0.222399s
Total: 0.236952s
Total: 0.220413s
Total: 0.275408s
Total: 0.264300s
Total: 0.317761s

I intentionally did not use something like wrk or ab, so as to replicate making a request to new connection on initial page load (TCP handshake, no keepalive).

The results are comparable (geoblock is slightly faster), so there is not time to be saved by making this extra request.

@linear linear bot closed this as completed Jul 8, 2024
@MaxMillington
Copy link
Collaborator Author

@UkuLoskit I missed this. Thanks for doing the research. If you message finance@osmosis.team they can help with the bounty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bounty Anyone who can ship a fix to these issues will be awarded OSMO as a thank you!
Projects
None yet
Development

No branches or pull requests

2 participants