[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 126/164: Added removing key from strata
From: |
gnunet |
Subject: |
[gnunet] 126/164: Added removing key from strata |
Date: |
Fri, 30 Jul 2021 15:33:12 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
commit 05f3792850a54a3b013fd04b52b857ef59fea956
Author: Elias Summermatter <elias.summermatter@seccom.ch>
AuthorDate: Sun May 30 17:11:09 2021 +0200
Added removing key from strata
---
src/setu/gnunet-service-setu.c | 70 +++++++++++--------------
src/setu/gnunet-service-setu_strata_estimator.c | 20 +++----
src/setu/perf_setu_api.c | 2 +-
src/setu/setu_api.c | 2 +-
4 files changed, 44 insertions(+), 50 deletions(-)
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c
index 96ea446a2..8b74d20b1 100644
--- a/src/setu/gnunet-service-setu.c
+++ b/src/setu/gnunet-service-setu.c
@@ -440,7 +440,7 @@ struct Operation
* Lower bound for the set size, used only when
* byzantine mode is enabled.
*/
- int byzantine_lower_bound;
+ uint64_t byzantine_lower_bound;
/**
* Unique request id for the request from a remote peer, sent to the
@@ -465,32 +465,27 @@ struct Operation
/**
* Number of Element per bucket in IBF
*/
- unsigned int ibf_number_buckets_per_element;
+ uint8_t ibf_number_buckets_per_element;
/**
* Set difference is multiplied with this factor
* to gennerate large enought IBF
*/
- uint64_t ibf_bucket_number_factor;
+ uint8_t ibf_bucket_number_factor;
/**
* Defines which site a client is
* 0 = Initiating peer
* 1 = Receiving peer
*/
- unsigned int peer_site;
+ uint8_t peer_site;
- /**
- * Count active passive switches to generate different salts
- */
-
- unsigned int active_passive_switches;
/**
* Local peer element count
*/
- uint32_t local_element_count;
+ uint64_t local_element_count;
/**
* Mode of operation that was chosen by the algorithm
@@ -514,12 +509,12 @@ struct Operation
uint64_t total_elements_size_local;
/**
- * Practical limit of number of elements in set
+ * Limit of number of elements in set
*/
- uint64_t upper_element_boundary;
+ uint64_t byzantine_upper_bound;
/**
- * is the count of already pased differential sync iterations
+ * is the count of already passed differential sync iterations
*/
uint8_t differential_sync_iterations;
@@ -774,10 +769,10 @@ static const struct GNUNET_CONFIGURATION_Handle *setu_cfg;
*/
#if MEASURE_PERFORMANCE
struct perf_num_send_received_msg {
- int sent;
- int sent_var_bytes;
- int received;
- int received_var_bytes;
+ uint64_t sent;
+ uint64_t sent_var_bytes;
+ uint64_t received;
+ uint64_t received_var_bytes;
};
/**
@@ -797,10 +792,10 @@ struct per_store_struct
struct perf_num_send_received_msg offer;
struct perf_num_send_received_msg done;
struct perf_num_send_received_msg over;
- int se_diff;
- int se_diff_remote;
- int se_diff_local;
- int active_passive_switches;
+ uint64_t se_diff;
+ uint64_t se_diff_remote;
+ uint64_t se_diff_local;
+ uint64_t active_passive_switches;
uint8_t mode_of_operation;
};
@@ -867,7 +862,7 @@ load_config(struct Operation * op) {
GNUNET_CONFIGURATION_get_value_number(setu_cfg,"BOUNDARIES",
"UPPER_ELEMENT", &number);
- op->upper_element_boundary = number;
+ op->byzantine_upper_bound = number;
op->peer_site = 0;
@@ -881,7 +876,7 @@ load_config(struct Operation * op) {
* @return bytes used
*/
static int
-sum_sent_received_bytes(int size, struct perf_num_send_received_msg
perf_num_send_received_msg) {
+sum_sent_received_bytes(uint64_t size, struct perf_num_send_received_msg
perf_num_send_received_msg) {
return (size * perf_num_send_received_msg.sent) +
(size * perf_num_send_received_msg.received) +
perf_num_send_received_msg.sent_var_bytes +
@@ -998,7 +993,7 @@ estimate_best_mode_of_operation(uint64_t avg_element_size,
uint8_t sizeof_done_header = 4;
uint8_t rtt_min_full = 2;
uint8_t sizeof_request_full = 4;
- uint16_t estimated_total_diff = (est_set_diff_remote + est_set_diff_local);
+ uint64_t estimated_total_diff = (est_set_diff_remote + est_set_diff_local);
/* Estimate byte required if we send first */
uint64_t total_elements_to_send_local_send_first = est_set_diff_remote +
local_set_size;
@@ -1023,7 +1018,7 @@ estimate_best_mode_of_operation(uint64_t avg_element_size,
/* Estimate bytes required by IBF transmission*/
- double ibf_bucket_count = estimated_total_diff * ibf_bucket_number_factor;
+ long double ibf_bucket_count = estimated_total_diff *
ibf_bucket_number_factor;
if (ibf_bucket_count <= IBF_MIN_SIZE) {
ibf_bucket_count = IBF_MIN_SIZE;
@@ -1034,7 +1029,7 @@ estimate_best_mode_of_operation(uint64_t avg_element_size,
uint64_t estimated_counter_size = ceil(
MIN(2 * log2l((float) local_set_size / ibf_bucket_count),
log2l(local_set_size)));
- float counter_bytes = (float) estimated_counter_size / 8;
+ long double counter_bytes = (float) estimated_counter_size / 8;
uint64_t ibf_bytes = ceil((sizeof(struct IBFMessage) * ibf_message_count)
* 1.2 + \
(ibf_bucket_count * sizeof(struct IBF_Key)) * 1.2 + \
@@ -1077,7 +1072,7 @@ estimate_best_mode_of_operation(uint64_t avg_element_size,
* @return GNUNET_YES if message permitted in phase and GNUNET_NO if not
permitted in given
* phase
*/
-static int check_valid_phase(uint8_t allowed_phases[], size_t size_phases,
struct Operation *op){
+static int check_valid_phase(const uint8_t allowed_phases[], size_t
size_phases, struct Operation *op){
for(uint32_t phase_ctr=0; phase_ctr < size_phases; phase_ctr++) {
uint8_t phase = allowed_phases[phase_ctr];
if (phase == op->phase) {
@@ -1342,9 +1337,9 @@ static int
check_byzantine_bounds(struct Operation *op) {
if (op->byzantine != GNUNET_YES)
return GNUNET_OK;
- if(op->remote_element_count + op->remote_set_diff >
op->upper_element_boundary)
+ if(op->remote_element_count + op->remote_set_diff >
op->byzantine_upper_bound)
return GNUNET_SYSERR;
- if(op->local_element_count + op->local_set_diff >
op->upper_element_boundary)
+ if(op->local_element_count + op->local_set_diff >
op->byzantine_upper_bound)
return GNUNET_SYSERR;
if(op->remote_element_count < op->byzantine_lower_bound)
return GNUNET_SYSERR;
@@ -2164,10 +2159,10 @@ handle_union_p2p_strata_estimator (void *cls,
other_size = GNUNET_ntohll (msg->set_size);
op->remote_element_count = other_size;
- if(op->upper_element_boundary < op->remote_element_count) {
+ if(op->byzantine_upper_bound < op->remote_element_count) {
LOG (GNUNET_ERROR_TYPE_ERROR,
"Exceeded configured upper bound <%lu> of element: %u\n",
- op->upper_element_boundary,
+ op->byzantine_upper_bound,
op->remote_element_count);
fail_union_operation (op);
return;
@@ -2204,10 +2199,10 @@ handle_union_p2p_strata_estimator (void *cls,
long diff_local = remote_se->stratas[0]->strata[0]->local_decoded_count;
/* Prevent estimations from overshooting max element */
- if(diff_remote + op->remote_element_count > op->upper_element_boundary)
- diff_remote = op->upper_element_boundary - op->remote_element_count;
- if(diff_local + op->local_element_count > op->upper_element_boundary)
- diff_local = op->upper_element_boundary - op->local_element_count;
+ if(diff_remote + op->remote_element_count > op->byzantine_upper_bound)
+ diff_remote = op->byzantine_upper_bound - op->remote_element_count;
+ if(diff_local + op->local_element_count > op->byzantine_upper_bound)
+ diff_local = op->byzantine_upper_bound - op->local_element_count;
if(diff_remote < 0 || diff_local < 0) {
LOG (GNUNET_ERROR_TYPE_ERROR,
"PROTOCOL VIOLATION: More element is set as upper boundary or other
peer is "
@@ -2547,7 +2542,6 @@ decode_and_send (struct Operation *op)
#if MEASURE_PERFORMANCE
perf_store.active_passive_switches += 1;
#endif
- op->active_passive_switches += 1;
op->salt_send = op->salt_receive++;
@@ -4706,7 +4700,7 @@ handle_client_evaluate (void *cls,
op->rtt_bandwidth_tradeoff = msg->bandwidth_latency_tradeoff;
op->ibf_bucket_number_factor = msg->ibf_bucket_number_factor;
op->ibf_number_buckets_per_element = msg->ibf_number_of_buckets_per_element;
- op->upper_element_boundary = msg->byzantine_upper_bond;
+ op->byzantine_upper_bound = msg->byzantine_upper_bond;
context = GNUNET_MQ_extract_nested_mh (msg);
/* create hashmap for message control */
@@ -4911,7 +4905,7 @@ handle_client_accept (void *cls,
op->rtt_bandwidth_tradeoff = msg->bandwidth_latency_tradeoff;
op->ibf_bucket_number_factor = msg->ibf_bucket_number_factor;
op->ibf_number_buckets_per_element = msg->ibf_number_of_buckets_per_element;
- op->upper_element_boundary = msg->byzantine_upper_bond;
+ op->byzantine_upper_bound = msg->byzantine_upper_bond;
/* create hashmap for message control */
op->message_control_flow =
GNUNET_CONTAINER_multihashmap_create(32,GNUNET_NO);
op->inquiries_sent = GNUNET_CONTAINER_multihashmap_create(32,GNUNET_NO);
diff --git a/src/setu/gnunet-service-setu_strata_estimator.c
b/src/setu/gnunet-service-setu_strata_estimator.c
index 29cfaf783..3dd7d367f 100644
--- a/src/setu/gnunet-service-setu_strata_estimator.c
+++ b/src/setu/gnunet-service-setu_strata_estimator.c
@@ -164,9 +164,8 @@ strata_estimator_insert (struct MultiStrataEstimator *se,
}
-
/**
- * Remove a key from the strata estimator.
+ * Remove a key from the strata estimator. (NOT USED)
*
* @param se strata estimator to remove the key from
* @param key key to remove
@@ -177,16 +176,21 @@ strata_estimator_remove (struct MultiStrataEstimator *se,
{
/* count trailing '1'-bits of v */
- for(int strata_ctr=0; strata_ctr < MULTI_SE_BASE_COUNT; strata_ctr++) {
+ for(int strata_ctr=0; strata_ctr < se->size; strata_ctr++) {
uint64_t v;
unsigned int i;
- v = key.key_val;
+
+ struct IBF_Key unsalted_key;
+ unsalt_key (&key,
+ strata_ctr * (64 / MULTI_SE_BASE_COUNT),
+ &unsalted_key);
+
+ v = unsalted_key.key_val;
for (i = 0; v & 1; v >>= 1, i++) {
/* empty */;
- ibf_remove(se->stratas[strata_ctr]->strata[i], key);
+ ibf_remove(se->stratas[strata_ctr]->strata[i], unsalted_key);
}
}
-
}
@@ -277,13 +281,9 @@ strata_estimator_difference (const struct
MultiStrataEstimator *se1,
return count * (1 << (i + 1));
}
break_all_counting_loops:;
- //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "LOCAL:
%u\n",se1->stratas[strata_ctr]->strata[0]->local_decoded_count);
- //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "REMOTE:
%u\n",se1->stratas[strata_ctr]->strata[0]->remote_decoded_count);
avg_local_diff +=
se1->stratas[strata_ctr]->strata[0]->local_decoded_count;
avg_remote_diff +=
se1->stratas[strata_ctr]->strata[0]->remote_decoded_count;
}
- //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "TOTAL LOCAL: %u\n",avg_local_diff);
- //GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "TOTAL REMOTE: %u\n",avg_remote_diff);
se1->stratas[0]->strata[0]->local_decoded_count = avg_local_diff /
number_of_estimators;
se1->stratas[0]->strata[0]->remote_decoded_count = avg_remote_diff /
number_of_estimators;
}
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c
index 76417fdfc..c47bd8f66 100644
--- a/src/setu/perf_setu_api.c
+++ b/src/setu/perf_setu_api.c
@@ -405,7 +405,7 @@ run (void *cls,
"Running real set-reconciliation\n");
//init_set1 ();
// limit ~23800 element total
- initRandomSets(45, 500,500,32);
+ initRandomSets(470, 500,500,32);
}
void perf_thread() {
diff --git a/src/setu/setu_api.c b/src/setu/setu_api.c
index 006ec19db..4d0fc9932 100644
--- a/src/setu/setu_api.c
+++ b/src/setu/setu_api.c
@@ -22,7 +22,7 @@
* @brief api for the set union service
* @author Florian Dold
* @author Christian Grothoff
- * @author Elias Summermatter
+ * @author Elias Summermatter
*/
#include "platform.h"
#include "gnunet_util_lib.h"
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [gnunet] 164/164: completing rebase to master, (continued)
- [gnunet] 164/164: completing rebase to master, gnunet, 2021/07/30
- [gnunet] 138/164: Fixed one more, gnunet, 2021/07/30
- [gnunet] 135/164: Made perf compleate in time, gnunet, 2021/07/30
- [gnunet] 146/164: Added comment to explain |1, gnunet, 2021/07/30
- [gnunet] 153/164: Fixed another bug in message flow control, gnunet, 2021/07/30
- [gnunet] 154/164: Use GNUNET_free instead of build in free, gnunet, 2021/07/30
- [gnunet] 159/164: removed exponation from plausability check FIX, gnunet, 2021/07/30
- [gnunet] 134/164: -SETU: fix indentation, gnunet, 2021/07/30
- [gnunet] 161/164: Fixed smal bug in propabilistic algo, gnunet, 2021/07/30
- [gnunet] 152/164: Reverted some stuff, gnunet, 2021/07/30
- [gnunet] 126/164: Added removing key from strata,
gnunet <=