def test_process_pre_prepare_with_ordered_request(replica, pre_prepare): expect_suspicious(replica, Suspicions.PPR_WITH_ORDERED_REQUEST.code) replica.node.seqNoDB = FakeSomething(get=lambda req: (1, 1)) replica.nonFinalisedReqs = lambda a: pre_prepare.reqIdr def request_propagates(reqs): assert False, "Requested propagates for: {}".format(reqs) replica.node.request_propagates = request_propagates with pytest.raises(SuspiciousNode): replica.processPrePrepare(pre_prepare, replica.primaryName) assert (pre_prepare, replica.primaryName, set(pre_prepare.reqIdr)) not in replica.prePreparesPendingFinReqs
def test_process_pre_prepare_with_incorrect_audit_txn_root( replica_with_requests, state_roots, txn_roots, multi_sig, fake_requests): expect_suspicious(replica_with_requests, Suspicions.PPR_AUDIT_TXN_ROOT_HASH_WRONG.code) pre_prepare_params = create_pre_prepare_params( state_root=state_roots[DOMAIN_LEDGER_ID], ledger_id=DOMAIN_LEDGER_ID, txn_root=txn_roots[DOMAIN_LEDGER_ID], bls_multi_sig=multi_sig, view_no=replica_with_requests.viewNo, inst_id=replica_with_requests.instId, pool_state_root=state_roots[POOL_LEDGER_ID], # INVALID! audit_txn_root="HSai3sMHKeAva4gWMabDrm1yNhezvPHfXnGyHf2ex1L4", reqs=fake_requests) pre_prepare = PrePrepare(*pre_prepare_params) with pytest.raises(SuspiciousNode): replica_with_requests.processPrePrepare( pre_prepare, replica_with_requests.primaryName)