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

[DSM] New payment and punishment menchanism #267

Merged
merged 11 commits into from
Oct 13, 2020

Conversation

mmyyrroonn
Copy link
Member

@mmyyrroonn mmyyrroonn commented Oct 5, 2020

Fix #223
Fix #259

Mechanism

  • Merchant need to trigger the payment by a extrinsic. Slot payment mechanism has been removed.
  • The storage orders can only be closed by sorder_payment
  • If the current block is lager than the sorder's expired_on, report_works won't update the sorder's status anymore.

Code Change

  • Remove payment module
  • Remove two interfaces maybe_punishment_merchant and close_order from MarketInterface
  • Add one interface update_merchant_punishment into MarketInterface
  • Add one more extrinsic sorder_payment
  • Add some util functions.

Test

  • Change the expired date for sorders in swork module
  • Add three more tests for new payment mechanism

@mmyyrroonn mmyyrroonn requested a review from badkk October 5, 2020 06:21
@mmyyrroonn mmyyrroonn changed the title [MPoW]New payment and punishment menchanism [MPoW] New payment and punishment menchanism Oct 5, 2020
@badkk
Copy link
Member

badkk commented Oct 9, 2020

Fix #223
Fix #259

Mechanism

  • Merchant need to trigger the payment by a extrinsic. Slot payment mechanism has been removed.
  • The storage orders can only be closed by sorder_payment
  • If the current block is lager than the sorder's expired_on, report_works won't update the sorder's status anymore.

Code Change

  • Remove payment module
  • Remove two interfaces maybe_punishment_merchant and close_order from MarketInterface
  • Add one interface update_merchant_punishment into MarketInterface
  • Add one more extrinsic sorder_payment
  • Add some util functions.

Test

  • Change the expired date for sorders in swork module
  • Add three more tests for new payment mechanism

Can we merge update_merchant_punishment and update_sorder? Because it just a special status of upcoming sOrder status.

cstrml/market/src/lib.rs Show resolved Hide resolved
cstrml/market/src/lib.rs Outdated Show resolved Hide resolved
cstrml/market/src/lib.rs Outdated Show resolved Hide resolved
cstrml/market/src/lib.rs Outdated Show resolved Hide resolved
cstrml/market/src/lib.rs Outdated Show resolved Hide resolved
cstrml/market/src/lib.rs Outdated Show resolved Hide resolved
cstrml/market/src/lib.rs Outdated Show resolved Hide resolved
cstrml/market/src/lib.rs Show resolved Hide resolved
cstrml/market/src/lib.rs Show resolved Hide resolved
cstrml/market/src/lib.rs Show resolved Hide resolved
@mmyyrroonn mmyyrroonn closed this Oct 9, 2020
@mmyyrroonn mmyyrroonn reopened this Oct 9, 2020
@badkk badkk changed the title [MPoW] New payment and punishment menchanism [DSM] New payment and punishment menchanism Oct 10, 2020
cstrml/market/src/lib.rs Outdated Show resolved Hide resolved
cstrml/swork/src/mock.rs Show resolved Hide resolved
@badkk badkk added A2-breakapi PR which break the outter api A3-breaktest PR which break current test case M0-protocol Mechanism related, break the protocol-self P1-asap🏃🏼‍♂️ No need to stop dead in your tracks, however issue should be addressed as soon as possible. labels Oct 12, 2020
@badkk
Copy link
Member

badkk commented Oct 12, 2020

lgtm🥳

@badkk badkk merged commit f041cc7 into crustio:master Oct 13, 2020
@mmyyrroonn mmyyrroonn deleted the new-payment-and-punishment-menchanism branch October 13, 2020 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A2-breakapi PR which break the outter api A3-breaktest PR which break current test case M0-protocol Mechanism related, break the protocol-self P1-asap🏃🏼‍♂️ No need to stop dead in your tracks, however issue should be addressed as soon as possible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Market] Remove maybe_punish_merchant and close_sorder interface [Payment] Returning mechanism
3 participants