feef2f8791
* updater: apply exponential backoff after download failure (#8059)
* updater: apply exponential backoff after download failure
* updater: reset backoff on new release
* Limit incoming connections. (#8060)
* Limit ingress connections
* Optimized handshakes logging
* Max code size on Kovan (#8067)
* Enable code size limit on kovan
* Fix formatting.
* add some dos protection (#8084)
* more dos protection (#8104)
* Const time comparison (#8113)
* Use `subtle::slices_equal` for constant time comparison.
Also update the existing version of subtle in `ethcrypto` from
0.1 to 0.5
* Test specifically for InvalidPassword error.
* revert removing blooms (#8066)
* Revert "fix traces, removed bloomchain crate, closes #7228, closes #7167"
This reverts commit 1bf62038678295e5586f02a38a0c5aab9a9efe62.
* Revert "fixed broken logs (#7934)"
This reverts commit f8a2e53f3e
.
* fixed broken logs
* bring back old lock order
* remove migration v13
* revert CURRENT_VERSION to 12 in migration.rs
* Fix compilation.
* Check one step deeper if we're on release track branches
* add missing pr
* Fix blooms?
* Fix tests compiilation.
* Fix size.
25 lines
529 B
Rust
25 lines
529 B
Rust
extern crate rand;
|
|
|
|
use self::rand::random;
|
|
use bloomchain::Bloom;
|
|
|
|
pub fn generate_random_bloom() -> Bloom {
|
|
let mut res = [0u8; 256];
|
|
let p0 = random::<u8>();
|
|
let b0 = random::<u8>() % 8;
|
|
let p1 = random::<u8>();
|
|
let b1 = random::<u8>() % 8;
|
|
let p2 = random::<u8>();
|
|
let b2 = random::<u8>() % 8;
|
|
|
|
res[p0 as usize] |= 1 << b0;
|
|
res[p1 as usize] |= 1 << b1;
|
|
res[p2 as usize] |= 1 << b2;
|
|
|
|
From::from(res)
|
|
}
|
|
|
|
pub fn generate_n_random_blooms(n: usize) -> Vec<Bloom> {
|
|
(0..n).map(|_| generate_random_bloom()).collect()
|
|
}
|