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

Deposit recovery upon lost state #5

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

matthiasgeihs
Copy link
Contributor

@matthiasgeihs matthiasgeihs commented Apr 16, 2021

Closes #4

This change allows a channel participant to recover its deposited funds from purely on-chain calldata. This is useful in case the channel state has been lost.

The change introduces a method depositChannelParticipant on the asset holder that records the channelID upon funds deposit. Previously, only the fundingID would be available via calldata, from which the channelID is not recoverable.

The adjudicator is augmented with a function registerDepositRecovery which allows a channel participant to initiate deposited funds recovery.

@matthiasgeihs matthiasgeihs marked this pull request as draft April 16, 2021 21:08
@codecov-commenter
Copy link

Codecov Report

Merging #5 (3d12166) into master (f494e95) will decrease coverage by 12.41%.
The diff coverage is 27.50%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master       #5       +/-   ##
===========================================
- Coverage   99.00%   86.58%   -12.42%     
===========================================
  Files           9        9               
  Lines         200      231       +31     
  Branches       53       63       +10     
===========================================
+ Hits          198      200        +2     
- Misses          2       31       +29     
Impacted Files Coverage Δ
contracts/Adjudicator.sol 84.21% <25.00%> (-15.79%) ⬇️
contracts/AssetHolder.sol 85.10% <37.50%> (-10.14%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f494e95...3d12166. Read the comment docs.

@matthiasgeihs
Copy link
Contributor Author

matthiasgeihs commented Apr 16, 2021

The current version requires to fix the deposited funds upon recovery initialization.

An alternative would be to conclude the channel with a zero balance in case of a recovery. And when the asset holder detects a zero balance at conclusion, it would automatically leave the initial deposit values untouched.

Edit
Pushed the alternative version. I think it is cleaner.

@matthiasgeihs matthiasgeihs force-pushed the 4-recover-deposit branch 2 times, most recently from 638e25d to 579bff5 Compare April 16, 2021 21:56
`channelID` is a convenient variable name, so we rename the function to prevent shadowing.

Signed-off-by: Matthias Geihs <[email protected]>
@matthiasgeihs matthiasgeihs force-pushed the 4-recover-deposit branch 3 times, most recently from 0d56a4b to bef1060 Compare April 19, 2021 08:26
Signed-off-by: Matthias Geihs <[email protected]>
Signed-off-by: Matthias Geihs <[email protected]>
Signed-off-by: Matthias Geihs <[email protected]>
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.

Funds not recoverable
2 participants