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

Guardian: consider making an optional call to claim() every time #130

Closed
Ivshti opened this issue Mar 18, 2021 · 1 comment
Closed

Guardian: consider making an optional call to claim() every time #130

Ivshti opened this issue Mar 18, 2021 · 1 comment
Assignees
Milestone

Comments

@Ivshti
Copy link
Member

Ivshti commented Mar 18, 2021

Current design: when a channel is closed, we allow users to regain their unspent amount plus the late payment interest, but we only call claim() when the contract runs out of funds to pay. This means that the last callers will rely entirely on claim() to get their funds.

Consider this design: in every getRefund(), transfer the unspent amount (totalDeposited - spenderLeafAmount), and optionally pay out the additional late payment interest through calling claim()

The drawback is gas usage, so it must be measured.

This way, we guarantee that the unspent amount will always be paid, and if there's some issue with claim(), only the interest will be omitted

Some gas can be saved from not keeping track of remaining

There is a third option: call claim() only when the channel is closed and from that point onward, distribute *multiplier. The consideration there is that we need to know whether claim() was called (whether interest exists) on subsequent calls, and we need to ensure that we use the correct interest rate (whatever it was at time of calling), considering it's mutable.

@Ivshti Ivshti self-assigned this Mar 18, 2021
@Ivshti Ivshti added this to the V5 milestone Mar 18, 2021
Ivshti pushed a commit that referenced this issue Mar 19, 2021
…gas costs but makes everything simpler and more reliable, see #130
@Ivshti
Copy link
Member Author

Ivshti commented Mar 28, 2021

Decided to do it after all, merged into #identity-tests

@Ivshti Ivshti closed this as completed Mar 28, 2021
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

No branches or pull requests

1 participant