Skip to content

Event with empty data gives exception on decoding #404

@TechGeorgii

Description

@TechGeorgii

Hey guys!

Describe the bug
Event with empty data gives exception on decoding

To Reproduce
A valid log event https://etherscan.io/tx/0xc3aa108b0e1b99071e31be022be84e8a7e7ecc05d0525ac9d2395b197c4d9d64#eventlog
throws error on decoding.

import { event, indexed } from '@subsquid/evm-abi';

const transferEvent = event(
  '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
  'Transfer(address,address,uint256)',
  { from: indexed(p.address), to: indexed(p.address), value: p.uint256 },
);

// throws error
const res = transferEvent.decode({
  data: '0x',
  topics: [
    '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
    '0x0000000000000000000000000000000dac17f958d2ee523a2206206994597c13',
    '0x000000000000000000000000ac30bc0273a8e974b6f8217738f9edc7c74982d0',
  ],
});

Expected behavior
value should be decoded as 0 – data is from valid event https://etherscan.io/tx/0xc3aa108b0e1b99071e31be022be84e8a7e7ecc05d0525ac9d2395b197c4d9d64#eventlog

Environment (please complete the following information):

  • specify the version of the core packages (@subsquid/cli, @subsquid/substrate-processor, ...)
    @subsquid/evm-abi": 0.3.1

Metadata

Metadata

Assignees

No one assigned

    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