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

Allow relaying of all ERC-20 methods #1288

Merged
merged 3 commits into from
Mar 14, 2024
Merged

Allow relaying of all ERC-20 methods #1288

merged 3 commits into from
Mar 14, 2024

Conversation

iamacook
Copy link
Member

Summary

This facilitates the relaying of all ERC-20 methods, with validation of transfer and transferFrom methods:

  • transfer transactions that are being executed to 'self' (the Safe) cannot be relayed.
  • transferFrom transactions that are being executed to 'self' or transferring from the sender to receiver cannot be relayed.

Motivation

We were previous only allowing "valid" transfer relays. It was otherwise not possible to relay other methods.

This is an inherent bug that was ported over from the relay service - it was only validating transfer calldata. Other methods were able to relay as they passed the 'self'-validation.

Note: although there is no validation of transferFrom on the relay service, adding it aligns with that of transfer.

Changes

  • Add validation of transferFrom relays
  • Allow relay of other methods of ERC-20
  • Add respective IEncoders for mocking calldata
  • Add test coverage

@iamacook iamacook self-assigned this Mar 12, 2024
@coveralls
Copy link

coveralls commented Mar 12, 2024

Pull Request Test Coverage Report for Build 8277263145

Details

  • 35 of 37 (94.59%) changed or added relevant lines in 2 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.02%) to 93.378%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/domain/relay/limit-addresses.mapper.ts 27 29 93.1%
Files with Coverage Reduction New Missed Lines %
src/domain/relay/limit-addresses.mapper.ts 1 90.52%
Totals Coverage Status
Change from base Build 8248254267: -0.02%
Covered Lines: 6377
Relevant Lines: 6595

💛 - Coveralls

@iamacook iamacook marked this pull request as ready for review March 12, 2024 14:46
@iamacook iamacook requested a review from a team as a code owner March 12, 2024 14:46
@iamacook iamacook requested a review from fmrsabino March 13, 2024 15:14
Copy link
Collaborator

@fmrsabino fmrsabino left a comment

Choose a reason for hiding this comment

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

👏 🚀

src/domain/relay/limit-addresses.mapper.ts Outdated Show resolved Hide resolved
src/domain/relay/limit-addresses.mapper.ts Show resolved Hide resolved
@iamacook iamacook merged commit c7029a1 into main Mar 14, 2024
16 checks passed
@iamacook iamacook deleted the relay-erc20-methods branch March 14, 2024 12:12
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.

None yet

3 participants