- withdraw and deposit - re-join - check validators 3 ''' # keep these values same as jail_cluster.json TARGET_NODE = 'node2' TARGET_NODE_MNEMONIC = 'symptom labor zone shrug chicken bargain hood define tornado mass inquiry rural step color guitar' TARGET_NODE_VALIDATOR_SEED = '5c1b9c06ae7485cd0f9d75819f964db3b1306ebd397f5bbdc1dd386a32b7c1c0' MISSED_BLOCK_THRESHOLD = 5 JAIL_DURATION = 10 BASE_PORT = int(os.environ.get('BASE_PORT', 26650)) TARGET_PORT = BASE_PORT + 2 * 10 supervisor = UnixStreamXMLRPCClient('data/supervisor.sock') rpc = get_rpc() # wait for at least one block generated wait_for_blocks(rpc, 1, height=0) # wait for 3 validators online print('Wait for 3 validators online') wait_for_validators(rpc, 3) enckey = rpc.wallet.restore(TARGET_NODE_MNEMONIC, name='target') print('Stop', TARGET_NODE) stop_node(supervisor, TARGET_NODE) print('Waiting for', MISSED_BLOCK_THRESHOLD + 3, 'blocks') wait_for_blocks(rpc, MISSED_BLOCK_THRESHOLD + 3)
''' def monetary_expansion(S, tau): period = 10 Y = 365 * 24 * 60 * 60 R = 0.45 * math.exp(-S / tau) N = int(S * (math.pow(1 + R, period / Y) - 1)) return N - N % 10000 BASE_PORT = int(os.environ.get('BASE_PORT', 26650)) supervisor = UnixStreamXMLRPCClient('data/supervisor.sock') wait_for_port(BASE_PORT + 20 + 7) rpc = get_rpc() rpc2 = get_rpc(2) init_bonded = 90000000000000000 wait_for_blocks(rpc, 2, height=0) os.environ['ENCKEY'] = rpc.wallet.enckey() bonded_staking = rpc.address.list()[0] # first reward distribution # minted = 6978080000 minted = monetary_expansion(init_bonded * 2, 145000000000000000) state = rpc.chain.staking(bonded_staking, height=2) assert int(state['bonded']) == init_bonded + minted // 2