def _prepare_selector_collision_msg(duplicates): dup_sel = valmap(apply_formatter_to_array(abi_to_signature), duplicates) joined_funcs = valmap(lambda funcs: ', '.join(funcs), dup_sel) func_sel_msg_list = [ funcs + ' have selector ' + sel for sel, funcs in joined_funcs.items() ] return ' and\n'.join(func_sel_msg_list)
'raw': HexBytes, 's': to_hexbytes(32, variable_length=True), 'to': apply_formatter_if(is_address, to_checksum_address), 'hash': to_hexbytes(32), 'v': apply_formatter_if(is_not_null, to_integer_if_hex), 'standardV': apply_formatter_if(is_not_null, to_integer_if_hex), } transaction_formatter = apply_formatters_to_dict(TRANSACTION_FORMATTERS) WHISPER_LOG_FORMATTERS = { 'from': to_hexbytes(60), 'hash': to_hexbytes(32), 'payload': HexBytes, 'to': to_hexbytes(60), 'topics': apply_formatter_to_array(HexBytes), } whisper_log_formatter = apply_formatters_to_dict(WHISPER_LOG_FORMATTERS) LOG_ENTRY_FORMATTERS = { 'blockHash': apply_formatter_if(is_not_null, to_hexbytes(32)), 'blockNumber': apply_formatter_if(is_not_null, to_integer_if_hex), 'transactionIndex': apply_formatter_if(is_not_null, to_integer_if_hex), 'transactionHash': apply_formatter_if(is_not_null, to_hexbytes(32)), 'logIndex': to_integer_if_hex, 'address': to_checksum_address, 'topics': apply_formatter_to_array(to_hexbytes(32)), 'data': to_ascii_if_bytes, }
'toBlock': to_integer_if_hex, } filter_params_formatter = apply_formatters_to_dict(FILTER_PARAMS_FORMATTERS) filter_params_transformer = compose(filter_params_remapper, filter_params_formatter) TRANSACTION_FORMATTERS = { 'to': apply_formatter_if(partial(operator.eq, ''), static_return(None)), } transaction_formatter = apply_formatters_to_dict(TRANSACTION_FORMATTERS) RECEIPT_FORMATTERS = { 'logs': apply_formatter_to_array(log_key_remapper), } receipt_formatter = apply_formatters_to_dict(RECEIPT_FORMATTERS) transaction_params_transformer = compose(transaction_params_remapper, transaction_params_formatter) ethereum_tester_middleware = construct_formatting_middleware( request_formatters={ # Eth 'eth_getBlockByNumber': apply_formatters_to_args( apply_formatter_if(is_not_named_block, to_integer_if_hex), ), 'eth_getFilterChanges': apply_formatters_to_args(hex_to_integer),
'to': apply_formatter_if(is_address, to_checksum_address), 'hash': to_hexbytes(32), 'v': apply_formatter_if(is_not_null, to_integer_if_hex), 'standardV': apply_formatter_if(is_not_null, to_integer_if_hex), } transaction_formatter = apply_formatters_to_dict(TRANSACTION_FORMATTERS) WHISPER_LOG_FORMATTERS = { 'from': to_hexbytes(60), 'hash': to_hexbytes(32), 'payload': HexBytes, 'to': to_hexbytes(60), 'topics': apply_formatter_to_array(HexBytes), } whisper_log_formatter = apply_formatters_to_dict(WHISPER_LOG_FORMATTERS) LOG_ENTRY_FORMATTERS = { 'blockHash': apply_formatter_if(is_not_null, to_hexbytes(32)), 'blockNumber': apply_formatter_if(is_not_null, to_integer_if_hex), 'transactionIndex': apply_formatter_if(is_not_null, to_integer_if_hex), 'transactionHash': apply_formatter_if(is_not_null, to_hexbytes(32)), 'logIndex': to_integer_if_hex, 'address': to_checksum_address, 'topics': apply_formatter_to_array(to_hexbytes(32)), 'data': to_ascii_if_bytes,
filter_params_formatter = apply_formatters_to_dict(FILTER_PARAMS_FORMATTERS) filter_params_transformer = compose(filter_params_remapper, filter_params_formatter) TRANSACTION_FORMATTERS = { 'to': apply_formatter_if(partial(operator.eq, b''), static_return(None)), } transaction_formatter = apply_formatters_to_dict(TRANSACTION_FORMATTERS) RECEIPT_FORMATTERS = { 'logs': apply_formatter_to_array(log_key_remapper), } receipt_formatter = apply_formatters_to_dict(RECEIPT_FORMATTERS) transaction_params_transformer = compose(transaction_params_remapper, transaction_params_formatter) ethereum_tester_middleware = construct_formatting_middleware( request_formatters={ # Eth 'eth_getBlockByNumber': apply_formatters_to_args( apply_formatter_if(is_not_named_block, to_integer_if_hex), ), 'eth_getFilterChanges': apply_formatters_to_args(hex_to_integer), 'eth_getFilterLogs': apply_formatters_to_args(hex_to_integer),
'gasPrice': to_integer_if_hex, 'value': to_integer_if_hex, 'from': to_normalized_address, 'to': apply_formatter_if(to_normalized_address, is_not_create_address), 'hash': to_ascii_if_bytes, } transaction_formatter = apply_formatters_to_dict(TRANSACTION_FORMATTERS) LOG_ENTRY_FORMATTERS = { 'blockHash': apply_formatter_if(to_ascii_if_bytes, is_not_null), 'blockNumber': apply_formatter_if(to_integer_if_hex, is_not_null), 'transactionIndex': apply_formatter_if(to_integer_if_hex, is_not_null), 'logIndex': to_integer_if_hex, 'address': to_normalized_address, 'topics': apply_formatter_to_array(to_ascii_if_bytes), 'data': to_ascii_if_bytes, } log_entry_formatter = apply_formatters_to_dict(LOG_ENTRY_FORMATTERS) RECEIPT_FORMATTERS = { 'blockHash': apply_formatter_if(to_ascii_if_bytes, is_not_null), 'blockNumber': apply_formatter_if(to_integer_if_hex, is_not_null), 'transactionIndex': apply_formatter_if(to_integer_if_hex, is_not_null), 'transactionHash': to_ascii_if_bytes, 'cumulativeGasUsed': to_integer_if_hex, 'gasUsed': to_integer_if_hex, 'contractAddress': apply_formatter_if(to_normalized_address, is_not_null), 'logs': apply_formatter_to_array(log_entry_formatter), }
'gasPrice': to_integer_if_hex, 'value': to_integer_if_hex, 'from': to_normalized_address, 'to': apply_formatter_if(to_normalized_address, is_address), 'hash': to_ascii_if_bytes, } transaction_formatter = apply_formatters_to_dict(TRANSACTION_FORMATTERS) LOG_ENTRY_FORMATTERS = { 'blockHash': apply_formatter_if(to_ascii_if_bytes, is_not_null), 'blockNumber': apply_formatter_if(to_integer_if_hex, is_not_null), 'transactionIndex': apply_formatter_if(to_integer_if_hex, is_not_null), 'logIndex': to_integer_if_hex, 'address': to_normalized_address, 'topics': apply_formatter_to_array(to_ascii_if_bytes), 'data': to_ascii_if_bytes, } log_entry_formatter = apply_formatters_to_dict(LOG_ENTRY_FORMATTERS) RECEIPT_FORMATTERS = { 'blockHash': apply_formatter_if(to_ascii_if_bytes, is_not_null), 'blockNumber': apply_formatter_if(to_integer_if_hex, is_not_null), 'transactionIndex': apply_formatter_if(to_integer_if_hex, is_not_null), 'transactionHash': to_ascii_if_bytes, 'cumulativeGasUsed': to_integer_if_hex, 'gasUsed': to_integer_if_hex, 'contractAddress': apply_formatter_if(to_normalized_address, is_not_null), 'logs': apply_formatter_to_array(log_entry_formatter), }
} transaction_params_formatter = apply_formatters_to_dict(TRANSACTION_PARAMS_FORMATTERS) TRANSACTION_FORMATTERS = { 'to': apply_formatter_if(partial(operator.eq, b''), static_return(None)), } transaction_formatter = apply_formatters_to_dict(TRANSACTION_FORMATTERS) RECEIPT_FORMATTERS = { 'logs': apply_formatter_to_array(log_key_remapper), } receipt_formatter = apply_formatters_to_dict(RECEIPT_FORMATTERS) ethereum_tester_middleware = construct_formatting_middleware( request_formatters={ # Eth 'eth_getBlockByNumber': apply_formatters_to_args( apply_formatter_if(is_not_named_block, to_integer_if_hex), ), 'eth_getFilterChanges': apply_formatters_to_args(hex_to_integer), 'eth_getFilterLogs': apply_formatters_to_args(hex_to_integer), 'eth_getBlockTransactionCountByNumber': apply_formatters_to_args(