mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-03-03 19:50:28 +00:00
set RNG for test case for consistent test outputs
This commit is contained in:
parent
76cc964a37
commit
c080324e08
@ -1,4 +1,4 @@
|
||||
import random
|
||||
from random import Random
|
||||
|
||||
from eth2spec.test.context import (
|
||||
spec_state_test, expect_assertion_error, always_bls, with_all_phases,
|
||||
@ -152,9 +152,10 @@ def test_success_misc_balances(spec, state):
|
||||
@single_phase
|
||||
def test_success_with_effective_balance_disparity(spec, state):
|
||||
# Jitter balances to be different from effective balances
|
||||
rng = Random(12345)
|
||||
for i in range(len(state.balances)):
|
||||
pre = int(state.balances[i])
|
||||
state.balances[i] += random.randrange(max(pre - 5000, 0), pre + 5000)
|
||||
state.balances[i] += rng.randrange(max(pre - 5000, 0), pre + 5000)
|
||||
|
||||
attester_slashing = get_valid_attester_slashing(spec, state, signed_1=True, signed_2=True)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user