def make_l4_block():
    return l4_block_model.L4BlockModel(
        dc_id="an id",
        block_id="8474745",
        timestamp="129874",
        prev_proof="the previous block proof",
        l1_dc_id="l1 dc id",
        l1_block_id="l1 block id",
        l1_proof="l1 block proof",
        validations=[{"l3_dc_id": "l3 dc id", "l3_block_id": "l3 block id", "l3_proof": "l3 block proof", "valid": True}],
    )
Example #2
0
def create_l4_block():
    return l4_block_model.L4BlockModel(
        dc_id="an id",
        block_id="123",
        timestamp="129874",
        prev_proof="the previous block proof",
        scheme="trust",
        proof="proof",
        l1_dc_id="l1 dc id",
        l1_block_id="123",
        l1_proof="l1 block proof",
        validations=[{
            "l3_dc_id": "l3 dc id",
            "l3_block_id": "123",
            "l3_proof": "l3 block proof",
            "valid": True
        }],
    )
Example #3
0
def create_block(l1_headers: "L1Headers", validations: List[Dict[str, Any]]) -> l4_block_model.L4BlockModel:
    block_id, prev_proof = get_next_block_info()

    l4_block = l4_block_model.L4BlockModel(
        dc_id=keys.get_public_id(),
        current_ddss=party.get_address_ddss(ADDRESS),  # Get DDSS from party, cached hourly
        block_id=str(block_id),
        timestamp=str(math.floor(time.time())),
        prev_proof=prev_proof,
        scheme=PROOF_SCHEME,
        l1_dc_id=l1_headers["dc_id"],
        l1_block_id=l1_headers["block_id"],
        l1_proof=l1_headers["proof"],
        validations=validations,
    )

    sign_block(l4_block)

    return l4_block
Example #4
0
 def test_setting_validations(self):
     l4 = l4_block_model.L4BlockModel(l1_block_id="l1_block_id",
                                      l1_dc_id="l1_dc_id")
     self.assertEqual(l4.get_associated_l1_block_id(), {"l1_block_id"})
     self.assertEqual(l4.get_associated_l1_dcid(), "l1_dc_id")