-
Notifications
You must be signed in to change notification settings - Fork 56
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
WIP: progress in quoting land #2498
WIP: progress in quoting land #2498
Conversation
6afe055
to
37555c9
Compare
@@ -406,6 +408,10 @@ impl Network { | |||
.send_and_get_responses(&close_nodes, &request, true) | |||
.await; | |||
|
|||
// consider data to be already paid for if 1/3 of the close nodes already have it | |||
let mut peer_already_have_it = 0; | |||
let enough_peers_already_have_it = close_nodes.len() / 3; |
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.
to avoid malicious attacke, better at least have 2
holders.
for close_nodes.len() = 5
, enough_peers_already_have_it
will have a value of 1
, which is somehow vulunerable.
maybe make it std::cmp::max(2, close_nodes.len()/3)
or close_nodes.len() / 2
instead.
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.
Make sense let's go with: close_nodes.len() / 2
.duration_since(UNIX_EPOCH) | ||
.map_err(|e| { | ||
Error::InvalidRequest(format!( | ||
"Payment quote timestamp is invalid for record {pretty_key}: {e}" | ||
)) | ||
})? | ||
.as_secs(); | ||
// NB TODO @mick: can we check if the quote has expired with block time in evmlib? Or should nodes do it manually here? Else keep the block below |
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.
the quote
was made by the node, not related to the block time, hence have to do it manually ?
unless node using block time on quote, which requires an extra query to the block?
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.
We can't really couple a transaction to a quote anymore since we no longer use the transaction's event logs to verify payments. So we'd have to do it manually.
37555c9
into
maidsafe:feat-upgradable-smart-contracts-and-updated-quotation-flow
No description provided.