You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-Adding support for tx_max_expected_probability, a parameter that defines the maximum expected probability for a single maker to be included in a collaborative transaction. A value of 1 (100%) for this probability corresponds to the previous behavior. A value smaller than 1 allows to prevent a large maker from always being included in a transaction. For a given total amount of fidelity bonds, this mechanism allows to reduce the ability of an attacker to be systematically included in a transaction, and also to be the only entity included as makers in the transaction.
log.debug('Remaining probability of not being selected for large makers: '+str(large_makers_not_chosen_prob[0]) +' -> '+str(large_makers_not_chosen_prob[0]*(1-1./len(orders))))
log.debug('Bondless or bond maker randomly selected')
239
+
returnrandom_under_max_order_choose(orders, n, large_makers_not_chosen_prob=large_makers_not_chosen_prob, tx_max_expected_probability=tx_max_expected_probability)
log.debug('Bondless maker selected because no alternative')
246
+
returnrandom_under_max_order_choose(orders, n, large_makers_not_chosen_prob=large_makers_not_chosen_prob, tx_max_expected_probability=tx_max_expected_probability)
#If maximum expected probability target for large makers cannot be achieved using a constant value for prob
254
+
ifprob<=0ornforders-nrem+1<=1./prob:
255
+
max_exp_prob=large_makers_not_chosen_prob[0]
256
+
257
+
foriinrange(nforders-nrem+1, nforders+1):
258
+
max_exp_prob*=1-1./i
259
+
max_exp_prob=1-max_exp_prob
260
+
261
+
#If the probability target cannot be achieved at all
262
+
ifmax_exp_prob>tx_max_expected_probability:
263
+
log.warn('A large maker maximum expected probability target of '+str(tx_max_expected_probability) +' cannot be achieved. A probability of '+str(max_exp_prob) +' will be targeted instead')
log.debug('Large maker maximum expected probability target of '+str(tx_max_expected_probability) +' achievable using an increasing draw probability due to the limited number of makers')
log.debug('Remaining probability of not being selected for large makers: '+str(large_makers_not_chosen_prob[0]) +' -> '+str(large_makers_not_chosen_prob[0]*(1-prob)))
0 commit comments