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

use transferFrom(pool -> receiver) over hop through offRamp #1258

Merged
merged 13 commits into from
Aug 6, 2024

Conversation

RensR
Copy link
Collaborator

@RensR RensR commented Aug 5, 2024

Motivation

Change the hop through the offRamp to a transferFrom so the funds never touch CCIP contracts outside of the pool

Solution

@RensR RensR changed the title use transferFrom over transfer use transferFrom(pool->receiver) over transfer hop through ramp Aug 5, 2024
@RensR RensR changed the title use transferFrom(pool->receiver) over transfer hop through ramp use transferFrom(pool -> receiver) over hop through offRamp Aug 5, 2024
Copy link
Contributor

github-actions bot commented Aug 5, 2024

LCOV of commit d90f3e3 during Solidity Foundry #7018

Summary coverage rate:
  lines......: 98.7% (1847 of 1871 lines)
  functions..: 96.4% (345 of 358 functions)
  branches...: 90.4% (776 of 858 branches)

Files changed coverage rate: n/a

RensR added 2 commits August 5, 2024 18:10
# Conflicts:
#	core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt
@RensR RensR marked this pull request as ready for review August 5, 2024 16:17
@RensR RensR requested review from makramkd, elatoskinas and a team as code owners August 5, 2024 16:17
@@ -478,7 +478,7 @@ contract TokenPoolAndProxy is EVM2EVMOnRampSetup {
vm.startPrank(address(s_fakeOffRamp));

vm.expectEmit(address(s_legacyPool));
emit Minted(address(s_pool), s_fakeOffRamp, amount);
emit Minted(address(s_pool), address(s_pool), amount);
Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: we should verify the Approve event as well

);
i_token.approve(msg.sender, releaseOrMintIn.amount);
Copy link
Collaborator

@elatoskinas elatoskinas Aug 6, 2024

Choose a reason for hiding this comment

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

q: shouldn't we check the bool output value and revert if it's false in all approve instances?

Although this would bubble up to the transferFrom function failing in the OffRamp, so not strictly necessary

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We want to keep these function as low in gas as possible, so given this isn't strictly necessary I'd vote to do it through the implicit check over explicit

@RensR RensR enabled auto-merge (squash) August 6, 2024 10:58
# Conflicts:
#	contracts/gas-snapshots/ccip.gas-snapshot
#	core/gethwrappers/ccip/generated/evm_2_evm_multi_offramp/evm_2_evm_multi_offramp.go
#	core/gethwrappers/ccip/generation/generated-wrapper-dependency-versions-do-not-edit.txt
@RensR RensR merged commit dc33de8 into ccip-develop Aug 6, 2024
102 of 103 checks passed
@RensR RensR deleted the transferFrom branch August 6, 2024 14:39
@cl-sonarqube-production
Copy link

Quality Gate passed Quality Gate passed

Issues
0 New issues
0 Fixed issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarQube

RensR added a commit that referenced this pull request Aug 9, 2024
Final release of all 1.5 contracts - don't merge before the other PRs
are all in


TODO
- #1258
- #1256
- #1273

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
dhaidashenko pushed a commit that referenced this pull request Sep 2, 2024
## Motivation
Change the hop through the offRamp to a transferFrom so the funds never
touch CCIP contracts outside of the pool

## Solution
dhaidashenko pushed a commit that referenced this pull request Sep 2, 2024
Final release of all 1.5 contracts - don't merge before the other PRs
are all in


TODO
- #1258
- #1256
- #1273

---------

Co-authored-by: app-token-issuer-infra-releng[bot] <120227048+app-token-issuer-infra-releng[bot]@users.noreply.github.com>
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.

4 participants