-
Notifications
You must be signed in to change notification settings - Fork 19
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
VAL-104 Run crank lazily #104
Conversation
@@ -129,7 +138,7 @@ interface IPool is IERC4626 { | |||
/** | |||
* @dev Cranks the pool's withdrawals | |||
*/ | |||
function crank() external returns (uint256); | |||
function crank() external; |
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.
Can add this back in, but since we're emitting an event with more information, felt duplicative?
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.
The return value doesn't seem very meaningful anyway. I can't think of an on-chain use case off the top of my head.
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.
Looks good
@@ -129,7 +138,7 @@ interface IPool is IERC4626 { | |||
/** | |||
* @dev Cranks the pool's withdrawals | |||
*/ | |||
function crank() external returns (uint256); | |||
function crank() external; |
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.
The return value doesn't seem very meaningful anyway. I can't think of an on-chain use case off the top of my head.
This runs the crank lazily on several mutating Pool functions (let me know if I missed some, or if this is too burdensome..).
Gas cost for a crank that actually does something is ~330k, for one that short-circuits, around 110k.
The behavior of the global crank was also tweaked slightly -- if there's 0 shares to redeem, that still "counts" as the crank for that period, and it can't be re-run in that period. I also added a
PoolCranked
event that's emitted when the crank runs for that period.The mutating functions that the crank lazily executes on are:
In the PermissionedPool, it can be called directly via the PoolController / PA, or from a "valid participant"; in the Pool.sol, anyone can run it.