validators = {} for name in VALIDATOR_NAMES: validators[name] = Validator(name) # Watcher lives at validator name 0 and receives all the messages watcher = validators[0] for v in VALIDATOR_NAMES: for genesis_message in GENESIS_MESSAGES: validators[v].receive_consensus_message(genesis_message) # GLOBAL MEMPOOLS mempools = {} for ID in SHARD_IDS: mempools[ID] = generate_transactions.gen_alice_and_bob_tx() # GLOBAL VIEWABLES viewables = {} for v in VALIDATOR_NAMES: viewables[v] = [] # SIMULATION LOOP: for i in range(NUM_PROPOSALS): # Make a new message from a random validator on a random shard rand_ID = random.choice(SHARD_IDS) next_proposer = 3 * rand_ID + random.randint(1, 3) if next_proposer == 0: assert False, "watcher should never propose"
for name in VALIDATOR_NAMES: validators[name] = Validator(name) # Watcher lives at validator name 0 and receives all the messages watcher = validators[0] for v in VALIDATOR_NAMES: for genesis_message in GENESIS_MESSAGES: validators[v].receive_consensus_message(genesis_message) # GLOBAL MEMPOOLS mempools = {} if RESTRICT_ROUTING: for ID in SHARD_IDS: if ID in MSG_ROUTES: mempools[ID] = gen_alice_and_bob_tx(MSG_ROUTES[ID]) else: mempools[ID] = [] else: txs = gen_alice_and_bob_tx() for ID in SHARD_IDS: mempools[ID] = copy.copy(txs) add_switch_message(1, 4, 3, 1) # GLOBAL VIEWABLES viewables = {} for v in VALIDATOR_NAMES: viewables[v] = {} for w in VALIDATOR_NAMES: viewables[v][w] = []
GENESIS_BLOCKS[ID].child_IDs = INITIAL_TOPOLOGY[ID] validators = {} for name in VALIDATOR_NAMES: validators[name] = Validator(name) # Watcher lives at validator name 0 and receives all the messages watcher = validators[0] for v in VALIDATOR_NAMES: for genesis_message in GENESIS_MESSAGES: validators[v].receive_consensus_message(genesis_message) # GLOBAL MEMPOOLS mempools = {} txs = gen_alice_and_bob_tx() for ID in SHARD_IDS: mempools[ID] = txs # GLOBAL VIEWABLES viewables = {} for v in VALIDATOR_NAMES: viewables[v] = {} for w in VALIDATOR_NAMES: viewables[v][w] = [] max_height = 0 # SIMULATION LOOP: for i in range(NUM_ROUNDS): # Make a new message from a random validator on a random shard