def test_parsing_basic_type_strings(type_str, expected):
    result = parse(type_str)
    assert result == expected
def test_parsing_tuple_integer_type_strings(type_str, expected):
    result = parse(type_str)
    assert result == expected
def test_parsing_optional_types(type_str, expected):
    result = parse(type_str)
    assert result == expected
def test_parsing_container_type_strings(type_str, expected):
    result = parse(type_str)
    assert result == expected
def test_parsing_array_integer_type_strings(type_str, item_type):
    result = parse(type_str)
    assert isinstance(result, ArrayType)
    assert item_type == result.item_type
Exemple #6
0
    rlp.decode(data) for data in RLP_RAW_TRIE_NODES_8 if data)
RLP_TRIE_NODES_9 = tuple(
    rlp.decode(data) for data in RLP_RAW_TRIE_NODES_9 if data)

RLP_PINGS = tuple(
    rlp.decode(data, sedes=RLPPing) for data in RLP_RAW_PINGS if data)
RLP_PONGS = tuple(
    rlp.decode(data, sedes=RLPPong) for data in RLP_RAW_PONGS if data)
RLP_FIND_NODES = tuple(
    rlp.decode(data, sedes=RLPFindNode) for data in RLP_RAW_FIND_NODES if data)
RLP_NEIGHBORS = tuple(
    rlp.decode(data, sedes=RLPNeighbours) for data in RLP_RAW_NEIGHBORS
    if data)

sss_header_type_str = '{bytes32,bytes32,bytes20,bytes32,bytes32,bytes32,uint2048,scalar256,scalar256,scalar256,scalar256,scalar256,bytes,bytes,bytes8?}'  # noqa: E501
sss_header_type = parse(sss_header_type_str)
sss_txn_type_str = '{scalar256,scalar256,scalar256,bytes20?,scalar256,bytes,uint8,uint256,uint256}'  # noqa: E501
sss_txn_type = parse(sss_txn_type_str)
sss_block_type_str = '{%s,%s[],%s[]}' % (sss_header_type_str, sss_txn_type,
                                         sss_header_type_str)
sss_block_type = parse(sss_block_type_str)
sss_log_type_str = '{bytes20,uint256[],bytes}'
sss_log_type = parse(sss_log_type_str)
sss_receipt_type_str = '{bytes,scalar256,uint2048,%s[]}' % sss_log_type_str
sss_receipt_type = parse(sss_receipt_type_str)
sss_receipts_type = parse('%s[]' % sss_receipt_type_str)

sss_account_type = parse('{scalar256,scalar256,bytes32,bytes32}')
sss_mini_account_type = parse('{scalar256,scalar256,bytes32?,bytes32?}')

sss_trie_node_type = parse('bytes[]')
Exemple #7
0
def test_container_type_encoding(type_str, elements, expected):
    container_type = parse(type_str)
    actual = container_type.encode(elements)
    assert actual == expected