Skip to content

The bug is in the Python wrapper layer (hypersync/__init__.py) #55

@Pratham6392

Description

@Pratham6392
Image

Issue

In the CallDecoder class if I do something like this :

**cd = hypersync.CallDecoder(["transfer(address,uint256)"])
cd.decode_inputs_sync(["0xa9059cbb..."])**

This throws an error :

  • AttributeError: ... has no attribute 'decode_input_syncs'
  • or TypeError: ... 'builtin_function_or_method' ... cannot be converted to 'Sequence'

The core issue in hypersync/init.py file :

async def decode_inputs(self, inputs: list[str]) -> list[list[DecodedSolValue]]:
    """Parse log and return decoded event. Returns None if topic0 not found."""
    return await self.inner.decode_inputs(input)

def decode_inputs_sync(self, inputs: list[str]) -> list[list[DecodedSolValue]]:
    """Parse log and return decoded event. Returns None if topic0 not found."""
    return self.inner.decode_input_syncs(input)

Bugs in that snippet:

  • used input (builtin) instead of inputs
  • used decode_input_syncs instead of decode_inputs_sync

Solution :

async def decode_inputs(self, inputs: list[str]) -> list[list[DecodedSolValue]]:
       """Decode ABI-encoded calldata strings; forwards to the Rust CallDecoder."""
       return await self.inner.decode_inputs(inputs)

   def decode_inputs_sync(self, inputs: list[str]) -> list[list[DecodedSolValue]]:
       """Decode ABI-encoded calldata strings; forwards to the Rust CallDecoder."""
       return self.inner.decode_inputs_sync(inputs)

Here , what I fixed :

  • async path forwards inputs to self.inner.decode_inputs(inputs)
  • sync path forwards inputs to self.inner.decode_inputs_sync(inputs)

So the two earlier bugs are fixed there:

  • no accidental use of builtin input
  • no typo decode_input_syncs method name

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions