virtualeconomy / v-systems

V Systems Reference Full Node
Other
115 stars 45 forks source link

Payment channel #177

Closed ncying closed 4 years ago

ncying commented 4 years ago

PR Details

Description

Payment channel is a channel which introduce to help two users to transfer their assets. Another important usage of payment channel is given the user choices to transfer low amount, high-frequency assets to other users. In this PR, we will design a one-way payment channel to help the users achive this effect.

Related Issue

None

Motivation and Context

In the design of this payment channel, we will introduce a one-way payment procedure. Once the channel opened, the sender can pay the tokens/VSYS to recipient with any amount offline. The scheme is the sender sign the following information and give the signature to the recipient offline.

toSign = channelId + totalPaid
signature = sign(toSign, sender's private key)

How Has This Been Tested

All current unit tests passed

Types of Changes

Checklist

codecov-io commented 4 years ago

Codecov Report

Merging #177 into feature/deposit_withdraw_contract will decrease coverage by 1.44%. The diff coverage is 20.2%.

Impacted file tree graph

@@                         Coverage Diff                          @@
##           feature/deposit_withdraw_contract    #177      +/-   ##
====================================================================
- Coverage                              60.74%   59.3%   -1.45%     
====================================================================
  Files                                    202     203       +1     
  Lines                                   5615    5775     +160     
  Branches                                 256     259       +3     
====================================================================
+ Hits                                    3411    3425      +14     
- Misses                                  2204    2350     +146
Impacted Files Coverage Δ
.../vsys/blockchain/state/opcdiffs/BasicOpcDiff.scala 0% <0%> (ø) :arrow_up:
...s/blockchain/contract/ContractPaymentChannel.scala 0% <0%> (ø)
...n/contract/ContractDepositWithdrawProductive.scala 100% <100%> (ø) :arrow_up:
...ala/vsys/blockchain/state/opcdiffs/OpcDiffer.scala 95.65% <100%> (+0.19%) :arrow_up:
...n/scala/vsys/blockchain/contract/ContractGen.scala 100% <100%> (ø) :arrow_up:
...vsys/blockchain/state/opcdiffs/AssertOpcDiff.scala 54.38% <100%> (+1.65%) :arrow_up:
.../vsys/blockchain/state/opcdiffs/CDBVROpcDiff.scala 51.16% <16.66%> (+1.16%) :arrow_up:
...a/vsys/blockchain/state/opcdiffs/LoadOpcDiff.scala 50% <25%> (-16.67%) :arrow_down:
...a/vsys/blockchain/state/opcdiffs/CDBVOpcDiff.scala 79.54% <50%> (-2.96%) :arrow_down:

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 ddf9c1f...e7f1011. Read the comment docs.