def test_audit_not_committed_if_pre_prepare_doesnt_have_audit(alh, db_manager): size_before = alh.ledger.size uncommited_size_before = alh.ledger.uncommitted_size do_apply_audit_txn(alh, txns_count=10, ledger_id=DOMAIN_LEDGER_ID, view_no=0, pp_sq_no=1, txn_time=10000, has_audit_txn=False) txn_root_hash_1 = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash_1 = db_manager.get_state(DOMAIN_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=15, ledger_id=DOMAIN_LEDGER_ID, view_no=0, pp_sq_no=2, txn_time=10000, has_audit_txn=True) # commit the first batch without audit txns alh.commit_batch(FakeSomething()) assert alh.ledger.uncommitted_size == uncommited_size_before + 1 assert alh.ledger.size == size_before
def check_apply_audit_txn(alh, txns_count, ledger_id, view_no, pp_sq_no, txn_time, seq_no, pool_size, domain_size, config_size, last_pool_seqno, last_domain_seqno, last_config_seqno): db_manager = alh.database_manager uncommited_size_before = alh.ledger.uncommitted_size size_before = alh.ledger.size do_apply_audit_txn(alh, txns_count=txns_count, ledger_id=ledger_id, view_no=view_no, pp_sq_no=pp_sq_no, txn_time=txn_time) assert alh.ledger.uncommitted_size == uncommited_size_before + 1 assert alh.ledger.size == size_before txn = alh.ledger.get_uncommitted_txns()[-1] check_audit_txn(txn=txn, view_no=view_no, pp_seq_no=pp_sq_no, seq_no=seq_no, txn_time=txn_time, ledger_id=ledger_id, txn_root=db_manager.get_ledger(ledger_id).uncommitted_root_hash, state_root=db_manager.get_state(ledger_id).headHash, pool_size=pool_size, domain_size=domain_size, config_size=config_size, last_pool_seqno=last_pool_seqno, last_domain_seqno=last_domain_seqno, last_config_seqno=last_config_seqno)
def test_commit_works_after_catchup(alh, db_manager, initial_domain_size, initial_pool_size, initial_config_size, initial_seq_no): size_before = alh.ledger.size # apply and commit batch do_apply_audit_txn(alh, txns_count=7, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=35, txn_time=11111) txn_root_hash = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash = db_manager.get_state(DOMAIN_LEDGER_ID).headHash alh.commit_batch(FakeSomething()) # add txns to audit ledger emulating catchup caughtup_txns = 5 txns_per_batch = 2 add_txns_to_audit(alh, count=caughtup_txns, ledger_id=POOL_LEDGER_ID, txns_per_batch=txns_per_batch, view_no=3, initial_pp_seq_no=36, pp_time=11222) alh.on_catchup_finished() # apply and commit new batch do_apply_audit_txn(alh, txns_count=3, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=45, txn_time=21111) assert alh.ledger.uncommitted_size == alh.ledger.size + 1 txn_root_hash = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash = db_manager.get_state(DOMAIN_LEDGER_ID).headHash alh.commit_batch(FakeSomething()) assert alh.ledger.uncommitted_size == alh.ledger.size assert alh.ledger.size == size_before + 2 + caughtup_txns check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=3, pp_seq_no=45, seq_no=initial_seq_no + 2 + caughtup_txns, txn_time=21111, txn_roots={DOMAIN_LEDGER_ID: txn_root_hash}, state_roots={DOMAIN_LEDGER_ID: state_root_hash}, pool_size=initial_pool_size + txns_per_batch * caughtup_txns, domain_size=initial_domain_size + 7 + 3, config_size=initial_config_size, last_pool_seqno=initial_seq_no + 1 + caughtup_txns, last_domain_seqno=None, last_config_seqno=None, primaries=2 * (caughtup_txns + 1))
def test_transform_txn_for_catchup_rep(alh, db_manager, initial_domain_size, initial_pool_size, initial_config_size): do_apply_audit_txn(alh, txns_count=10, ledger_id=DOMAIN_LEDGER_ID, view_no=0, pp_sq_no=1, txn_time=10000, has_audit_txn=True) audit_txn_after_serialization = \ JsonSerializer.loads( JsonSerializer.dumps( alh.ledger.get_last_txn() ) ) transformed_audit_txn = alh.transform_txn_for_ledger(audit_txn_after_serialization) check_audit_txn(txn=transformed_audit_txn, view_no=0, pp_seq_no=1, seq_no=1, txn_time=10000, ledger_id=DOMAIN_LEDGER_ID, txn_root=db_manager.get_ledger(DOMAIN_LEDGER_ID).uncommitted_root_hash, state_root=db_manager.get_state(DOMAIN_LEDGER_ID).headHash, pool_size=initial_pool_size, domain_size=initial_domain_size + 10, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=None, last_config_seqno=None)
def test_apply_revert_commit(alh, db_manager, initial_domain_size, initial_pool_size, initial_config_size, initial_seq_no): size_before = alh.ledger.size # apply 2 batches do_apply_audit_txn(alh, txns_count=7, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=35, txn_time=11111) txn_root_hash_1 = db_manager.get_ledger(DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash_1 = db_manager.get_state(DOMAIN_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=15, ledger_id=POOL_LEDGER_ID, view_no=3, pp_sq_no=36, txn_time=11112) # reject 2d batch alh.post_batch_rejected(POOL_LEDGER_ID) assert alh.ledger.uncommitted_size == alh.ledger.size + 1 assert alh.ledger.size == size_before # commit 1st batch alh.commit_batch(DOMAIN_LEDGER_ID, 7, state_root_hash_1, txn_root_hash_1, 11111) assert alh.ledger.uncommitted_size == alh.ledger.size assert alh.ledger.size == size_before + 1 check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=3, pp_seq_no=35, seq_no=initial_seq_no + 1, txn_time=11111, ledger_id=DOMAIN_LEDGER_ID, txn_root=txn_root_hash_1, state_root=state_root_hash_1, pool_size=initial_pool_size, domain_size=initial_domain_size + 7, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=None, last_config_seqno=None)
def test_commit_one_batch(alh, db_manager, initial_domain_size, initial_pool_size, initial_config_size, initial_seq_no): size_before = alh.ledger.size do_apply_audit_txn(alh, txns_count=7, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=35, txn_time=11111) txn_root_hash = db_manager.get_ledger(DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash = db_manager.get_state(DOMAIN_LEDGER_ID).headHash pool_txn_root_hash = db_manager.get_ledger(POOL_LEDGER_ID).uncommitted_root_hash pool_state_root_hash = db_manager.get_state(POOL_LEDGER_ID).headHash alh.commit_batch(FakeSomething()) assert alh.ledger.uncommitted_size == alh.ledger.size assert alh.ledger.size == size_before + 1 check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=3, pp_seq_no=35, seq_no=initial_seq_no + 1, txn_time=11111, txn_roots={ DOMAIN_LEDGER_ID: txn_root_hash, POOL_LEDGER_ID: pool_txn_root_hash }, state_roots={ DOMAIN_LEDGER_ID: state_root_hash, POOL_LEDGER_ID: pool_state_root_hash }, pool_size=initial_pool_size, domain_size=initial_domain_size + 7, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=None, last_config_seqno=None, primaries=DEFAULT_PRIMARIES)
def test_commit_one_batch(alh, db_manager, initial_domain_size, initial_pool_size, initial_config_size, initial_seq_no): size_before = alh.ledger.size do_apply_audit_txn(alh, txns_count=7, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=35, txn_time=11111) txn_root_hash = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash = db_manager.get_state(DOMAIN_LEDGER_ID).headHash alh.commit_batch(DOMAIN_LEDGER_ID, 7, state_root_hash, txn_root_hash, 11111) assert alh.ledger.uncommitted_size == alh.ledger.size assert alh.ledger.size == size_before + 1 check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=3, pp_seq_no=35, seq_no=initial_seq_no + 1, txn_time=11111, ledger_id=DOMAIN_LEDGER_ID, txn_root=txn_root_hash, state_root=state_root_hash, pool_size=initial_pool_size, domain_size=initial_domain_size + 7, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=None, last_config_seqno=None)
def test_revert_works_after_catchup(alh, db_manager, initial_domain_size, initial_pool_size, initial_config_size, initial_seq_no): size_before = alh.ledger.size # apply and commit batch do_apply_audit_txn(alh, txns_count=7, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=35, txn_time=11111) txn_root_hash = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash = db_manager.get_state(DOMAIN_LEDGER_ID).headHash alh.commit_batch(DOMAIN_LEDGER_ID, 7, state_root_hash, txn_root_hash, 11111) # add txns to audit ledger emulating catchup caughtup_txns = 5 txns_per_batch = 2 add_txns_to_audit(alh, count=caughtup_txns, ledger_id=POOL_LEDGER_ID, txns_per_batch=txns_per_batch, view_no=3, initial_pp_seq_no=36, pp_time=11222) # apply and revert new batch do_apply_audit_txn(alh, txns_count=3, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=45, txn_time=21111) assert alh.ledger.uncommitted_size == alh.ledger.size + 1 alh.post_batch_rejected(DOMAIN_LEDGER_ID) assert alh.ledger.uncommitted_size == alh.ledger.size assert alh.ledger.size == size_before + 1 + caughtup_txns txn_root_hash = db_manager.get_ledger(POOL_LEDGER_ID).uncommitted_root_hash state_root_hash = db_manager.get_state(POOL_LEDGER_ID).headHash check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=3, pp_seq_no=36 + caughtup_txns - 1, seq_no=initial_seq_no + 1 + caughtup_txns, txn_time=11222, ledger_id=POOL_LEDGER_ID, txn_root=txn_root_hash, state_root=state_root_hash, pool_size=initial_pool_size + txns_per_batch * caughtup_txns, domain_size=initial_domain_size + 7, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=1, last_config_seqno=None)
def check_apply_audit_txn(alh, txns_count, ledger_ids, view_no, pp_sq_no, txn_time, seq_no, pool_size, domain_size, config_size, last_pool_seqno, last_domain_seqno, last_config_seqno, primaries, other_sizes={}, original_view_no=None, digest=''): db_manager = alh.database_manager uncommited_size_before = alh.ledger.uncommitted_size size_before = alh.ledger.size do_apply_audit_txn(alh, txns_count=txns_count, ledger_id=ledger_ids[0], view_no=view_no, pp_sq_no=pp_sq_no, txn_time=txn_time, original_view_no=original_view_no, digest=digest) assert alh.ledger.uncommitted_size == uncommited_size_before + 1 assert alh.ledger.size == size_before txn = alh.ledger.get_uncommitted_txns()[-1] expected_view_no = original_view_no if original_view_no is not None else view_no check_audit_txn(txn=txn, view_no=expected_view_no, pp_seq_no=pp_sq_no, seq_no=seq_no, txn_time=txn_time, txn_roots={ ledger_id: db_manager.get_ledger(ledger_id).uncommitted_root_hash for ledger_id in ledger_ids }, state_roots={ ledger_id: db_manager.get_state(ledger_id).headHash for ledger_id in ledger_ids }, pool_size=pool_size, domain_size=domain_size, config_size=config_size, last_pool_seqno=last_pool_seqno, last_domain_seqno=last_domain_seqno, last_config_seqno=last_config_seqno, primaries=primaries, other_sizes=other_sizes, digest=digest)
def test_apply_revert_commit(alh, db_manager, initial_domain_size, initial_pool_size, initial_config_size, initial_seq_no): size_before = alh.ledger.size # apply 2 batches do_apply_audit_txn(alh, txns_count=7, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=35, txn_time=11111) txn_root_hash_1 = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash_1 = db_manager.get_state(DOMAIN_LEDGER_ID).headHash txn_root_hash_2 = db_manager.get_ledger( POOL_LEDGER_ID).uncommitted_root_hash state_root_hash_2 = db_manager.get_state(POOL_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=15, ledger_id=POOL_LEDGER_ID, view_no=3, pp_sq_no=36, txn_time=11112) # reject 2d batch alh.post_batch_rejected(POOL_LEDGER_ID) assert alh.ledger.uncommitted_size == alh.ledger.size + 1 assert alh.ledger.size == size_before # commit 1st batch alh.commit_batch(FakeSomething()) assert alh.ledger.uncommitted_size == alh.ledger.size assert alh.ledger.size == size_before + 1 check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=3, pp_seq_no=35, seq_no=initial_seq_no + 1, txn_time=11111, txn_roots={ DOMAIN_LEDGER_ID: txn_root_hash_1, POOL_LEDGER_ID: txn_root_hash_2 }, state_roots={ DOMAIN_LEDGER_ID: state_root_hash_1, POOL_LEDGER_ID: state_root_hash_2 }, pool_size=initial_pool_size, domain_size=initial_domain_size + 7, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=None, last_config_seqno=None, primaries=DEFAULT_PRIMARIES, node_reg=DEFAULT_NODE_REG)
def test_audit_not_applied_if_pre_prepare_doesnt_have_audit(alh): size_before = alh.ledger.size uncommited_size_before = alh.ledger.uncommitted_size do_apply_audit_txn(alh, txns_count=10, ledger_id=DOMAIN_LEDGER_ID, view_no=0, pp_sq_no=1, txn_time=10000, has_audit_txn=False) assert alh.ledger.uncommitted_size == uncommited_size_before assert alh.ledger.size == size_before assert alh.ledger.size == alh.ledger.uncommitted_size
def test_audit_not_reverted_if_pre_prepare_doesnt_have_audit(alh, db_manager): do_apply_audit_txn(alh, txns_count=10, ledger_id=DOMAIN_LEDGER_ID, view_no=0, pp_sq_no=1, txn_time=10000, has_audit_txn=True) size_after_1st = alh.ledger.size uncommited_size_after_1st = alh.ledger.uncommitted_size do_apply_audit_txn(alh, txns_count=15, ledger_id=DOMAIN_LEDGER_ID, view_no=0, pp_sq_no=2, txn_time=10000, has_audit_txn=False) # revert the 2d batch without audit alh.post_batch_rejected(DOMAIN_LEDGER_ID) assert alh.ledger.uncommitted_size == uncommited_size_after_1st assert alh.ledger.size == size_after_1st
def test_reject_batch(alh, db_manager, initial_domain_size, initial_pool_size, initial_config_size): uncommited_size_before = alh.ledger.uncommitted_size size_before = alh.ledger.size do_apply_audit_txn(alh, txns_count=5, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=37, txn_time=11112) txn_root_hash_1 = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash_1 = db_manager.get_state(DOMAIN_LEDGER_ID).headHash txn_root_hash_2_pre = db_manager.get_ledger( POOL_LEDGER_ID).uncommitted_root_hash state_root_hash_2_pre = db_manager.get_state(POOL_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=6, ledger_id=POOL_LEDGER_ID, view_no=3, pp_sq_no=38, txn_time=11113) txn_root_hash_2 = db_manager.get_ledger( POOL_LEDGER_ID).uncommitted_root_hash state_root_hash_2 = db_manager.get_state(POOL_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=7, ledger_id=CONFIG_LEDGER_ID, view_no=3, pp_sq_no=39, txn_time=11114) txn_root_hash_3 = db_manager.get_ledger( CONFIG_LEDGER_ID).uncommitted_root_hash state_root_hash_3 = db_manager.get_state(CONFIG_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=8, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=40, txn_time=11115) assert alh.ledger.uncommitted_size == uncommited_size_before + 4 assert alh.ledger.size == size_before alh.post_batch_rejected(DOMAIN_LEDGER_ID) assert alh.ledger.uncommitted_size == uncommited_size_before + 3 assert alh.ledger.size == size_before check_audit_txn(txn=alh.ledger.get_last_txn(), view_no=3, pp_seq_no=39, seq_no=3, txn_time=11114, txn_roots={ CONFIG_LEDGER_ID: txn_root_hash_3, }, state_roots={ CONFIG_LEDGER_ID: state_root_hash_3, }, pool_size=initial_pool_size + 6, domain_size=initial_domain_size + 5, config_size=initial_config_size + 7, last_pool_seqno=2, last_domain_seqno=1, last_config_seqno=None, primaries=2) alh.post_batch_rejected(DOMAIN_LEDGER_ID) assert alh.ledger.uncommitted_size == uncommited_size_before + 2 assert alh.ledger.size == size_before check_audit_txn(txn=alh.ledger.get_last_txn(), view_no=3, pp_seq_no=38, seq_no=2, txn_time=11113, txn_roots={ POOL_LEDGER_ID: txn_root_hash_2, }, state_roots={ POOL_LEDGER_ID: state_root_hash_2, }, pool_size=initial_pool_size + 6, domain_size=initial_domain_size + 5, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=1, last_config_seqno=None, primaries=1) alh.post_batch_rejected(DOMAIN_LEDGER_ID) assert alh.ledger.uncommitted_size == uncommited_size_before + 1 assert alh.ledger.size == size_before check_audit_txn(txn=alh.ledger.get_last_txn(), view_no=3, pp_seq_no=37, seq_no=1, txn_time=11112, txn_roots={ DOMAIN_LEDGER_ID: txn_root_hash_1, POOL_LEDGER_ID: txn_root_hash_2_pre }, state_roots={ DOMAIN_LEDGER_ID: state_root_hash_1, POOL_LEDGER_ID: state_root_hash_2_pre }, pool_size=initial_pool_size, domain_size=initial_domain_size + 5, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=None, last_config_seqno=None, primaries=DEFAULT_PRIMARIES) alh.post_batch_rejected(DOMAIN_LEDGER_ID) assert alh.ledger.uncommitted_size == uncommited_size_before assert alh.ledger.size == size_before assert alh.ledger.get_last_txn() is None
def test_commit_multiple_batches(alh, db_manager, initial_domain_size, initial_pool_size, initial_config_size, initial_seq_no): size_before = alh.ledger.size # apply 5 3PC batches do_apply_audit_txn(alh, txns_count=7, ledger_id=DOMAIN_LEDGER_ID, view_no=3, pp_sq_no=35, txn_time=11111) txn_root_hash_1 = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash_1 = db_manager.get_state(DOMAIN_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=15, ledger_id=POOL_LEDGER_ID, view_no=3, pp_sq_no=36, txn_time=11112) txn_root_hash_2 = db_manager.get_ledger( POOL_LEDGER_ID).uncommitted_root_hash state_root_hash_2 = db_manager.get_state(POOL_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=5, ledger_id=CONFIG_LEDGER_ID, view_no=3, pp_sq_no=37, txn_time=11112) txn_root_hash_3 = db_manager.get_ledger( CONFIG_LEDGER_ID).uncommitted_root_hash state_root_hash_3 = db_manager.get_state(CONFIG_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=10, ledger_id=DOMAIN_LEDGER_ID, view_no=4, pp_sq_no=1, txn_time=11115) txn_root_hash_4 = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash_4 = db_manager.get_state(DOMAIN_LEDGER_ID).headHash do_apply_audit_txn(alh, txns_count=20, ledger_id=DOMAIN_LEDGER_ID, view_no=4, pp_sq_no=2, txn_time=11119) txn_root_hash_5 = db_manager.get_ledger( DOMAIN_LEDGER_ID).uncommitted_root_hash state_root_hash_5 = db_manager.get_state(DOMAIN_LEDGER_ID).headHash assert alh.ledger.uncommitted_size == alh.ledger.size + 5 # commit 1st batch alh.commit_batch(FakeSomething()) assert alh.ledger.uncommitted_size == alh.ledger.size + 4 assert alh.ledger.size == size_before + 1 check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=3, pp_seq_no=35, seq_no=initial_seq_no + 1, txn_time=11111, ledger_id=DOMAIN_LEDGER_ID, txn_root=txn_root_hash_1, state_root=state_root_hash_1, pool_size=initial_pool_size, domain_size=initial_domain_size + 7, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=None, last_config_seqno=None, primaries=1) # commit 2d batch alh.commit_batch(FakeSomething()) assert alh.ledger.uncommitted_size == alh.ledger.size + 3 assert alh.ledger.size == size_before + 2 check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=3, pp_seq_no=36, seq_no=initial_seq_no + 2, txn_time=11112, ledger_id=POOL_LEDGER_ID, txn_root=txn_root_hash_2, state_root=state_root_hash_2, pool_size=initial_pool_size + 15, domain_size=initial_domain_size + 7, config_size=initial_config_size, last_pool_seqno=None, last_domain_seqno=initial_seq_no + 1, last_config_seqno=None, primaries=2) # commit 3d batch alh.commit_batch(FakeSomething()) assert alh.ledger.uncommitted_size == alh.ledger.size + 2 assert alh.ledger.size == size_before + 3 check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=3, pp_seq_no=37, seq_no=initial_seq_no + 3, txn_time=11112, ledger_id=CONFIG_LEDGER_ID, txn_root=txn_root_hash_3, state_root=state_root_hash_3, pool_size=initial_pool_size + 15, domain_size=initial_domain_size + 7, config_size=initial_config_size + 5, last_pool_seqno=initial_seq_no + 2, last_domain_seqno=initial_seq_no + 1, last_config_seqno=None, primaries=3) # commit 4th batch alh.commit_batch(FakeSomething()) assert alh.ledger.uncommitted_size == alh.ledger.size + 1 assert alh.ledger.size == size_before + 4 check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=4, pp_seq_no=1, seq_no=initial_seq_no + 4, txn_time=11115, ledger_id=DOMAIN_LEDGER_ID, txn_root=txn_root_hash_4, state_root=state_root_hash_4, pool_size=initial_pool_size + 15, domain_size=initial_domain_size + 7 + 10, config_size=initial_config_size + 5, last_pool_seqno=initial_seq_no + 2, last_domain_seqno=None, last_config_seqno=initial_seq_no + 3, primaries=4) # commit 5th batch alh.commit_batch(FakeSomething()) assert alh.ledger.uncommitted_size == alh.ledger.size assert alh.ledger.size == size_before + 5 check_audit_txn(txn=alh.ledger.get_last_committed_txn(), view_no=4, pp_seq_no=2, seq_no=initial_seq_no + 5, txn_time=11119, ledger_id=DOMAIN_LEDGER_ID, txn_root=txn_root_hash_5, state_root=state_root_hash_5, pool_size=initial_pool_size + 15, domain_size=initial_domain_size + 7 + 10 + 20, config_size=initial_config_size + 5, last_pool_seqno=initial_seq_no + 2, last_domain_seqno=None, last_config_seqno=initial_seq_no + 3, primaries=5)