예제 #1
0
    parser.add_argument('--no-sharding', default=False, action='store_true')
    parser.add_argument('--script', required=True)
    parser.add_argument('--num-seats', type=int, required=True)

    args = parser.parse_args()

    chain_id = args.chain_id
    pattern = args.pattern
    epoch_length = args.epoch_length
    assert epoch_length > 0
    num_nodes = args.num_nodes
    assert num_nodes > 0
    max_tps = args.max_tps
    assert max_tps > 0

    all_nodes = mocknet.get_nodes(pattern=pattern)
    random.shuffle(all_nodes)
    assert len(all_nodes) > num_nodes, 'Need at least one RPC node'
    validator_nodes = all_nodes[:num_nodes]
    logger.info(f'validator_nodes: {validator_nodes}')
    rpc_nodes = all_nodes[num_nodes:]
    logger.info(
        f'Starting Load of {chain_id} test using {len(validator_nodes)} validator nodes and {len(rpc_nodes)} RPC nodes.'
    )

    upgrade_schedule = mocknet.create_upgrade_schedule(
        rpc_nodes, validator_nodes, args.progressive_upgrade,
        args.increasing_stakes, args.num_seats)
    logger.info(f'upgrade_schedule: %s' % str(upgrade_schedule))

    if not args.skip_setup:
예제 #2
0
# Force each node to submit many transactions for
# about 20 minutes. Monitor the block production time
# stays consistent.

import sys, time
from rc import pmap

from load_testing_helper import ALL_TX_TIMEOUT, TRANSFER_ONLY_TIMEOUT, CONTRACT_DEPLOY_TIME

sys.path.append('lib')
import mocknet
from metrics import Metrics
import utils

nodes = mocknet.get_nodes()
initial_validator_accounts = mocknet.list_validators(nodes[0])


def wasm_contract():
    return utils.compile_rust_contract('''
const N: u32 = 100;

metadata! {
    #[near_bindgen]
    #[derive(Default, BorshSerialize, BorshDeserialize)]
    pub struct LoadContract {}
}

#[near_bindgen]
impl LoadContract {
    pub fn do_work(&self) {
예제 #3
0
        nohup bash ./restaked.sh {delay_sec} {stake_amount} 1>>/home/ubuntu/restaked.out 2>>/home/ubuntu/restaked.err </dev/null &
    '''.format(stake_amount=shlex.quote(str(random.randint(10**3, 10**5))),
               delay_sec=shlex.quote(str(delay_sec)))
    logger.info(f'Starting restaked on {node.instance_name}: {s}')
    node.machine.run('bash', input=s)


if __name__ == '__main__':
    logger.info('Starting restaker.')
    parser = argparse.ArgumentParser(description='Run restaker')
    parser.add_argument('--delay-sec', type=int, required=True)
    parser.add_argument('--near-pk', required=True)
    parser.add_argument('--near-sk', required=True)
    parser.add_argument('--create-accounts',
                        default=False,
                        action='store_true')
    args = parser.parse_args()

    delay_sec = args.delay_sec
    assert delay_sec
    near_pk = args.near_pk
    near_sk = args.near_sk
    need_create_accounts = args.create_accounts

    all_machines = mocknet.get_nodes(pattern='shardnet-')
    random.shuffle(all_machines)

    pmap(
        lambda machine: restart_restaked(machine, delay_sec, near_pk, near_sk,
                                         need_create_accounts), all_machines)