Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Fix issue decoding log with only indexed parameters #2549

Merged
merged 2 commits into from
Mar 22, 2019

Conversation

angus-hamill
Copy link

Description

If a log has only indexed parameters, the data field may still be present as 0x. The AbiCoder was attempting to decode this and erroring.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Enhancement

Checklist:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no warnings.
  • I have updated or added types for all modules I've changed
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run test in the root folder with success and extended the tests if necessary.
  • I ran npm run build in the root folder and tested it in the browser and with node.
  • I ran npm run dtslint in the root folder and tested that all my types are correct
  • I have tested my code on an ethereum test network.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.0008%) to 98.652% when pulling e423d93 on angus-hamill:indexed-logs-fix into 1a7c600 on ethereum:1.0.

@coveralls
Copy link

coveralls commented Mar 21, 2019

Coverage Status

Coverage increased (+0.003%) to 98.655% when pulling c44c645 on angus-hamill:indexed-logs-fix into ae35123 on ethereum:1.0.

@@ -229,7 +229,7 @@ export default class AbiCoder {
nonIndexedInputItems.push(input);
});

if (data) {
if (data && data !== '0x') {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would something like
if (response.data === '0x') delete response.data suffice?
Is that what you meant?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would do it this way:

if (response.data === '0x') {
reponse.data = null;
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 👍

@nivida nivida merged commit 52717e0 into web3:1.0 Mar 22, 2019
@angus-hamill angus-hamill deleted the indexed-logs-fix branch March 22, 2019 12:17
@nivida
Copy link
Contributor

nivida commented Mar 22, 2019

@angus-hamill FYI: I'll release this fix when I've closed the issue #2539

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants