Repository navigation
fix: decode anonymous event logs - #5374
mortezashojaei wants to merge 2 commits into
Conversation
|
@mortezashojaei is attempting to deploy a commit to the Wevm Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 6ee966c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Thanks @mortezashojaei! Closing in favor of #5375, which keeps both of your commits and adds one on top. The follow-up matches anonymous events only when they are requested: Generated by Claude Code |
encodeEventTopicsalready omits the signature topic for anonymous events (#4613).decodeEventLogandparseEventLogsstill treattopics[0]as that signature, sogetLogsandwatchEventdrop the logs (ordecodeEventLogthrowsAbiEventSignatureNotFoundErrorfor the first indexed argument).Anonymous logs are decoded by using every topic as an indexed argument. A normal event signature still wins when the log has one. Several anonymous events with the same indexed arity are not guessed, because a dynamic payload can decode as a static type without throwing (
stringdata reads asuint25632). PasseventNamein that case (AbiEventAmbiguityError).parseEventLogsleaves that log out untileventNamenarrows it to one event.Indexed
stringandbytesfilters count every anonymous topic. The non-strict fallback does not invent an anonymous event when strict decoding fails.pnpm exec vitest -c ./test/vitest.config.ts --run --project core \ src/utils/abi/decodeEventLog.test.ts \ src/utils/abi/parseEventLogs.test.ts \ src/utils/abi/encodeEventTopics.test.ts \ src/index.test.ts95 event-log tests passed, plus the export snapshot.
pnpm exec tsc -bpassed.Test plan
data: 0x) and data-only anonymous log (topics: [])stringfilter matches on the only topic (previously dropped bytopics.length - 1)bytesfilters ignore hex caseeventNamethrows / is omitted;eventNameselects the eventencodeEventTopicsanonymous tests still pass