-
Notifications
You must be signed in to change notification settings - Fork 6
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
fix: edgecase where user is blacklisted with an inflight message #105
Conversation
function withdrawBlacklistedFunds() external onlyOwner { | ||
uint256 _amount = blacklistedFunds; | ||
blacklistedFunds = 0; | ||
|
||
IUSDC(USDC).safeTransfer(owner(), _amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not allowing the owner to set any arbitrary receiver of the funds?
function withdrawBlacklistedFunds() external onlyOwner { | |
uint256 _amount = blacklistedFunds; | |
blacklistedFunds = 0; | |
IUSDC(USDC).safeTransfer(owner(), _amount); | |
function withdrawBlacklistedFunds(address _to) external onlyOwner { | |
uint256 _amount = blacklistedFunds; | |
blacklistedFunds = 0; | |
IUSDC(USDC).safeTransfer(_to, _amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
/** | ||
* @notice Withdraws the blacklisted funds | ||
*/ | ||
function withdrawBlacklistedFunds() external onlyOwner { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For better UX, we shouldn't allow this to be called when the burnAmount
is burned. And maybe we should set to 0
the blacklisted amount as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not? Arguably Im not sure we should even allow the blacklisted funds to be withdrawn, maybe we should just burn them, but idk what circles process is for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, as I see it, we should burn that too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should just burn them, but idk what circles process is for that
I'm more inclined to just burn them, but yeah, I think is worth to ask them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah awesome yes, makes sense
/** | ||
* @notice Returns the amount of funds locked that got blacklisted | ||
*/ | ||
function blacklistedFunds() external view returns (uint256); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing return var and its NATSPEC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
function withdrawBlacklistedFunds() external onlyOwner { | ||
uint256 _amount = blacklistedFunds; | ||
blacklistedFunds = 0; | ||
|
||
IUSDC(USDC).safeTransfer(owner(), _amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
function withdrawBlacklistedFunds() external onlyOwner { | |
uint256 _amount = blacklistedFunds; | |
blacklistedFunds = 0; | |
IUSDC(USDC).safeTransfer(owner(), _amount); | |
function withdrawBlacklistedFunds(address _to) external onlyOwner { | |
uint256 _amount = blacklistedFunds; | |
blacklistedFunds = 0; | |
IUSDC(USDC).safeTransfer(_to, _amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
@excaliborr Why don't we allow the owner to transfer the blacklisted funds on L2, such as we do on L1 with |
I know it doesn't depend from us, but if another minter is added and a mint is done over a blacklisted address it will screw up |
It just felt weird to me, as we would then need to mint them for no reason, if the owner wanted to he could mint himself funds anyway |
If another minter is added it shouldn't matter, on L1 we will take the min(balance, burnAmount) anyway |
Wdyt about adding this function in case the blacklisted sender is unblacklisted:
|
4bc416a
to
f0de413
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Missing unit tests for the whole
catch
logic onl1Adapter#receiveMessage
. - Missing unit tests for the
userBlacklistedFunds
update onl2Adapter#receiveMessage
* @param _user The user to withdraw the funds for | ||
*/ | ||
function withdrawBlacklistedFunds(address _user) external override { | ||
// TODO: Add explicit check if migration has happend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing check on the TODO here, or to be done on a next PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next PR, hex is adding this logic in his, intentionally left it out
|
||
_mintSupplyOnL2(optimism, OP_ALIASED_L1_MESSENGER, _blacklistedAmount); | ||
|
||
assertEq(l2Adapter.blacklistedFunds(), _blacklistedAmount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that bef the call blacklistedFunds()
is equal to 0
, but don't you think adding it before the call and then compare the var is more future proof in case something changes on the setup? Like
uint256 _blacklistedFundsBef = l2Adapter.blacklistedFunds();
// Mint the supply on L2
assertEq(l2Adapter.blacklistedFunds(), _blacklistedFundsBef + _blacklistedAmount);
....
Maybe this can be applied to other tests also on another PR? It might be worth to check IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing stuff! 🔥
🤖 Linear
Closes OPT-XXX