-
Notifications
You must be signed in to change notification settings - Fork 9
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
Server only api #37
Closed
Closed
Server only api #37
Changes from all commits
Commits
Show all changes
52 commits
Select commit
Hold shift + click to select a range
d173ad2
add validation for the 'from' an 'to' params of the 'compute_transfer…
jaensen a24e84d
fixed format strings for error messages
jaensen 5144dfb
fixed format strings for error messages
jaensen b19584e
moved the rpc call dispatching to rpc_handler.rs and the function imp…
jaensen 1ad37fe
added a CallContext for loggin of rpc requests and moved the rpc call…
jaensen de6324f
log startup info
jaensen 2201bf9
dropped the incremental chunked results for simpler code. + log resul…
jaensen fd7268c
removed all code that's not directly required for the server use of t…
jaensen d7579f4
more logging
jaensen 6668e27
trial and erroring a memory leak :/
jaensen b7992c4
more logging, more dropping
jaensen 5b10d16
removed trace logging after the pathfinder ran for ~ 8h without issues.
jaensen 96befac
unfinished: Allow to 'push' graph updates via http.
jaensen 2aece90
get the test-data from the 'dev' branch
jaensen 5320349
trying different trust_transfer_limit implementation
jaensen 0626107
restored 'trust_transfer_limit' logic
jaensen cd108e0
fixed build warning
jaensen 80aed20
refactored the compute_flow function to better show the data flow and…
jaensen 7b89934
moved 'trust_transfer_limit' from safe to db
jaensen ca465fb
re-added fn default() -> CallContext for use in tests
jaensen e268db6
add capacity edges from users that hold accepted tokens to orgas
jaensen 159a951
removed unnecessary field
jaensen 5950ab8
add flow-edges from users with trusted tokens to the organizations th…
jaensen ee593af
OP-159: fix(workflow): add feature/server_only branch trigger, remove…
almereyda 60fa1b1
Merge pull request #42 from CirclesUBI/fix/op-159-server_only
almereyda 4baf76d
Edit compute_edges
9b1d4e8
update with fixed workflows
JacqueGM 48fce9e
fix format
JacqueGM b37076d
Merge branch 'dev' of https://github.com/CirclesUBI/pathfinder2 into …
JacqueGM 7f3050a
fix format
JacqueGM ad3398d
update lint issues
JacqueGM a6f2198
fix lint
JacqueGM a9fd2d2
fix map and lint
JacqueGM 0d273ed
update branch
JacqueGM bbac07b
avoid building for server_only for now
JacqueGM 2f07179
fix lint and add test back
JacqueGM 2c187c0
git test fmt
JacqueGM 9e7d27a
add default trait
JacqueGM 329302d
adding test but with error with call_context
JacqueGM 9b7db63
fix format
JacqueGM 98b3c17
fix call_context error
JacqueGM cf3b970
remove some test to start
JacqueGM d3125e9
Exclude edges with equeal source and destination
4091056
Make compiler happy
a022f69
Resolve merge conflicts
c94dbc8
Remove repeated comments
bc2ac09
Fix imports
a0d0c57
Merge pull request #43 from CirclesUBI/compute-edges-all
JacqueGM e8aec86
update build work
JacqueGM 18d2cc3
apply format changes
JacqueGM d515a68
update clippy failing
JacqueGM 9c53202
fix fmt
JacqueGM File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
use crate::graph::adjacencies::Adjacencies; | ||
use crate::graph::Node; | ||
use crate::types::{Address, U256}; | ||
use std::cmp::min; | ||
use std::collections::{HashMap, VecDeque}; | ||
|
||
pub fn augmenting_path( | ||
source: &Address, | ||
sink: &Address, | ||
adjacencies: &mut Adjacencies, | ||
max_distance: Option<u64>, | ||
) -> (U256, Vec<Node>) { | ||
let mut parent = HashMap::new(); | ||
if *source == *sink { | ||
return (U256::default(), vec![]); | ||
} | ||
let mut queue = VecDeque::<(Node, (u64, U256))>::new(); | ||
queue.push_back((Node::Node(*source), (0, U256::default() - U256::from(1)))); | ||
while let Some((node, (depth, flow))) = queue.pop_front() { | ||
if let Some(max) = max_distance { | ||
// * 3 because we have three edges per trust connection (two intermediate nodes). | ||
if depth >= max * 3 { | ||
continue; | ||
} | ||
} | ||
for (target, capacity) in adjacencies.outgoing_edges_sorted_by_capacity(&node) { | ||
if !parent.contains_key(&target) && capacity > U256::default() { | ||
parent.insert(target.clone(), node.clone()); | ||
let new_flow = min(flow, capacity); | ||
if target == Node::Node(*sink) { | ||
return ( | ||
new_flow, | ||
trace(parent, &Node::Node(*source), &Node::Node(*sink)), | ||
); | ||
} | ||
queue.push_back((target, (depth + 1, new_flow))); | ||
} | ||
} | ||
} | ||
(U256::default(), vec![]) | ||
} | ||
|
||
fn trace(parent: HashMap<Node, Node>, source: &Node, sink: &Node) -> Vec<Node> { | ||
let mut t = vec![sink.clone()]; | ||
let mut node = sink; | ||
loop { | ||
node = parent.get(node).unwrap(); | ||
t.push(node.clone()); | ||
if *node == *source { | ||
break; | ||
} | ||
} | ||
t | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the current implementation sorting only by capacity? I understand that we generating here a priority for the edges to be selected for the final path. Is here the place where we could also prioritize the edges that transfer tokens to their owners?