citp/BlockSci

blocksci.cluster.Cluster.tagged_addresses returns a TypeError

mikispag opened this issue · 6 comments

Reproduction Steps

import blocksci
chain = blocksci.Blockchain(BLOCKSCI_CONFIG_PATH)
cm = blocksci.cluster.ClusterManager(BLOCKSCI_CLUSTERS_PATH, chain)
chain_address = chain.address_from_string("1FU2uVBCpAeGDmEjqmwEi9mzwe19vAsjhm")
cluster = cm.cluster_with_address(chain_address)
x = cluster.tagged_addresses(tags)

throws:

TypeError: Unable to convert function return value to a Python type! The signature was
        (self: blocksci.cluster.Cluster, tagged_addresses: Dict[Address, str]) -> ranges::any_view<blocksci::TaggedAddress, (ranges::category)1, void>

System Information

Using AMI: no
BlockSci version: 0.7.0
Blockchain: Bitcoin
Parser: Disk
Total memory: 64 GB

Can you clarify what is in your tags variable?

It's a dictionary populated like this:

tags = {}
tags[chain.address_from_string(address)] = "dummy"

I haven't used the tagging feature in a while. We have an FAQ entry about it, and according to that your code looks correct to me.
Could it be that while populating tags there was an invalid address and thus, tags contains a None (or otherwise unexpected) entry?

Thanks for taking a look.
Unfortunately, that's not the case.

This is a complete minimal repro example:

import blocksci

BLOCKSCI_CLUSTERS_PATH = '/var/lib/bitcoind/blocksci-clusters'
BLOCKSCI_DATA_PATH = '/var/lib/bitcoind/blocksci-data'
BLOCKSCI_CONFIG_PATH = BLOCKSCI_DATA_PATH + '/blocksci.config'

chain = blocksci.Blockchain(BLOCKSCI_CONFIG_PATH)
cm = blocksci.cluster.ClusterManager(BLOCKSCI_CLUSTERS_PATH, chain)
chain_address = chain.address_from_string("1FU2uVBCpAeGDmEjqmwEi9mzwe19vAsjhm")
cluster = cm.cluster_with_address(chain_address)
tags = {chain_address: "dummy"}
x = cluster.tagged_addresses(tags)

I get:

TypeError: Unable to convert function return value to a Python type! The signature was
	(self: blocksci.cluster.Cluster, tagged_addresses: Dict[Address, str]) -> ranges::any_view<blocksci::TaggedAddress, (ranges::category)1, void>

Oh, that's weird, but I currently do not have time to debug this.

I could image this is caused by the ranges library upgrade in #387. You could try a revision before that update.
I'm pretty sure this worked when the corresponding FAQ entry was written on Dec 9 2019 - so you could also try a revision from that period in the v0.6 branch.
I guess this is not what you wanted to hear, sorry!

Thank you. Yeah, that's unfortunate.

I took a look at the diffs, but can't easily spot a problem.
I will patiently wait for a fix :) .