Example #1
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) {
Example #2
0
            rpc_nodes=rpc_nodes,
            epoch_length=epoch_length,
            node_pks=node_pks,
            increasing_stakes=args.increasing_stakes,
            num_seats=args.num_seats,
            sharding=not args.no_sharding,
            all_node_pks=all_node_pks,
            node_ips=node_ips)
        mocknet.start_nodes(all_nodes, upgrade_schedule)
        time.sleep(60)

    mocknet.wait_all_nodes_up(all_nodes)

    archival_node = rpc_nodes[0]
    logger.info(f'Archival node: {archival_node.instance_name}')
    initial_validator_accounts = mocknet.list_validators(archival_node)
    logger.info(f'initial_validator_accounts: {initial_validator_accounts}')
    test_passed = True

    script, deploy_time, test_timeout = (None, None, None)
    if args.script == 'skyward':
        script = 'load_testing_add_and_delete_helper.py'
        deploy_time = load_testing_add_and_delete_helper.CONTRACT_DEPLOY_TIME
        test_timeout = load_testing_add_and_delete_helper.TEST_TIMEOUT
    elif args.script == 'add_and_delete':
        script = 'load_test_spoon_helper.py'
        deploy_time = load_test_spoon_helper.CONTRACT_DEPLOY_TIME
        test_timeout = load_test_spoon_helper.TEST_TIMEOUT
    else:
        assert False, f'Unsupported --script={args.script}'