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

chore: PermissionlessGenericHandler: unpack depositor address with custom length #161

Merged
merged 7 commits into from
Apr 7, 2023

Conversation

viatrix
Copy link
Contributor

@viatrix viatrix commented Mar 22, 2023

Description

Currently executionDataDepositor address is decoded in deposit function on origin chain as abi.decode so its length is not used here and the address is read as 32 bytes (20 bytes padded with 0).
This change implements parsing of executionDataDepositor in the same way as executeContractAddress, using its length (20 bytes for EVM).

Related Issue Or Context

We had different encodings of executionDataDepositor and executeContractAddress addresses: one of them was encoded using 32 bytes and another one was encoded using 20 bytes (for EVM chains). This change would make the encoding consistent.

Closes: #

How Has This Been Tested? Testing details.

Unit tests were updated.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation

Checklist:

  • I have commented my code, particularly in hard-to-understand areas.
  • I have ensured that all acceptance criteria (or expected behavior) from issue are met
  • I have updated the documentation locally and in chainbridge-docs.
  • I have added tests to cover my changes.
  • I have ensured that all the checks are passing and green, I've signed the CLA bot

@viatrix viatrix changed the title PermissionlessGenericHandler: unpack depositor address with custom length chore: PermissionlessGenericHandler: unpack depositor address with custom length Mar 22, 2023
Comment on lines 85 to 86
executionDataDepositor: bytes bytes 36 + len(executeFuncSignature) + len(executeContractAddress) - 36 + len(executeFuncSignature) + len(executeContractAddress) + len(executionDataDepositor)
executionData: bytes bytes 36 + len(executeFuncSignature) + len(executeContractAddress) + len(executionDataDepositor) - END
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
executionDataDepositor: bytes bytes 36 + len(executeFuncSignature) + len(executeContractAddress) - 36 + len(executeFuncSignature) + len(executeContractAddress) + len(executionDataDepositor)
executionData: bytes bytes 36 + len(executeFuncSignature) + len(executeContractAddress) + len(executionDataDepositor) - END
executionDataDepositor: bytes bytes 36 + len(executeFuncSignature) + len(executeContractAddress) - 36 + len(executeFuncSignature) + len(executeContractAddress) + len(executionDataDepositor)
executionData: bytes bytes 36 + len(executeFuncSignature) + len(executeContractAddress) + len(executionDataDepositor) - END

@viatrix viatrix merged commit ead1143 into master Apr 7, 2023
@mpetrun5 mpetrun5 deleted the viatrix/generic-handler-update branch May 11, 2023 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants