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

feat: dod settlement rpc patch #1124

Merged
merged 8 commits into from
Jun 4, 2020
Merged

feat: dod settlement rpc patch #1124

merged 8 commits into from
Jun 4, 2020

Conversation

lc3091
Copy link
Contributor

@lc3091 lc3091 commented Jun 2, 2020

Proposed changes in this pull request

  • add/change dod settlement related rpc interfaces

Type

  • Bug fix: (Link to the issue #{issue No.})
  • Feature (Non-breaking change)
  • Feature (Breaking change)
  • Documentation Improvement

Checklist

Write a small comment explaining if its N/A (not applicable)

  • Read the CONTRIBUTION.
  • All the tests are passing after the introduction of new changes.
  • Added tests respective to the part of code I have written.
  • Added proper documentation where ever applicable.
  • Code has been written according to Golang-Style-Guide

Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
@lc3091 lc3091 self-assigned this Jun 2, 2020
@lc3091 lc3091 changed the title Feature/dod rpc patch feat: dod settlement rpc patch Jun 2, 2020
@@ -428,6 +428,36 @@ func DoDSettleGetConnectionRawParam(ctx *vmstore.VMContext, id types.Hash) (*DoD
return cp, nil
}

func DoDSettleInheritRawParam(src *DoDSettleConnectionRawParam, dst *DoDSettleConnectionParam) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
431-459 lines are duplicate of vm/contract/abi/abi_dod_settlement.go:461-489 (dupl)

@codecov
Copy link

codecov bot commented Jun 2, 2020

Codecov Report

Merging #1124 into master will increase coverage by 0.06%.
The diff coverage is 84.24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1124      +/-   ##
==========================================
+ Coverage   71.65%   71.72%   +0.06%     
==========================================
  Files         297      297              
  Lines       36256    36330      +74     
==========================================
+ Hits        25980    26057      +77     
+ Misses       6855     6845      -10     
- Partials     3421     3428       +7     
Flag Coverage Δ
#unittests 71.72% <84.24%> (+0.06%) ⬆️
Impacted Files Coverage Δ
vm/contract/dod_settlement.go 88.07% <81.57%> (-0.91%) ⬇️
vm/contract/abi/abi_dod_settlement.go 81.71% <83.19%> (+0.64%) ⬆️
rpc/api/dod_settlement.go 90.83% <96.77%> (-0.53%) ⬇️
vm/contract/abi/abi_dod_settlement_types.go 80.97% <100.00%> (+0.53%) ⬆️
consensus/pov/pov_chain.go 61.92% <0.00%> (-1.25%) ⬇️
p2p/node.go 78.71% <0.00%> (-0.75%) ⬇️
consensus/dpos/dpos_impl.go 70.07% <0.00%> (+0.63%) ⬆️
p2p/sync.go 62.19% <0.00%> (+0.73%) ⬆️
... and 4 more

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 d26e2ec...a7aadba. Read the comment docs.

Signed-off-by: lichao <chao.li@qlink.mobi>
@@ -428,6 +439,36 @@ func DoDSettleGetConnectionRawParam(ctx *vmstore.VMContext, id types.Hash) (*DoD
return cp, nil
}

func DoDSettleInheritRawParam(src *DoDSettleConnectionRawParam, dst *DoDSettleConnectionParam) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
442-470 lines are duplicate of vm/contract/abi/abi_dod_settlement.go:472-500 (dupl)

@@ -520,7 +561,7 @@ func DoDSettleGetOrderIdListByAddress(ctx *vmstore.VMContext, address types.Addr
return userInfo.OrderIds, nil
}

func DodSettleGetOrderInvoice(ctx *vmstore.VMContext, seller types.Address, order *DoDSettleOrderInfo, start, end int64, flight, split bool) (*DoDSettleInvoiceOrderDetail, error) {
func DoDSettleGetOrderInvoice(ctx *vmstore.VMContext, seller types.Address, order *DoDSettleOrderInfo, start, end int64, flight, split bool) (*DoDSettleInvoiceOrderDetail, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
Function 'DoDSettleGetOrderInvoice' has too many statements (52 > 50) (funlen)

@@ -726,7 +779,7 @@ func DodSettleGetOrderInvoice(ctx *vmstore.VMContext, seller types.Address, orde
return invoiceOrder, nil
}

func DodSettleGetProductInvoice(conn *DoDSettleConnectionInfo, start, end int64, flight, split bool) (*DoDSettleInvoiceConnDetail, error) {
func DoDSettleGetProductInvoice(conn *DoDSettleConnectionInfo, start, end int64, flight, split bool) (*DoDSettleInvoiceConnDetail, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
Function 'DoDSettleGetProductInvoice' has too many statements (54 > 50) (funlen)

@@ -992,7 +1075,7 @@ func DodSettleGenerateInvoiceByProduct(ctx *vmstore.VMContext, seller types.Addr
return invoice, nil
}

func DodSettleGenerateInvoiceByBuyer(ctx *vmstore.VMContext, seller, buyer types.Address, start, end int64, flight, split bool) (*DoDSettleBuyerInvoice, error) {
func DoDSettleGenerateInvoiceByBuyer(ctx *vmstore.VMContext, seller, buyer types.Address, start, end int64, flight, split bool) (*DoDSettleBuyerInvoice, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
cyclomatic complexity 16 of func DoDSettleGenerateInvoiceByBuyer is high (> 15) (gocyclo)

@@ -608,14 +653,14 @@ func TestDodSettleGenerateInvoiceByOrder(t *testing.T) {

start = int64(4000)
end = int64(0)
invoice, err = DodSettleGenerateInvoiceByOrder(ctx, seller, order.OrderId, start, end, true, false)
invoice, err = DoDSettleGenerateInvoiceByOrder(ctx, seller, order.OrderId, start, end, true, false)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
SA4006: this value of invoice is never used (staticcheck)

if err != nil {
t.Fatal(err)
}

start = int64(0)
end = int64(1000)
invoice, err = DodSettleGenerateInvoiceByOrder(ctx, seller, order.OrderId, start, end, false, true)
invoice, err = DoDSettleGenerateInvoiceByOrder(ctx, seller, order.OrderId, start, end, false, true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
SA4006: this value of invoice is never used (staticcheck)

if err != nil {
t.Fatal(err)
}

start = int64(12000)
end = int64(15000)
invoice, err = DodSettleGenerateInvoiceByProduct(ctx, seller, conn2.ProductId, start, end, true, true)
invoice, err = DoDSettleGenerateInvoiceByProduct(ctx, seller, conn2.ProductId, start, end, true, true)
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
SA4006: this value of invoice is never used (staticcheck)

Signed-off-by: lichao <chao.li@qlink.mobi>
Signed-off-by: lichao <chao.li@qlink.mobi>
@@ -428,6 +440,36 @@ func DoDSettleGetConnectionRawParam(ctx *vmstore.VMContext, id types.Hash) (*DoD
return cp, nil
}

func DoDSettleInheritRawParam(src *DoDSettleConnectionRawParam, dst *DoDSettleConnectionParam) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
443-471 lines are duplicate of vm/contract/abi/abi_dod_settlement.go:473-501 (dupl)

DstCity: "NYC",
DstDataCenter: "DCY",
DstPort: dstPortP,
ItemId: fmt.Sprintf("item%d", rand.Int()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

[golangci-lint] reported by reviewdog 🐶
G404: Use of weak random number generator (math/rand instead of crypto/rand) (gosec)

@lc3091 lc3091 marked this pull request as ready for review June 4, 2020 14:23
@lc3091 lc3091 added the ready-to-rebase-and-merge ready-to-rebase-and-merge label Jun 4, 2020
@mergify mergify bot merged commit 1ebe09b into master Jun 4, 2020
@mergify mergify bot deleted the feature/dod-rpc-patch branch June 4, 2020 14:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants