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

link transfer status #13177

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/gorgeous-squids-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

link transfer status check #bugfix
5 changes: 5 additions & 0 deletions contracts/.changeset/smooth-years-reply.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@chainlink/contracts": patch
---

link transfer status check #bugfix
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 {
}

/**
* @notice withdraws LINK received as payment for work performed
* @notice this is for NOPs to withdraw LINK received as payment for work performed
*/
function withdrawPayment(address from, address to) external {
if (to == ZERO_ADDRESS) revert InvalidRecipient();
Expand All @@ -78,7 +78,10 @@ contract AutomationRegistryLogicC2_3 is AutomationRegistryBase2_3 {
uint96 balance = _updateTransmitterBalanceFromPool(from, s_hotVars.totalPremium, uint96(s_transmittersList.length));
s_transmitters[from].balance = 0;
s_reserveAmounts[IERC20(address(i_link))] = s_reserveAmounts[IERC20(address(i_link))] - balance;
i_link.transfer(to, balance);
bool transferStatus = i_link.transfer(to, balance);
Copy link
Contributor

Choose a reason for hiding this comment

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

why it won't fail in CI bc of you did not generate wrappers?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, can you elaborate on this?

Copy link
Contributor

Choose a reason for hiding this comment

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

bc the contract is changed, don't you need to regenerate Go wrappers?

Copy link
Contributor

Choose a reason for hiding this comment

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

wow this is super interesting. My guess is that because the link token always returns true, the optimizer considers this a "dead path" and essentially removes it, making the current bytecode match the old bytecode.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I ran wrappers generation locally, and this change doesnt change any wrappers. Correct me if I need other steps..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If LINk never returns false, do we still need to check the status? our automation codebase has the tradition of checking the status :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@RyanRHall @FelixFan1992 If no objection, I will abandon this PR since checking the bool return is not needed for LINK.

if (!transferStatus) {
revert TransferFailed();
}
emit PaymentWithdrawn(from, balance, to, msg.sender);
}

Expand Down
Loading