{"action":"created","issue":{"url":"https://api.github.com/repos/freedomlayer/offst/issues/195","repository_url":"https://api.github.com/repos/freedomlayer/offst","labels_url":"https://api.github.com/repos/freedomlayer/offst/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/freedomlayer/offst/issues/195/comments","events_url":"https://api.github.com/repos/freedomlayer/offst/issues/195/events","html_url":"https://github.com/freedomlayer/offst/issues/195","id":440350875,"node_id":"MDU6SXNzdWU0NDAzNTA4NzU=","number":195,"title":"Index servers are too optimistic (fees not accounted for)","user":{"login":"realcr","id":5255681,"node_id":"MDQ6VXNlcjUyNTU2ODE=","avatar_url":"https://avatars0.githubusercontent.com/u/5255681?v=4","gravatar_id":"","url":"https://api.github.com/users/realcr","html_url":"https://github.com/realcr","followers_url":"https://api.github.com/users/realcr/followers","following_url":"https://api.github.com/users/realcr/following{/other_user}","gists_url":"https://api.github.com/users/realcr/gists{/gist_id}","starred_url":"https://api.github.com/users/realcr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/realcr/subscriptions","organizations_url":"https://api.github.com/users/realcr/orgs","repos_url":"https://api.github.com/users/realcr/repos","events_url":"https://api.github.com/users/realcr/events{/privacy}","received_events_url":"https://api.github.com/users/realcr/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"amosonn","id":3142573,"node_id":"MDQ6VXNlcjMxNDI1NzM=","avatar_url":"https://avatars2.githubusercontent.com/u/3142573?v=4","gravatar_id":"","url":"https://api.github.com/users/amosonn","html_url":"https://github.com/amosonn","followers_url":"https://api.github.com/users/amosonn/followers","following_url":"https://api.github.com/users/amosonn/following{/other_user}","gists_url":"https://api.github.com/users/amosonn/gists{/gist_id}","starred_url":"https://api.github.com/users/amosonn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amosonn/subscriptions","organizations_url":"https://api.github.com/users/amosonn/orgs","repos_url":"https://api.github.com/users/amosonn/repos","events_url":"https://api.github.com/users/amosonn/events{/privacy}","received_events_url":"https://api.github.com/users/amosonn/received_events","type":"User","site_admin":false},"assignees":[{"login":"amosonn","id":3142573,"node_id":"MDQ6VXNlcjMxNDI1NzM=","avatar_url":"https://avatars2.githubusercontent.com/u/3142573?v=4","gravatar_id":"","url":"https://api.github.com/users/amosonn","html_url":"https://github.com/amosonn","followers_url":"https://api.github.com/users/amosonn/followers","following_url":"https://api.github.com/users/amosonn/following{/other_user}","gists_url":"https://api.github.com/users/amosonn/gists{/gist_id}","starred_url":"https://api.github.com/users/amosonn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amosonn/subscriptions","organizations_url":"https://api.github.com/users/amosonn/orgs","repos_url":"https://api.github.com/users/amosonn/repos","events_url":"https://api.github.com/users/amosonn/events{/privacy}","received_events_url":"https://api.github.com/users/amosonn/received_events","type":"User","site_admin":false}],"milestone":null,"comments":18,"created_at":"2019-05-04T17:51:10Z","updated_at":"2019-05-18T21:37:59Z","closed_at":null,"author_association":"COLLABORATOR","body":"## Index servers\r\n\r\nIndex servers do mainly two things:\r\n1. Collect information about the network: For every node, index servers collect his current available credit capacity with his direct friends.\r\n2. Answer queries for routes of certain capacity.\r\n\r\n## Problem with current implementation\r\n\r\nThe current implementation of Index servers is too optimistic, because index servers do not take into account the fees for sending credits along routes.\r\n\r\nFor example, with the current implementation, if a node B wants to send 10 credits to a remote node E, the following route may be proposed:\r\n```text\r\nB -- C -- D -- E\r\n```\r\nWhere the available capacity is as follows:\r\n- B -> C: 10\r\n- C -> D: 10\r\n- D -> E: 10.\r\n\r\nA route with exactly those capacities for sending credits is not sufficient for passing 10 credits, because fees needs to be paid to the intermediate nodes. Therefore, at least the following available capacities are required:\r\n- B -> C: 12\r\n- C -> D: 11\r\n- D -> E: 10\r\n\r\nThe implementation of the Index servers needs to be updated to take into account the payment fees to mediators.\r\n\r\n## Relevant code\r\n\r\nThe relevant code is at: `components/index_server/src/graph/simple_capacity_graph.rs`, which relies on the implementation at `bfs.rs`.\r\n\r\nThe current implementation relies on running a BFS algorithm to find a path of certain capacity from a source node to a destination node. We need to take into account the fees to the transaction mediators in this search algorithm.\r\n\r\nOther relevant code is somewhat far away, at `components/funder/src/credit_calc.rs`. This is the piece of code that contains the actual calculation for fees to mediators during a transaction. The crate offst-index-server should not have the crate offst-funder as a dependency, so maybe it could be a good idea to move credit_calc.rs to offst-proto, possibly now or in the future.\r\n\r\n## Proposal for solution algorithm\r\n\r\nIt might be possible to start a graph search algorithm that goes backwards (From the destination back to the source). The search algorithm can be somewhat like BFS, but we need to make sure that doing something like this is actually sound, and we can't possibly miss valid routes or return wrong routes.\r\n\r\n## How to work on this\r\n\r\nThis is a task that requires some prior research. Please write a short proposal of what you intend to do before you start coding, hopefully I might be able to say something useful that could help you out."},"comment":{"url":"https://api.github.com/repos/freedomlayer/offst/issues/comments/493709021","html_url":"https://github.com/freedomlayer/offst/issues/195#issuecomment-493709021","issue_url":"https://api.github.com/repos/freedomlayer/offst/issues/195","id":493709021,"node_id":"MDEyOklzc3VlQ29tbWVudDQ5MzcwOTAyMQ==","user":{"login":"SonOfLilit","id":14973,"node_id":"MDQ6VXNlcjE0OTcz","avatar_url":"https://avatars0.githubusercontent.com/u/14973?v=4","gravatar_id":"","url":"https://api.github.com/users/SonOfLilit","html_url":"https://github.com/SonOfLilit","followers_url":"https://api.github.com/users/SonOfLilit/followers","following_url":"https://api.github.com/users/SonOfLilit/following{/other_user}","gists_url":"https://api.github.com/users/SonOfLilit/gists{/gist_id}","starred_url":"https://api.github.com/users/SonOfLilit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonOfLilit/subscriptions","organizations_url":"https://api.github.com/users/SonOfLilit/orgs","repos_url":"https://api.github.com/users/SonOfLilit/repos","events_url":"https://api.github.com/users/SonOfLilit/events{/privacy}","received_events_url":"https://api.github.com/users/SonOfLilit/received_events","type":"User","site_admin":false},"created_at":"2019-05-18T21:37:59Z","updated_at":"2019-05-18T21:37:59Z","author_association":"NONE","body":"Since most end-users are going to have a \"bank\" node always be their first\nnode, I think we should allow that bank node to offer the user static fees\nand take up the difference.\n\nOn Sat, May 18, 2019, 8:27 PM real <notifications@github.com> wrote:\n\n> @SonOfLilit <https://github.com/SonOfLilit> :\n>\n> so if making more transactions doesn't cost the company more but making\n> the same amount of transactions with higher amounts costs linearly more,\n> you'd want prices to depend linearly on transaction size, etc'\n>\n> Hopefully we have got this covered with the new proposal for affine fees: m*x\n> + n fees for a transaction of size x credits, where 0 <= m < 1 and n are\n> fully configurable for every directed edge.\n>\n> Banks also make you pay $25 from your pocket to any middleman node, and\n> won't tell you in advance how many middle nodes there are (!!!)\n>\n> With the proposed design the buying experience for an end user should be\n> as follows:\n>\n>    - You pick an item you want to buy.\n>    - You click on buying and then a cheapest route is chosen for you. The\n>    route determines the fees.\n>    - You get to choose if you agree to the fees or not.\n>\n> This somehow breaks the rule of \"simple and predictable\" fees for the end\n> user, but at least the user always knows before the payment happens exactly\n> what the fees are going to be.\n>\n> —\n> You are receiving this because you were mentioned.\n> Reply to this email directly, view it on GitHub\n> <https://github.com/freedomlayer/offst/issues/195?email_source=notifications&email_token=AAADU7LGIXHUNR32VDXTNYLPWA37FA5CNFSM4HKZNHGKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODVWSTPA#issuecomment-493693372>,\n> or mute the thread\n> <https://github.com/notifications/unsubscribe-auth/AAADU7OIFWOQ66L4YBQ4GCLPWA37FANCNFSM4HKZNHGA>\n> .\n>\n"}}
{"actor":{"display_login":"SonOfLilit"}}