Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

Funding fraud refactor #534

Merged
merged 12 commits into from
Mar 27, 2020
Merged

Funding fraud refactor #534

merged 12 commits into from
Mar 27, 2020

Conversation

NicholasDotSol
Copy link
Contributor

refs: #494

Members of the signing group might decide to call notifyFraudFundingTimeout in a race to avoid late submissions for provideFraudBTCFundingProof to succeed in order to contain funds lost due to fraud.

  • Fraud during funding ends on provideFundingECDSAFraudProof with the signers
    always losing their full bind as long as the funding timeout has not elapsed.

NicholasDotSol added 3 commits March 17, 2020 21:54
Funding Fraud now completes on provideFundingECDSAFraudProof
and always costs the signers
their full bond as long as the funding
timeout has not elapsed
temove tests for notifyFraudFundingTimeout
and provideFraudBTCFundingProof
partiallySlashForFraudInFunding was
only called by notifyFraudFundingTimeout, which
was removed
NicholasDotSol added 2 commits March 20, 2020 02:26
If the funding proof timeout has elpased, the funder does not recieve
the signer bond. It is burned instead.
Test that the signer bond is always seized and
the funder is awarded the bond if the timeout has not elapsed.
Bond can be a const assigned directly
/* NB: This is reuse of the variable */
_d.fundingProofTimerStart = block.timestamp;
_d.setFraudAwaitingBTCFundingProof();
distributeSignerBondsToFunder(_d);
Copy link
Contributor

@Shadowfiend Shadowfiend Mar 24, 2020

Choose a reason for hiding this comment

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

If we still distinguish between funding timeouts, we allow the signers to grief the funder by observing a late funding tx, committing fraud, and then losing their bond. The funder is still out their BTC value completely, though the system is in balance and the signers have lost +50% value (more or less).

If we remove the distinction, we allow the funder to gain the ETH bond even if they haven't funded the deposit, but only if they convince the funders to collude. So they can get +150% value (more or less), but it requires them convincing signers to actively do the wrong thing, rather than simply make a mistake. We also simplify the code. I'm tempted to take this path…

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thoughts?

Agree. As a note:

f we remove the distinction, we allow the funder to gain the ETH bond even if they haven't funded the deposit, but only if they convince the funders to collude.

This shouldn't be a concern, making the change even better

NicholasDotSol added 5 commits March 24, 2020 12:54
provideFundingECDSAFraudProof should always transfer signer bond to funder.

This avoids some signer griefing vectors while simplifying the logic
provideFundingECDSAFraudProof time disctinction was removed.
@tintinweb
Copy link

just dropping a quick summary of changes here:

removes state fraud_awaiting_btc_funding_proof and therefore transitions:

  • notifyFraudFundingTimeout
  • provideFraudBTCFundingProof

changes:

  • provideFundingECDSAFraudProof slashes member stakes, seizes signer bonds and distributes them to the funder (distributeSignerBondsToFunder) - does this implicitly close the keep or will it stay open?
  • notifyFundingTimeout closes the keep (implicitly releasing the signer bond)

@Shadowfiend
Copy link
Contributor

does this implicitly close the keep

It does! Keep closing is now part of seizeSignerBonds:

https://github.com/keep-network/keep-ecdsa/blob/050cc064dd679ce0494521df3785581aaed090d5/solidity/contracts/BondedECDSAKeep.sol#L254

Copy link
Contributor

@Shadowfiend Shadowfiend left a comment

Choose a reason for hiding this comment

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

Green.

Light.

💚

@Shadowfiend Shadowfiend merged commit 93697fe into master Mar 27, 2020
@Shadowfiend Shadowfiend deleted the funding-fraud branch March 27, 2020 14:47
_d.logSetupFailed();

partiallySlashForFraudInFunding(_d);
distributeSignerBondsToFunder(_d);

Choose a reason for hiding this comment

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

Note: funder can cause this to fail and potentially push a fraudulent deposit into an active state.

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed, this feeds into the overall “push vs pull” question noted in a few other places as well:

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants