Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle null address for ESDTRoleBurnForAll #1136

Conversation

cfaur09
Copy link
Contributor

@cfaur09 cfaur09 commented Oct 25, 2023

Reasoning

  • Detected an issue where null addresses returned by the vmQuery were not being handled correctly
  • Simplified the process of parsing and mapping addresses and roles by separating the logic into a helper function
  • Improved code clarity and made error handling more explicit for scenarios where a role is received without a preceding address

Proposed Changes

  • Created a processEncodedAddressesAndRoles helper function to streamline the parsing of the encodedData array
  • Handled null addresses by setting them as undefined in the TokenRoles object
  • Included checks to ensure roles are only processed if they have an associated address or if the address is explicitly set to null/undefined

How to test

  • tokens/XBID-c7e360/roles -> should return token roles without errors
  • tokens/XBID-c7e360 -> should return token details

@codecov
Copy link

codecov bot commented Oct 25, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (80cd538) 33.96% compared to head (1ee746e) 33.96%.

Additional details and impacted files
@@             Coverage Diff              @@
##           development    #1136   +/-   ##
============================================
  Coverage        33.96%   33.96%           
============================================
  Files                9        9           
  Lines              315      315           
  Branches            19       19           
============================================
  Hits               107      107           
  Misses             189      189           
  Partials            19       19           
Flag Coverage Δ
unittests 33.96% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cfaur09 cfaur09 added the bugfix Fix something that isn't working correctly label Oct 25, 2023
@tanghel tanghel merged commit 902cf2f into development Oct 30, 2023
6 of 7 checks passed
@tanghel tanghel deleted the SERVICES-1892-handle-null-address-for-esdt-role-burn-for-all branch October 30, 2023 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fix something that isn't working correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants