Mintbase / arak

General Purpose Ethereum Event Indexer
GNU General Public License v3.0
1 stars 1 forks source link

Better Debug Logging & Null Byte Bug Fix #14

Closed bh2smith closed 1 year ago

bh2smith commented 1 year ago

This PR accomplishes two things:

  1. Adding relevant context to Debug logging (pointing to the specific offending event) on store_event error:

So before we were seeing: Error: store_event while now we see

 Error: store_event Log { event: "erc1155_uri", block_number: 15275205, log_index: 137, transaction_index: 46, address: Address(0x495f947276749Ce646f68AC8c248420045cb7b5e), fields: [String("\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\u{1}\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"), Uint(Uint(BitWidth(256), 85244680541858928040054182450164838257542484891320981406559063124705063993345))] }

which uniquely identifies the offending Log.

  1. Replaces trim null bytes with replace null bytes (so we don't miss internal null bytes - like in the updated test example).

    Test Plan

Altered test now passes.

bh2smith commented 1 year ago

I have tested this on the offending event log. Will merge and deploy.