コード例 #1
0
def test_get_signer_address_valid(
    equivocation_inspector_contract_session,
    signed_block_header_one,
    signed_block_header_one_address,
):
    """Test the address recovery for signatures.

    Since the issued blocks from the Koven test network have used the same address for the signing
    the block as well as getting the reward, it is possible to compare the outcome of the recovery
    with the content of the block header.
    """

    address_recovered = equivocation_inspector_contract_session.functions.testGetSignerAddress(
        signed_block_header_one.unsignedBlockHeader,
        signed_block_header_one.signature).call()

    assert is_same_address(address_recovered, signed_block_header_one_address)
コード例 #2
0
def test_get_signer_address_valid(
    equivocation_inspector_contract_session,
    block_header_by_malicious_validator,
    malicious_validator_address,
):
    """Test the address recovery for signatures.

    Since the generated blocks use the same address for the signing the block as
    well as getting the reward, it is possible to compare the outcome of the
    recovery with the content of the block header.
    """

    address_recovered = equivocation_inspector_contract_session.functions.testGetSignerAddress(
        block_header_by_malicious_validator.unsignedBlockHeader,
        block_header_by_malicious_validator.signature,
    ).call()

    assert is_same_address(address_recovered, malicious_validator_address)
コード例 #3
0
def test_is_same_address(address1, address2, expected):
    assert is_same_address(address1, address2) == expected